From 32b9dbc425db7fb0f73b0a77d46f218d4538e37d Mon Sep 17 00:00:00 2001 From: Keith Gable Date: Tue, 2 Apr 2024 12:53:32 -0700 Subject: [PATCH] Make extconf.rb honor AR and LD variables in addition to CC Signed-off-by: Keith Gable --- ext/nokogiri/extconf.rb | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/ext/nokogiri/extconf.rb b/ext/nokogiri/extconf.rb index 07db83663c..8a5c886ab4 100644 --- a/ext/nokogiri/extconf.rb +++ b/ext/nokogiri/extconf.rb @@ -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']` @@ -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 @@ -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(" ")