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

@ -29,11 +29,13 @@ let
baseruby = self.override {
useRailsExpress = false;
docSupport = false;
rubygemsSupport = false;
};
self = lib.makeOverridable (
{ stdenv, buildPackages, lib
, fetchurl, fetchFromSavannah, fetchFromGitHub
, useRailsExpress ? true
, rubygemsSupport ? true
, zlib, zlibSupport ? true
, openssl, opensslSupport ? true
, gdbm, gdbmSupport ? true
@ -90,7 +92,7 @@ let
patchLevel = ver.patchLevel;
}).${ver.majMinTiny};
postUnpack = ''
postUnpack = opString rubygemsSupport ''
cp -r ${rubygems} $sourceRoot/rubygems
'';
@ -136,12 +138,6 @@ let
installFlags = stdenv.lib.optionalString docSupport "install-doc";
# Bundler tries to create this directory
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
sed -i '/NROFF/d' $out/lib/ruby/*/*/rbconfig.rb
@ -162,6 +158,12 @@ let
EOF
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 ''
# Prevent the docs from being included in the closure
sed -i "s|\$(DESTDIR)$devdoc|\$(datarootdir)/\$(RI_BASE_NAME)|" $rbConfig