ruby: Rename removeReferencesToCC flag to !jitSupport
If JIT support is built in to ruby, there's no choice other then to leave this cc reference as is. removeReferencesToCC didn't do it's job completely since some time ago. That's why it was practically redundant - `lib/ruby/${version}/<platform>/rbconfig.rb` still referenced cc. Removing this reference from `lib/ruby/${version}/<platform>/rbconfig.rb` as well might lead to breakage in some Gems that require this feature. But, if JIT support is not desired, it should be safe enough to completely remove all cc references, both in lib/ruby/${version}/<platform>/rbconfig.rb and in $out/lib/libruby.so . Hence now `rubyMinimal` has JIT support disabled and it has no references at all to stdenv.cc.
This commit is contained in:
parent
8aaf2e60e5
commit
f59f04352a
@ -44,11 +44,23 @@ let
|
|||||||
, groff, docSupport ? true
|
, groff, docSupport ? true
|
||||||
, libyaml, yamlSupport ? true
|
, libyaml, yamlSupport ? true
|
||||||
, libffi, fiddleSupport ? true
|
, libffi, fiddleSupport ? true
|
||||||
# ruby -e "puts RbConfig::CONFIG['configure_args']"
|
# By default, ruby has 3 observed references to stdenv.cc:
|
||||||
# puts a reference to the C compiler in the binary.
|
#
|
||||||
# This might be required by some gems at runtime,
|
# - If you run:
|
||||||
# but we allow to strip it out for smaller closure size.
|
# ruby -e "puts RbConfig::CONFIG['configure_args']"
|
||||||
, removeReferencesTo, removeReferenceToCC ? true
|
# - In:
|
||||||
|
# $out/${passthru.libPath}/${stdenv.targetPlatform.system}/rbconfig.rb
|
||||||
|
# Or (usually):
|
||||||
|
# $(nix-build -A ruby)/lib/ruby/2.6.0/x86_64-linux/rbconfig.rb
|
||||||
|
# - In $out/lib/libruby.so and/or $out/lib/libruby.dylib
|
||||||
|
#
|
||||||
|
# Since some Gems require JIT support, there's probably no
|
||||||
|
# escape from this reference. Hence, it was decided to enable this
|
||||||
|
# feature by default, as it's enabled by default by ruby's ./configure
|
||||||
|
# script. We do disable this feature though for the other cc references
|
||||||
|
# in all of the locations given above for the `rubyMinimal` build defined
|
||||||
|
# in all-packages.nix.
|
||||||
|
, removeReferencesTo, jitSupport ? true
|
||||||
, autoreconfHook, bison, autoconf
|
, autoreconfHook, bison, autoconf
|
||||||
, buildEnv, bundler, bundix
|
, buildEnv, bundler, bundix
|
||||||
, libiconv, libobjc, libunwind, Foundation
|
, libiconv, libobjc, libunwind, Foundation
|
||||||
@ -121,6 +133,7 @@ let
|
|||||||
|
|
||||||
configureFlags = ["--enable-shared" "--enable-pthread" "--with-soname=ruby-${version}"]
|
configureFlags = ["--enable-shared" "--enable-pthread" "--with-soname=ruby-${version}"]
|
||||||
++ op useRailsExpress "--with-baseruby=${baseruby}/bin/ruby"
|
++ op useRailsExpress "--with-baseruby=${baseruby}/bin/ruby"
|
||||||
|
++ op (!jitSupport) "--disable-jit-support"
|
||||||
++ op (!docSupport) "--disable-install-doc"
|
++ op (!docSupport) "--disable-install-doc"
|
||||||
++ ops stdenv.isDarwin [
|
++ ops stdenv.isDarwin [
|
||||||
# on darwin, we have /usr/include/tk.h -- so the configure script detects
|
# on darwin, we have /usr/include/tk.h -- so the configure script detects
|
||||||
@ -157,11 +170,14 @@ let
|
|||||||
# Remove unnecessary groff reference from runtime closure, since it's big
|
# Remove unnecessary groff reference from runtime closure, since it's big
|
||||||
sed -i '/NROFF/d' $out/lib/ruby/*/*/rbconfig.rb
|
sed -i '/NROFF/d' $out/lib/ruby/*/*/rbconfig.rb
|
||||||
${
|
${
|
||||||
lib.optionalString removeReferenceToCC ''
|
lib.optionalString (!jitSupport) ''
|
||||||
# Get rid of the CC runtime dependency
|
# Get rid of the CC runtime dependency
|
||||||
${removeReferencesTo}/bin/remove-references-to \
|
${removeReferencesTo}/bin/remove-references-to \
|
||||||
-t ${stdenv.cc} \
|
-t ${stdenv.cc} \
|
||||||
$out/lib/libruby*
|
$out/lib/libruby*
|
||||||
|
${removeReferencesTo}/bin/remove-references-to \
|
||||||
|
-t ${stdenv.cc} \
|
||||||
|
$out/${passthru.libPath}/${stdenv.targetPlatform.system}/rbconfig.rb
|
||||||
''
|
''
|
||||||
}
|
}
|
||||||
# Bundler tries to create this directory
|
# Bundler tries to create this directory
|
||||||
|
@ -10548,6 +10548,7 @@ in
|
|||||||
rubyMinimal = ruby.override {
|
rubyMinimal = ruby.override {
|
||||||
# gem support is minimal overhead
|
# gem support is minimal overhead
|
||||||
rubygemsSupport = true;
|
rubygemsSupport = true;
|
||||||
|
jitSupport = false;
|
||||||
useRailsExpress = false;
|
useRailsExpress = false;
|
||||||
zlibSupport = false;
|
zlibSupport = false;
|
||||||
opensslSupport = false;
|
opensslSupport = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user