ruby: --disable-rubygems for baseruby

This works just fine, and means we don't run into an issue with RubyGems
trying to install into a different Ruby's prefix when cross-compiling.
See https://github.com/NixOS/nixpkgs/pull/51842#issuecomment-478392799.
This commit is contained in:
Alyssa Ross 2019-05-18 17:45:38 +00:00
parent 50d8295cc6
commit 5b0851028f

View File

@ -29,11 +29,13 @@ let
baseruby = self.override { baseruby = self.override {
useRailsExpress = false; useRailsExpress = false;
docSupport = false; docSupport = false;
rubygemsSupport = false;
}; };
self = lib.makeOverridable ( self = lib.makeOverridable (
{ stdenv, buildPackages, lib { stdenv, buildPackages, lib
, fetchurl, fetchFromSavannah, fetchFromGitHub , fetchurl, fetchFromSavannah, fetchFromGitHub
, useRailsExpress ? true , useRailsExpress ? true
, rubygemsSupport ? true
, zlib, zlibSupport ? true , zlib, zlibSupport ? true
, openssl, opensslSupport ? true , openssl, opensslSupport ? true
, gdbm, gdbmSupport ? true , gdbm, gdbmSupport ? true
@ -90,7 +92,7 @@ let
patchLevel = ver.patchLevel; patchLevel = ver.patchLevel;
}).${ver.majMinTiny}; }).${ver.majMinTiny};
postUnpack = '' postUnpack = opString rubygemsSupport ''
cp -r ${rubygems} $sourceRoot/rubygems cp -r ${rubygems} $sourceRoot/rubygems
''; '';
@ -136,12 +138,6 @@ let
installFlags = stdenv.lib.optionalString docSupport "install-doc"; installFlags = stdenv.lib.optionalString docSupport "install-doc";
# Bundler tries to create this directory # Bundler tries to create this directory
postInstall = '' postInstall = ''
# Update rubygems
pushd rubygems
chmod +w bundler/bundler.gemspec
${buildRuby} setup.rb --destdir $GEM_HOME
popd
# Remove unnecessary groff reference from runtime closure, since it's big # Remove unnecessary groff reference from runtime closure, since it's big
sed -i '/NROFF/d' $out/lib/ruby/*/*/rbconfig.rb sed -i '/NROFF/d' $out/lib/ruby/*/*/rbconfig.rb
@ -162,6 +158,12 @@ let
EOF EOF
rbConfig=$(find $out/lib/ruby -name rbconfig.rb) rbConfig=$(find $out/lib/ruby -name rbconfig.rb)
'' + opString rubygemsSupport ''
# Update rubygems
pushd rubygems
chmod +w bundler/bundler.gemspec
${buildRuby} setup.rb
popd
'' + opString docSupport '' '' + opString docSupport ''
# Prevent the docs from being included in the closure # Prevent the docs from being included in the closure
sed -i "s|\$(DESTDIR)$devdoc|\$(datarootdir)/\$(RI_BASE_NAME)|" $rbConfig sed -i "s|\$(DESTDIR)$devdoc|\$(datarootdir)/\$(RI_BASE_NAME)|" $rbConfig