Skip to content

Commit

Permalink
Merge pull request #623 from ged/rcd-1.8
Browse files Browse the repository at this point in the history
Update to rcd-1.8.0 and add ruby-3.4 in native gem
  • Loading branch information
larskanis authored Jan 10, 2025
2 parents c6d1047 + 15be07d commit 70a5695
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ end
group :test do
gem "bundler", ">= 1.16", "< 3.0"
gem "rake-compiler", "~> 1.0"
gem "rake-compiler-dock", "~> 1.5"
gem "rake-compiler-dock", "~> 1.8.0"
gem "rspec", "~> 3.5"
# "bigdecimal" is a gem on ruby-3.4+ and it's optional for ruby-pg.
# Specs should succeed without it, but 4 examples are then excluded.
Expand Down
9 changes: 4 additions & 5 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ CrossLibraries = [
['x64-mingw-ucrt', 'mingw64', 'x86_64-w64-mingw32'],
['x86-mingw32', 'mingw', 'i686-w64-mingw32'],
['x64-mingw32', 'mingw64', 'x86_64-w64-mingw32'],
['x86_64-linux', 'linux-x86_64', 'x86_64-redhat-linux-gnu'],
['x86_64-linux', 'linux-x86_64', 'x86_64-linux-gnu'],
].map do |platform, openssl_config, toolchain|
CrossLibrary.new platform, openssl_config, toolchain
end
Expand Down Expand Up @@ -100,13 +100,12 @@ CrossLibraries.each do |xlib|
desc "Build fat binary gem for platform #{platform}"
task "gem:native:#{platform}" => ['gem:native:prepare'] do
RakeCompilerDock.sh <<-EOT, platform: platform
#{ "sudo yum install -y perl-IPC-Cmd bison flex &&" if platform =~ /linux/ }
#{ # remove nm on Linux to suppress PostgreSQL's check for exit which raises thread_exit as a false positive:
"sudo mv `which nm` `which nm`.bak && sudo mv `which nm` `which nm`.bak &&" if platform =~ /linux/ }
#{ "sudo apt-get update && sudo apt-get install -y bison flex &&" if platform =~ /mingw/ }
"sudo mv `which nm` `which nm`.bak &&" if platform =~ /linux/ }
sudo apt-get update && sudo apt-get install -y bison flex &&
(cp build/gem/gem-*.pem ~/.gem/ || true) &&
bundle install --local &&
rake native:#{platform} pkg/#{$gem_spec.full_name}-#{platform}.gem MAKEOPTS=-j`nproc` RUBY_CC_VERSION=3.3.0:3.2.0:3.1.0:3.0.0:2.7.0
rake native:#{platform} pkg/#{$gem_spec.full_name}-#{platform}.gem MAKEOPTS=-j`nproc` RUBY_CC_VERSION=3.4.1:3.3.5:3.2.6:3.1.6:3.0.7:2.7.8
EOT
end
desc "Build the native binary gems"
Expand Down
7 changes: 7 additions & 0 deletions ext/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ def work_path
# See https://github.com/cockroachdb/cockroach/issues/49734
recipe.configure_options << "CFLAGS=-fcommon#{" -fPIC" if RUBY_PLATFORM =~ /linux/}"
recipe.configure_options << "--without-keyutils"
recipe.configure_options << "krb5_cv_attr_constructor_destructor=yes"
recipe.configure_options << "ac_cv_func_regcomp=yes"
recipe.configure_options << "ac_cv_printf_positional=yes"
recipe.host = toolchain
recipe.cook_and_activate
end
Expand All @@ -111,6 +114,8 @@ def configure_defaults
*(RUBY_PLATFORM=~/linux/ ? ['--with-gssapi'] : []),
'--without-zlib',
'--without-icu',
'--without-readline',
'ac_cv_search_gss_store_cred_into=',
]
end
def compile
Expand All @@ -135,6 +140,8 @@ def install
File.join(postgresql_recipe.port_path, "lib/libpq-ruby-pg.so.1")
# Avoid dependency to external libgcc.dll on x86-mingw32
$LDFLAGS << " -static-libgcc"
# Avoid: "libpq.so: undefined reference to `dlopen'" in cross-ruby-2.7.8
$LDFLAGS << " -Wl,--no-as-needed"
# Find libpq in the ports directory coming from lib/3.3
# It is shared between all compiled ruby versions.
$LDFLAGS << " '-Wl,-rpath=$$ORIGIN/../../ports/#{gem_platform}/lib'"
Expand Down

0 comments on commit 70a5695

Please sign in to comment.