Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

native gem support: add 3.2, drop 2.6 #367

Merged
merged 5 commits into from
Jan 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 19 additions & 17 deletions .github/workflows/gem-install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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"
Expand All @@ -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:
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
28 changes: 13 additions & 15 deletions .github/workflows/sqlite3-ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
8 changes: 5 additions & 3 deletions bin/test-gem-file-contents
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
31 changes: 25 additions & 6 deletions ext/sqlite3/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion rakelib/native.rake
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down