diff --git a/pkgs/development/interpreters/ruby/default.nix b/pkgs/development/interpreters/ruby/default.nix index 73c6e286aa92..96d73d45c261 100644 --- a/pkgs/development/interpreters/ruby/default.nix +++ b/pkgs/development/interpreters/ruby/default.nix @@ -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 < 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 diff --git a/pkgs/development/interpreters/ruby/rubygems/default.nix b/pkgs/development/interpreters/ruby/rubygems/default.nix index 257d589df6c3..2ff5b6985747 100644 --- a/pkgs/development/interpreters/ruby/rubygems/default.nix +++ b/pkgs/development/interpreters/ruby/rubygems/default.nix @@ -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 ]; diff --git a/pkgs/development/interpreters/ruby/rvm-patchsets.nix b/pkgs/development/interpreters/ruby/rvm-patchsets.nix deleted file mode 100644 index fbbfd4c97302..000000000000 --- a/pkgs/development/interpreters/ruby/rvm-patchsets.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ fetchFromGitHub }: - -fetchFromGitHub { - owner = "skaes"; - repo = "rvm-patchsets"; - rev = "e6574c54a34fe6e4d45aa1433872a22ddfe14cf3"; - hash = "sha256-x2KvhgRVJ4Nc5v1j4DggKO1u3otG8HVMxhq4yuUKnds="; -} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 35fac7591d00..ddb39aab7f36 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -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 { };