Skip to content

Commit

Permalink
wip: change -linux to -linux-gnu everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
flavorjones committed Jan 15, 2024
1 parent 1fa0b59 commit 9a609e1
Show file tree
Hide file tree
Showing 10 changed files with 75 additions and 50 deletions.
28 changes: 14 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ jobs:
fail-fast: false
matrix:
platform:
- x86-mingw32
- aarch64-linux-gnu
- arm-linux-gnu
- arm64-darwin
- jruby
- x64-mingw-ucrt
- x64-mingw32
- x86-linux
- x86_64-linux
- x86-linux-gnu
- x86-mingw32
- x86_64-darwin
- arm64-darwin
- arm-linux
- aarch64-linux
- jruby
- x86_64-linux-gnu

runs-on: ubuntu-latest
env:
Expand Down Expand Up @@ -171,7 +171,7 @@ jobs:
- os: macos
platform: x86_64-darwin
- os: ubuntu
platform: x86_64-linux
platform: x86_64-linux-gnu
- os: ubuntu
ruby: jruby-head
platform: jruby
Expand Down Expand Up @@ -278,12 +278,12 @@ jobs:
fail-fast: false
matrix:
include:
- {platform: aarch64-linux, dockerfile: debian, from_image: arm64v8/ubuntu }
- {platform: arm-linux, dockerfile: alpine, from_image: arm32v6/alpine }
- {platform: arm-linux, dockerfile: debian, from_image: navikey/raspbian-bullseye }
- {platform: x86-linux, dockerfile: alpine, from_image: i386/alpine }
- {platform: x86_64-linux, dockerfile: alpine, from_image: alpine }
- {platform: x86_64-linux, dockerfile: centos, from_image: amd64/centos }
- {platform: aarch64-linux-gnu, dockerfile: debian, from_image: arm64v8/ubuntu }
- {platform: arm-linux-gnu, dockerfile: alpine, from_image: arm32v6/alpine }
- {platform: arm-linux-gnu, dockerfile: debian, from_image: navikey/raspbian-bullseye }
- {platform: x86-linux-gnu, dockerfile: alpine, from_image: i386/alpine }
- {platform: x86_64-linux-gnu, dockerfile: alpine, from_image: alpine }
- {platform: x86_64-linux-gnu, dockerfile: centos, from_image: amd64/centos }
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/publish-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ jobs:
fail-fast: false
matrix:
platform:
- x86-mingw32
- aarch64-linux-gnu
- arm-linux-gnu
- arm64-darwin
- x64-mingw-ucrt
- x64-mingw32
- x86-linux
- x86_64-linux
- x86-linux-gnu
- x86-mingw32
- x86_64-darwin
- arm64-darwin
- arm-linux
- aarch64-linux
- x86_64-linux-gnu
- jruby
runs-on: ubuntu-latest
steps:
Expand Down
9 changes: 4 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
/.bundle/
/.yardoc
/Dockerfile.mri.aarch64-linux
/Dockerfile.mri.arm-linux
/Dockerfile.mri.aarch64-linux-gnu
/Dockerfile.mri.arm-linux-gnu
/Dockerfile.mri.arm64-darwin
/Dockerfile.mri.arm64-linux
/Dockerfile.mri.x64-mingw-ucrt
/Dockerfile.mri.x64-mingw32
/Dockerfile.mri.x86-linux
/Dockerfile.mri.x86-linux-gnu
/Dockerfile.mri.x86-mingw32
/Dockerfile.mri.x86_64-darwin
/Dockerfile.mri.x86_64-linux
/Dockerfile.mri.x86_64-linux-gnu
/Gemfile.lock
/_yardoc/
/cache/
Expand Down
8 changes: 4 additions & 4 deletions Dockerfile.mri.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<%
image = case platform
when /x86_64-linux/ then "quay.io/pypa/manylinux2014_x86_64"
when /x86-linux/ then "quay.io/pypa/manylinux2014_i686"
when /x86_64-linux-gnu/ then "quay.io/pypa/manylinux2014_x86_64"
when /x86-linux-gnu/ then "quay.io/pypa/manylinux2014_i686"
else "ubuntu:20.04"
end
manylinux = !!(image =~ /manylinux/)
Expand Down Expand Up @@ -68,8 +68,8 @@ RUN dpkg -i /debs/*.deb
RUN apt-get -y update && \
apt-get install -y <%
if platform =~ /darwin/ %> clang python lzma-dev libxml2-dev libssl-dev libc++-10-dev <% end %><%
if platform =~ /aarch64-linux/ %> gcc-aarch64-linux-gnu g++-aarch64-linux-gnu <% end %><%
if platform =~ /arm-linux/ %> gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf <% end %><%
if platform =~ /aarch64-linux-gnu/ %> gcc-aarch64-linux-gnu g++-aarch64-linux-gnu <% end %><%
if platform =~ /arm-linux-gnu/ %> gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf <% end %><%
if platform =~ /x86-mingw32/ %> gcc-mingw-w64-i686 g++-mingw-w64-i686 <% end %><%
if platform =~ /x64-mingw32/ %> gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 <% end %> && \
rm -rf /var/lib/apt/lists/*
Expand Down
3 changes: 3 additions & 0 deletions History.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
next / unreleased
-----------------

* Linux builds and their images are now fully qualified with the libc flavor. So, `x86_64-linux`
should now be referred to as `x86_64-linux-gnu`, and the generated files are also named with the
libc name.
* Replace `rvm` with `rbenv` and `ruby-build`
- `rvm` has been replaced by `rbenv` and `ruby-build`
- no longer applying sendfile patches to bootstrap rubies
Expand Down
33 changes: 22 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Your Rakefile should enable cross compilation like so:
```ruby
exttask = Rake::ExtensionTask.new('my_extension', my_gem_spec) do |ext|
ext.cross_compile = true
ext.cross_platform = %w[x86-mingw32 x64-mingw-ucrt x64-mingw32 x86-linux x86_64-linux x86_64-darwin arm64-darwin]
ext.cross_platform = %w[x86-mingw32 x64-mingw-ucrt x64-mingw32 x86-linux-gnu x86_64-linux-gnu x86_64-darwin arm64-darwin]
end
```

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

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.
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.
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`.
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+.
This is to match the [changed platform of RubyInstaller-3.1](https://rubyinstaller.org/2021/12/31/rubyinstaller-3.1.0-1-released.html).

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

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

Or non-interactive:

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

```ruby
PLATFORMS = %w[
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
]
task 'gem:native' do
require 'rake_compiler_dock'
sh "bundle package --all" # Avoid repeated downloads of gems by using gem files from the host.
%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|
PLATFORMS.each do |plat|
RakeCompilerDock.sh "bundle --local && rake native:#{plat} gem", platform: plat
end
RakeCompilerDock.sh "bundle --local && rake java gem", rubyvm: :jruby
Expand Down Expand Up @@ -187,21 +198,21 @@ jobs:
name: "native-gem"
runs-on: ubuntu-latest
container:
image: "ghcr.io/rake-compiler/rake-compiler-dock-image:1.2.2-mri-x86_64-linux"
image: "ghcr.io/rake-compiler/rake-compiler-dock-image:1.2.2-mri-x86_64-linux-gnu"
steps:
- uses: actions/checkout@v2
- run: bundle install && bundle exec rake gem:x86_64-linux:rcd
- run: bundle install && bundle exec rake gem:x86_64-linux-gnu:rcd
- uses: actions/upload-artifact@v2
with:
name: native-gem
path: gems
retention-days: 1
```
Where the referenced rake task might be defined by:
Where the referenced rake task might be defined by something like:
``` ruby
cross_platforms = ["x64-mingw32", "x86_64-linux", "x86_64-darwin", "arm64-darwin"]
cross_platforms = ["x64-mingw32", "x86_64-linux-gnu", "x86_64-darwin", "arm64-darwin"]

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

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.:

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

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

Expand All @@ -237,7 +248,7 @@ The following variables are recognized by rake-compiler-dock:
* `RCD_RUBYVM` - The ruby VM and toolchain to be used.
Must be one of `mri`, `jruby`.
* `RCD_PLATFORM` - The target rubygems platform.
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`.
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`.
It is ignored when `rubyvm` is set to `:jruby`.
* `RCD_IMAGE` - The docker image that is downloaded and started.
Defaults to "ghcr.io/rake-compiler/rake-compiler-dock-image:IMAGE_VERSION-PLATFORM" with an image version that is determined by the gem version.
Expand Down
15 changes: 8 additions & 7 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,16 @@ CLEAN.include("tmp")
RakeCompilerDock::GemHelper.install_tasks

platforms = [
["x86-mingw32", "i686-w64-mingw32"],
["x64-mingw32", "x86_64-w64-mingw32"],
# tuple is [platform, target]
["aarch64-linux-gnu", "aarch64-linux-gnu"],
["arm-linux-gnu", "arm-linux-gnueabihf"],
["arm64-darwin", "aarch64-apple-darwin"],
["x64-mingw-ucrt", "x86_64-w64-mingw32"],
["x86-linux", "i686-redhat-linux"],
["x86_64-linux", "x86_64-redhat-linux"],
["x64-mingw32", "x86_64-w64-mingw32"],
["x86-linux-gnu", "i686-redhat-linux-gnu"],
["x86-mingw32", "i686-w64-mingw32"],
["x86_64-darwin", "x86_64-apple-darwin"],
["arm64-darwin", "aarch64-apple-darwin"],
["arm-linux", "arm-linux-gnueabihf"],
["aarch64-linux", "aarch64-linux-gnu"],
["x86_64-linux-gnu", "x86_64-redhat-linux-gnu"],
]

namespace :build do
Expand Down
3 changes: 2 additions & 1 deletion lib/rake_compiler_dock.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ module RakeCompilerDock
#
# Option +:platform+ can be set to a list of space separated values.
# It selects the docker image(s) with an appropriate toolchain.
# Allowed values are +:x86-mingw32+, +x64-mingw32+, +x86-linux+ or +x86_64-linux+.
# Allowed values are +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+.
# If the list contains multiple values, +cmd+ is consecutively executed in each of the docker images,
# Option +:platform+ is ignored when +:rubyvm+ is set to +:jruby+.
# Default is "x86-mingw32 x64-mingw32" .
Expand Down
12 changes: 11 additions & 1 deletion test/rcd_test/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,17 @@ else
ext.ext_dir = 'ext/mri'
ext.lib_dir = 'lib/rcd_test'
ext.cross_compile = true
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]
ext.cross_platform = %w[
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
]
end
end

Expand Down
2 changes: 1 addition & 1 deletion test/test_starter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def test_container_jrubyvm?
assert(Starter.container_jrubyvm?({:rubyvm => "jruby"}))
assert(Starter.container_jrubyvm?({:platform => "jruby"}))
refute(Starter.container_jrubyvm?({:rubyvm => "mri"}))
refute(Starter.container_jrubyvm?({:platform => "x86_64-linux"}))
refute(Starter.container_jrubyvm?({:platform => "x86_64-linux-gnu"}))
end

def test_platforms
Expand Down

0 comments on commit 9a609e1

Please sign in to comment.