diff options
Diffstat (limited to 'nixpkgs/pkgs/development/interpreters/ruby/default.nix')
-rw-r--r-- | nixpkgs/pkgs/development/interpreters/ruby/default.nix | 54 |
1 files changed, 40 insertions, 14 deletions
diff --git a/nixpkgs/pkgs/development/interpreters/ruby/default.nix b/nixpkgs/pkgs/development/interpreters/ruby/default.nix index dd450e8dd53c..efb898aa72b6 100644 --- a/nixpkgs/pkgs/development/interpreters/ruby/default.nix +++ b/nixpkgs/pkgs/development/interpreters/ruby/default.nix @@ -2,7 +2,7 @@ , fetchurl, fetchpatch, fetchFromSavannah, fetchFromGitHub , zlib, openssl, gdbm, ncurses, readline, groff, libyaml, libffi, autoreconfHook, bison , autoconf, libiconv, libobjc, libunwind, Foundation -, buildEnv, bundler, bundix, makeWrapper +, buildEnv, bundler, bundix, makeWrapper, removeReferencesTo } @ args: let @@ -28,6 +28,7 @@ let isRuby20 = ver.majMin == "2.0"; isRuby21 = ver.majMin == "2.1"; atLeast25 = lib.versionAtLeast ver.majMin "2.5"; + atLeast27 = lib.versionAtLeast ver.majMin "2.7"; baseruby = self.override { useRailsExpress = false; docSupport = false; @@ -50,6 +51,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 @@ -126,7 +132,13 @@ let cp ${config}/config.sub tool/ ''; - configureFlags = ["--enable-shared" "--enable-pthread"] + # Force the revision.h generation. Somehow `revision.tmp` is an empty + # file and because we don't add `git` to buildInputs, hence the check is + # always true. + # https://github.com/ruby/ruby/commit/97a5af62a318fcd93a4e5e4428d576c0280ddbae + buildFlags = lib.optionals atLeast27 [ "REVISION_LATEST=0" ]; + + configureFlags = ["--enable-shared" "--enable-pthread" "--with-soname=ruby_${tag}"] ++ op useRailsExpress "--with-baseruby=${baseruby}/bin/ruby" ++ op (!docSupport) "--disable-install-doc" ++ ops stdenv.isDarwin [ @@ -154,12 +166,19 @@ let export GEM_HOME="$out/${passthru.gemPath}" ''; - installFlags = stdenv.lib.optionalString docSupport "install-doc"; + installFlags = stdenv.lib.optional docSupport "install-doc"; # Bundler tries to create this directory postInstall = '' # 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* + '' + } # Bundler tries to create this directory mkdir -p $out/nix-support cat > $out/nix-support/setup-hook <<EOF @@ -263,27 +282,34 @@ in { }; ruby_2_4 = generic { - version = rubyVersion "2" "4" "7" ""; + version = rubyVersion "2" "4" "9" ""; sha256 = { - src = "12cbyf7zai8mi3mxffm5ynq3mmkcbvs7kb1bbrs259m61irgqvnd"; - git = "1dgch9xz4wdcncb6pf2dvijm10yk6mbw2wfdrj7d3wazrjzh305z"; + src = "1bn6n5b920qy3lsx99jr8495jkc3sg89swgb96d5fgd579g6p6zr"; + git = "066kb1iki7mx7qkm10xhj5b6v8s47wg68v43l3nc36y2hyim1w2c"; }; }; ruby_2_5 = generic { - version = rubyVersion "2" "5" "6" ""; + version = rubyVersion "2" "5" "7" ""; sha256 = { - src = "19xy6rf138ys4qycv0ibsycqwbjmf1j6iv9plw9cs81hcxnd0zhx"; - git = "067gyy7149m6vk9dfyx22mghm2gbgy7snfa7df4ddrvr1pqffqmz"; + src = "1m6nmnj9shifp8g3yh7aimac01vl035bzcc19x2spdji6ig0sb8b"; + git = "0wppf82c9ccdbnvj30mppr5a3mc7sxm05diahjdw7hhk29n43knp"; }; }; ruby_2_6 = generic { - version = rubyVersion "2" "6" "4" ""; + version = rubyVersion "2" "6" "5" ""; sha256 = { - src = "0dvrw4g2igvjclxk9bmb9pf6mzxwm22zqvqa0abkfnshfnxdihag"; - git = "1h4z66amjykpzl6lxx6yad2yfpwnwix4sw19bd96jnwg248kviqf"; + src = "0zgdrgylq6avbblf78kpaf0k2xnkpc3jng3wkd7x67ycdrqnp5v6"; + git = "0pay6ic22ag3bnvxffhgwp7z6clkd0p93944a1l4lvc5hxc8v77j"; }; }; -} + ruby_2_7 = generic { + version = rubyVersion "2" "7" "0" ""; + sha256 = { + src = "1glc3zpnih6h8mrgfcak0aa7cgmi4zyvxfyi6y2brwg2nn9sm6cc"; + git = "11iz64k95czs273mb10195d1j75mmbcgddfdx1vay5876ffw81dq"; + }; + }; +} |