Merge pull request #218114 from marsam/update-ruby

ruby_3_1: 3.1.2 -> 3.1.3, ruby_3_2: init at 3.2.1
This commit is contained in:
Mario Rodas 2023-03-14 18:48:01 -05:00 committed by GitHub
commit a239c7d2ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 85 additions and 51 deletions

View File

@ -2,7 +2,7 @@
, fetchurl, fetchpatch, fetchFromSavannah, fetchFromGitHub
, zlib, gdbm, ncurses, readline, groff, libyaml, libffi, jemalloc, autoreconfHook, bison
, autoconf, libiconv, libobjc, libunwind, Foundation
, buildEnv, bundler, bundix
, buildEnv, bundler, bundix, rustPlatform
, makeBinaryWrapper, buildRubyGem, defaultGemConfig, removeReferencesTo
, openssl, openssl_1_1
, linuxPackages, libsystemtap
@ -12,20 +12,20 @@ let
op = lib.optional;
ops = lib.optionals;
opString = lib.optionalString;
patchSet = import ./rvm-patchsets.nix { inherit fetchFromGitHub; };
config = import ./config.nix { inherit fetchFromSavannah; };
rubygems = import ./rubygems { inherit stdenv lib fetchurl; };
# Contains the ruby version heuristics
rubyVersion = import ./ruby-version.nix { inherit lib; };
generic = { version, sha256 }: let
generic = { version, sha256, cargoSha256 ? null }: let
ver = version;
atLeast30 = lib.versionAtLeast ver.majMin "3.0";
atLeast31 = lib.versionAtLeast ver.majMin "3.1";
atLeast32 = lib.versionAtLeast ver.majMin "3.2";
self = lib.makeOverridable (
{ stdenv, buildPackages, lib
, fetchurl, fetchpatch, fetchFromSavannah, fetchFromGitHub
, useRailsExpress ? true
, rubygemsSupport ? true
, zlib, zlibSupport ? true
, openssl, openssl_1_1, opensslSupport ? true
@ -45,17 +45,17 @@ let
# Or (usually):
# $(nix-build -A ruby)/lib/ruby/2.6.0/x86_64-linux/rbconfig.rb
# - In $out/lib/libruby.so and/or $out/lib/libruby.dylib
, removeReferencesTo, jitSupport ? false
, removeReferencesTo, jitSupport ? yjitSupport
, rustPlatform, yjitSupport ? atLeast32
, autoreconfHook, bison, autoconf
, buildEnv, bundler, bundix
, libiconv, libobjc, libunwind, Foundation
, makeBinaryWrapper, buildRubyGem, defaultGemConfig
, baseRuby ? buildPackages.ruby_3_1.override {
useRailsExpress = false;
docSupport = false;
rubygemsSupport = false;
}
, useBaseRuby ? stdenv.hostPlatform != stdenv.buildPlatform || useRailsExpress
, useBaseRuby ? stdenv.hostPlatform != stdenv.buildPlatform
}:
stdenv.mkDerivation rec {
pname = "ruby";
@ -71,9 +71,12 @@ let
outputs = [ "out" ] ++ lib.optional docSupport "devdoc";
strictDeps = true;
nativeBuildInputs = [ autoreconfHook bison ]
++ (op docSupport groff)
++ (ops (dtraceSupport && stdenv.isLinux) [ systemtap libsystemtap ])
++ ops yjitSupport [ rustPlatform.cargoSetupHook rustPlatform.rust.cargo rustPlatform.rust.rustc ]
++ op useBaseRuby baseRuby;
buildInputs = [ autoconf ]
++ (op fiddleSupport libffi)
@ -93,13 +96,11 @@ let
enableParallelBuilding = true;
patches =
(import ./patchsets.nix {
inherit patchSet useRailsExpress ops fetchpatch;
patchLevel = ver.patchLevel;
}).${ver.majMinTiny}
++ op (lib.versionOlder ver.majMin "3.1") ./do-not-regenerate-revision.h.patch
++ op (atLeast30 && useBaseRuby) ./do-not-update-gems-baseruby.patch
patches = op (lib.versionOlder ver.majMin "3.1") ./do-not-regenerate-revision.h.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") [
# Ruby 3.0 adds `-fdeclspec` to $CC instead of $CFLAGS. Fixed in later versions.
(fetchpatch {
@ -107,6 +108,14 @@ let
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) [
# We upgrade rubygems to a version that isn't compatible with the
# ruby 2.7 installer. Backport the upstream fix.
@ -121,8 +130,23 @@ let
url = "https://github.com/ruby/ruby/commit/261d8dd20afd26feb05f00a560abd99227269c1c.patch";
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";
cargoDeps = if yjitSupport then rustPlatform.fetchCargoTarball {
inherit src;
sourceRoot = "${pname}-${version}/${cargoRoot}";
sha256 = cargoSha256;
} else null;
postUnpack = opString rubygemsSupport ''
rm -rf $sourceRoot/{lib,test}/rubygems*
cp -r ${rubygems}/lib/rubygems* $sourceRoot/lib
@ -146,6 +170,7 @@ let
(lib.withFeatureAs useBaseRuby "baseruby" "${baseRuby}/bin/ruby")
(lib.enableFeature dtraceSupport "dtrace")
(lib.enableFeature jitSupport "jit-support")
(lib.enableFeature yjitSupport "yjit")
(lib.enableFeature docSupport "install-doc")
(lib.withFeature jemallocSupport "jemalloc")
(lib.withFeatureAs docSupport "ridir" "${placeholder "devdoc"}/share/ri")
@ -208,7 +233,7 @@ let
for makefile in $extMakefiles; do
make -C "$(dirname "$makefile")" distclean
done
find "$out/${passthru.gemPath}" -name gem_make.out -delete
find "$out/${passthru.gemPath}" \( -name gem_make.out -o -name mkmf.log \) -delete
# Bundler tries to create this directory
mkdir -p $out/nix-support
cat > $out/nix-support/setup-hook <<EOF
@ -275,6 +300,7 @@ let
ruby = self;
};
inherit rubygems;
inherit (import ../../ruby-modules/with-packages {
inherit lib stdenv makeBinaryWrapper buildRubyGem buildEnv;
gemConfig = defaultGemConfig;
@ -302,7 +328,13 @@ in {
};
ruby_3_1 = generic {
version = rubyVersion "3" "1" "2" "";
sha256 = "0gm84ipk6mrfw94852w5h7xxk2lqrxjbnlwb88svf0lz70933131";
version = rubyVersion "3" "1" "3" "";
sha256 = "sha256-XqSYo19M0Vh1IApS3eQrbrF54SZOF9eHMsOlfNHGq54=";
};
ruby_3_2 = generic {
version = rubyVersion "3" "2" "1" "";
sha256 = "sha256-E9Z5AWYO4yF9vZ3VYFk0a9QhLOZKacMG71LfZJNfjb0=";
cargoSha256 = "sha256-6du7RJo0DH+eYMOoh3L31F3aqfR5+iG1iKauSV1uNcQ=";
};
}

View File

@ -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

View File

@ -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)

View File

@ -1,18 +0,0 @@
{ patchSet, useRailsExpress, ops, patchLevel, fetchpatch }:
{
"2.7.7" = ops useRailsExpress [
"${patchSet}/patches/ruby/2.7/head/railsexpress/01-fix-broken-tests-caused-by-ad.patch"
"${patchSet}/patches/ruby/2.7/head/railsexpress/02-improve-gc-stats.patch"
"${patchSet}/patches/ruby/2.7/head/railsexpress/03-more-detailed-stacktrace.patch"
"${patchSet}/patches/ruby/2.7/head/railsexpress/04-malloc-trim.patch"
];
"3.0.5" = 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"
];
"3.1.2" = ops useRailsExpress [
"${patchSet}/patches/ruby/3.1/head/railsexpress/01-improve-gc-stats.patch"
"${patchSet}/patches/ruby/3.1/head/railsexpress/02-malloc-trim.patch"
];
}

View File

@ -18,11 +18,11 @@ index 34620860..00ab31d9 100644
extend Gem::Deprecate
DEFAULT_OPTIONS = { # :nodoc:
- :env_shebang => false,
+ :env_shebang => true,
:document => %w[ri],
:domain => :both, # HACK dup
:force => false,
- :env_shebang => false,
+ :env_shebang => true,
:document => %w[ri],
:domain => :both, # HACK dup
:force => false,
--
2.21.0

View File

@ -2,11 +2,11 @@
stdenv.mkDerivation rec {
pname = "rubygems";
version = "3.3.20";
version = "3.4.8";
src = fetchurl {
url = "https://rubygems.org/rubygems/rubygems-${version}.tgz";
sha256 = "sha256-VTUMZ2mqbszM7uXOYV6Grg7dkeGAGVXYjBX0hA/vOTg=";
sha256 = "sha256-0FlDZJNJJGVkvBmKWNBqNRaTto6ciCOuQEK6uq6dotQ=";
};
patches = [
@ -23,6 +23,7 @@ stdenv.mkDerivation rec {
meta = with lib; {
description = "Package management framework for Ruby";
changelog = "https://github.com/rubygems/rubygems/blob/v${version}/CHANGELOG.md";
homepage = "https://rubygems.org/";
license = with licenses; [ mit /* or */ ruby ];
maintainers = with maintainers; [ zimbatm ];

View File

@ -1,8 +0,0 @@
{ fetchFromGitHub }:
fetchFromGitHub {
owner = "skaes";
repo = "rvm-patchsets";
rev = "e6574c54a34fe6e4d45aa1433872a22ddfe14cf3";
hash = "sha256-x2KvhgRVJ4Nc5v1j4DggKO1u3otG8HVMxhq4yuUKnds=";
}

View File

@ -16949,7 +16949,8 @@ with pkgs;
mkRuby
ruby_2_7
ruby_3_0
ruby_3_1;
ruby_3_1
ruby_3_2;
ruby = ruby_2_7;
rubyPackages = rubyPackages_2_7;
@ -16957,6 +16958,7 @@ with pkgs;
rubyPackages_2_7 = recurseIntoAttrs ruby_2_7.gems;
rubyPackages_3_0 = recurseIntoAttrs ruby_3_0.gems;
rubyPackages_3_1 = recurseIntoAttrs ruby_3_1.gems;
rubyPackages_3_2 = recurseIntoAttrs ruby_3_2.gems;
mruby = callPackage ../development/compilers/mruby { };