From 7a51d67976f4f77b19353d1569dc27ceb9ca0e51 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Tue, 23 Jan 2024 00:08:22 +0100 Subject: [PATCH] Find link order issues for openssl on 3.2.2 and 3.3.0 reverts https://github.com/ruby/openssl/pull/486 --- .../patches/0003-openssl-zlib-ext-3.2.2.patch | 21 ++++++++++++++---- .../patches/0003-openssl-zlib-ext-3.3.0.patch | 22 ++++++++++++++----- 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/recipes/ruby/all/patches/0003-openssl-zlib-ext-3.2.2.patch b/recipes/ruby/all/patches/0003-openssl-zlib-ext-3.2.2.patch index 81c3225b86f8bf..f69e2daae031f2 100644 --- a/recipes/ruby/all/patches/0003-openssl-zlib-ext-3.2.2.patch +++ b/recipes/ruby/all/patches/0003-openssl-zlib-ext-3.2.2.patch @@ -7,10 +7,10 @@ diff --git a/ext/openssl/extconf.rb b/ext/openssl/extconf.rb have_library("crypt32") + have_library("advapi32") end - + return false unless have_header("openssl/ssl.h") @@ -57,8 +58,12 @@ def find_openssl_library - + if $mswin # OpenSSL >= 1.1.0: libcrypto.lib and libssl.lib. + # Potentially with 'd' appended (conan center index) @@ -22,13 +22,26 @@ diff --git a/ext/openssl/extconf.rb b/ext/openssl/extconf.rb + have_library("libssld", "SSL_new") return true end - + +@@ -95,6 +100,12 @@ end + Logging::message "=== Checking for required stuff... ===\n" + pkg_config_found = !dir_config_given && pkg_config("openssl") && have_header("openssl/ssl.h") + ++# Force finding the PKG config anyways because we want to grab the one ++# generated by conan to avoids the library linking order issue ++# (dl lz need to be after lssl and co). ++pkg_config("openssl") ++ ++ + if !pkg_config_found && !find_openssl_library + Logging::message "=== Checking for required stuff failed. ===\n" + Logging::message "Makefile wasn't created. Fix the errors above.\n" diff --git a/ext/zlib/extconf.rb b/ext/zlib/extconf.rb --- ext/zlib/extconf.rb +++ ext/zlib/extconf.rb @@ -11,7 +11,7 @@ require 'rbconfig' dir_config 'zlib' - + libs = $libs -if %w'z libz zlib1 zlib zdll zlibwapi'.find {|z| have_library(z, 'deflateReset')} and +if %w'z zlibstatic zlibstaticd zlib zlibd libz zlib1 zdll zlibwapi'.find {|z| have_library(z, 'deflateReset')} and diff --git a/recipes/ruby/all/patches/0003-openssl-zlib-ext-3.3.0.patch b/recipes/ruby/all/patches/0003-openssl-zlib-ext-3.3.0.patch index 8180ee1df61672..09642880a142cf 100644 --- a/recipes/ruby/all/patches/0003-openssl-zlib-ext-3.3.0.patch +++ b/recipes/ruby/all/patches/0003-openssl-zlib-ext-3.3.0.patch @@ -1,7 +1,6 @@ diff --git a/ext/openssl/extconf.rb b/ext/openssl/extconf.rb -index 56f4a1c..1d45d88 100644 ---- a/ext/openssl/extconf.rb -+++ b/ext/openssl/extconf.rb +--- ext/openssl/extconf.rb ++++ ext/openssl/extconf.rb @@ -68,6 +68,7 @@ def find_openssl_library # required for static OpenSSL libraries have_library("gdi32") # OpenSSL <= 1.0.2 (for RAND_screen()) @@ -24,10 +23,21 @@ index 56f4a1c..1d45d88 100644 return true end +@@ -116,6 +121,11 @@ end + Logging::message "=== Checking for required stuff... ===\n" + pkg_config_found = !dir_config_given && pkg_config("openssl") && have_header("openssl/ssl.h") + ++# Force finding the PKG config anyways because we want to grab the one ++# generated by conan to avoids the library linking order issue ++# (dl lz need to be after lssl and co). ++pkg_config("openssl") ++ + if !pkg_config_found && !find_openssl_library + Logging::message "=== Checking for required stuff failed. ===\n" + Logging::message "Makefile wasn't created. Fix the errors above.\n" diff --git a/ext/zlib/extconf.rb b/ext/zlib/extconf.rb -index 2b2dbb1..2abc037 100644 ---- a/ext/zlib/extconf.rb -+++ b/ext/zlib/extconf.rb +--- ext/zlib/extconf.rb ++++ ext/zlib/extconf.rb @@ -11,7 +11,7 @@ require 'rbconfig' dir_config 'zlib'