2013-02-25 12:16:32 +01:00
|
|
|
{ stdenv, fetchurl
|
|
|
|
, zlib, zlibSupport ? true
|
|
|
|
, openssl, opensslSupport ? true
|
|
|
|
, gdbm, gdbmSupport ? true
|
|
|
|
, ncurses, readline, cursesSupport ? false
|
|
|
|
, groff, docSupport ? false
|
|
|
|
, libyaml, yamlSupport ? true
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
op = stdenv.lib.optional;
|
|
|
|
ops = stdenv.lib.optionals;
|
|
|
|
in
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
version = with passthru; "${majorVersion}.${minorVersion}-p${patchLevel}";
|
|
|
|
|
|
|
|
name = "ruby-${version}";
|
|
|
|
|
|
|
|
src = fetchurl {
|
2013-11-24 17:35:50 +01:00
|
|
|
url = "http://cache.ruby-lang.org/pub/ruby/2.0/${name}.tar.bz2";
|
2013-11-24 17:38:40 +01:00
|
|
|
sha256 = "3de4e4d9aff4682fa4f8ed2b70bd0d746fae17452fc3d3a8e8f505ead9105ad9";
|
2013-02-25 12:16:32 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
# Have `configure' avoid `/usr/bin/nroff' in non-chroot builds.
|
|
|
|
NROFF = "${groff}/bin/nroff";
|
|
|
|
|
|
|
|
buildInputs = (ops cursesSupport [ ncurses readline ] )
|
|
|
|
++ (op docSupport groff )
|
|
|
|
++ (op zlibSupport zlib)
|
|
|
|
++ (op opensslSupport openssl)
|
|
|
|
++ (op gdbmSupport gdbm)
|
2013-11-24 17:42:18 +01: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 12:16:32 +01:00
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2013-11-24 17:42:18 +01:00
|
|
|
configureFlags = ["--enable-shared" ]
|
|
|
|
# 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 12:16:32 +01:00
|
|
|
|
|
|
|
installFlags = stdenv.lib.optionalString docSupport "install-doc";
|
|
|
|
# Bundler tries to create this directory
|
|
|
|
postInstall = "mkdir -pv $out/${passthru.gemPath}";
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
license = "Ruby";
|
|
|
|
homepage = "http://www.ruby-lang.org/en/";
|
|
|
|
description = "The Ruby language";
|
|
|
|
platforms = stdenv.lib.platforms.all;
|
|
|
|
};
|
|
|
|
|
|
|
|
passthru = rec {
|
|
|
|
majorVersion = "2.0";
|
|
|
|
minorVersion = "0";
|
2013-11-24 17:38:40 +01:00
|
|
|
patchLevel = "353";
|
2013-02-25 12:16:32 +01:00
|
|
|
libPath = "lib/ruby/${majorVersion}";
|
|
|
|
gemPath = "lib/ruby/gems/${majorVersion}";
|
|
|
|
};
|
|
|
|
}
|