Skip to content

Commit

Permalink
Use --enable-cross-build flag to determine whether to use arch subdir
Browse files Browse the repository at this point in the history
Using this flag will enable us to keep the vendored libraries in
`ports/archives` rather than `ports/<arch>/archives`.
  • Loading branch information
stanhu authored and mudge committed Aug 2, 2023
1 parent cdb96ab commit 0619315
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion ext/re2/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@
--with-re2-dir=DIRECTORY
Look for re2 headers and library in DIRECTORY.
Flags only used when building and using the packaged libraries:
--enable-cross-build
Enable cross-build mode. (You probably do not want to set this manually.)
Environment variables used:
CC
Expand All @@ -54,6 +61,10 @@ def config_system_libraries?
enable_config("system-libraries", ENV.key?('RE2_USE_SYSTEM_LIBRARIES'))
end

def config_cross_build?
enable_config("cross-build")
end

def concat_flags(*args)
args.compact.join(" ")
end
Expand Down Expand Up @@ -207,12 +218,15 @@ def process_recipe(name, version)
require "mini_portile2"
message("Using mini_portile version #{MiniPortile::VERSION}\n")

cross_build_p = config_cross_build?
message "Cross build is #{cross_build_p ? "enabled" : "disabled"}.\n"

MiniPortileCMake.new(name, version).tap do |recipe|
recipe.host = target_host
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?
target_dir = File.join(target_dir, target_arch) if cross_build_p
recipe.target = target_dir

recipe.configure_options += [
Expand Down

0 comments on commit 0619315

Please sign in to comment.