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

Make extconf.rb honor AR and LD variables in addition to CC #3165

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 17 additions & 1 deletion ext/nokogiri/extconf.rb
Expand Up @@ -137,6 +137,9 @@
NOKOGIRI_USE_SYSTEM_LIBRARIES
Equivalent to `--enable-system-libraries` when set, even if nil or blank.

AR
Use this path to invoke the library archiver instead of `RbConfig::CONFIG['AR']`

CC
Use this path to invoke the compiler instead of `RbConfig::CONFIG['CC']`

Expand All @@ -146,6 +149,9 @@
CFLAGS
If this string is accepted by the compiler, add it to the flags passed to the compiler

LD
Use this path to invoke the linker instead of `RbConfig::CONFIG['LD']`

LDFLAGS
If this string is accepted by the linker, add it to the flags passed to the linker

Expand Down Expand Up @@ -626,12 +632,22 @@ def needs_darwin_linker_hack
append_cppflags "-I/usr/local/include"
end

if ENV["AR"]
RbConfig::CONFIG["AR"] = RbConfig::MAKEFILE_CONFIG["AR"] = ENV["AR"]
end

if ENV["CC"]
RbConfig::CONFIG["CC"] = RbConfig::MAKEFILE_CONFIG["CC"] = ENV["CC"]
end

# use same c compiler for libxml and libxslt
if ENV["LD"]
RbConfig::CONFIG["LD"] = RbConfig::MAKEFILE_CONFIG["LD"] = ENV["LD"]
end

# use same toolchain for libxml and libxslt
ENV["AR"] = RbConfig::CONFIG["AR"]
ENV["CC"] = RbConfig::CONFIG["CC"]
ENV["LD"] = RbConfig::CONFIG["LD"]

if arg_config("--prevent-strip")
old_cflags = $CFLAGS.split.join(" ")
Expand Down