From c0c6c473e94919352b72d3ae04ba7339475111f4 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Mon, 17 Jul 2023 09:58:48 -0700 Subject: [PATCH] Use a temporary directory for cooking recipe This reduces the filename lengths since Windows can hit a limit of 250 characters (CMAKE_OBJECT_PATH_MAX). --- ext/re2/extconf.rb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ext/re2/extconf.rb b/ext/re2/extconf.rb index a88222c..3fac599 100644 --- a/ext/re2/extconf.rb +++ b/ext/re2/extconf.rb @@ -135,6 +135,14 @@ def cmake_compile_flags(host) ] end +def with_temp_dir + Dir.mktmpdir do |temp_dir| + Dir.chdir(temp_dir) do + yield + end + end +end + # # main # @@ -283,7 +291,9 @@ def process_recipe(name, version) end end - recipe.cook + # Use a temporary base directory to reduce filename lengths since + # Windows can hit a limit of 250 characters (CMAKE_OBJECT_PATH_MAX). + with_temp_dir { recipe.cook } FileUtils.touch(checkpoint) end