diff options
Diffstat (limited to 'infra/libkookie/nixpkgs/pkgs/development/interpreters/ruby/default.nix')
-rw-r--r-- | infra/libkookie/nixpkgs/pkgs/development/interpreters/ruby/default.nix | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/infra/libkookie/nixpkgs/pkgs/development/interpreters/ruby/default.nix b/infra/libkookie/nixpkgs/pkgs/development/interpreters/ruby/default.nix index 02d0f02c3495..87aa5aca1e14 100644 --- a/infra/libkookie/nixpkgs/pkgs/development/interpreters/ruby/default.nix +++ b/infra/libkookie/nixpkgs/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 @@ -108,6 +119,9 @@ let sed -i configure.ac -e '/config.guess/d' cp --remove-destination ${config}/config.guess tool/ cp --remove-destination ${config}/config.sub tool/ + # Make the build reproducible for ruby <= 2.7 + # See https://github.com/ruby/io-console/commit/679a941d05d869f5e575730f6581c027203b7b26#diff-d8422f096931c58d4463e2489f62a228b0f24f0492950ba88c8c89a0d741cfe6 + sed -i ext/io/console/io-console.gemspec -e '/s\.date/d' ''; # Force the revision.h generation. Somehow `revision.tmp` is an empty @@ -118,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 @@ -150,11 +165,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 @@ -188,6 +206,8 @@ let sed -i "s|'--with-baseruby=${baseruby}/bin/ruby'||" $rbConfig ''; + disallowedRequisites = op (!jitSupport) stdenv.cc.cc; + meta = with stdenv.lib; { description = "The Ruby language"; homepage = "http://www.ruby-lang.org/en/"; |