summary refs log tree commit diff
path: root/pkgs/development
diff options
context:
space:
mode:
authorMichael Fellinger <m.fellinger@gmail.com>2014-08-30 13:01:02 +0200
committerMateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk>2014-08-31 13:24:10 +0100
commit57b667fe65ecd06a788f2b1d7e659747248d7e8b (patch)
tree032c6e88da2dc9f29c62983e8d615784eeefefb4 /pkgs/development
parent6ad299460caccd4c4ab928d7988f7a1f0460fea8 (diff)
downloadnixpkgs-57b667fe65ecd06a788f2b1d7e659747248d7e8b.tar
nixpkgs-57b667fe65ecd06a788f2b1d7e659747248d7e8b.tar.gz
nixpkgs-57b667fe65ecd06a788f2b1d7e659747248d7e8b.tar.bz2
nixpkgs-57b667fe65ecd06a788f2b1d7e659747248d7e8b.tar.lz
nixpkgs-57b667fe65ecd06a788f2b1d7e659747248d7e8b.tar.xz
nixpkgs-57b667fe65ecd06a788f2b1d7e659747248d7e8b.tar.zst
nixpkgs-57b667fe65ecd06a788f2b1d7e659747248d7e8b.zip
ruby: add version 2.1.2
Diffstat (limited to 'pkgs/development')
-rw-r--r--pkgs/development/interpreters/ruby/ruby-2.1.2.nix72
1 files changed, 72 insertions, 0 deletions
diff --git a/pkgs/development/interpreters/ruby/ruby-2.1.2.nix b/pkgs/development/interpreters/ruby/ruby-2.1.2.nix
new file mode 100644
index 00000000000..430bf4f1665
--- /dev/null
+++ b/pkgs/development/interpreters/ruby/ruby-2.1.2.nix
@@ -0,0 +1,72 @@
+{ 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 {
+  name = "ruby-2.1.2";
+  src = fetchurl {
+    url = "http://cache.ruby-lang.org/pub/ruby/2.1/${name}.tar.bz2";
+    sha256 = "6948b02570cdfb89a8313675d4aa665405900e27423db408401473f30fc6e901";
+  };
+
+  # 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)
+    ++ (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);
+
+  enableParallelBuilding = true;
+
+  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 [ ]);
+
+  installFlags = stdenv.lib.optionalString docSupport "install-doc";
+  # Bundler tries to create this directory
+  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
+  '';
+
+  meta = {
+    license = "Ruby";
+    homepage = "http://www.ruby-lang.org/en/";
+    description = "The Ruby language";
+    platforms = stdenv.lib.platforms.all;
+  };
+
+  passthru = rec {
+    majorVersion = "2.1";
+    minorVersion = "2";
+    libPath = "lib/ruby/${majorVersion}";
+    gemPath = "lib/ruby/gems/${majorVersion}";
+  };
+}