From 5485876b4566f1ed0be75386eec5f34830ea4dc1 Mon Sep 17 00:00:00 2001 From: Paul Mucur Date: Tue, 16 Jul 2024 08:36:35 +0100 Subject: [PATCH] Add patch to fix building Abseil with CMake 3.30.0 Fixes https://github.com/mudge/re2/issues/158 --- Rakefile | 5 +++- ext/re2/recipes.rb | 1 + ...testonly-target-absl-test_allocator-.patch | 29 +++++++++++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 patches/abseil/0001-Avoid-export-of-testonly-target-absl-test_allocator-.patch diff --git a/Rakefile b/Rakefile index 2ec6560..9d52973 100644 --- a/Rakefile +++ b/Rakefile @@ -16,6 +16,9 @@ re2_archive = File.join("ports/archives", File.basename(re2_recipe.files[0][:url re2_gemspec.files << abseil_archive re2_gemspec.files << re2_archive +Dir[File.join("patches/**/*.patch")].each do |patch| + re2_gemspec.files << patch +end cross_platforms = %w[ aarch64-linux @@ -39,7 +42,7 @@ Rake::ExtensionTask.new('re2', re2_gemspec) do |e| e.config_options << '--disable-system-libraries' e.cross_platform = cross_platforms e.cross_compiling do |spec| - spec.files.reject! { |path| File.fnmatch?('ports/*', path) } + spec.files.reject! { |path| File.fnmatch?('ports/*', path) || File.fnmatch?('patches/*', path) } spec.dependencies.reject! { |dep| dep.name == 'mini_portile2' } end end diff --git a/ext/re2/recipes.rb b/ext/re2/recipes.rb index 8119ffd..7a3f358 100644 --- a/ext/re2/recipes.rb +++ b/ext/re2/recipes.rb @@ -20,6 +20,7 @@ def load_recipes url: "https://github.com/abseil/abseil-cpp/archive/refs/tags/#{recipe.version}.tar.gz", sha256: dependencies['abseil']['sha256'] }] + recipe.patch_files = Dir[File.join(PACKAGE_ROOT_DIR, "patches/abseil/*.patch")].sort end re2_recipe = build_recipe('libre2', dependencies['libre2']['version']) do |recipe| diff --git a/patches/abseil/0001-Avoid-export-of-testonly-target-absl-test_allocator-.patch b/patches/abseil/0001-Avoid-export-of-testonly-target-absl-test_allocator-.patch new file mode 100644 index 0000000..2296900 --- /dev/null +++ b/patches/abseil/0001-Avoid-export-of-testonly-target-absl-test_allocator-.patch @@ -0,0 +1,29 @@ +From 779a3565ac6c5b69dd1ab9183e500a27633117d5 Mon Sep 17 00:00:00 2001 +From: Derek Mauro +Date: Tue, 30 Jan 2024 10:13:25 -0800 +Subject: [PATCH] Avoid export of testonly target absl::test_allocator in CMake + builds + +Closes #1536 + +PiperOrigin-RevId: 602764437 +Change-Id: Ia5c20a3874262a2ddb8797f608af17d7e86dd6d6 +--- + absl/container/CMakeLists.txt | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/absl/container/CMakeLists.txt b/absl/container/CMakeLists.txt +index 449a2cad..ee9ca9c3 100644 +--- a/absl/container/CMakeLists.txt ++++ b/absl/container/CMakeLists.txt +@@ -213,6 +213,7 @@ absl_cc_library( + DEPS + absl::config + GTest::gmock ++ TESTONLY + ) + + absl_cc_test( +-- +2.45.2 +