Merge pull request #231899 from NixOS/please-no-openssl1-for-ruby-3

ruby_3_0: make it use OpenSSL 3
This commit is contained in:
Martin Weinelt 2023-05-15 20:26:28 +02:00 committed by GitHub
commit 54fba9982e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -15,6 +15,13 @@ let
config = import ./config.nix { inherit fetchFromSavannah; };
rubygems = import ./rubygems { inherit stdenv lib fetchurl; };
openssl3Gem = fetchFromGitHub {
owner = "ruby";
repo = "openssl";
rev = "v3.0.2";
hash = "sha256-KhuKRP1JkMJv7CagGRQ0KKGOd5Oh0FP0fbj0VZ4utGo=";
};
# Contains the ruby version heuristics
rubyVersion = import ./ruby-version.nix { inherit lib; };
@ -84,8 +91,8 @@ let
++ (op fiddleSupport libffi)
++ (ops cursesSupport [ ncurses readline ])
++ (op zlibSupport zlib)
++ (op (!atLeast31 && opensslSupport) openssl_1_1)
++ (op (atLeast31 && opensslSupport) openssl)
++ (op (atLeast30 && opensslSupport) openssl)
++ (op (!atLeast30 && opensslSupport) openssl_1_1)
++ (op gdbmSupport gdbm)
++ (op yamlSupport libyaml)
# Looks like ruby fails to build on darwin without readline even if curses
@ -113,7 +120,7 @@ let
url = "https://github.com/ruby/ruby/commit/0acc05caf7518cd0d63ab02bfa036455add02346.patch";
sha256 = "sha256-43hI9L6bXfeujgmgKFVmiWhg7OXvshPCCtQ4TxqK1zk=";
})
]
]
++ ops (!atLeast30 && rubygemsSupport) [
# We upgrade rubygems to a version that isn't compatible with the
# ruby 2.7 installer. Backport the upstream fix.
@ -149,6 +156,12 @@ let
rm -rf $sourceRoot/{lib,test}/rubygems*
cp -r ${rubygems}/lib/rubygems* $sourceRoot/lib
cp -r ${rubygems}/test/rubygems $sourceRoot/test
'' + opString (ver.majMin == "3.0" && opensslSupport) ''
# Replace the Gem by a OpenSSL3-compatible one.
echo "Hotpatching the OpenSSL gem with a 3.x series for OpenSSL 3 support..."
cp -vr ${openssl3Gem}/ext/openssl $sourceRoot/ext/
cp -vr ${openssl3Gem}/lib/ $sourceRoot/ext/openssl/
cp -vr ${openssl3Gem}/{History.md,openssl.gemspec} $sourceRoot/ext/openssl/
'';
postPatch = ''