Skip to content

Commit 0b25bbe

Browse files
committed
change -linux to -linux-gnu everywhere
and test gems built with the `-linux-gnu` suffix on ruby 3.1 and later, which are the ones that ship with rubygems 3.2.33 or later (the version that first recognizes the `-gnu` suffix)
1 parent f700f7d commit 0b25bbe

File tree

10 files changed

+99
-46
lines changed

10 files changed

+99
-46
lines changed

.github/workflows/ci.yml

+38-10
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,22 @@ jobs:
4545
fail-fast: false
4646
matrix:
4747
include:
48-
- platform: aarch64-linux
49-
- platform: arm-linux
48+
- platform: aarch64-linux-gnu
49+
alias: aarch64-linux
50+
- platform: arm-linux-gnu
51+
alias: arm-linux
5052
- platform: arm64-darwin
5153
- platform: jruby
5254
- platform: x64-mingw-ucrt
5355
static: true
5456
- platform: x64-mingw32
5557
static: true
56-
- platform: x86-linux
58+
- platform: x86-linux-gnu
59+
alias: x86-linux
5760
- platform: x86-mingw32
5861
- platform: x86_64-darwin
59-
- platform: x86_64-linux
62+
- platform: x86_64-linux-gnu
63+
alias: x86_64-linux
6064
runs-on: ubuntu-latest
6165
steps:
6266
- uses: actions/checkout@v3
@@ -114,6 +118,21 @@ jobs:
114118
name: gem-${{ matrix.platform }}-static
115119
path: test/rcd_test/pkg/*-*-*.gem
116120

121+
- if: matrix.alias
122+
name: Build native gem ${{ matrix.alias }}
123+
run: |
124+
cd test/rcd_test/
125+
bundle install
126+
bundle exec rake clean clobber
127+
bundle exec rake gem:${{ matrix.alias }}
128+
129+
- if: matrix.alias
130+
name: Upload native gem ${{ matrix.alias }}
131+
uses: actions/upload-artifact@v3
132+
with:
133+
name: gem-${{ matrix.alias }}
134+
path: test/rcd_test/pkg/*-*-*.gem
135+
117136
test_source_gem:
118137
name: test source
119138
needs: build_source_gem
@@ -172,6 +191,15 @@ jobs:
172191
platform: x86_64-darwin
173192
- os: ubuntu
174193
platform: x86_64-linux
194+
- os: ubuntu # ruby 3.0 and earlier ship rubygems < 3.2.33, so can't recognize the -gnu suffix
195+
ruby: "3.1"
196+
platform: x86_64-linux-gnu
197+
- os: ubuntu
198+
ruby: "3.2"
199+
platform: x86_64-linux-gnu
200+
- os: ubuntu
201+
ruby: "3.3"
202+
platform: x86_64-linux-gnu
175203
- os: ubuntu
176204
ruby: jruby
177205
platform: jruby
@@ -282,22 +310,22 @@ jobs:
282310
matrix:
283311
include:
284312
- from_image: amd64/centos
285-
platform: x86_64-linux
313+
platform: x86_64-linux-gnu
286314
dockerfile: centos
287315
- from_image: navikey/raspbian-bullseye
288-
platform: arm-linux
316+
platform: arm-linux-gnu
289317
dockerfile: debian
290318
- from_image: arm64v8/ubuntu
291-
platform: aarch64-linux
319+
platform: aarch64-linux-gnu
292320
dockerfile: debian
293321
- from_image: i386/alpine
294-
platform: x86-linux
322+
platform: x86-linux-gnu
295323
dockerfile: alpine
296324
- from_image: arm32v6/alpine
297-
platform: arm-linux
325+
platform: arm-linux-gnu
298326
dockerfile: alpine
299327
- from_image: alpine
300-
platform: x86_64-linux
328+
platform: x86_64-linux-gnu
301329
dockerfile: alpine
302330
runs-on: ubuntu-latest
303331
steps:

.github/workflows/publish-images.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ jobs:
1313
fail-fast: false
1414
matrix:
1515
platform:
16-
- x86-mingw32
16+
- aarch64-linux-gnu
17+
- arm-linux-gnu
18+
- arm64-darwin
1719
- x64-mingw-ucrt
1820
- x64-mingw32
19-
- x86-linux
20-
- x86_64-linux
21+
- x86-linux-gnu
22+
- x86-mingw32
2123
- x86_64-darwin
22-
- arm64-darwin
23-
- arm-linux
24-
- aarch64-linux
24+
- x86_64-linux-gnu
2525
- jruby
2626
runs-on: ubuntu-latest
2727
steps:

.gitignore

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
/.bundle/
22
/.yardoc
3-
/Dockerfile.mri.aarch64-linux
4-
/Dockerfile.mri.arm-linux
3+
/Dockerfile.mri.aarch64-linux-gnu
4+
/Dockerfile.mri.arm-linux-gnu
55
/Dockerfile.mri.arm64-darwin
6-
/Dockerfile.mri.arm64-linux
76
/Dockerfile.mri.x64-mingw-ucrt
87
/Dockerfile.mri.x64-mingw32
9-
/Dockerfile.mri.x86-linux
8+
/Dockerfile.mri.x86-linux-gnu
109
/Dockerfile.mri.x86-mingw32
1110
/Dockerfile.mri.x86_64-darwin
12-
/Dockerfile.mri.x86_64-linux
11+
/Dockerfile.mri.x86_64-linux-gnu
1312
/Gemfile.lock
1413
/_yardoc/
1514
/cache/

Dockerfile.mri.erb

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<%
22
image = case platform
3-
when /x86_64-linux/ then "quay.io/pypa/manylinux2014_x86_64"
4-
when /x86-linux/ then "quay.io/pypa/manylinux2014_i686"
3+
when /x86_64-linux-gnu/ then "quay.io/pypa/manylinux2014_x86_64"
4+
when /x86-linux-gnu/ then "quay.io/pypa/manylinux2014_i686"
55
else "ubuntu:20.04"
66
end
77
manylinux = !!(image =~ /manylinux/)
@@ -68,8 +68,8 @@ RUN dpkg -i /debs/*.deb
6868
RUN apt-get -y update && \
6969
apt-get install -y <%
7070
if platform =~ /darwin/ %> clang python lzma-dev libxml2-dev libssl-dev libc++-10-dev <% end %><%
71-
if platform =~ /aarch64-linux/ %> gcc-aarch64-linux-gnu g++-aarch64-linux-gnu <% end %><%
72-
if platform =~ /arm-linux/ %> gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf <% end %><%
71+
if platform =~ /aarch64-linux-gnu/ %> gcc-aarch64-linux-gnu g++-aarch64-linux-gnu <% end %><%
72+
if platform =~ /arm-linux-gnu/ %> gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf <% end %><%
7373
if platform =~ /x86-mingw32/ %> gcc-mingw-w64-i686 g++-mingw-w64-i686 <% end %><%
7474
if platform =~ /x64-mingw32/ %> gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 <% end %> && \
7575
rm -rf /var/lib/apt/lists/*

History.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
next / unreleased
22
-----------------
33

4+
* Linux builds and their images are now fully qualified with the libc flavor. So, `x86_64-linux`
5+
should now be referred to as `x86_64-linux-gnu`, and the generated files are also named with the
6+
libc name.
47
* Replace `rvm` with `rbenv` and `ruby-build`
58
- `rvm` has been replaced by `rbenv` and `ruby-build`
69
- no longer applying sendfile patches to bootstrap rubies

README.md

+22-11
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Your Rakefile should enable cross compilation like so:
3333
```ruby
3434
exttask = Rake::ExtensionTask.new('my_extension', my_gem_spec) do |ext|
3535
ext.cross_compile = true
36-
ext.cross_platform = %w[x86-mingw32 x64-mingw-ucrt x64-mingw32 x86-linux x86_64-linux x86_64-darwin arm64-darwin]
36+
ext.cross_platform = %w[x86-mingw32 x64-mingw-ucrt x64-mingw32 x86-linux-gnu x86_64-linux-gnu x86_64-darwin arm64-darwin]
3737
end
3838
```
3939

@@ -44,7 +44,7 @@ Additionally it may also be used to build ffi based binary gems like [libusb](ht
4444
### Interactive Usage
4545

4646
Rake-compiler-dock offers the shell command `rake-compiler-dock` and a [ruby API](http://www.rubydoc.info/gems/rake-compiler-dock/RakeCompilerDock) for issuing commands within the docker image, described below.
47-
There are dedicated images for `x86-mingw32`, `x64-mingw-ucrt`, `x64-mingw32`, `x86-linux`, `x86_64-linux`, `x86_64-darwin`, `arm64-darwin` and `jruby` targets.
47+
There are dedicated images for targets: `aarch64-linux-gnu`, `arm-linux-gnu`, `arm64-darwin`, `x64-mingw-ucrt`, `x64-mingw32`, `x86-linux-gnu`, `x86-mingw32`, `x86_64-darwin`, `x86_64-linux-gnu`, and `jruby`.
4848
The images contain all supported cross ruby versions, with the exception of `x64-mingw32`, which has versions before 3.1 only, and `x64-mingw-ucrt`, which has only ruby-3.1+.
4949
This is to match the [changed platform of RubyInstaller-3.1](https://rubyinstaller.org/2021/12/31/rubyinstaller-3.1.0-1-released.html).
5050

@@ -68,12 +68,12 @@ To build x86 Windows and x86_64 Linux binary gems interactively, it can be calle
6868
user@host:$ ls pkg/*.gem
6969
your-gem-1.0.0.gem your-gem-1.0.0-x86-mingw32.gem
7070

71-
user@host:$ RCD_PLATFORM=x86_64-linux rake-compiler-dock # this enters a container for amd64 Linux target
71+
user@host:$ RCD_PLATFORM=x86_64-linux-gnu rake-compiler-dock # this enters a container for amd64 Linux target
7272
user@adc55b2b92a9:$ bundle
7373
user@adc55b2b92a9:$ rake cross native gem
7474
user@adc55b2b92a9:$ exit
7575
user@host:$ ls pkg/*.gem
76-
your-gem-1.0.0.gem your-gem-1.0.0-x86_64-linux.gem
76+
your-gem-1.0.0.gem your-gem-1.0.0-x86_64-linux-gnu.gem
7777

7878
Or non-interactive:
7979

@@ -118,10 +118,21 @@ To make the build process reproducible for other parties, it is recommended to a
118118
This can be done like this:
119119

120120
```ruby
121+
PLATFORMS = %w[
122+
aarch64-linux-gnu
123+
arm-linux-gnu
124+
arm64-darwin
125+
x64-mingw-ucrt
126+
x64-mingw32
127+
x86-linux-gnu
128+
x86-mingw32
129+
x86_64-darwin
130+
x86_64-linux-gnu
131+
]
121132
task 'gem:native' do
122133
require 'rake_compiler_dock'
123134
sh "bundle package --all" # Avoid repeated downloads of gems by using gem files from the host.
124-
%w[ x86-mingw32 x64-mingw-ucrt x64-mingw32 x86-linux x86_64-linux arm-linux aarch64-linux x86_64-darwin arm64-darwin ].each do |plat|
135+
PLATFORMS.each do |plat|
125136
RakeCompilerDock.sh "bundle --local && rake native:#{plat} gem", platform: plat
126137
end
127138
RakeCompilerDock.sh "bundle --local && rake java gem", rubyvm: :jruby
@@ -187,21 +198,21 @@ jobs:
187198
name: "native-gem"
188199
runs-on: ubuntu-latest
189200
container:
190-
image: "ghcr.io/rake-compiler/rake-compiler-dock-image:1.2.2-mri-x86_64-linux"
201+
image: "ghcr.io/rake-compiler/rake-compiler-dock-image:1.2.2-mri-x86_64-linux-gnu"
191202
steps:
192203
- uses: actions/checkout@v2
193-
- run: bundle install && bundle exec rake gem:x86_64-linux:rcd
204+
- run: bundle install && bundle exec rake gem:x86_64-linux-gnu:rcd
194205
- uses: actions/upload-artifact@v2
195206
with:
196207
name: native-gem
197208
path: gems
198209
retention-days: 1
199210
```
200211
201-
Where the referenced rake task might be defined by:
212+
Where the referenced rake task might be defined by something like:
202213
203214
``` ruby
204-
cross_platforms = ["x64-mingw32", "x86_64-linux", "x86_64-darwin", "arm64-darwin"]
215+
cross_platforms = ["x64-mingw32", "x86_64-linux-gnu", "x86_64-darwin", "arm64-darwin"]
205216

206217
namespace "gem" do
207218
cross_platforms.each do |platform|
@@ -223,7 +234,7 @@ For an example of rake tasks that support this style of invocation, visit https:
223234

224235
OCI images snapshotted from `main` are published weekly to Github Container Registry with the string "snapshot" in place of the version number in the tag name, e.g.:
225236

226-
- `ghcr.io/rake-compiler/rake-compiler-dock-image:snapshot-mri-x86_64-linux`
237+
- `ghcr.io/rake-compiler/rake-compiler-dock-image:snapshot-mri-x86_64-linux-gnu`
227238

228239
These images are intended for integration testing. They may not work properly and should not be considered production ready.
229240

@@ -237,7 +248,7 @@ The following variables are recognized by rake-compiler-dock:
237248
* `RCD_RUBYVM` - The ruby VM and toolchain to be used.
238249
Must be one of `mri`, `jruby`.
239250
* `RCD_PLATFORM` - The target rubygems platform.
240-
Must be a space separated list out of `x86-mingw32`, `x64-mingw-ucrt`, `x64-mingw32`, `x86-linux`, `x86_64-linux`, `arm-linux`, `aarch64-linux`, `x86_64-darwin` and `arm64-darwin`.
251+
Must be a space separated list out of `aarch64-linux-gnu`, `arm-linux-gnu`, `arm64-darwin`, `x64-mingw-ucrt`, `x64-mingw32`, `x86-linux-gnu`, `x86-mingw32`, `x86_64-darwin`, `x86_64-linux-gnu`.
241252
It is ignored when `rubyvm` is set to `:jruby`.
242253
* `RCD_IMAGE` - The docker image that is downloaded and started.
243254
Defaults to "ghcr.io/rake-compiler/rake-compiler-dock-image:IMAGE_VERSION-PLATFORM" with an image version that is determined by the gem version.

Rakefile

+8-7
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,16 @@ CLEAN.include("tmp")
99
RakeCompilerDock::GemHelper.install_tasks
1010

1111
platforms = [
12-
["x86-mingw32", "i686-w64-mingw32"],
13-
["x64-mingw32", "x86_64-w64-mingw32"],
12+
# tuple is [platform, target]
13+
["aarch64-linux-gnu", "aarch64-linux-gnu"],
14+
["arm-linux-gnu", "arm-linux-gnueabihf"],
15+
["arm64-darwin", "aarch64-apple-darwin"],
1416
["x64-mingw-ucrt", "x86_64-w64-mingw32"],
15-
["x86-linux", "i686-redhat-linux"],
16-
["x86_64-linux", "x86_64-redhat-linux"],
17+
["x64-mingw32", "x86_64-w64-mingw32"],
18+
["x86-linux-gnu", "i686-redhat-linux-gnu"],
19+
["x86-mingw32", "i686-w64-mingw32"],
1720
["x86_64-darwin", "x86_64-apple-darwin"],
18-
["arm64-darwin", "aarch64-apple-darwin"],
19-
["arm-linux", "arm-linux-gnueabihf"],
20-
["aarch64-linux", "aarch64-linux-gnu"],
21+
["x86_64-linux-gnu", "x86_64-redhat-linux-gnu"],
2122
]
2223

2324
namespace :build do

lib/rake_compiler_dock.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ module RakeCompilerDock
2626
#
2727
# Option +:platform+ can be set to a list of space separated values.
2828
# It selects the docker image(s) with an appropriate toolchain.
29-
# Allowed values are +:x86-mingw32+, +x64-mingw32+, +x86-linux+ or +x86_64-linux+.
29+
# Allowed values are +aarch64-linux-gnu+, +arm-linux-gnu+, +arm64-darwin+, +x64-mingw-ucrt+,
30+
# +x64-mingw32+, +x86-linux-gnu+, +x86-mingw32+, +x86_64-darwin+, +x86_64-linux-gnu+.
3031
# If the list contains multiple values, +cmd+ is consecutively executed in each of the docker images,
3132
# Option +:platform+ is ignored when +:rubyvm+ is set to +:jruby+.
3233
# Default is "x86-mingw32 x64-mingw32" .

test/rcd_test/Rakefile

+11-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,17 @@ else
1818
ext.ext_dir = 'ext/mri'
1919
ext.lib_dir = 'lib/rcd_test'
2020
ext.cross_compile = true
21-
ext.cross_platform = %w[x86-mingw32 x64-mingw-ucrt x64-mingw32 x86-linux x86_64-linux aarch64-linux arm-linux x86_64-darwin arm64-darwin]
21+
ext.cross_platform = %w[
22+
aarch64-linux-gnu
23+
arm-linux-gnu
24+
arm64-darwin
25+
x64-mingw-ucrt
26+
x64-mingw32
27+
x86-linux-gnu
28+
x86-mingw32
29+
x86_64-darwin
30+
x86_64-linux-gnu
31+
]
2232
end
2333
end
2434

test/test_starter.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def test_container_jrubyvm?
113113
assert(Starter.container_jrubyvm?({:rubyvm => "jruby"}))
114114
assert(Starter.container_jrubyvm?({:platform => "jruby"}))
115115
refute(Starter.container_jrubyvm?({:rubyvm => "mri"}))
116-
refute(Starter.container_jrubyvm?({:platform => "x86_64-linux"}))
116+
refute(Starter.container_jrubyvm?({:platform => "x86_64-linux-gnu"}))
117117
end
118118

119119
def test_platforms

0 commit comments

Comments
 (0)