PR comments

This commit is contained in:
Jude Taylor 2015-09-26 06:23:25 -07:00
parent 1223210576
commit 68e802c46b
2 changed files with 110 additions and 110 deletions

View File

@ -10,130 +10,130 @@ let
patchSet = import ./rvm-patchsets.nix { inherit fetchFromGitHub; }; patchSet = import ./rvm-patchsets.nix { inherit fetchFromGitHub; };
config = import ./config.nix { inherit fetchFromSavannah; }; config = import ./config.nix { inherit fetchFromSavannah; };
generic = { majorVersion, minorVersion, teenyVersion, patchLevel, sha256 }: let generic = { majorVersion, minorVersion, teenyVersion, patchLevel, sha256 }: let
versionNoPatch = "${majorVersion}.${minorVersion}.${teenyVersion}"; versionNoPatch = "${majorVersion}.${minorVersion}.${teenyVersion}";
version = "${versionNoPatch}-p${patchLevel}"; version = "${versionNoPatch}-p${patchLevel}";
fullVersionName = if patchLevel != "0" && stdenv.lib.versionOlder versionNoPatch "2.1" fullVersionName = if patchLevel != "0" && stdenv.lib.versionOlder versionNoPatch "2.1"
then version then version
else versionNoPatch; else versionNoPatch;
tag = "v" + stdenv.lib.replaceChars ["." "p" "-"] ["_" "_" ""] fullVersionName; tag = "v" + stdenv.lib.replaceChars ["." "p" "-"] ["_" "_" ""] fullVersionName;
isRuby21 = majorVersion == "2" && minorVersion == "1"; isRuby21 = majorVersion == "2" && minorVersion == "1";
isRuby18 = majorVersion == "1" && minorVersion == "8"; isRuby18 = majorVersion == "1" && minorVersion == "8";
baseruby = self.override { useRailsExpress = false; }; baseruby = self.override { useRailsExpress = false; };
self = lib.makeOverridable ( self = lib.makeOverridable (
{ stdenv, lib, fetchurl, fetchFromSavannah, fetchFromGitHub { stdenv, lib, fetchurl, fetchFromSavannah, fetchFromGitHub
, useRailsExpress ? true , useRailsExpress ? true
, zlib, zlibSupport ? true , zlib, zlibSupport ? true
, openssl, opensslSupport ? true , openssl, opensslSupport ? true
, gdbm, gdbmSupport ? true , gdbm, gdbmSupport ? true
, ncurses, readline, cursesSupport ? true , ncurses, readline, cursesSupport ? true
, groff, docSupport ? false , groff, docSupport ? false
, libyaml, yamlSupport ? true , libyaml, yamlSupport ? true
, libffi, fiddleSupport ? true , libffi, fiddleSupport ? true
, autoreconfHook, bison, autoconf , autoreconfHook, bison, autoconf
, darwin ? null , darwin ? null
}: }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
inherit version; inherit version;
name = "ruby-${version}"; name = "ruby-${version}";
src = if useRailsExpress then fetchFromGitHub { src = if useRailsExpress then fetchFromGitHub {
owner = "ruby"; owner = "ruby";
repo = "ruby"; repo = "ruby";
rev = tag; rev = tag;
sha256 = sha256.git; sha256 = sha256.git;
} else fetchurl { } else fetchurl {
url = "http://cache.ruby-lang.org/pub/ruby/${majorVersion}.${minorVersion}/ruby-${fullVersionName}.tar.gz"; url = "http://cache.ruby-lang.org/pub/ruby/${majorVersion}.${minorVersion}/ruby-${fullVersionName}.tar.gz";
sha256 = sha256.src; sha256 = sha256.src;
}; };
# Have `configure' avoid `/usr/bin/nroff' in non-chroot builds. # Have `configure' avoid `/usr/bin/nroff' in non-chroot builds.
NROFF = "${groff}/bin/nroff"; NROFF = "${groff}/bin/nroff";
buildInputs = ops useRailsExpress [ autoreconfHook bison ] buildInputs = ops useRailsExpress [ autoreconfHook bison ]
++ (op fiddleSupport libffi) ++ (op fiddleSupport libffi)
++ (ops cursesSupport [ ncurses readline ]) ++ (ops cursesSupport [ ncurses readline ])
++ (op docSupport groff) ++ (op docSupport groff)
++ (op zlibSupport zlib) ++ (op zlibSupport zlib)
++ (op opensslSupport openssl) ++ (op opensslSupport openssl)
++ (op gdbmSupport gdbm) ++ (op gdbmSupport gdbm)
++ (op yamlSupport libyaml) ++ (op yamlSupport libyaml)
# Looks like ruby fails to build on darwin without readline even if curses # Looks like ruby fails to build on darwin without readline even if curses
# support is not enabled, so add readline to the build inputs if curses # support is not enabled, so add readline to the build inputs if curses
# support is disabled (if it's enabled, we already have it) and we're # support is disabled (if it's enabled, we already have it) and we're
# running on darwin # running on darwin
++ (op (!cursesSupport && stdenv.isDarwin) readline) ++ (op (!cursesSupport && stdenv.isDarwin) readline)
++ (ops stdenv.isDarwin (with darwin; [ libiconv libobjc libunwind ])) ++ (ops stdenv.isDarwin (with darwin; [ libiconv libobjc libunwind ]))
++ op isRuby18 autoconf; ++ op isRuby18 autoconf;
enableParallelBuilding = true; enableParallelBuilding = true;
patches = (import ./patchsets.nix { patches = (import ./patchsets.nix {
inherit patchSet useRailsExpress ops patchLevel; inherit patchSet useRailsExpress ops patchLevel;
})."${versionNoPatch}"; })."${versionNoPatch}";
postUnpack = opString isRuby21 '' postUnpack = opString isRuby21 ''
rm "$sourceRoot/enc/unicode/name2ctype.h" rm "$sourceRoot/enc/unicode/name2ctype.h"
''; '';
postPatch = opString (!isRuby18) (if isRuby21 then '' postPatch = opString (!isRuby18) (if isRuby21 then ''
rm tool/config_files.rb rm tool/config_files.rb
cp ${config}/config.guess tool/ cp ${config}/config.guess tool/
cp ${config}/config.sub tool/ cp ${config}/config.sub tool/
'' else opString useRailsExpress '' '' else opString useRailsExpress ''
sed -i configure.in -e '/config.guess/d' sed -i configure.in -e '/config.guess/d'
cp ${config}/config.guess tool/ cp ${config}/config.guess tool/
cp ${config}/config.sub tool/ cp ${config}/config.sub tool/
''); '');
configureFlags = ["--enable-shared" "--enable-pthread"] configureFlags = ["--enable-shared" "--enable-pthread"]
++ op useRailsExpress "--with-baseruby=${baseruby}/bin/ruby" ++ op useRailsExpress "--with-baseruby=${baseruby}/bin/ruby"
++ ops stdenv.isDarwin [ ++ ops stdenv.isDarwin [
# on darwin, we have /usr/include/tk.h -- so the configure script detects # on darwin, we have /usr/include/tk.h -- so the configure script detects
# that tk is installed # that tk is installed
"--with-out-ext=tk" "--with-out-ext=tk"
# on yosemite, "generating encdb.h" will hang for a very long time without this flag # on yosemite, "generating encdb.h" will hang for a very long time without this flag
"--with-setjmp-type=setjmp" "--with-setjmp-type=setjmp"
]; ];
installFlags = stdenv.lib.optionalString docSupport "install-doc"; installFlags = stdenv.lib.optionalString docSupport "install-doc";
# Bundler tries to create this directory
postInstall = ''
# Bundler tries to create this directory # Bundler tries to create this directory
mkdir -pv $out/${passthru.gemPath} postInstall = ''
mkdir -p $out/nix-support # Bundler tries to create this directory
cat > $out/nix-support/setup-hook <<EOF mkdir -pv $out/${passthru.gemPath}
addGemPath() { mkdir -p $out/nix-support
addToSearchPath GEM_PATH \$1/${passthru.gemPath} cat > $out/nix-support/setup-hook <<EOF
} addGemPath() {
addToSearchPath GEM_PATH \$1/${passthru.gemPath}
}
envHooks+=(addGemPath) envHooks+=(addGemPath)
EOF EOF
'' + opString useRailsExpress '' '' + opString useRailsExpress ''
rbConfig=$(find $out/lib/ruby -name rbconfig.rb) rbConfig=$(find $out/lib/ruby -name rbconfig.rb)
# Prevent the baseruby from being included in the closure. # Prevent the baseruby from being included in the closure.
sed -i '/^ CONFIG\["BASERUBY"\]/d' $rbConfig sed -i '/^ CONFIG\["BASERUBY"\]/d' $rbConfig
sed -i "s|'--with-baseruby=${baseruby}/bin/ruby'||" $rbConfig sed -i "s|'--with-baseruby=${baseruby}/bin/ruby'||" $rbConfig
''; '';
meta = { meta = {
license = stdenv.lib.licenses.ruby; license = stdenv.lib.licenses.ruby;
homepage = "http://www.ruby-lang.org/en/"; homepage = "http://www.ruby-lang.org/en/";
description = "The Ruby language"; description = "The Ruby language";
platforms = stdenv.lib.platforms.all; platforms = stdenv.lib.platforms.all;
}; };
passthru = rec { passthru = rec {
inherit majorVersion minorVersion teenyVersion patchLevel; inherit majorVersion minorVersion teenyVersion patchLevel;
rubyEngine = "ruby"; rubyEngine = "ruby";
baseRuby = baseruby; baseRuby = baseruby;
libPath = "lib/${versionNoPatch}"; libPath = "lib/${versionNoPatch}";
gemPath = "lib/${rubyEngine}/gems/${versionNoPatch}"; gemPath = "lib/${rubyEngine}/gems/${versionNoPatch}";
}; };
} }
) args; in self; ) args; in self;
in { in {
ruby_1_8_7 = generic { ruby_1_8_7 = generic {

View File

@ -5088,7 +5088,7 @@ let
bundlerEnv = callPackage ../development/interpreters/ruby/bundler-env { }; bundlerEnv = callPackage ../development/interpreters/ruby/bundler-env { };
ruby_1_8_7 = callPackage ../development/interpreters/ruby/ruby-1.8.7.nix { }; ruby_1_8_7 = callPackage ../development/interpreters/ruby/ruby-1.8.7.nix { };
inherit (callPackage ../development/interpreters/ruby {}) inherit (callPackages ../development/interpreters/ruby {})
# TODO: uncomment when ruby_1_8_7 doesn't need autoconf # TODO: uncomment when ruby_1_8_7 doesn't need autoconf
# ruby_1_8_7 # ruby_1_8_7
ruby_1_9_3 ruby_1_9_3