Skip to content

Commit

Permalink
ext(native): work around darwin linker behavior in Ruby 3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
flavorjones committed Jan 2, 2023
1 parent 06e47b4 commit dc8ccd8
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions ext/sqlite3/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,13 @@ def configure_packaged_libraries
end

flags.each { |flag| append_ldflags(flag) }

# See https://github.com/rake-compiler/rake-compiler-dock/issues/87 for more info.
if cross_build? &&
darwin? &&
Gem::Requirement.new("~> 3.2").satisfied_by?(Gem::Version.new(RbConfig::CONFIG["ruby_version"]))
append_ldflags("-Wl,-flat_namespace")
end
end
end

Expand Down Expand Up @@ -172,6 +179,10 @@ def download
minimal_recipe.download
end

def darwin?
RbConfig::CONFIG["target_os"].include?("darwin")
end

def print_help
print(<<~TEXT)
USAGE: ruby #{$PROGRAM_NAME} [options]
Expand Down

0 comments on commit dc8ccd8

Please sign in to comment.