diff options
author | Profpatsch <mail@profpatsch.de> | 2019-12-12 16:38:55 +0100 |
---|---|---|
committer | Profpatsch <mail@profpatsch.de> | 2019-12-25 13:59:42 +0100 |
commit | 80c07f8aafc03a157c43438fe97079815a2bdcdb (patch) | |
tree | 7a408aa605ac98a7ae5384068112aac5ac99f6db /pkgs/development/interpreters/ruby | |
parent | add4e5ea661e1771536286a3042b18bdcf6dcd10 (diff) |
ruby: add `removeReferenceToCC` package option
Reduces the runtime closure by ~200MB if enabled.
Diffstat (limited to 'pkgs/development/interpreters/ruby')
-rw-r--r-- | pkgs/development/interpreters/ruby/default.nix | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/pkgs/development/interpreters/ruby/default.nix b/pkgs/development/interpreters/ruby/default.nix index d70c7e70f33b..ab25b4e189a6 100644 --- a/pkgs/development/interpreters/ruby/default.nix +++ b/pkgs/development/interpreters/ruby/default.nix @@ -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 |