2014-08-09 05:00:08 +01:00
|
|
|
{ stdenv, fetchurl, fetchFromGitHub
|
2013-02-25 11:16:32 +00:00
|
|
|
, zlib, zlibSupport ? true
|
|
|
|
, openssl, opensslSupport ? true
|
|
|
|
, gdbm, gdbmSupport ? true
|
|
|
|
, ncurses, readline, cursesSupport ? false
|
|
|
|
, groff, docSupport ? false
|
|
|
|
, libyaml, yamlSupport ? true
|
2014-10-26 04:47:48 +00:00
|
|
|
, libffi, fiddleSupport ? true
|
2014-08-09 05:00:08 +01:00
|
|
|
, ruby_2_0_0, autoreconfHook, bison, useRailsExpress ? true
|
2013-02-25 11:16:32 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
op = stdenv.lib.optional;
|
|
|
|
ops = stdenv.lib.optionals;
|
2014-08-09 05:00:08 +01:00
|
|
|
patchSet = import ./rvm-patchsets.nix { inherit fetchFromGitHub; };
|
|
|
|
baseruby = ruby_2_0_0.override { useRailsExpress = false; };
|
2013-02-25 11:16:32 +00:00
|
|
|
in
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2014-08-09 05:00:08 +01:00
|
|
|
version = with passthru; "${majorVersion}.${minorVersion}.${teenyVersion}-p${patchLevel}";
|
|
|
|
|
2013-02-25 11:16:32 +00:00
|
|
|
name = "ruby-${version}";
|
2014-08-09 05:00:08 +01:00
|
|
|
|
|
|
|
src = if useRailsExpress then fetchFromGitHub {
|
|
|
|
owner = "ruby";
|
|
|
|
repo = "ruby";
|
|
|
|
rev = "v2_0_0_${passthru.patchLevel}";
|
|
|
|
sha256 = "07ccnxgiqxn5ycmq2wl7j3aqmndm4n358y35kzaivb488ayjg3pj";
|
|
|
|
} else fetchurl {
|
2013-11-24 16:35:50 +00:00
|
|
|
url = "http://cache.ruby-lang.org/pub/ruby/2.0/${name}.tar.bz2";
|
2014-08-09 05:00:08 +01:00
|
|
|
sha256 = "1qnqccyfhx0fykxqbzlxq0yvyvq6q9v32givyfyr303dx7bxlqh7";
|
2013-02-25 11:16:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
# Have `configure' avoid `/usr/bin/nroff' in non-chroot builds.
|
|
|
|
NROFF = "${groff}/bin/nroff";
|
|
|
|
|
2014-08-09 05:00:08 +01:00
|
|
|
buildInputs = ops useRailsExpress [ autoreconfHook bison ]
|
2014-10-26 04:47:48 +00:00
|
|
|
++ (op fiddleSupport libffi)
|
2014-08-09 05:00:08 +01:00
|
|
|
++ (ops cursesSupport [ ncurses readline ] )
|
2013-02-25 11:16:32 +00:00
|
|
|
++ (op docSupport groff )
|
|
|
|
++ (op zlibSupport zlib)
|
|
|
|
++ (op opensslSupport openssl)
|
|
|
|
++ (op gdbmSupport gdbm)
|
2013-11-24 16:42:18 +00:00
|
|
|
++ (op yamlSupport libyaml)
|
|
|
|
# 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 disabled (if it's enabled, we already have it) and we're
|
|
|
|
# running on darwin
|
|
|
|
++ (op (!cursesSupport && stdenv.isDarwin) readline);
|
2013-02-25 11:16:32 +00:00
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
2014-08-09 05:00:08 +01:00
|
|
|
|
|
|
|
patches = ops useRailsExpress [
|
2014-11-20 11:53:44 +00:00
|
|
|
"${patchSet}/patches/ruby/2.0.0/p481/railsexpress/01-zero-broken-tests.patch"
|
|
|
|
"${patchSet}/patches/ruby/2.0.0/p481/railsexpress/02-railsexpress-gc.patch"
|
|
|
|
"${patchSet}/patches/ruby/2.0.0/p481/railsexpress/03-display-more-detailed-stack-trace.patch"
|
|
|
|
"${patchSet}/patches/ruby/2.0.0/p481/railsexpress/04-show-full-backtrace-on-stack-overflow.patch"
|
|
|
|
"${patchSet}/patches/ruby/2.0.0/p481/railsexpress/05-fix-missing-c-return-event.patch"
|
2014-08-09 05:00:08 +01:00
|
|
|
];
|
|
|
|
|
2013-11-24 16:42:18 +00:00
|
|
|
configureFlags = ["--enable-shared" ]
|
2014-08-09 05:00:08 +01:00
|
|
|
++ op useRailsExpress "--with-baseruby=${baseruby}/bin/ruby"
|
2013-11-24 16:42:18 +00:00
|
|
|
# on darwin, we have /usr/include/tk.h -- so the configure script detects
|
|
|
|
# that tk is installed
|
|
|
|
++ ( if stdenv.isDarwin then [ "--with-out-ext=tk " ] else [ ]);
|
2013-02-25 11:16:32 +00:00
|
|
|
|
|
|
|
installFlags = stdenv.lib.optionalString docSupport "install-doc";
|
|
|
|
# Bundler tries to create this directory
|
2013-12-26 23:38:10 +00:00
|
|
|
postInstall = ''
|
|
|
|
# Bundler tries to create this directory
|
|
|
|
mkdir -pv $out/${passthru.gemPath}
|
|
|
|
mkdir -p $out/nix-support
|
|
|
|
cat > $out/nix-support/setup-hook <<EOF
|
|
|
|
addGemPath() {
|
|
|
|
addToSearchPath GEM_PATH \$1/${passthru.gemPath}
|
|
|
|
}
|
|
|
|
|
|
|
|
envHooks+=(addGemPath)
|
|
|
|
EOF
|
|
|
|
'';
|
2013-02-25 11:16:32 +00:00
|
|
|
|
|
|
|
meta = {
|
2014-11-06 00:44:33 +00:00
|
|
|
license = stdenv.lib.licenses.ruby;
|
2013-02-25 11:16:32 +00:00
|
|
|
homepage = "http://www.ruby-lang.org/en/";
|
|
|
|
description = "The Ruby language";
|
|
|
|
platforms = stdenv.lib.platforms.all;
|
|
|
|
};
|
|
|
|
|
|
|
|
passthru = rec {
|
2014-08-09 05:00:08 +01:00
|
|
|
majorVersion = "2";
|
2013-02-25 11:16:32 +00:00
|
|
|
minorVersion = "0";
|
2014-08-09 05:00:08 +01:00
|
|
|
teenyVersion = "0";
|
|
|
|
patchLevel = "481";
|
|
|
|
libPath = "lib/ruby/${majorVersion}.${minorVersion}";
|
|
|
|
gemPath = "lib/ruby/gems/${majorVersion}.${minorVersion}";
|
2013-02-25 11:16:32 +00:00
|
|
|
};
|
|
|
|
}
|