From 551f185ce9e4c0298ca86efb5f62bd3af0bc287b Mon Sep 17 00:00:00 2001 From: Lars Kanis Date: Thu, 25 Dec 2025 23:02:32 +0100 Subject: [PATCH 1/2] Update to ruby-4.0 --- .github/workflows/binary-gems.yml | 10 +++++----- Gemfile | 6 +++--- Rakefile | 5 +++-- ext/extconf.rb | 4 ++-- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/.github/workflows/binary-gems.yml b/.github/workflows/binary-gems.yml index 72d8c8ee4..9575d0374 100644 --- a/.github/workflows/binary-gems.yml +++ b/.github/workflows/binary-gems.yml @@ -20,8 +20,8 @@ jobs: rcd_build: name: Build runs-on: ubuntu-latest - env: - RCD_IMAGE_VERSION: snapshot + # env: + # RCD_IMAGE_VERSION: snapshot strategy: fail-fast: false matrix: @@ -67,7 +67,7 @@ jobs: matrix: include: - os: windows-latest - ruby: "3.4" + ruby: "4.0" platform: "x64-mingw-ucrt" - os: windows-latest ruby: "3.2.9-1" @@ -81,10 +81,10 @@ jobs: ruby: "3.2" platform: "x86_64-linux" - os: ubuntu-24.04-arm - ruby: "3.4" + ruby: "4.0" platform: "aarch64-linux" - os: macos-latest - ruby: "3.4" + ruby: "4.0" platform: "arm64-darwin" - os: macos-15-intel ruby: "3.4" diff --git a/Gemfile b/Gemfile index edf7a4607..c22c0988b 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,7 @@ # -*- ruby -*- -# Specify your gem's runtime dependencies in pg.gemspec -gemspec +# No pg gem, since "bundle package" fails on bundler-2.7+, if the extension isn't built +# gemspec source "https://rubygems.org/" @@ -13,7 +13,7 @@ end group :test do gem "bundler", ">= 1.16", "< 5.0" gem "rake-compiler", "~> 1.0" - gem "rake-compiler-dock", "~> 1.10.0", git: "https://github.com/rake-compiler/rake-compiler-dock" + gem "rake-compiler-dock", "~> 1.11.0" #, git: "https://github.com/rake-compiler/rake-compiler-dock" 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. diff --git a/Rakefile b/Rakefile index 43a483bd6..b3c41ddd0 100644 --- a/Rakefile +++ b/Rakefile @@ -106,7 +106,8 @@ task 'gem:native:prepare' do # Copy gem signing key and certs to be accessible from the docker container mkdir_p 'build/gem' sh "cp ~/.gem/gem-*.pem build/gem/ || true" - sh "bundle package --all" + sh "bundle config set cache_all false" + sh "bundle package" begin OpenSSL::PKey.read(File.read(File.expand_path("~/.gem/gem-private_key.pem")), ENV["GEM_PRIVATE_KEY_PASSPHRASE"] || "") rescue OpenSSL::PKey::PKeyError @@ -126,7 +127,7 @@ CrossLibraries.each do |xlib| 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 MAKEFLAGS="-j`nproc` V=1" RUBY_CC_VERSION=#{RakeCompilerDock.ruby_cc_version("~>2.7", "~>3.0")} + rake native:#{platform} pkg/#{$gem_spec.full_name}-#{platform}.gem MAKEFLAGS="-j`nproc` V=1" RUBY_CC_VERSION=#{RakeCompilerDock.ruby_cc_version("~>4.0", "~>3.0")} EOT end desc "Build the native binary gems" diff --git a/ext/extconf.rb b/ext/extconf.rb index a1d7570d7..bce72ee8c 100644 --- a/ext/extconf.rb +++ b/ext/extconf.rb @@ -27,13 +27,13 @@ gem 'mini_portile2', '~>2.1' require 'mini_portile2' - OPENSSL_VERSION = ENV['OPENSSL_VERSION'] || '3.5.2' + OPENSSL_VERSION = ENV['OPENSSL_VERSION'] || '3.6.0' OPENSSL_SOURCE_URI = "http://www.openssl.org/source/openssl-#{OPENSSL_VERSION}.tar.gz" KRB5_VERSION = ENV['KRB5_VERSION'] || '1.22.1' KRB5_SOURCE_URI = "http://kerberos.org/dist/krb5/#{KRB5_VERSION[/^(\d+\.\d+)/]}/krb5-#{KRB5_VERSION}.tar.gz" - POSTGRESQL_VERSION = ENV['POSTGRESQL_VERSION'] || '17.6' + POSTGRESQL_VERSION = ENV['POSTGRESQL_VERSION'] || '18.1' POSTGRESQL_SOURCE_URI = "http://ftp.postgresql.org/pub/source/v#{POSTGRESQL_VERSION}/postgresql-#{POSTGRESQL_VERSION}.tar.bz2" class BuildRecipe < MiniPortile From 3f71103b73f9b0ddad626b31aebcba9056ef574b Mon Sep 17 00:00:00 2001 From: Lars Kanis Date: Thu, 25 Dec 2025 23:14:04 +0100 Subject: [PATCH 2/2] Remove x86-mingw32 from binary builds It fails with OpenSSL linker error: ``` configure:13021: i686-w64-mingw32-gcc -o conftest.exe -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wshadow=compatible-local -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -I/home/runner/work/ruby-pg/ruby-pg/ports/x86-mingw32/include -D_POSIX_C_SOURCE -I./src/include/port/win32 -L/home/runner/work/ruby-pg/ruby-pg/ports/x86-mingw32/lib -L/home/runner/work/ruby-pg/ruby-pg/ports/x86-mingw32/lib64 -L/home/runner/work/ruby-pg/ruby-pg/ports/x86-mingw32/lib-arm64 -Wl,--allow-multiple-definition -Wl,--disable-auto-import conftest.c -lcrypto -lm -lssl -lwsock32 -lgdi32 -lws2_32 -lcrypt32 >&5 /usr/bin/i686-w64-mingw32-ld: /home/runner/work/ruby-pg/ruby-pg/ports/x86-mingw32/lib/libcrypto.a(libdefault-lib-cipher_aes_cfb_hw.obj):cipher_aes_cfb_hw.c:(.text+0x1ea): undefined reference to `ossl_aes_cfb128_vaes_enc' /usr/bin/i686-w64-mingw32-ld: /home/runner/work/ruby-pg/ruby-pg/ports/x86-mingw32/lib/libcrypto.a(libdefault-lib-cipher_aes_cfb_hw.obj):cipher_aes_cfb_hw.c:(.text+0x220): undefined reference to `ossl_aes_cfb128_vaes_dec' ``` x86-mingw32 is no longer supported by RubyInstaller-4.0 and it seems to be more effort than use. --- .github/workflows/binary-gems.yml | 5 ----- ...se-workaround-of-__builtin_setjmp-only-on-MINGW-on-.patch | 0 ...ibpq-Process-buffered-SSL-read-bytes-to-support-rec.patch | 0 3 files changed, 5 deletions(-) rename ports/patches/postgresql/{17.6 => 18.1}/0001-Use-workaround-of-__builtin_setjmp-only-on-MINGW-on-.patch (100%) rename ports/patches/postgresql/{17.6 => 18.1}/0001-libpq-Process-buffered-SSL-read-bytes-to-support-rec.patch (100%) diff --git a/.github/workflows/binary-gems.yml b/.github/workflows/binary-gems.yml index 9575d0374..4f73f0b6f 100644 --- a/.github/workflows/binary-gems.yml +++ b/.github/workflows/binary-gems.yml @@ -28,7 +28,6 @@ jobs: include: - platform: "x64-mingw-ucrt" - platform: "x64-mingw32" - - platform: "x86-mingw32" - platform: "x86_64-linux" - platform: "x86_64-linux-musl" - platform: "aarch64-linux" @@ -69,10 +68,6 @@ jobs: - os: windows-latest ruby: "4.0" platform: "x64-mingw-ucrt" - - os: windows-latest - ruby: "3.2.9-1" - platform: "x86-mingw32" - PGVERSION: 10.20-1-windows - os: windows-latest ruby: "3.2" platform: "x64-mingw-ucrt" diff --git a/ports/patches/postgresql/17.6/0001-Use-workaround-of-__builtin_setjmp-only-on-MINGW-on-.patch b/ports/patches/postgresql/18.1/0001-Use-workaround-of-__builtin_setjmp-only-on-MINGW-on-.patch similarity index 100% rename from ports/patches/postgresql/17.6/0001-Use-workaround-of-__builtin_setjmp-only-on-MINGW-on-.patch rename to ports/patches/postgresql/18.1/0001-Use-workaround-of-__builtin_setjmp-only-on-MINGW-on-.patch diff --git a/ports/patches/postgresql/17.6/0001-libpq-Process-buffered-SSL-read-bytes-to-support-rec.patch b/ports/patches/postgresql/18.1/0001-libpq-Process-buffered-SSL-read-bytes-to-support-rec.patch similarity index 100% rename from ports/patches/postgresql/17.6/0001-libpq-Process-buffered-SSL-read-bytes-to-support-rec.patch rename to ports/patches/postgresql/18.1/0001-libpq-Process-buffered-SSL-read-bytes-to-support-rec.patch