summary refs log tree commit diff
diff options
context:
space:
mode:
authorDoron Behar <doron.behar@gmail.com>2020-11-09 17:25:41 +0200
committerGitHub <noreply@github.com>2020-11-09 17:25:41 +0200
commit32fdf2118ce78744e30dd512c1d5a13ae2eb03f2 (patch)
treeaeab4765dd9e6a15013070a61880507363e61001
parent8aaf2e60e54409dfa06011077991d20600365386 (diff)
parent9db44f61a78a3a1fea720de7465787383a52d010 (diff)
downloadnixpkgs-32fdf2118ce78744e30dd512c1d5a13ae2eb03f2.tar
nixpkgs-32fdf2118ce78744e30dd512c1d5a13ae2eb03f2.tar.gz
nixpkgs-32fdf2118ce78744e30dd512c1d5a13ae2eb03f2.tar.bz2
nixpkgs-32fdf2118ce78744e30dd512c1d5a13ae2eb03f2.tar.lz
nixpkgs-32fdf2118ce78744e30dd512c1d5a13ae2eb03f2.tar.xz
nixpkgs-32fdf2118ce78744e30dd512c1d5a13ae2eb03f2.tar.zst
nixpkgs-32fdf2118ce78744e30dd512c1d5a13ae2eb03f2.zip
Merge pull request #90151 from doronbehar/ruby-gcc-ref
-rw-r--r--nixos/doc/manual/release-notes/rl-2103.xml12
-rw-r--r--pkgs/development/interpreters/ruby/default.nix27
-rw-r--r--pkgs/top-level/aliases.nix1
-rw-r--r--pkgs/top-level/all-packages.nix13
4 files changed, 34 insertions, 19 deletions
diff --git a/nixos/doc/manual/release-notes/rl-2103.xml b/nixos/doc/manual/release-notes/rl-2103.xml
index 709b2ba5228..f857f1e28b7 100644
--- a/nixos/doc/manual/release-notes/rl-2103.xml
+++ b/nixos/doc/manual/release-notes/rl-2103.xml
@@ -90,6 +90,18 @@
     </para>
    </listitem>
    <listitem>
+     <para>
+       <literal>rubyMinimal</literal> was removed due to being unused and
+       unusable. The default ruby interpreter includes JIT support, which makes
+       it reference it's compiler. Since JIT support is probably needed by some
+       Gems, it was decided to enable this feature with all cc references by
+       default, and allow to build a Ruby derivation without references to cc,
+       by setting <literal>jitSupport = false;</literal> in an overlay. See
+       <link xlink:href="https://github.com/NixOS/nixpkgs/pull/90151">#90151</link>
+       for more info.
+     </para>
+   </listitem>
+   <listitem>
     <para>
      The option <option>fonts.enableFontDir</option> has been renamed to
      <xref linkend="opt-fonts.fontDir.enable"/>. The path of font directory
diff --git a/pkgs/development/interpreters/ruby/default.nix b/pkgs/development/interpreters/ruby/default.nix
index 189be8945fa..cfd5c7e5180 100644
--- a/pkgs/development/interpreters/ruby/default.nix
+++ b/pkgs/development/interpreters/ruby/default.nix
@@ -44,11 +44,22 @@ 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 ? true
+      # By default, ruby has 3 observed references to stdenv.cc:
+      #
+      # - If you run:
+      #     ruby -e "puts RbConfig::CONFIG['configure_args']"
+      # - 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. 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
       , autoreconfHook, bison, autoconf
       , buildEnv, bundler, bundix
       , libiconv, libobjc, libunwind, Foundation
@@ -121,6 +132,7 @@ let
 
         configureFlags = ["--enable-shared" "--enable-pthread" "--with-soname=ruby-${version}"]
           ++ op useRailsExpress "--with-baseruby=${baseruby}/bin/ruby"
+          ++ op (!jitSupport) "--disable-jit-support"
           ++ op (!docSupport) "--disable-install-doc"
           ++ ops stdenv.isDarwin [
             # on darwin, we have /usr/include/tk.h -- so the configure script detects
@@ -157,11 +169,14 @@ let
           # Remove unnecessary groff reference from runtime closure, since it's big
           sed -i '/NROFF/d' $out/lib/ruby/*/*/rbconfig.rb
           ${
-            lib.optionalString removeReferenceToCC ''
+            lib.optionalString (!jitSupport) ''
               # Get rid of the CC runtime dependency
               ${removeReferencesTo}/bin/remove-references-to \
                 -t ${stdenv.cc} \
                 $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
diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix
index f8228f45701..cebec0d5e52 100644
--- a/pkgs/top-level/aliases.nix
+++ b/pkgs/top-level/aliases.nix
@@ -501,6 +501,7 @@ mapAliases ({
   ruby_2_5_0 = throw "ruby_2_5_0 was deprecated on 2018-02-13: use a newer version of ruby";
   rubyPackages_2_4 = throw "rubyPackages_2_4 was deprecated in 2019-12: use a newer version of rubyPackages instead";
   rubygems = throw "rubygems was deprecated on 2016-03-02: rubygems is now bundled with ruby";
+  rubyMinimal = throw "rubyMinimal was removed due to being unused";
   rxvt_unicode-with-plugins = rxvt-unicode; # added 2020-02-02
   rxvt_unicode = rxvt-unicode-unwrapped; # added 2020-02-02
   urxvt_autocomplete_all_the_things = rxvt-unicode-plugins.autocomplete-all-the-things; # added 2020-02-02
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 2f06713de0a..8eae90ddc4c 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -10545,19 +10545,6 @@ in
     ruby_2_6
     ruby_2_7;
 
-  rubyMinimal = ruby.override {
-    # gem support is minimal overhead
-    rubygemsSupport = true;
-    useRailsExpress = false;
-    zlibSupport = false;
-    opensslSupport = false;
-    gdbmSupport = false;
-    cursesSupport = false;
-    docSupport = false;
-    yamlSupport = false;
-    fiddleSupport = false;
-  };
-
   ruby = ruby_2_6;
   rubyPackages = rubyPackages_2_6;