From 4a3836eff77e9f5b647129174e0e5b5ec47f5c60 Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Mon, 8 Mar 2021 22:07:50 -0500 Subject: [PATCH] feat(build): default to --disable-static on TruffleRuby * Shared libraries are more flexible and compile faster, see https://github.com/sparklemotion/nokogiri/issues/2191#issuecomment-780724627 * Static libraries can still be chosen (e.g., for testing) with: gem install nokogiri -- --use-system-libraries=false --enable-static Co-authored-by: Benoit Daloze --- CHANGELOG.md | 1 + ext/nokogiri/extconf.rb | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5adb27eae2..20d631d864 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ Nokogiri follows [Semantic Versioning](https://semver.org/), please see the [REA * Reduce the number of object allocations needed when parsing an HTML::DocumentFragment. [[#2087](https://github.com/sparklemotion/nokogiri/issues/2087)] (Thanks, [@ashmaroli](https://github.com/ashmaroli)!) * [JRuby] Update the algorithm used to calculate `Node#line` to be wrong less-often. The underlying parser, Xerces, does not track line numbers, and so we've always used a hacky solution for this method. [[#1223](https://github.com/sparklemotion/nokogiri/issues/1223)] * Introduce `--enable-system-libraries` and `--disable-system-libraries` flags to `extconf.rb`. These flags provide the same functionality as `--use-system-libraries` and the `NOKOGIRI_USE_SYSTEM_LIBRARIES` environment variable, but are more idiomatic. [[#2193](https://github.com/sparklemotion/nokogiri/issues/2193)] (Thanks, [@eregon](https://github.com/eregon)!) +* [TruffleRuby] `--disable-static` is used by default on TruffleRuby, when `--disable-system-libraries` is set, which is more flexible and compiles faster, see [#2191](https://github.com/sparklemotion/nokogiri/issues/2191#issuecomment-780724627). [[#2193](https://github.com/sparklemotion/nokogiri/issues/2193)] (Thanks, [@eregon](https://github.com/eregon)!) ## 1.11.1 / 2021-01-06 diff --git a/ext/nokogiri/extconf.rb b/ext/nokogiri/extconf.rb index 0dfb79603c..b08c3ced1f 100644 --- a/ext/nokogiri/extconf.rb +++ b/ext/nokogiri/extconf.rb @@ -154,7 +154,8 @@ def config_clean? end def config_static? - enable_config("static", true) + default_static = !truffle? + enable_config("static", default_static) end def config_cross_build? @@ -191,6 +192,10 @@ def nix? !(windows? || solaris? || darwin?) end +def truffle? + ::RUBY_ENGINE == 'truffleruby' +end + def concat_flags(*args) args.compact.join(" ") end