diff options
author | Mario Rodas <marsam@users.noreply.github.com> | 2023-02-24 04:20:00 +0000 |
---|---|---|
committer | Mario Rodas <marsam@users.noreply.github.com> | 2023-02-24 04:20:00 +0000 |
commit | 188e51d08cea930f3f7956167f22e36255f941e8 (patch) | |
tree | 9d54f3e2d7a8dce48e409ae3a707d4f46c562d0c /pkgs/development/interpreters/ruby | |
parent | 0ce320c93328bd400a9727bd8c643fc8adff1997 (diff) |
ruby_3_2: build with YJIT support by default
Diffstat (limited to 'pkgs/development/interpreters/ruby')
-rw-r--r-- | pkgs/development/interpreters/ruby/default.nix | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/pkgs/development/interpreters/ruby/default.nix b/pkgs/development/interpreters/ruby/default.nix index 6c8b8eb037243..0297839e7da44 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 @@ -18,9 +18,10 @@ let # 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"; + atLeast32 = lib.versionAtLeast ver.majMin "3.2"; self = lib.makeOverridable ( { stdenv, buildPackages, lib , fetchurl, fetchpatch, fetchFromSavannah, fetchFromGitHub @@ -43,7 +44,8 @@ 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 @@ -73,6 +75,7 @@ let 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) @@ -117,6 +120,14 @@ let }) ]; + 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 @@ -140,6 +151,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") @@ -303,5 +315,6 @@ in { ruby_3_2 = generic { version = rubyVersion "3" "2" "1" ""; sha256 = "sha256-E9Z5AWYO4yF9vZ3VYFk0a9QhLOZKacMG71LfZJNfjb0="; + cargoSha256 = "sha256-6du7RJo0DH+eYMOoh3L31F3aqfR5+iG1iKauSV1uNcQ="; }; } |