tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
ruby: Add 2.1.6
William A. Kennington III
10 years ago
d5cd6eeb
84ef883a
+124
-1
2 changed files
expand all
collapse all
unified
split
pkgs
development
interpreters
ruby
ruby-2.1.6.nix
top-level
all-packages.nix
+122
pkgs/development/interpreters/ruby/ruby-2.1.6.nix
···
1
1
+
{ stdenv, lib, fetchurl, fetchgit, fetchFromGitHub
2
2
+
, zlib, zlibSupport ? true
3
3
+
, openssl, opensslSupport ? true
4
4
+
, gdbm, gdbmSupport ? true
5
5
+
, ncurses, readline, cursesSupport ? true
6
6
+
, groff, docSupport ? false
7
7
+
, libyaml, yamlSupport ? true
8
8
+
, libffi, fiddleSupport ? true
9
9
+
, ruby_2_1_6, autoreconfHook, bison, useRailsExpress ? true
10
10
+
}:
11
11
+
12
12
+
let
13
13
+
op = stdenv.lib.optional;
14
14
+
ops = stdenv.lib.optionals;
15
15
+
patchSet = import ./rvm-patchsets.nix { inherit fetchFromGitHub; };
16
16
+
config = import ./config.nix fetchgit;
17
17
+
baseruby = ruby_2_1_6.override { useRailsExpress = false; };
18
18
+
in
19
19
+
20
20
+
stdenv.mkDerivation rec {
21
21
+
version = with passthru; "${majorVersion}.${minorVersion}.${teenyVersion}-p${patchLevel}";
22
22
+
23
23
+
name = "ruby-${version}";
24
24
+
25
25
+
src = if useRailsExpress then fetchFromGitHub {
26
26
+
owner = "ruby";
27
27
+
repo = "ruby";
28
28
+
rev = "v2_1_6";
29
29
+
sha256 = "18kbjsbmgv6l3p1qxgmjnhh4jl7xdk3c20ycjpp62vrhq7pyzjsm";
30
30
+
} else fetchurl {
31
31
+
url = "http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.6.tar.gz";
32
32
+
sha256 = "1r4bs8lfwsypbcf8j2lpv3by40729vp5mh697njizj97fjp644qy";
33
33
+
};
34
34
+
35
35
+
# Have `configure' avoid `/usr/bin/nroff' in non-chroot builds.
36
36
+
NROFF = "${groff}/bin/nroff";
37
37
+
38
38
+
buildInputs = ops useRailsExpress [ autoreconfHook bison ]
39
39
+
++ (op fiddleSupport libffi)
40
40
+
++ (ops cursesSupport [ ncurses readline ])
41
41
+
++ (op docSupport groff)
42
42
+
++ (op zlibSupport zlib)
43
43
+
++ (op opensslSupport openssl)
44
44
+
++ (op gdbmSupport gdbm)
45
45
+
++ (op yamlSupport libyaml)
46
46
+
# Looks like ruby fails to build on darwin without readline even if curses
47
47
+
# support is not enabled, so add readline to the build inputs if curses
48
48
+
# support is disabled (if it's enabled, we already have it) and we're
49
49
+
# running on darwin
50
50
+
++ (op (!cursesSupport && stdenv.isDarwin) readline);
51
51
+
52
52
+
enableParallelBuilding = true;
53
53
+
54
54
+
# Fix a build failure on systems with nix store optimisation.
55
55
+
# (The build process attempted to copy file a overwriting file b, where a and
56
56
+
# b are hard-linked, which results in cp returning a non-zero exit code.)
57
57
+
# https://github.com/NixOS/nixpkgs/issues/4266
58
58
+
postUnpack = ''rm "$sourceRoot/enc/unicode/name2ctype.h"'';
59
59
+
60
60
+
patches = ops useRailsExpress [
61
61
+
"${patchSet}/patches/ruby/2.1.6/railsexpress/01-zero-broken-tests.patch"
62
62
+
"${patchSet}/patches/ruby/2.1.6/railsexpress/02-improve-gc-stats.patch"
63
63
+
"${patchSet}/patches/ruby/2.1.6/railsexpress/03-display-more-detailed-stack-trace.patch"
64
64
+
"${patchSet}/patches/ruby/2.1.6/railsexpress/04-show-full-backtrace-on-stack-overflow.patch"
65
65
+
"${patchSet}/patches/ruby/2.1.6/railsexpress/05-funny-falcon-stc-density.patch"
66
66
+
"${patchSet}/patches/ruby/2.1.6/railsexpress/06-funny-falcon-stc-pool-allocation.patch"
67
67
+
"${patchSet}/patches/ruby/2.1.6/railsexpress/07-aman-opt-aset-aref-str.patch"
68
68
+
"${patchSet}/patches/ruby/2.1.6/railsexpress/08-funny-falcon-method-cache.patch"
69
69
+
"${patchSet}/patches/ruby/2.1.6/railsexpress/09-heap-dump-support.patch"
70
70
+
];
71
71
+
72
72
+
# Ruby >= 2.1.0 tries to download config.{guess,sub}
73
73
+
postPatch = ''
74
74
+
rm tool/config_files.rb
75
75
+
cp ${config}/config.guess tool/
76
76
+
cp ${config}/config.sub tool/
77
77
+
'';
78
78
+
79
79
+
configureFlags = ["--enable-shared" ]
80
80
+
++ op useRailsExpress "--with-baseruby=${baseruby}/bin/ruby"
81
81
+
# on darwin, we have /usr/include/tk.h -- so the configure script detects
82
82
+
# that tk is installed
83
83
+
++ ( if stdenv.isDarwin then [ "--with-out-ext=tk " ] else [ ]);
84
84
+
85
85
+
installFlags = stdenv.lib.optionalString docSupport "install-doc";
86
86
+
# Bundler tries to create this directory
87
87
+
postInstall = ''
88
88
+
# Bundler tries to create this directory
89
89
+
mkdir -pv $out/${passthru.gemPath}
90
90
+
mkdir -p $out/nix-support
91
91
+
cat > $out/nix-support/setup-hook <<EOF
92
92
+
addGemPath() {
93
93
+
addToSearchPath GEM_PATH \$1/${passthru.gemPath}
94
94
+
}
95
95
+
96
96
+
envHooks+=(addGemPath)
97
97
+
EOF
98
98
+
'' + lib.optionalString useRailsExpress ''
99
99
+
rbConfig=$(find $out/lib/ruby -name rbconfig.rb)
100
100
+
101
101
+
# Prevent the baseruby from being included in the closure.
102
102
+
sed -i '/^ CONFIG\["BASERUBY"\]/d' $rbConfig
103
103
+
sed -i "s|'--with-baseruby=${baseruby}/bin/ruby'||" $rbConfig
104
104
+
'';
105
105
+
106
106
+
meta = {
107
107
+
license = stdenv.lib.licenses.ruby;
108
108
+
homepage = "http://www.ruby-lang.org/en/";
109
109
+
description = "The Ruby language";
110
110
+
platforms = stdenv.lib.platforms.all;
111
111
+
};
112
112
+
113
113
+
passthru = rec {
114
114
+
majorVersion = "2";
115
115
+
minorVersion = "1";
116
116
+
teenyVersion = "6";
117
117
+
patchLevel = "0";
118
118
+
rubyEngine = "ruby";
119
119
+
libPath = "lib/${rubyEngine}/${majorVersion}.${minorVersion}.${teenyVersion}";
120
120
+
gemPath = "lib/${rubyEngine}/gems/${majorVersion}.${minorVersion}.${teenyVersion}";
121
121
+
};
122
122
+
}
+2
-1
pkgs/top-level/all-packages.nix
···
5086
5086
ruby_2_1_1 = lowPrio (callPackage ../development/interpreters/ruby/ruby-2.1.1.nix { });
5087
5087
ruby_2_1_2 = lowPrio (callPackage ../development/interpreters/ruby/ruby-2.1.2.nix { });
5088
5088
ruby_2_1_3 = lowPrio (callPackage ../development/interpreters/ruby/ruby-2.1.3.nix { });
5089
5089
+
ruby_2_1_6 = lowPrio (callPackage ../development/interpreters/ruby/ruby-2.1.6.nix { });
5089
5090
ruby_2_2_0 = lowPrio (callPackage ../development/interpreters/ruby/ruby-2.2.0.nix { });
5090
5091
5091
5092
# Ruby aliases
···
5093
5094
ruby_1_8 = ruby_1_8_7;
5094
5095
ruby_1_9 = ruby_1_9_3;
5095
5096
ruby_2_0 = ruby_2_0_0;
5096
5096
-
ruby_2_1 = ruby_2_1_3;
5097
5097
+
ruby_2_1 = ruby_2_1_6;
5097
5098
ruby_2_2 = ruby_2_2_0;
5098
5099
5099
5100
rubygemsFun = ruby: builderDefsPackage (import ../development/interpreters/ruby/rubygems.nix) {