ruby_3_0: init 3.0.0

https://www.ruby-lang.org/en/news/2020/12/25/ruby-3-0-0-released/
This commit is contained in:
Mario Rodas 2020-12-29 04:20:00 +00:00
parent 3cf05b37f2
commit 1b3130ec1a
5 changed files with 61 additions and 8 deletions

View File

@ -27,6 +27,7 @@ let
ver = version;
tag = ver.gitTag;
atLeast27 = lib.versionAtLeast ver.majMin "2.7";
atLeast30 = lib.versionAtLeast ver.majMin "3.0";
baseruby = self.override {
useRailsExpress = false;
docSupport = false;
@ -109,7 +110,9 @@ let
(import ./patchsets.nix {
inherit patchSet useRailsExpress ops fetchpatch;
patchLevel = ver.patchLevel;
}).${ver.majMinTiny};
}).${ver.majMinTiny}
++ op atLeast27 ./do-not-regenerate-revision.h.patch
++ op (atLeast30 && useRailsExpress) ./do-not-update-gems-baseruby.patch;
postUnpack = opString rubygemsSupport ''
rm -rf $sourceRoot/{lib,test}/rubygems*
@ -121,17 +124,12 @@ let
sed -i configure.ac -e '/config.guess/d'
cp --remove-destination ${config}/config.guess tool/
cp --remove-destination ${config}/config.sub tool/
'' + opString (!atLeast30) ''
# Make the build reproducible for ruby <= 2.7
# See https://github.com/ruby/io-console/commit/679a941d05d869f5e575730f6581c027203b7b26#diff-d8422f096931c58d4463e2489f62a228b0f24f0492950ba88c8c89a0d741cfe6
sed -i ext/io/console/io-console.gemspec -e '/s\.date/d'
'';
# Force the revision.h generation. Somehow `revision.tmp` is an empty
# file and because we don't add `git` to buildInputs, hence the check is
# always true.
# https://github.com/ruby/ruby/commit/97a5af62a318fcd93a4e5e4428d576c0280ddbae
buildFlags = lib.optionals atLeast27 [ "REVISION_LATEST=0" ];
configureFlags = ["--enable-shared" "--enable-pthread" "--with-soname=ruby-${version}"]
++ op useRailsExpress "--with-baseruby=${baseruby}/bin/ruby"
++ op (!jitSupport) "--disable-jit-support"
@ -149,6 +147,10 @@ let
preConfigure = opString docSupport ''
configureFlagsArray+=("--with-ridir=$devdoc/share/ri")
# rdoc creates XDG_DATA_DIR (defaulting to $HOME/.local/share) even if
# it's not going to be used.
export HOME=$TMPDIR
'';
# fails with "16993 tests, 2229489 assertions, 105 failures, 14 errors, 89 skips"
@ -261,4 +263,12 @@ in {
git = "0kbgznf1yprfp9645k31ra5f4757b7fichzi0hdg6nxkj90853s0";
};
};
ruby_3_0 = generic {
version = rubyVersion "3" "0" "0" "";
sha256 = {
src = "0a4fmxafxvkg1m738g2lmkhipwnmd96kzqy1m9kvk3n1l50x2gm1";
git = "0fvnxv97m94nridlc5nvvrlg53pr5g042dkfc5ysd327s7xj4cjp";
};
};
}

View File

@ -0,0 +1,23 @@
Do not regenerate revision.h
Ruby's makefile compares the shipped version with the git revision to regenerate
revision.h [1], but since we don't include git in buildInputs, this comparison
fails and it can't find $(REVISION_H).
[1] https://github.com/ruby/ruby/commit/97a5af62a318fcd93a4e5e4428d576c0280ddbae
diff -Naur ruby.old/defs/gmake.mk ruby.new/defs/gmake.mk
--- ruby.old/defs/gmake.mk
+++ ruby.new/defs/gmake.mk
@@ -325,11 +325,9 @@
REVISION_IN_HEADER := $(shell sed -n 's/^\#define RUBY_FULL_REVISION "\(.*\)"/\1/p' $(srcdir)/revision.h 2>/dev/null)
REVISION_LATEST := $(shell $(CHDIR) $(srcdir) && git log -1 --format=%H 2>/dev/null)
-ifneq ($(REVISION_IN_HEADER),$(REVISION_LATEST))
# GNU make treat the target as unmodified when its dependents get
# updated but it is not updated, while others may not.
$(srcdir)/revision.h: $(REVISION_H)
-endif
# Query on the generated rdoc
#

View File

@ -0,0 +1,14 @@
Do not update gems when building with base ruby
diff -Naur ruby.old/defs/gmake.mk ruby.new/defs/gmake.mk
--- ruby.old/common.mk
+++ ruby.new/common.mk
@@ -1298,7 +1298,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:
update-gems$(gnumake:yes=-nongnumake): PHONY
$(ECHO) Downloading bundled gem files...

View File

@ -16,4 +16,8 @@
"${patchSet}/patches/ruby/2.7/head/railsexpress/02-improve-gc-stats.patch"
"${patchSet}/patches/ruby/2.7/head/railsexpress/03-more-detailed-stacktrace.patch"
];
"3.0.0" = ops useRailsExpress [
"${patchSet}/patches/ruby/3.0/head/railsexpress/01-improve-gc-stats.patch"
"${patchSet}/patches/ruby/3.0/head/railsexpress/02-malloc-trim.patch"
];
}

View File

@ -11561,13 +11561,15 @@ in
bison = buildPackages.bison_3_5;
})
ruby_2_6
ruby_2_7;
ruby_2_7
ruby_3_0;
ruby = ruby_2_6;
rubyPackages = rubyPackages_2_6;
rubyPackages_2_6 = recurseIntoAttrs ruby_2_6.gems;
rubyPackages_2_7 = recurseIntoAttrs ruby_2_7.gems;
rubyPackages_3_0 = recurseIntoAttrs ruby_3_0.gems;
mruby = callPackage ../development/compilers/mruby { };