+20
-1
pkgs/development/interpreters/ruby/default.nix
+20
-1
pkgs/development/interpreters/ruby/default.nix
···
21
21
generic = { version, sha256, cargoSha256 ? null }: let
22
22
ver = version;
23
23
atLeast30 = lib.versionAtLeast ver.majMin "3.0";
24
+
atLeast31 = lib.versionAtLeast ver.majMin "3.1";
24
25
atLeast32 = lib.versionAtLeast ver.majMin "3.2";
25
26
self = lib.makeOverridable (
26
27
{ stdenv, buildPackages, lib
···
96
97
enableParallelBuilding = true;
97
98
98
99
patches = op (lib.versionOlder ver.majMin "3.1") ./do-not-regenerate-revision.h.patch
99
-
++ op (atLeast30 && useBaseRuby) ./do-not-update-gems-baseruby.patch
100
+
++ op (atLeast30 && useBaseRuby) (
101
+
if atLeast32 then ./do-not-update-gems-baseruby-3.2.patch
102
+
else ./do-not-update-gems-baseruby.patch
103
+
)
100
104
++ ops (ver.majMin == "3.0") [
101
105
# Ruby 3.0 adds `-fdeclspec` to $CC instead of $CFLAGS. Fixed in later versions.
102
106
(fetchpatch {
···
104
108
sha256 = "sha256-43hI9L6bXfeujgmgKFVmiWhg7OXvshPCCtQ4TxqK1zk=";
105
109
})
106
110
]
111
+
++ ops (ver.majMin == "3.1") [
112
+
# Ruby 3.1.3 cannot find pkg-config in mkmf.rb
113
+
# https://bugs.ruby-lang.org/issues/19189
114
+
(fetchpatch {
115
+
url = "https://github.com/ruby/ruby/commit/613fca01486e47dee9364a2fd86b5f5e77fe23c8.patch";
116
+
sha256 = "sha256-0Ku7l6VEpcvxexL9QA5+mNER4v8gYZOJhAjhCL1WDpw=";
117
+
})
118
+
]
107
119
++ ops (!atLeast30 && rubygemsSupport) [
108
120
# We upgrade rubygems to a version that isn't compatible with the
109
121
# ruby 2.7 installer. Backport the upstream fix.
···
118
130
url = "https://github.com/ruby/ruby/commit/261d8dd20afd26feb05f00a560abd99227269c1c.patch";
119
131
sha256 = "0wrii25cxcz2v8bgkrf7ibcanjlxwclzhayin578bf0qydxdm9qy";
120
132
})
133
+
]
134
+
++ ops atLeast31 [
135
+
# When using a baseruby, ruby always sets "libdir" to the build
136
+
# directory, which nix rejects due to a reference in to /build/ in
137
+
# the final product. Removing this reference doesn't seem to break
138
+
# anything and fixes cross compliation.
139
+
./dont-refer-to-build-dir.patch
121
140
];
122
141
123
142
cargoRoot = opString yjitSupport "yjit";
+13
pkgs/development/interpreters/ruby/do-not-update-gems-baseruby-3.2.patch
+13
pkgs/development/interpreters/ruby/do-not-update-gems-baseruby-3.2.patch
···
1
+
diff --git a/common.mk b/common.mk
2
+
index 3798f82bc6..4d07b28aa4 100644
3
+
--- a/common.mk
4
+
+++ b/common.mk
5
+
@@ -1374,7 +1374,7 @@ update-config_files: PHONY
6
+
config.guess config.sub
7
+
8
+
refresh-gems: update-bundled_gems prepare-gems
9
+
-prepare-gems: $(HAVE_BASERUBY:yes=update-gems) $(HAVE_BASERUBY:yes=extract-gems)
10
+
+prepare-gems:
11
+
extract-gems: $(HAVE_BASERUBY:yes=update-gems)
12
+
13
+
update-gems$(gnumake:yes=-sequential): PHONY
+12
pkgs/development/interpreters/ruby/dont-refer-to-build-dir.patch
+12
pkgs/development/interpreters/ruby/dont-refer-to-build-dir.patch
···
1
+
diff --git a/tool/fake.rb b/tool/fake.rb
2
+
index 91dfb041c4..9c235f1e3a 100644
3
+
--- a/tool/fake.rb
4
+
+++ b/tool/fake.rb
5
+
@@ -48,7 +48,6 @@ class File
6
+
$builtruby ||= File.join(builddir, config['RUBY_INSTALL_NAME'] + config['EXEEXT'])
7
+
RbConfig.fire_update!("builddir", builddir)
8
+
RbConfig.fire_update!("buildlibdir", builddir)
9
+
- RbConfig.fire_update!("libdir", builddir)
10
+
RbConfig.fire_update!("prefix", $topdir)
11
+
RbConfig.fire_update!("top_srcdir", $top_srcdir ||= top_srcdir)
12
+
RbConfig.fire_update!("extout", $extout)