Skip to content

Commit

Permalink
Ruby 3.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jmarrec committed Jan 24, 2024
1 parent cec0853 commit 72d25e0
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 10 deletions.
12 changes: 12 additions & 0 deletions recipes/ruby/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
sources:
"3.3.0":
url: "https://cache.ruby-lang.org/pub/ruby/3.3/ruby-3.3.0.tar.gz"
sha256: "96518814d9832bece92a85415a819d4893b307db5921ae1f0f751a9a89a56b7d"
"3.2.2":
url: "https://cache.ruby-lang.org/pub/ruby/3.2/ruby-3.2.2.tar.gz"
sha256: "96c57558871a6748de5bc9f274e93f4b5aad06cd8f37befa0e8d94e7b8a423bc"
"3.1.0":
url: "https://cache.ruby-lang.org/pub/ruby/3.1/ruby-3.1.0.tar.gz"
sha256: "50a0504c6edcb4d61ce6b8cfdbddaa95707195fab0ecd7b5e92654b2a9412854"
patches:
"3.3.0":
- patch_file: "patches/0001-darwin-includedir-3.2.2.patch"
patch_type: "portability"
- patch_file: "patches/0002-remove-fpic-3.3.0.patch"
patch_type: "portability"
- patch_file: "patches/0003-openssl-zlib-ext-3.3.0.patch"
patch_type: "conan"
- patch_file: "patches/0004-windows-cflags-3.2.2.patch"
patch_type: "portability"
"3.2.2":
- patch_file: "patches/0001-darwin-includedir-3.2.2.patch"
patch_type: "portability"
Expand Down
28 changes: 18 additions & 10 deletions recipes/ruby/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,14 @@ def requirements(self):
self.requires("zlib/1.2.12")

if self.options.with_openssl:
self.requires("openssl/[>=1.1.1 <=3.1]")
if Version(self.version) < "3.2.0":
self.requires("openssl/[>=1.1.1 <3.0]")
elif Version(self.version) < "3.3.0":
# self.requires("openssl/[>=1.1.1 <=3.1]")
self.requires("openssl/3.1.0")
else:
# self.requires("openssl/[>=1.1.1 <=3.2]")
self.requires("openssl/3.2.0")

if self.options.get_safe("with_libyaml"):
self.requires("libyaml/0.2.5")
Expand Down Expand Up @@ -158,13 +165,13 @@ def generate(self):
tc.configure_args.append(f"--with-{dep}-dir={root_path}")
opt_dirs.append(root_path)

if opt_dirs:
if self.settings.os == "Windows":
sep = ";"
tc.configure_args.append(f'--with-opt-dir="{sep.join(opt_dirs)}"')
else:
sep = ":"
tc.configure_args.append(f'--with-opt-dir={sep.join(opt_dirs)}')
# if opt_dirs:
# if self.settings.os == "Windows":
# sep = ";"
# tc.configure_args.append(f'--with-opt-dir="{sep.join(opt_dirs)}"')
# else:
# sep = ":"
# tc.configure_args.append(f'--with-opt-dir={sep.join(opt_dirs)}')

if cross_building(self) and is_apple_os(self):
apple_arch = to_apple_arch(self)
Expand All @@ -190,8 +197,9 @@ def generate(self):

def _patch_sources(self):
apply_conandata_patches(self)
replace_in_file(self, os.path.join(self.source_folder, "gems", "bundled_gems"), "rbs 2.0.0", "rbs 3.1.0")
replace_in_file(self, os.path.join(self.source_folder, "gems", "bundled_gems"), "debug 1.4.0", "debug 1.6.3")
if Version(self.version) < "3.2.0":
replace_in_file(self, os.path.join(self.source_folder, "gems", "bundled_gems"), "rbs 2.0.0", "rbs 3.1.0")
replace_in_file(self, os.path.join(self.source_folder, "gems", "bundled_gems"), "debug 1.4.0", "debug 1.6.3")

def build(self):
self._patch_sources()
Expand Down
14 changes: 14 additions & 0 deletions recipes/ruby/all/patches/0002-remove-fpic-3.3.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
diff --git a/configure.ac b/configure.ac
--- configure.ac
+++ configure.ac
@@ -3027,9 +3027,7 @@ STATIC=
# mkmf.rb's have_header() to fail if the desired resource happens to be
# installed in the /usr/local tree.
RUBY_APPEND_OPTION(CCDLFLAGS, -fno-common)],
- [bsdi*|cygwin*|msys*|mingw*|aix*|interix*], [ ],
- [
- RUBY_APPEND_OPTION(CCDLFLAGS, -fPIC)])
+ [ ])
], [
AS_CASE(["$target_os"],
[solaris*|irix*], [CCDLFLAGS="$CCDLFLAGS -KPIC"],
39 changes: 39 additions & 0 deletions recipes/ruby/all/patches/0003-openssl-zlib-ext-3.3.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
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
@@ -68,6 +68,7 @@ def find_openssl_library
# required for static OpenSSL libraries
have_library("gdi32") # OpenSSL <= 1.0.2 (for RAND_screen())
have_library("crypt32")
+ have_library("advapi32")
end

return false unless have_header("openssl/ssl.h")
@@ -78,8 +79,12 @@ def find_openssl_library

if $mswin
# OpenSSL >= 1.1.0: libcrypto.lib and libssl.lib.
+ # Potentially with 'd' appended (conan center index)
if have_library("libcrypto", "CRYPTO_malloc") &&
- have_library("libssl", "SSL_new")
+ have_library("libssl", "SSL_new")
+ return true
+ elsif have_library("libcryptod", "CRYPTO_malloc") &&
+ have_library("libssld", "SSL_new")
return true
end

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
@@ -11,7 +11,7 @@ require 'rbconfig'
dir_config 'zlib'

libs = $libs
-have_zlib = %w'z libz zlib1 zlib zdll zlibwapi'.any? {|z| have_library(z, 'deflateReset(NULL)', 'zlib.h')}
+have_zlib = %w'z zlibstatic zlibstaticd zlib zlibd libz zlib1 zdll zlibwapi'.any? {|z| have_library(z, 'deflateReset(NULL)', 'zlib.h')}

unless have_zlib
$libs = libs
2 changes: 2 additions & 0 deletions recipes/ruby/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
versions:
"3.3.0":
folder: all
"3.2.2":
folder: all
"3.1.0":
Expand Down

0 comments on commit 72d25e0

Please sign in to comment.