summary refs log tree commit diff
path: root/pkgs/development/interpreters
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/interpreters')
-rw-r--r--pkgs/development/interpreters/perl/default.nix34
-rw-r--r--pkgs/development/interpreters/python/cpython/default.nix2
-rw-r--r--pkgs/development/interpreters/ruby/default.nix50
-rw-r--r--pkgs/development/interpreters/ruby/rbinstall-new-rubygems-compat.patch87
4 files changed, 130 insertions, 43 deletions
diff --git a/pkgs/development/interpreters/perl/default.nix b/pkgs/development/interpreters/perl/default.nix
index f29e61d1105..9c3c34c73aa 100644
--- a/pkgs/development/interpreters/perl/default.nix
+++ b/pkgs/development/interpreters/perl/default.nix
@@ -1,6 +1,7 @@
-{ config, lib, stdenv, fetchurl, fetchpatch, fetchFromGitHub, pkgs, buildPackages
+{ config, lib, stdenv, fetchurl, fetchFromGitHub, pkgs, buildPackages
 , callPackage
 , enableThreading ? true, coreutils, makeWrapper
+, zlib
 }:
 
 # Note: this package is used for bootstrapping fetchurl, and thus
@@ -40,14 +41,7 @@ let
       ]
       ++ optional stdenv.isSunOS ./ld-shared.patch
       ++ optionals stdenv.isDarwin [ ./cpp-precomp.patch ./sw_vers.patch ]
-      ++ optionals crossCompiling [
-        ./MakeMaker-cross.patch
-        # https://github.com/arsv/perl-cross/pull/120
-        (fetchpatch {
-          url = "https://github.com/arsv/perl-cross/commit/3c318ae6572f8b36cb077c8b49c851e2f5fe181e.patch";
-          sha256 = "0cmcy8bams3c68f6xadl52z2w378wcpdjzi3qi4pcyvcfs011l6g";
-        })
-      ];
+      ++ optional crossCompiling ./MakeMaker-cross.patch;
 
     # This is not done for native builds because pwd may need to come from
     # bootstrap tools when building bootstrap perl.
@@ -115,6 +109,16 @@ let
         cf_by="nixpkgs"
         cf_time="$(date -d "@$SOURCE_DATE_EPOCH")"
         EOF
+
+        # Compress::Raw::Zlib should use our zlib package instead of the one
+        # included with the distribution
+        cat > ./cpan/Compress-Raw-Zlib/config.in <<EOF
+        BUILD_ZLIB   = False
+        INCLUDE      = ${zlib.dev}/include
+        LIB          = ${zlib.out}/lib
+        OLD_ZLIB     = False
+        GZIP_OS_CODE = AUTO_DETECT
+        EOF
       '' + optionalString stdenv.isDarwin ''
         substituteInPlace hints/darwin.sh --replace "env MACOSX_DEPLOYMENT_TARGET=10.3" ""
       '' + optionalString (!enableThreading) ''
@@ -193,14 +197,14 @@ let
       priority = 6; # in `buildEnv' (including the one inside `perl.withPackages') the library files will have priority over files in `perl`
     };
   } // optionalAttrs (stdenv.buildPlatform != stdenv.hostPlatform) rec {
-    crossVersion = "393821c7cf53774233aaf130ff2c8ccec701b0a9"; # Sep 22, 2021
+    crossVersion = "1.3.7"; # Mar 15, 2022
 
     perl-cross-src = fetchFromGitHub {
       name = "perl-cross-${crossVersion}";
       owner = "arsv";
       repo = "perl-cross";
       rev = crossVersion;
-      sha256 = "1fn35b1773aibi2z54m0mar7114737mvfyp81wkdwhakrmzr5nv1";
+      sha256 = "sha256-F7Vi3RAgIE/3NPlbD5zQ3Q8Ex9ddXTC4zoCRaOxXK0A=";
     };
 
     depsBuildBuild = [ buildPackages.stdenv.cc makeWrapper ];
@@ -229,15 +233,15 @@ in {
   perl534 = common {
     perl = pkgs.perl534;
     buildPerl = buildPackages.perl534;
-    version = "5.34.0";
-    sha256 = "16mywn5afpv1mczv9dlc1w84rbgjgrr0pyr4c0hhb2wnif0zq7jm";
+    version = "5.34.1";
+    sha256 = "sha256-NXlRpJGwuhzjYRJjki/ux4zNWB3dwkpEawM+JazyQqE=";
   };
 
   # the latest Devel version
   perldevel = common {
     perl = pkgs.perldevel;
     buildPerl = buildPackages.perldevel;
-    version = "5.35.4";
-    sha256 = "1ss2r0qq5li6d2qghfv1iah5nl6nraymd7b7ib1iy1395rwyhl4q";
+    version = "5.35.9";
+    sha256 = "sha256-/nmSCIIXHXoC68DxFM9b5GM2AKU4WlLbfWLgduanL7U=";
   };
 }
diff --git a/pkgs/development/interpreters/python/cpython/default.nix b/pkgs/development/interpreters/python/cpython/default.nix
index 02ecf8d25b1..4dc95d9e1fd 100644
--- a/pkgs/development/interpreters/python/cpython/default.nix
+++ b/pkgs/development/interpreters/python/cpython/default.nix
@@ -282,7 +282,7 @@ in with passthru; stdenv.mkDerivation {
 
   CPPFLAGS = concatStringsSep " " (map (p: "-I${getDev p}/include") buildInputs);
   LDFLAGS = concatStringsSep " " (map (p: "-L${getLib p}/lib") buildInputs);
-  LIBS = "${optionalString (!stdenv.isDarwin) "-lcrypt"} ${optionalString (ncurses != null) "-lncurses"}";
+  LIBS = "${optionalString (!stdenv.isDarwin) "-lcrypt"}";
   NIX_LDFLAGS = lib.optionalString stdenv.cc.isGNU ({
     "glibc" = "-lgcc_s";
     "musl" = "-lgcc_eh";
diff --git a/pkgs/development/interpreters/ruby/default.nix b/pkgs/development/interpreters/ruby/default.nix
index ea31f354d0d..37d70d4719a 100644
--- a/pkgs/development/interpreters/ruby/default.nix
+++ b/pkgs/development/interpreters/ruby/default.nix
@@ -59,14 +59,9 @@ let
         pname = "ruby";
         inherit version;
 
-        src = if useRailsExpress then fetchFromGitHub {
-          owner  = "ruby";
-          repo   = "ruby";
-          rev    = tag;
-          sha256 = sha256.git;
-        } else fetchurl {
+        src = fetchurl {
           url = "https://cache.ruby-lang.org/pub/ruby/${ver.majMin}/ruby-${ver}.tar.gz";
-          sha256 = sha256.src;
+          inherit sha256;
         };
 
         # Have `configure' avoid `/usr/bin/nroff' in non-chroot builds.
@@ -100,17 +95,22 @@ let
             patchLevel = ver.patchLevel;
           }).${ver.majMinTiny}
           ++ op (lib.versionOlder ver.majMin "3.1") ./do-not-regenerate-revision.h.patch
-          ++ op (atLeast30 && useRailsExpress) ./do-not-update-gems-baseruby.patch
-          # Ruby prior to 3.0 has a bug the installer (tools/rbinstall.rb) but
-          # the resulting error was swallowed. Newer rubygems no longer swallows
-          # this error. We upgrade rubygems when rubygemsSupport is enabled, so
-          # we have to fix this bug to prevent the install step from failing.
-          # See https://github.com/ruby/ruby/pull/2930
-          ++ op (!atLeast30 && rubygemsSupport)
+          ++ op (atLeast30 && useBaseRuby) ./do-not-update-gems-baseruby.patch
+          ++ ops (!atLeast30 && rubygemsSupport) [
+            # We upgrade rubygems to a version that isn't compatible with the
+            # ruby 2.7 installer. Backport the upstream fix.
+            ./rbinstall-new-rubygems-compat.patch
+
+            # Ruby prior to 3.0 has a bug the installer (tools/rbinstall.rb) but
+            # the resulting error was swallowed. Newer rubygems no longer swallows
+            # this error. We upgrade rubygems when rubygemsSupport is enabled, so
+            # we have to fix this bug to prevent the install step from failing.
+            # See https://github.com/ruby/ruby/pull/2930
             (fetchpatch {
               url = "https://github.com/ruby/ruby/commit/261d8dd20afd26feb05f00a560abd99227269c1c.patch";
               sha256 = "0wrii25cxcz2v8bgkrf7ibcanjlxwclzhayin578bf0qydxdm9qy";
-            });
+            })
+          ];
 
         postUnpack = opString rubygemsSupport ''
           rm -rf $sourceRoot/{lib,test}/rubygems*
@@ -182,6 +182,11 @@ let
               sed -i '/CC_VERSION_MESSAGE/d' $rbConfig
             ''
           }
+          # Remove unnecessary external intermediate files created by gems
+          extMakefiles=$(find $out/lib/ruby/gems -name Makefile)
+          for makefile in $extMakefiles; do
+            make -C "$(dirname "$makefile")" distclean
+          done
           # Bundler tries to create this directory
           mkdir -p $out/nix-support
           cat > $out/nix-support/setup-hook <<EOF
@@ -253,25 +258,16 @@ let
 in {
   ruby_2_7 = generic {
     version = rubyVersion "2" "7" "5" "";
-    sha256 = {
-      src = "1wc1hwmz4m6iqlmqag8liyld917p6a8dvnhnpd1v8d8jl80bjm97";
-      git = "16565fyl7141hr6q6d74myhsz46lvgam8ifnacshi68vzibwjbbh";
-    };
+    sha256 = "1wc1hwmz4m6iqlmqag8liyld917p6a8dvnhnpd1v8d8jl80bjm97";
   };
 
   ruby_3_0 = generic {
     version = rubyVersion "3" "0" "3" "";
-    sha256 = {
-      src = "1b4j39zyyvdkf1ax2c6qfa40b4mxfkr87zghhw19fmnzn8f8d1im";
-      git = "1q19w5i1jkfxn7qq6f9v9ngax9h52gxwijk7hp312dx6amwrkaim";
-    };
+    sha256 = "1b4j39zyyvdkf1ax2c6qfa40b4mxfkr87zghhw19fmnzn8f8d1im";
   };
 
   ruby_3_1 = generic {
     version = rubyVersion "3" "1" "1" "";
-    sha256 = {
-      src = "sha256-/m5Hgt6XRDl43bqLpL440iKqJNw+PwKmqOdwHA7rYZ0=";
-      git = "sha256-76t/tGyK5nz7nvcRdHJTjjckU+Kv+/kbTMiNWJ93jU8=";
-    };
+    sha256 = "sha256-/m5Hgt6XRDl43bqLpL440iKqJNw+PwKmqOdwHA7rYZ0=";
   };
 }
diff --git a/pkgs/development/interpreters/ruby/rbinstall-new-rubygems-compat.patch b/pkgs/development/interpreters/ruby/rbinstall-new-rubygems-compat.patch
new file mode 100644
index 00000000000..54ce8a357a8
--- /dev/null
+++ b/pkgs/development/interpreters/ruby/rbinstall-new-rubygems-compat.patch
@@ -0,0 +1,87 @@
+From 8e85d27f9ccfe152fc1b891c19f125915a907493 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
+Date: Tue, 1 Oct 2019 12:03:33 +0200
+Subject: [PATCH] Use `Gem::Package` like object instead of monkey patching.
+
+1. This is similar to what RubyGems does and it is less magic [[1]].
+2. It avoids deprecated code paths in RubyGems [[2]].
+
+[1]: https://github.com/rubygems/rubygems/blob/92892bbc3adba86a90756c385433835f6761b8da/lib/rubygems/installer.rb#L151
+[2]: https://github.com/rubygems/rubygems/blob/92892bbc3adba86a90756c385433835f6761b8da/lib/rubygems/installer.rb#L187
+
+(cherry picked from commit e960ef6f18a25c637c54f00c75bb6c24f8ab55d0)
+---
+ tool/rbinstall.rb | 47 +++++++++++++++++++++++++++--------------------
+ 1 file changed, 27 insertions(+), 20 deletions(-)
+
+diff --git a/tool/rbinstall.rb b/tool/rbinstall.rb
+index 060390626f..28ae8c409a 100755
+--- a/tool/rbinstall.rb
++++ b/tool/rbinstall.rb
+@@ -710,28 +710,34 @@ def remove_prefix(prefix, string)
+     end
+   end
+ 
+-  class UnpackedInstaller < Gem::Installer
+-    module DirPackage
+-      def extract_files(destination_dir, pattern = "*")
+-        path = File.dirname(@gem.path)
+-        return if path == destination_dir
+-        File.chmod(0700, destination_dir)
+-        mode = pattern == "bin/*" ? $script_mode : $data_mode
+-        spec.files.each do |f|
+-          src = File.join(path, f)
+-          dest = File.join(without_destdir(destination_dir), f)
+-          makedirs(dest[/.*(?=\/)/m])
+-          install src, dest, :mode => mode
+-        end
+-        File.chmod($dir_mode, destination_dir)
++  class DirPackage
++    attr_reader :spec
++
++    attr_accessor :dir_mode
++    attr_accessor :prog_mode
++    attr_accessor :data_mode
++
++    def initialize(spec)
++      @spec = spec
++      @src_dir = File.dirname(@spec.loaded_from)
++    end
++
++    def extract_files(destination_dir, pattern = "*")
++      path = @src_dir
++      return if path == destination_dir
++      File.chmod(0700, destination_dir)
++      mode = pattern == "bin/*" ? $script_mode : $data_mode
++      spec.files.each do |f|
++        src = File.join(path, f)
++        dest = File.join(without_destdir(destination_dir), f)
++        makedirs(dest[/.*(?=\/)/m])
++        install src, dest, :mode => mode
+       end
++      File.chmod($dir_mode, destination_dir)
+     end
++  end
+ 
+-    def initialize(spec, *options)
+-      super(spec.loaded_from, *options)
+-      @package.extend(DirPackage).spec = spec
+-    end
+-
++  class UnpackedInstaller < Gem::Installer
+     def write_cache_file
+     end
+ 
+@@ -890,7 +896,8 @@ def install_default_gem(dir, srcdir)
+     if File.directory?(ext = "#{gem_ext_dir}/#{spec.full_name}")
+       spec.extensions[0] ||= "-"
+     end
+-    ins = RbInstall::UnpackedInstaller.new(spec, options)
++    package = RbInstall::DirPackage.new spec
++    ins = RbInstall::UnpackedInstaller.new(package, options)
+     puts "#{INDENT}#{spec.name} #{spec.version}"
+     ins.install
+     File.chmod($data_mode, File.join(install_dir, "specifications", "#{spec.full_name}.gemspec"))
+-- 
+2.35.1
+