Skip to content

Commit

Permalink
ruby: --disable-rubygems for baseruby
Browse files Browse the repository at this point in the history
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 NixOS#51842 (comment).
  • Loading branch information
alyssais committed May 24, 2019
1 parent ef2035a commit d2516e5
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions pkgs/development/interpreters/ruby/default.nix
Expand Up @@ -29,11 +29,13 @@ let
baseruby = self.override {
useRailsExpress = false;
docSupport = false;
rubygemsSupport = false;
};
self = lib.makeOverridable (
{ stdenv, buildPackages, lib
, fetchurl, fetchpatch, fetchFromSavannah, fetchFromGitHub
, useRailsExpress ? true
, rubygemsSupport ? true
, zlib, zlibSupport ? true
, openssl, opensslSupport ? true
, gdbm, gdbmSupport ? true
Expand Down Expand Up @@ -89,7 +91,7 @@ let
patchLevel = ver.patchLevel;
})."${ver.majMinTiny}";

postUnpack = ''
postUnpack = opString rubygemsSupport ''
cp -r ${rubygems} $sourceRoot/rubygems
'';

Expand Down Expand Up @@ -135,12 +137,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
Expand All @@ -161,6 +157,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
Expand Down

0 comments on commit d2516e5

Please sign in to comment.