ruby: add `removeReferenceToCC` package option
Reduces the runtime closure by ~200MB if enabled.
This commit is contained in:
parent
add4e5ea66
commit
80c07f8aaf
|
@ -3,7 +3,7 @@
|
||||||
, zlib, openssl, gdbm, ncurses, readline, groff, libyaml, libffi, autoreconfHook, bison
|
, zlib, openssl, gdbm, ncurses, readline, groff, libyaml, libffi, autoreconfHook, bison
|
||||||
, autoconf, libiconv, libobjc, libunwind, Foundation
|
, autoconf, libiconv, libobjc, libunwind, Foundation
|
||||||
, buildEnv, bundler, bundix
|
, buildEnv, bundler, bundix
|
||||||
, makeWrapper, buildRubyGem, defaultGemConfig
|
, makeWrapper, buildRubyGem, defaultGemConfig, removeReferencesTo
|
||||||
} @ args:
|
} @ args:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
@ -44,6 +44,11 @@ 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']"
|
||||||
|
# puts a reference to the C compiler in the binary.
|
||||||
|
# This might be required by some gems at runtime,
|
||||||
|
# but we allow to strip it out for smaller closure size.
|
||||||
|
, removeReferencesTo, removeReferenceToCC ? false
|
||||||
, autoreconfHook, bison, autoconf
|
, autoreconfHook, bison, autoconf
|
||||||
, buildEnv, bundler, bundix
|
, buildEnv, bundler, bundix
|
||||||
, libiconv, libobjc, libunwind, Foundation
|
, libiconv, libobjc, libunwind, Foundation
|
||||||
|
@ -145,6 +150,13 @@ 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 ''
|
||||||
|
# Get rid of the CC runtime dependency
|
||||||
|
${removeReferencesTo}/bin/remove-references-to \
|
||||||
|
-t ${stdenv.cc} \
|
||||||
|
$out/lib/libruby.so.*
|
||||||
|
''}
|
||||||
|
|
||||||
# Bundler tries to create this directory
|
# Bundler tries to create this directory
|
||||||
mkdir -p $out/nix-support
|
mkdir -p $out/nix-support
|
||||||
cat > $out/nix-support/setup-hook <<EOF
|
cat > $out/nix-support/setup-hook <<EOF
|
||||||
|
|
Loading…
Reference in New Issue