2011-10-03 16:35:50 +01:00
|
|
|
{ stdenv, fetchurl
|
|
|
|
, zlib, zlibSupport ? true
|
|
|
|
, openssl, opensslSupport ? true
|
|
|
|
, gdbm, gdbmSupport ? true
|
|
|
|
, ncurses, readline, cursesSupport ? false
|
|
|
|
, groff, docSupport ? false
|
2012-01-10 23:06:23 +00:00
|
|
|
, libyaml, yamlSupport ? true
|
2011-10-03 16:35:50 +01:00
|
|
|
}:
|
|
|
|
|
|
|
|
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 16:35:50 +00:00
|
|
|
url = "http://cache.ruby-lang.org/pub/ruby/1.9/${name}.tar.bz2";
|
2013-11-24 16:37:26 +00:00
|
|
|
sha256 = "0fdc6e860d0023ba7b94c7a0cf1f7d32908b65b526246de9dfd5bb39d0d7922b";
|
2011-10-03 16:35:50 +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)
|
2011-11-23 06:32:17 +00:00
|
|
|
++ (op gdbmSupport gdbm)
|
2013-06-16 03:23:57 +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);
|
2012-07-09 22:30:20 +01:00
|
|
|
|
2013-06-10 22:13:20 +01:00
|
|
|
enableParallelBuilding = true;
|
2013-06-21 16:18:29 +01:00
|
|
|
patches = [ ./ruby19-parallel-install.patch
|
|
|
|
./bitperfect-rdoc.patch
|
|
|
|
];
|
2013-06-10 22:13:20 +01:00
|
|
|
|
2013-06-18 04:19:36 +01:00
|
|
|
configureFlags = [ "--enable-shared" "--enable-pthread" ]
|
|
|
|
# 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 [ ]);
|
2011-10-03 16:35:50 +01:00
|
|
|
|
|
|
|
installFlags = stdenv.lib.optionalString docSupport "install-doc";
|
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
|
|
|
|
'';
|
2011-10-03 16:35:50 +01:00
|
|
|
|
|
|
|
meta = {
|
2013-06-16 03:23:57 +01:00
|
|
|
license = "Ruby";
|
|
|
|
homepage = "http://www.ruby-lang.org/en/";
|
2011-10-03 16:35:50 +01:00
|
|
|
description = "The Ruby language";
|
2013-06-16 03:23:57 +01:00
|
|
|
maintainers = with stdenv.lib.maintainers; [ lovek323 ];
|
|
|
|
platforms = stdenv.lib.platforms.all;
|
2011-10-03 16:35:50 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
passthru = rec {
|
|
|
|
majorVersion = "1.9";
|
2011-11-02 15:42:29 +00:00
|
|
|
minorVersion = "3";
|
2013-11-24 16:37:26 +00:00
|
|
|
patchLevel = "484";
|
2011-10-03 16:35:50 +01:00
|
|
|
libPath = "lib/ruby/${majorVersion}";
|
|
|
|
gemPath = "lib/ruby/gems/${majorVersion}";
|
|
|
|
};
|
|
|
|
}
|