Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure different Windows flavors build their own abseil library #81

Merged
merged 2 commits into from
Aug 2, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion ext/re2/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ def target_host
host.gsub(/i386/, "i686")
end

def target_arch
RbConfig::CONFIG['arch']
end

def with_temp_dir
Dir.mktmpdir do |temp_dir|
Dir.chdir(temp_dir) do
Expand Down Expand Up @@ -205,7 +209,11 @@ def process_recipe(name, version)

MiniPortileCMake.new(name, version).tap do |recipe|
recipe.host = target_host
recipe.target = File.join(PACKAGE_ROOT_DIR, "ports")
target_dir = File.join(PACKAGE_ROOT_DIR, "ports")
# Ensure x64-mingw-ucrt and x64-mingw32 use different library paths since the host
# is the same (x86_64-w64-mingw32).
target_dir = File.join(target_dir, target_arch) if windows? && !target_arch.empty?
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it worth doing this for all builds rather than special casing it only for Windows? (I’m not sure what a sensible fallback value is if target_arch is nil or empty.)

Copy link
Collaborator Author

@stanhu stanhu Jul 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I originally had that, but I ran into an issue where the vendored libraries got moved from ports/archives to ports/<arch>/archives, so the Rakefile couldn't find the tarballs to include:

re2/Rakefile

Lines 111 to 112 in 1379bd2

abseil_archive = File.join('ports', 'archives', "#{dependencies['abseil']['version']}.tar.gz")
libre2_archive = File.join('ports', 'archives', "re2-#{dependencies['libre2']['version']}.tar.gz")

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could do what Nokogiri does and have an --enable-cross-build flag to indicate whether cross-compiling is happening.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's a much better solution: cbe6dc6. We already use --enable-cross-build in the Rakefile even though we didn't actually use it extconf.rb. 😄

recipe.target = target_dir

recipe.configure_options += [
# abseil needs a C++14 compiler
Expand Down