diff --git a/.github/workflows/gem-install.yml b/.github/workflows/gem-install.yml index e0bb1092..2fc981c0 100644 --- a/.github/workflows/gem-install.yml +++ b/.github/workflows/gem-install.yml @@ -56,7 +56,7 @@ jobs: fail-fast: false matrix: sys: ["enable", "disable"] - ruby: ["2.6", "2.7", "3.0", "3.1", "head", "truffleruby-head"] + ruby: ["2.7", "3.0", "3.1", "3.2", "head", "truffleruby-head"] runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -76,7 +76,7 @@ jobs: fail-fast: false matrix: sys: ["enable", "disable"] - ruby: ["3.1", "truffleruby-head"] + ruby: ["3.1", "3.2", "truffleruby-head"] runs-on: macos-latest steps: - uses: actions/checkout@v3 @@ -104,7 +104,7 @@ jobs: - uses: actions/checkout@v3 - uses: ruby/setup-ruby-pkgs@v1 with: - ruby-version: "3.0" + ruby-version: "${{matrix.ruby}}" mingw: "sqlite3" - uses: actions/download-artifact@v3 with: @@ -121,13 +121,13 @@ jobs: fail-fast: false matrix: sys: ["enable", "disable"] - ruby: ["3.1"] + ruby: ["3.1", "3.2"] runs-on: windows-2022 steps: - uses: actions/checkout@v3 - uses: ruby/setup-ruby-pkgs@v1 with: - ruby-version: "3.1" + ruby-version: "${{matrix.ruby}}" mingw: "sqlite3" - uses: actions/download-artifact@v3 with: @@ -146,7 +146,7 @@ jobs: plat: - "aarch64-linux" - "arm-linux" - # - "arm64-darwin" # omitted until github actions supports it + - "arm64-darwin" # github actions does not support this runtime as of 2022-12, but let's build anyway - "x64-mingw-ucrt" - "x64-mingw32" - "x86-linux" @@ -159,9 +159,11 @@ jobs: with: path: ports/archives key: ports-archives-tarball-${{hashFiles('ext/sqlite3/extconf.rb','dependencies.yml')}} - - run: | - docker run --rm -v "$(pwd):/sqlite3" -w /sqlite3 \ - larskanis/rake-compiler-dock-mri-${{matrix.plat}}:1.2.1 \ + - env: + # DOCKER_IMAGE: "larskanis/rake-compiler-dock-mri-${{matrix.plat}}:1.2.1" + DOCKER_IMAGE: "ghcr.io/rake-compiler/rake-compiler-dock-snapshot:${{matrix.plat}}" + run: | + docker run --rm -v "$(pwd):/sqlite3" -w /sqlite3 ${DOCKER_IMAGE} \ ./bin/test-gem-build gems ${{matrix.plat}} - uses: actions/upload-artifact@v3 with: @@ -174,7 +176,7 @@ jobs: strategy: fail-fast: false matrix: - ruby: ["2.6", "2.7", "3.0", "3.1"] + ruby: ["2.7", "3.0", "3.1", "3.2"] runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -194,7 +196,7 @@ jobs: strategy: fail-fast: false matrix: - ruby: ["2.6", "2.7", "3.0", "3.1"] + ruby: ["2.7", "3.0", "3.1", "3.2"] runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -218,7 +220,7 @@ jobs: strategy: fail-fast: false matrix: - ruby: ["3.1"] + ruby: ["3.1", "3.2"] runs-on: windows-2022 steps: - uses: actions/checkout@v3 @@ -239,7 +241,7 @@ jobs: strategy: fail-fast: false matrix: - ruby: ["2.6", "2.7", "3.0"] + ruby: ["2.7", "3.0"] runs-on: windows-2019 steps: - uses: actions/checkout@v3 @@ -260,7 +262,7 @@ jobs: strategy: fail-fast: false matrix: - ruby: ["2.6", "2.7", "3.0", "3.1"] + ruby: ["2.7", "3.0", "3.1", "3.2"] runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -280,7 +282,7 @@ jobs: strategy: fail-fast: false matrix: - ruby: ["2.6", "2.7", "3.0", "3.1"] + ruby: ["2.7", "3.0", "3.1", "3.2"] runs-on: macos-latest steps: - uses: actions/checkout@v3 @@ -298,7 +300,7 @@ jobs: strategy: fail-fast: false matrix: - ruby: ["2.6", "2.7", "3.0", "3.1"] + ruby: ["2.7", "3.0", "3.1", "3.2"] runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -316,7 +318,7 @@ jobs: strategy: fail-fast: false matrix: - ruby: ["2.6", "2.7", "3.0", "3.1"] + ruby: ["2.7", "3.0", "3.1", "3.2"] runs-on: ubuntu-latest container: image: ruby:${{matrix.ruby}}-alpine diff --git a/.github/workflows/sqlite3-ruby.yml b/.github/workflows/sqlite3-ruby.yml index 1ca4531f..d5e622ee 100644 --- a/.github/workflows/sqlite3-ruby.yml +++ b/.github/workflows/sqlite3-ruby.yml @@ -22,20 +22,19 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, macos-latest, windows-2022] - # use quotes for versions, otherwise "3.0" -> "3", "2.10" -> "2.1" - ruby: ["3.1", "3.0", "2.7", "2.6"] + os: [ubuntu-latest, macos-latest, windows-latest] + ruby: ["3.2", "3.1", "3.0", "2.7"] lib: [system, packaged] include: - - { os: ubuntu-latest, ruby: truffleruby-head, lib: packaged } - - { os: ubuntu-22.04 , ruby: head , lib: packaged } - - { os: ubuntu-22.04 , ruby: head , lib: system } - - { os: windows-2022 , ruby: ucrt , lib: system } - - { os: windows-2022 , ruby: mswin , lib: system } + - { os: ubuntu-latest, ruby: truffleruby-head, lib: packaged } + - { os: ubuntu-latest, ruby: head, lib: packaged } + - { os: ubuntu-latest, ruby: head, lib: system } + - { os: windows-latest, ruby: ucrt, lib: system } + - { os: windows-latest, ruby: mswin, lib: system } runs-on: ${{matrix.os}} steps: - - if: matrix.os == 'windows-2022' + - if: matrix.os == 'windows-latest' name: configure git crlf run: | git config --system core.autocrlf false @@ -95,15 +94,14 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, macos-latest, windows-2022] - # use quotes for versions, otherwise "3.0" -> "3", "2.10" -> "2.1" - ruby: ["3.1", "2.6"] # oldest and newest + os: [ubuntu-latest, macos-latest, windows-latest] + ruby: ["3.2", "2.7"] # oldest and newest include: - - { os: windows-2022, ruby: mingw } - - { os: windows-2022, ruby: mswin } + - { os: windows-latest, ruby: mingw } + - { os: windows-latest, ruby: mswin } runs-on: ${{matrix.os}} steps: - - if: matrix.os == 'windows-2022' + - if: matrix.os == 'windows-latest' name: configure git crlf run: | git config --system core.autocrlf false diff --git a/CHANGELOG.md b/CHANGELOG.md index 1079e523..15288302 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ ## next / unreleased +### Ruby + +This release introduces native gem support for Ruby 3.2. + +This release ends native gem support for Ruby 2.6, for which [upstream support ended 2022-04-12](https://www.ruby-lang.org/en/downloads/branches/). + + ### Dependencies * Vendored sqlite3 is updated to [v3.40.1](https://sqlite.org/releaselog/3_40_1.html). diff --git a/bin/test-gem-file-contents b/bin/test-gem-file-contents index f76579bd..9e7b5856 100755 --- a/bin/test-gem-file-contents +++ b/bin/test-gem-file-contents @@ -65,9 +65,11 @@ Minitest::Reporters.use!([Minitest::Reporters::SpecReporter.new]) puts "Testing '#{gemfile}' (#{gemspec.platform})" describe File.basename(gemfile) do - let(:all_supported_ruby_versions) { ["1.9.2", "2.0", "2.1", "2.2", "2.3", "2.4", "2.5", "2.6", "2.7", "3.0", "3.1"] } - let(:native_supported_ruby_versions) { ["2.6", "2.7", "3.0", "3.1"] } - let(:ucrt_supported_ruby_versions) { ["3.1"] } + let(:all_supported_ruby_versions) { + ["1.9.2", "2.0", "2.1", "2.2", "2.3", "2.4", "2.5", "2.6", "2.7", "3.0", "3.1", "3.2"] + } + let(:native_supported_ruby_versions) { ["2.7", "3.0", "3.1", "3.2"] } + let(:ucrt_supported_ruby_versions) { ["3.1", "3.2"] } let(:platform_supported_ruby_versions) do if gemspec.platform.to_s == "x64-mingw-ucrt" ucrt_supported_ruby_versions diff --git a/ext/sqlite3/extconf.rb b/ext/sqlite3/extconf.rb index c492d20d..bd453a0b 100644 --- a/ext/sqlite3/extconf.rb +++ b/ext/sqlite3/extconf.rb @@ -69,21 +69,29 @@ def configure_packaged_libraries # on macos, pkg-config will not return --cflags without this ENV["PKG_CONFIG_ALLOW_SYSTEM_CFLAGS"] = "t" + # only needed for Ruby 3.1.3, see https://bugs.ruby-lang.org/issues/19233 + RbConfig::CONFIG["PKG_CONFIG"] = config_string("PKG_CONFIG") || "pkg-config" + lib_path = File.join(recipe.path, "lib") pcfile = File.join(lib_path, "pkgconfig", "sqlite3.pc") abort_pkg_config("pkg_config") unless pkg_config(pcfile) # see https://bugs.ruby-lang.org/issues/18490 - flags = xpopen(["pkg-config", "--libs", "--static", pcfile], err: [:child, :out], &:read) + ldflags = xpopen(["pkg-config", "--libs", "--static", pcfile], err: [:child, :out], &:read) abort_pkg_config("xpopen") unless $?.success? - flags = flags.split + ldflags = ldflags.split - # see https://github.com/flavorjones/mini_portile/issues/118 - "-L#{lib_path}".tap do |lib_path_flag| - flags.prepend(lib_path_flag) unless flags.include?(lib_path_flag) + if needs_darwin_linker_hack + ldflags.delete("-lsqlite3") + ldflags.prepend("-Wl,-flat_namespace", "-Wl,-hidden-lsqlite3") + else + # see https://github.com/flavorjones/mini_portile/issues/118 + "-L#{lib_path}".tap do |lib_path_flag| + ldflags.prepend(lib_path_flag) unless ldflags.include?(lib_path_flag) + end end - flags.each { |flag| append_ldflags(flag) } + ldflags.each { |ldflag| append_ldflags(ldflag) } end end @@ -169,6 +177,17 @@ def download minimal_recipe.download end + def needs_darwin_linker_hack + # See https://github.com/rake-compiler/rake-compiler-dock/issues/87 for more info. + cross_build? && + darwin? && + RbConfig::CONFIG["ruby_version"] >= "3.2" + end + + def darwin? + RbConfig::CONFIG["target_os"].include?("darwin") + end + def print_help print(<<~TEXT) USAGE: ruby #{$PROGRAM_NAME} [options] diff --git a/rakelib/native.rake b/rakelib/native.rake index 89cea4b1..1f395d5f 100644 --- a/rakelib/native.rake +++ b/rakelib/native.rake @@ -6,7 +6,7 @@ require "rake/extensiontask" require "rake_compiler_dock" require "yaml" -cross_rubies = ["3.1.0", "3.0.0", "2.7.0", "2.6.0"] +cross_rubies = ["3.2.0", "3.1.0", "3.0.0", "2.7.0"] cross_platforms = [ "aarch64-linux", "arm-linux",