From fe5a648522dcb817a407e959d3674f08c77d54e3 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 854095a..64763c9 100644 --- a/ext/re2/extconf.rb +++ b/ext/re2/extconf.rb @@ -82,6 +82,14 @@ def target_host host.gsub(/i386/, "i686") end +def with_temp_dir + Dir.mktmpdir do |temp_dir| + Dir.chdir(temp_dir) do + yield + end + end +end + # # main # @@ -229,7 +237,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