From 99a66bc2f993141ccd6b26500fa1f4620b695a98 Mon Sep 17 00:00:00 2001 From: Jude Taylor Date: Sat, 12 Sep 2015 11:58:02 -0700 Subject: [PATCH] put all rubies in scope --- .../development/interpreters/ruby/default.nix | 16 +-- .../interpreters/ruby/ruby-1.8.7.nix | 104 ++++++++++++++++++ pkgs/top-level/all-packages.nix | 15 +-- 3 files changed, 121 insertions(+), 14 deletions(-) create mode 100644 pkgs/development/interpreters/ruby/ruby-1.8.7.nix diff --git a/pkgs/development/interpreters/ruby/default.nix b/pkgs/development/interpreters/ruby/default.nix index d69a1394a60..fa16352162c 100644 --- a/pkgs/development/interpreters/ruby/default.nix +++ b/pkgs/development/interpreters/ruby/default.nix @@ -6,7 +6,7 @@ , groff, docSupport ? false , libyaml, yamlSupport ? true , libffi, fiddleSupport ? true -, autoreconfHook, bison +, autoreconfHook, bison, autoconf , darwin ? null }: @@ -20,6 +20,7 @@ let let versionNoPatch = "${majorVersion}.${minorVersion}.${teenyVersion}"; isRuby21 = majorVersion == "2" && minorVersion == "1"; + isRuby18 = majorVersion == "1" && minorVersion == "8"; baseruby = self false; self = useRailsExpress: stdenv.mkDerivation rec { version = "${versionNoPatch}-p${patchLevel}"; @@ -57,19 +58,20 @@ let # support is disabled (if it's enabled, we already have it) and we're # running on darwin ++ (op (!cursesSupport && stdenv.isDarwin) readline) - ++ (ops stdenv.isDarwin (with darwin; [ libiconv libobjc libunwind ])); + ++ (ops stdenv.isDarwin (with darwin; [ libiconv libobjc libunwind ])) + ++ op isRuby18 autoconf; enableParallelBuilding = true; - patches = let patchsets = import ./patchsets.nix { + patches = (import ./patchsets.nix { inherit patchSet useRailsExpress ops patchLevel; - }; in patchsets."${versionNoPatch}"; + })."${versionNoPatch}"; postUnpack = opString isRuby21 '' rm "$sourceRoot/enc/unicode/name2ctype.h" ''; - postPatch = if isRuby21 then '' + postPatch = opString (!isRuby18) (if isRuby21 then '' rm tool/config_files.rb cp ${config}/config.guess tool/ cp ${config}/config.sub tool/ @@ -77,9 +79,9 @@ let sed -i configure.in -e '/config.guess/d' cp ${config}/config.guess tool/ cp ${config}/config.sub tool/ - ''; + ''); - configureFlags = ["--enable-shared"] + configureFlags = ["--enable-shared" "--enable-pthread"] ++ op useRailsExpress "--with-baseruby=${baseruby}/bin/ruby" ++ ops stdenv.isDarwin [ # on darwin, we have /usr/include/tk.h -- so the configure script detects diff --git a/pkgs/development/interpreters/ruby/ruby-1.8.7.nix b/pkgs/development/interpreters/ruby/ruby-1.8.7.nix new file mode 100644 index 00000000000..0ae1d1261ee --- /dev/null +++ b/pkgs/development/interpreters/ruby/ruby-1.8.7.nix @@ -0,0 +1,104 @@ +{ stdenv, lib, fetchurl, fetchFromGitHub +, zlib, zlibSupport ? true +, openssl, opensslSupport ? true +, gdbm, gdbmSupport ? true +, ncurses, readline, cursesSupport ? true +, groff, docSupport ? false +, ruby_1_8_7, autoreconfHook, bison, useRailsExpress ? true +}: + +let + op = stdenv.lib.optional; + ops = stdenv.lib.optionals; + patchSet = import ./rvm-patchsets.nix { inherit fetchFromGitHub; }; + baseruby = ruby_1_8_7.override { useRailsExpress = false; }; +in + +stdenv.mkDerivation rec { + version = with passthru; "${majorVersion}.${minorVersion}.${teenyVersion}-p${patchLevel}"; + + name = "ruby-${version}"; + + src = if useRailsExpress then fetchFromGitHub { + owner = "ruby"; + repo = "ruby"; + rev = "v1_8_7_${passthru.patchLevel}"; + sha256 = "1xddhxr0j26hpxfixvhqdscwk2ri846w2129fcfwfjzvy19igswx"; + } else fetchurl { + url = "http://cache.ruby-lang.org/pub/ruby/1.8/${name}.tar.bz2"; + sha256 = "1qq7khilwkayrhwmzlxk83scrmiqfi7lgsn4c63znyvz2c1lgqxl"; + }; + + # Have `configure' avoid `/usr/bin/nroff' in non-chroot builds. + NROFF = "${groff}/bin/nroff"; + + buildInputs = ops useRailsExpress [ autoreconfHook bison ] + ++ (ops cursesSupport [ ncurses readline ] ) + ++ (op docSupport groff ) + ++ (op zlibSupport zlib) + ++ (op opensslSupport openssl) + ++ (op gdbmSupport gdbm); + + patches = ops useRailsExpress [ + "${patchSet}/patches/ruby/1.8.7/p374/railsexpress/01-ignore-generated-files.patch" + "${patchSet}/patches/ruby/1.8.7/p374/railsexpress/02-fix-tests-for-osx.patch" + "${patchSet}/patches/ruby/1.8.7/p374/railsexpress/03-sigvtalrm-fix.patch" + "${patchSet}/patches/ruby/1.8.7/p374/railsexpress/04-railsbench-gc-patch.patch" + "${patchSet}/patches/ruby/1.8.7/p374/railsexpress/05-display-full-stack-trace.patch" + "${patchSet}/patches/ruby/1.8.7/p374/railsexpress/06-better-source-file-tracing.patch" + "${patchSet}/patches/ruby/1.8.7/p374/railsexpress/07-heap-dump-support.patch" + "${patchSet}/patches/ruby/1.8.7/p374/railsexpress/08-fork-support-for-gc-logging.patch" + "${patchSet}/patches/ruby/1.8.7/p374/railsexpress/09-track-malloc-size.patch" + "${patchSet}/patches/ruby/1.8.7/p374/railsexpress/10-track-object-allocation.patch" + "${patchSet}/patches/ruby/1.8.7/p374/railsexpress/11-expose-heap-slots.patch" + "${patchSet}/patches/ruby/1.8.7/p374/railsexpress/12-fix-heap-size-growth-logic.patch" + "${patchSet}/patches/ruby/1.8.7/p374/railsexpress/13-heap-slot-size.patch" + "${patchSet}/patches/ruby/1.8.7/p374/railsexpress/14-add-trace-stats-enabled-methods.patch" + "${patchSet}/patches/ruby/1.8.7/p374/railsexpress/15-track-live-dataset-size.patch" + "${patchSet}/patches/ruby/1.8.7/p374/railsexpress/16-add-object-size-information-to-heap-dump.patch" + "${patchSet}/patches/ruby/1.8.7/p374/railsexpress/17-caller-for-all-threads.patch" + ]; + + configureFlags = [ "--enable-shared" "--enable-pthread" ] + # Without this fails due to not finding X11/Xlib.h + # Not sure why this isn't required on Linux + ++ ops stdenv.isDarwin [ "--without-tcl" "--without-tk" ] + ++ op useRailsExpress "--with-baseruby=${baseruby}/bin/ruby"; + + installFlags = stdenv.lib.optionalString docSupport "install-doc"; + + postInstall = '' + # Bundler tries to create this directory + mkdir -pv $out/${passthru.gemPath} + mkdir -p $out/nix-support + cat > $out/nix-support/setup-hook <