ruby: fix cross compilation
This commit is contained in:
parent
35d43b45f7
commit
57ecdd6abd
|
@ -21,6 +21,7 @@ let
|
||||||
generic = { version, sha256, cargoSha256 ? null }: let
|
generic = { version, sha256, cargoSha256 ? null }: let
|
||||||
ver = version;
|
ver = version;
|
||||||
atLeast30 = lib.versionAtLeast ver.majMin "3.0";
|
atLeast30 = lib.versionAtLeast ver.majMin "3.0";
|
||||||
|
atLeast31 = lib.versionAtLeast ver.majMin "3.1";
|
||||||
atLeast32 = lib.versionAtLeast ver.majMin "3.2";
|
atLeast32 = lib.versionAtLeast ver.majMin "3.2";
|
||||||
self = lib.makeOverridable (
|
self = lib.makeOverridable (
|
||||||
{ stdenv, buildPackages, lib
|
{ stdenv, buildPackages, lib
|
||||||
|
@ -96,7 +97,10 @@ let
|
||||||
enableParallelBuilding = true;
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
patches = op (lib.versionOlder ver.majMin "3.1") ./do-not-regenerate-revision.h.patch
|
patches = op (lib.versionOlder ver.majMin "3.1") ./do-not-regenerate-revision.h.patch
|
||||||
++ op (atLeast30 && useBaseRuby) ./do-not-update-gems-baseruby.patch
|
++ op (atLeast30 && useBaseRuby) (
|
||||||
|
if atLeast32 then ./do-not-update-gems-baseruby-3.2.patch
|
||||||
|
else ./do-not-update-gems-baseruby.patch
|
||||||
|
)
|
||||||
++ ops (ver.majMin == "3.0") [
|
++ ops (ver.majMin == "3.0") [
|
||||||
# Ruby 3.0 adds `-fdeclspec` to $CC instead of $CFLAGS. Fixed in later versions.
|
# Ruby 3.0 adds `-fdeclspec` to $CC instead of $CFLAGS. Fixed in later versions.
|
||||||
(fetchpatch {
|
(fetchpatch {
|
||||||
|
@ -104,6 +108,14 @@ let
|
||||||
sha256 = "sha256-43hI9L6bXfeujgmgKFVmiWhg7OXvshPCCtQ4TxqK1zk=";
|
sha256 = "sha256-43hI9L6bXfeujgmgKFVmiWhg7OXvshPCCtQ4TxqK1zk=";
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
|
++ ops (ver.majMin == "3.1") [
|
||||||
|
# Ruby 3.1.3 cannot find pkg-config in mkmf.rb
|
||||||
|
# https://bugs.ruby-lang.org/issues/19189
|
||||||
|
(fetchpatch {
|
||||||
|
url = "https://github.com/ruby/ruby/commit/613fca01486e47dee9364a2fd86b5f5e77fe23c8.patch";
|
||||||
|
sha256 = "sha256-0Ku7l6VEpcvxexL9QA5+mNER4v8gYZOJhAjhCL1WDpw=";
|
||||||
|
})
|
||||||
|
]
|
||||||
++ ops (!atLeast30 && rubygemsSupport) [
|
++ ops (!atLeast30 && rubygemsSupport) [
|
||||||
# We upgrade rubygems to a version that isn't compatible with the
|
# We upgrade rubygems to a version that isn't compatible with the
|
||||||
# ruby 2.7 installer. Backport the upstream fix.
|
# ruby 2.7 installer. Backport the upstream fix.
|
||||||
|
@ -118,6 +130,13 @@ let
|
||||||
url = "https://github.com/ruby/ruby/commit/261d8dd20afd26feb05f00a560abd99227269c1c.patch";
|
url = "https://github.com/ruby/ruby/commit/261d8dd20afd26feb05f00a560abd99227269c1c.patch";
|
||||||
sha256 = "0wrii25cxcz2v8bgkrf7ibcanjlxwclzhayin578bf0qydxdm9qy";
|
sha256 = "0wrii25cxcz2v8bgkrf7ibcanjlxwclzhayin578bf0qydxdm9qy";
|
||||||
})
|
})
|
||||||
|
]
|
||||||
|
++ ops atLeast31 [
|
||||||
|
# When using a baseruby, ruby always sets "libdir" to the build
|
||||||
|
# directory, which nix rejects due to a reference in to /build/ in
|
||||||
|
# the final product. Removing this reference doesn't seem to break
|
||||||
|
# anything and fixes cross compliation.
|
||||||
|
./dont-refer-to-build-dir.patch
|
||||||
];
|
];
|
||||||
|
|
||||||
cargoRoot = opString yjitSupport "yjit";
|
cargoRoot = opString yjitSupport "yjit";
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
diff --git a/common.mk b/common.mk
|
||||||
|
index 3798f82bc6..4d07b28aa4 100644
|
||||||
|
--- a/common.mk
|
||||||
|
+++ b/common.mk
|
||||||
|
@@ -1374,7 +1374,7 @@ update-config_files: PHONY
|
||||||
|
config.guess config.sub
|
||||||
|
|
||||||
|
refresh-gems: update-bundled_gems prepare-gems
|
||||||
|
-prepare-gems: $(HAVE_BASERUBY:yes=update-gems) $(HAVE_BASERUBY:yes=extract-gems)
|
||||||
|
+prepare-gems:
|
||||||
|
extract-gems: $(HAVE_BASERUBY:yes=update-gems)
|
||||||
|
|
||||||
|
update-gems$(gnumake:yes=-sequential): PHONY
|
|
@ -0,0 +1,12 @@
|
||||||
|
diff --git a/tool/fake.rb b/tool/fake.rb
|
||||||
|
index 91dfb041c4..9c235f1e3a 100644
|
||||||
|
--- a/tool/fake.rb
|
||||||
|
+++ b/tool/fake.rb
|
||||||
|
@@ -48,7 +48,6 @@ class File
|
||||||
|
$builtruby ||= File.join(builddir, config['RUBY_INSTALL_NAME'] + config['EXEEXT'])
|
||||||
|
RbConfig.fire_update!("builddir", builddir)
|
||||||
|
RbConfig.fire_update!("buildlibdir", builddir)
|
||||||
|
- RbConfig.fire_update!("libdir", builddir)
|
||||||
|
RbConfig.fire_update!("prefix", $topdir)
|
||||||
|
RbConfig.fire_update!("top_srcdir", $top_srcdir ||= top_srcdir)
|
||||||
|
RbConfig.fire_update!("extout", $extout)
|
Loading…
Reference in a new issue