Skip to content

Commit

Permalink
wip: add arm-linux-musl
Browse files Browse the repository at this point in the history
note that we have to patch rake-compiler to build ruby 2.7 on 32-byte
arm because of coroutine issues that weren't fixed until 3.0.
  • Loading branch information
flavorjones committed Jan 18, 2024
1 parent ee2db79 commit 5dd8998
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 8 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ jobs:
alias: aarch64-linux
- platform: arm-linux-gnu
alias: arm-linux
- platform: arm-linux-musl
- platform: arm64-darwin
- platform: jruby
- platform: x64-mingw-ucrt
Expand Down Expand Up @@ -317,6 +318,69 @@ jobs:
ruby -rrcd_test -S rake test
"
test_arm-linux-gnu:
name: arm-linux-gnu
needs: build_native_gem
strategy:
fail-fast: false
matrix:
ruby: ["3.3", "3.2", "3.1", "3.0", "2.7", "2.6", "2.5", "2.4"]
platform: [arm-linux, arm-linux-gnu]
# include:
# # ruby 3.0 and earlier ship rubygems < 3.2.33, so can't recognize the -gnu suffix
# - ruby: "3.3"
# platform: arm-linux-gnu
# - ruby: "3.2"
# platform: arm-linux-gnu
# - ruby: "3.1"
# platform: arm-linux-gnu
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Download gem-${{ matrix.platform }}
uses: actions/download-artifact@v3
with:
name: gem-${{ matrix.platform }}
- name: Run tests
run: |
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker run --rm -v $PWD:/work -w /work \
--platform=linux/arm/v7 ruby:${{ matrix.ruby }} \
sh -c "
gem install --local *.gem --verbose &&
cd test/rcd_test/ &&
bundle install &&
ruby -rrcd_test -S rake test
"
test_arm-linux-musl:
name: arm-linux-musl
needs: build_native_gem
strategy:
fail-fast: false
matrix:
# ruby: ["3.3", "3.2", "3.1", "3.0", "2.7"] # ruby:2.6-alpine and earlier ship with rubygems that doesn't recognize the -musl suffix
ruby: ["3.3", "3.2", "3.1", "3.0", "2.7", "2.6", "2.5", "2.4"]
platform: [arm-linux-musl]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Download gem-${{ matrix.platform }}
uses: actions/download-artifact@v3
with:
name: gem-${{ matrix.platform }}
- name: Run tests
run: |
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker run --rm -v $PWD:/work -w /work \
--platform=linux/arm/v7 ruby:${{ matrix.ruby }}-alpine \
sh -c "
gem install --local *.gem --verbose &&
cd test/rcd_test/ &&
bundle install &&
ruby -rrcd_test -S rake test
"
test_native_gem:
name: test native
needs: build_native_gem
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/.yardoc
/Dockerfile.mri.aarch64-linux-gnu
/Dockerfile.mri.arm-linux-gnu
/Dockerfile.mri.arm-linux-musl
/Dockerfile.mri.arm64-darwin
/Dockerfile.mri.x64-mingw-ucrt
/Dockerfile.mri.x64-mingw32
Expand Down
8 changes: 3 additions & 5 deletions Dockerfile.mri.erb
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,9 @@ else
]
end

xrubies_build_plan.each do |xrubies, bootstrap_ruby_version| %>
ENV XRUBIES <%= xrubies %>
strip = '-s' if platform !~ /darwin/

<% strip = '-s' if platform !~ /darwin/ %>
# Build xruby versions, then cleanup all build artifacts
xrubies_build_plan.each do |xrubies, bootstrap_ruby_version| %>
RUN bash -c " \
rbenv shell <%= bootstrap_ruby_version %> && \
export CPPFLAGS='<%= "-D__USE_MINGW_ANSI_STDIO=1" if platform =~ /x64-mingw-ucrt/ %>' && \
Expand All @@ -161,7 +159,7 @@ RUN bash -c " \
<%= "export LIBS='-l:libssp.a' &&" if platform =~ /mingw/ %> \
<%= "export CC=#{target}-clang &&" if platform =~ /darwin/ %> \
export MAKE='make V=1' && \
rake-compiler cross-ruby VERSION=$XRUBIES HOST=<%= target %> && \
rake-compiler cross-ruby VERSION=<%= xrubies %> HOST=<%= target %> && \
rm -rf ~/.rake-compiler/builds ~/.rake-compiler/sources \
"
<% end %>
Expand Down
1 change: 1 addition & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ platforms = [
# tuple is [platform, target]
["aarch64-linux-gnu", "aarch64-linux-gnu"],
["arm-linux-gnu", "arm-linux-gnueabihf"],
["arm-linux-musl", "arm-linux-musleabihf"],
["arm64-darwin", "aarch64-apple-darwin"],
["x64-mingw-ucrt", "x86_64-w64-mingw32"],
["x64-mingw32", "x86_64-w64-mingw32"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ diff --git a/tasks/bin/cross-ruby.rake b/tasks/bin/cross-ruby.rake
index 8317a2a..5a1b3ea 100644
--- a/tasks/bin/cross-ruby.rake
+++ b/tasks/bin/cross-ruby.rake
@@ -116,10 +116,22 @@ RUBY_CC_VERSIONS.split(":").each do |ruby_cc_version|
@@ -116,10 +116,26 @@ RUBY_CC_VERSIONS.split(":").each do |ruby_cc_version|
"--host=#{mingw_host}",
"--target=#{mingw_target}",
"--build=#{RUBY_BUILD}",
Expand All @@ -12,7 +12,8 @@ index 8317a2a..5a1b3ea 100644
'--disable-install-doc',
'--with-ext=',
]
+ if mingw_host=~/darwin/

+ if mingw_host =~ /darwin/
+ options += [
+ '--enable-static',
+ '--disable-shared',
Expand All @@ -23,6 +24,9 @@ index 8317a2a..5a1b3ea 100644
+ '--enable-shared',
+ ]
+ end

+
+ # https://github.com/docker-library/ruby/issues/308
+ options << "--with-coroutine=arm32" if major == "2.7" && mingw_target =~ /arm-linux-musl/
+
# Force Winsock2 for Ruby 1.8, 1.9 defaults to it
options << "--with-winsock2" if major == "1.8"
1 change: 1 addition & 0 deletions test/rcd_test/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ else
aarch64-linux-gnu
arm-linux
arm-linux-gnu
arm-linux-musl
arm64-darwin
x64-mingw-ucrt
x64-mingw32
Expand Down

0 comments on commit 5dd8998

Please sign in to comment.