From 6852f66506e4fbeb42ea2d910e1ae85781e55a23 Mon Sep 17 00:00:00 2001 From: Mario Rodas Date: Thu, 1 Apr 2021 04:20:00 +0000 Subject: [PATCH] ruby: disable jit by default Building Ruby with jit by default includes clang in its closure, hence causing a large closure size. Ruby jit support is optional, and is only enabled at runtime through the `--jit` flag, hence it should not cause any regression. --- pkgs/development/interpreters/ruby/default.nix | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/pkgs/development/interpreters/ruby/default.nix b/pkgs/development/interpreters/ruby/default.nix index 4b185f038a17..5779ac8afb73 100644 --- a/pkgs/development/interpreters/ruby/default.nix +++ b/pkgs/development/interpreters/ruby/default.nix @@ -55,13 +55,7 @@ let # 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. If you'd like to have a ruby without reference to cc, setting - # jitSupport to false should remove all known references mentioned above. - , removeReferencesTo, jitSupport ? true + , removeReferencesTo, jitSupport ? false , autoreconfHook, bison, autoconf , buildEnv, bundler, bundix , libiconv, libobjc, libunwind, Foundation @@ -167,8 +161,9 @@ let installFlags = lib.optional docSupport "install-doc"; # Bundler tries to create this directory postInstall = '' + rbConfig=$(find $out/lib/ruby -name rbconfig.rb) # Remove unnecessary groff reference from runtime closure, since it's big - sed -i '/NROFF/d' $out/lib/ruby/*/*/rbconfig.rb + sed -i '/NROFF/d' $rbConfig ${ lib.optionalString (!jitSupport) '' # Get rid of the CC runtime dependency @@ -177,7 +172,8 @@ let $out/lib/libruby* ${removeReferencesTo}/bin/remove-references-to \ -t ${stdenv.cc} \ - $out/${passthru.libPath}/${stdenv.hostPlatform.system}/rbconfig.rb + $rbConfig + sed -i '/CC_VERSION_MESSAGE/d' $rbConfig '' } # Bundler tries to create this directory @@ -195,8 +191,6 @@ let addEnvHooks "$hostOffset" addGemPath addEnvHooks "$hostOffset" addRubyLibPath EOF - - rbConfig=$(find $out/lib/ruby -name rbconfig.rb) '' + opString docSupport '' # Prevent the docs from being included in the closure sed -i "s|\$(DESTDIR)$devdoc|\$(datarootdir)/\$(RI_BASE_NAME)|" $rbConfig