mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-25 00:12:56 +00:00
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
|
||||
, autoconf, libiconv, libobjc, libunwind, Foundation
|
||||
, buildEnv, bundler, bundix
|
||||
, makeWrapper, buildRubyGem, defaultGemConfig
|
||||
, makeWrapper, buildRubyGem, defaultGemConfig, removeReferencesTo
|
||||
} @ args:
|
||||
|
||||
let
|
||||
@ -44,6 +44,11 @@ let
|
||||
, groff, docSupport ? true
|
||||
, libyaml, yamlSupport ? 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
|
||||
, buildEnv, bundler, bundix
|
||||
, libiconv, libobjc, libunwind, Foundation
|
||||
@ -145,6 +150,13 @@ let
|
||||
# Remove unnecessary groff reference from runtime closure, since it's big
|
||||
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
|
||||
mkdir -p $out/nix-support
|
||||
cat > $out/nix-support/setup-hook <<EOF
|
||||
|
Loading…
Reference in New Issue
Block a user