rake-compiler-dock 1.9.1 → 1.11.0.rc1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/.github/workflows/ci.yml +74 -74
  4. data/.github/workflows/publish-images.yml +798 -46
  5. data/.github/workflows/publish-images.yml.erb +121 -0
  6. data/.github/workflows/release-images.yml +854 -45
  7. data/{History.md → CHANGELOG.md} +37 -0
  8. data/CONTRIBUTING.md +44 -1
  9. data/Dockerfile.jruby +3 -3
  10. data/Dockerfile.mri.erb +103 -58
  11. data/README.md +48 -6
  12. data/Rakefile +143 -40
  13. data/build/buildkitd.toml +2 -0
  14. data/build/gem_helper.rb +2 -2
  15. data/build/mk_musl_cross.sh +1 -1
  16. data/build/parallel_docker_build.rb +64 -23
  17. data/build/patches/{rake-compiler-1.2.9 → rake-compiler-1.3.1}/0004-Enable-build-of-static-libruby.patch +4 -2
  18. data/build/patches/{rake-compiler-1.2.9 → rake-compiler-1.3.1}/0005-build-miniruby-first.patch +2 -3
  19. data/build/patches/rake-compiler-1.3.1/0006-ruby-4-rubyspec-capiext.patch +16 -0
  20. data/build/sudoers +1 -1
  21. data/lib/rake_compiler_dock/starter.rb +11 -1
  22. data/lib/rake_compiler_dock/version.rb +2 -2
  23. data/lib/rake_compiler_dock.rb +12 -17
  24. data/mingw64-ucrt/README.md +0 -44
  25. data/test/env/Dockerfile.alpine +1 -1
  26. data/test/fixtures/mig_test_rpc.defs +8 -0
  27. data/test/rcd_test/Rakefile +1 -0
  28. data/test/rcd_test/ext/mri/extconf.rb +2 -0
  29. data/test/rcd_test/rcd_test.gemspec +1 -1
  30. data/test/rcd_test/test/test_basic.rb +11 -0
  31. data/test/test_environment_variables.rb +13 -0
  32. data/test/test_mig.rb +18 -0
  33. data/test/test_parallel_docker_build.rb +2 -2
  34. data/test/test_starter.rb +6 -0
  35. data/test/test_versions.rb +1 -1
  36. data.tar.gz.sig +0 -0
  37. metadata +39 -9
  38. metadata.gz.sig +0 -0
  39. data/test/env/Dockerfile.centos +0 -24
@@ -1,5 +1,42 @@
1
1
  # `rake-compiler/rake-compiler-dock` Changelog
2
2
 
3
+ ## 1.11.0.rc1 / 2025-12-18
4
+
5
+ ### Changes
6
+
7
+ - Add Ruby 4.0.0-preview2 cross-compilation support. @flavorjones
8
+ - Bump Ruby 3.3 to v3.3.10 (from v3.3.9) @flavorjones
9
+ - Bump Ruby 3.4 to v3.4.8 (from v3.4.5) @flavorjones
10
+ - Bump rake-compiler dependency to v1.3.1 (from v1.2.9) @flavorjones
11
+ - The default `rbenv` ruby in the container is now Ruby v3.4.8 (previously the default was 3.4.5).
12
+ - Optimized images by improving layer sharing. @larskanis
13
+
14
+ ### CRuby container summary
15
+
16
+ - native rubies: 4.0.0-preview2, 3.4.8 (default), 3.1.7
17
+ - `RUBY_CC_VERSION=4.0.0:3.4.8:3.3.10:3.2.9:3.1.7:3.0.7:2.7.8`
18
+
19
+
20
+ ## 1.10.0 / 2025-10-25
21
+
22
+ ### Changes
23
+
24
+ - Add support for ARM64 host images and release rake-compiler-dock host images for ARM64 and x86_64. #140
25
+ - Add new target platform `aarch64-mingw-ucrt` aka Windows on ARM. #152
26
+ - Allow easier selection of the ruby run in the container. #151
27
+ - Install `mig` which is a Macos specific RPC code generator. #155
28
+ - Add `RCD_IMAGE_VERSION` env var to easily set image version or `snapshot`. #163
29
+ - Disable `rpath` in cross compiled C extensions, since it is only valid in the build environment. #165
30
+ - Drop support for Ruby 2.4, 2.5, and 2.6. #153 @ianks @flavorjones
31
+ - Remove `rbenv` ruby version 2.5.9 from the build container. #153 @ianks @flavorjones
32
+ - Rename `History.md` to `CHANGELOG.md` which is more common.
33
+
34
+ ### CRuby container summary
35
+
36
+ - native rubies: 3.4.5 (default), 3.1.7
37
+ - `RUBY_CC_VERSION=3.4.5:3.3.9:3.2.9:3.1.7:3.0.7:2.7.8`
38
+
39
+
3
40
  ## v1.9.1 / 2025-01-20
4
41
 
5
42
  ### Features
data/CONTRIBUTING.md CHANGED
@@ -6,7 +6,7 @@ This document is intended for the rake-compiler-dock contributors.
6
6
 
7
7
  - prep
8
8
  - [ ] make sure CI is green!
9
- - [ ] update `History.md` and `lib/rake_compiler_dock/version.rb`
9
+ - [ ] update `CHANGELOG.md` and `lib/rake_compiler_dock/version.rb`
10
10
  - [ ] commit and create a git tag
11
11
  - option 1: build locally
12
12
  - build
@@ -64,3 +64,46 @@ docker buildx create --use --driver=docker-container
64
64
  bundle exec rake build
65
65
  ```
66
66
 
67
+
68
+ ### Create builder instance for two architectures
69
+
70
+ Building with qemu emulation fails currently with a segfault, so that it must be built by a builder instance with at least one remote node for the other architecture.
71
+ Building on native hardware is also much faster (~45 minutes) than on qemu.
72
+ A two-nodes builder requires obviously a ARM and a Intel/AMD device.
73
+ It can be created like this:
74
+
75
+ ```sh
76
+ # Make sure the remote instance can be connected
77
+ $ docker -H ssh://isa info
78
+
79
+ # Create a new builder with the local instance
80
+ # Disable the garbage collector by the config file
81
+ $ docker buildx create --name isayoga --config build/buildkitd.toml
82
+
83
+ # Add the remote instance
84
+ $ docker buildx create --name isayoga --config build/buildkitd.toml --append ssh://isa
85
+
86
+ # They are inactive from the start
87
+ $ docker buildx ls
88
+ NAME/NODE DRIVER/ENDPOINT STATUS BUILDKIT PLATFORMS
89
+ isayoga docker-container
90
+ \_ isayoga0 \_ unix:///var/run/docker.sock inactive
91
+ \_ isayoga1 \_ ssh://isa inactive
92
+ default* docker
93
+ \_ default \_ default running v0.13.2 linux/arm64
94
+
95
+ # Bootstrap the instances
96
+ $ docker buildx inspect --bootstrap --builder isayoga
97
+
98
+ # Set the new builder as default
99
+ $ docker buildx use isayoga
100
+
101
+ # Now it should be default and in state "running"
102
+ $ docker buildx ls
103
+ NAME/NODE DRIVER/ENDPOINT STATUS BUILDKIT PLATFORMS
104
+ isayoga* docker-container
105
+ \_ isayoga0 \_ unix:///var/run/docker.sock running v0.18.2 linux/arm64
106
+ \_ isayoga1 \_ ssh://isa running v0.18.2 linux/amd64, linux/amd64/v2, linux/amd64/v3, linux/386
107
+ default docker
108
+ \_ default \_ default running v0.13.2 linux/arm64
109
+ ```
data/Dockerfile.jruby CHANGED
@@ -48,9 +48,9 @@ COPY build/patches /home/rubyuser/patches
48
48
  RUN bash -c " \
49
49
  for v in ${RBENV_RUBIES} ; do \
50
50
  rbenv shell \$v && \
51
- gem install rake-compiler -v1.2.9 && \
52
- cd ${RBENV_ROOT}/versions/\$v/lib/ruby/gems/*/gems/rake-compiler-1.2.9 && \
53
- for patch in /home/rubyuser/patches/rake-compiler-1.2.9/*.patch ; do \
51
+ gem install rake-compiler -v1.3.1 && \
52
+ cd ${RBENV_ROOT}/versions/\$v/lib/ruby/gems/*/gems/rake-compiler-1.3.1 && \
53
+ for patch in /home/rubyuser/patches/rake-compiler-1.3.1/*.patch ; do \
54
54
  patch -p1 < \$patch ; \
55
55
  done \
56
56
  done \
data/Dockerfile.mri.erb CHANGED
@@ -1,6 +1,8 @@
1
1
  <% image = "ubuntu:20.04" %>
2
2
  FROM <%= image %>
3
3
 
4
+ ARG TARGETPLATFORM
5
+
4
6
  ##
5
7
  ## Install required base packages for compiling ruby
6
8
  ##
@@ -10,43 +12,6 @@ RUN apt-get -y update && \
10
12
  apt-get install -y autoconf cmake pkg-config zlib1g-dev libreadline-dev libsqlite0-dev libssl-dev libyaml-dev libffi-dev && \
11
13
  rm -rf /var/lib/apt/lists/*
12
14
 
13
- ##
14
- ## Install cross compilers
15
- ##
16
- <% if platform =~ /x64-mingw-ucrt/ %>
17
- COPY --from=larskanis/mingw64-ucrt:20.04 \
18
- /build/binutils-mingw-w64-x86-64_*.deb \
19
- /build/g++-mingw-w64-x86-64_*.deb \
20
- /build/gcc-mingw-w64-base_*.deb \
21
- /build/gcc-mingw-w64-x86-64_*.deb \
22
- /build/mingw-w64-common_*.deb \
23
- /build/mingw-w64-x86-64-dev_*.deb \
24
- /debs/
25
- RUN dpkg -i /debs/*.deb
26
-
27
- <% elsif platform =~ /linux-musl/ %>
28
- COPY build/mk_musl_cross.sh /tmp
29
- RUN /tmp/mk_musl_cross.sh <%= target %>
30
-
31
- <% else %>
32
- RUN apt-get -y update && \
33
- apt-get install -y <%
34
- if platform =~ /darwin/ %> clang python lzma-dev libxml2-dev libssl-dev libc++-10-dev <% end %><%
35
- if platform =~ /aarch64-linux-gnu/ %> gcc-aarch64-linux-gnu g++-aarch64-linux-gnu <% end %><%
36
- if platform =~ /arm-linux-gnu/ %> gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf <% end %><%
37
- if platform =~ /x86-linux-gnu/ %> gcc-i686-linux-gnu g++-i686-linux-gnu <% end %><%
38
- if platform =~ /x86_64-linux-gnu/ %> gcc-x86-64-linux-gnu g++-x86-64-linux-gnu <% end %><%
39
- if platform =~ /x86-mingw32/ %> gcc-mingw-w64-i686 g++-mingw-w64-i686 <% end %><%
40
- if platform =~ /x64-mingw32/ %> gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 <% end %> && \
41
- rm -rf /var/lib/apt/lists/*
42
- <% end %>
43
-
44
- <% if platform =~ /darwin/ %>
45
- COPY build/mk_osxcross.sh /tmp
46
- RUN /tmp/mk_osxcross.sh
47
- <% end %>
48
-
49
-
50
15
  ##
51
16
  ## install rbenv and ruby-build
52
17
  ##
@@ -74,7 +39,7 @@ ENV BASH_ENV=/etc/rubybashrc
74
39
  ##
75
40
  USER rubyuser
76
41
 
77
- ENV RBENV_RUBIES="2.5.9 3.1.6 3.4.1"
42
+ ENV RBENV_RUBIES="3.1.7 3.4.8 4.0.0-preview2"
78
43
 
79
44
  # Install the bootstrap rubies
80
45
  RUN bash -c " \
@@ -91,9 +56,9 @@ COPY build/patches /home/rubyuser/patches
91
56
  RUN bash -c " \
92
57
  for v in ${RBENV_RUBIES} ; do \
93
58
  rbenv shell \$v && \
94
- gem install rake-compiler -v1.2.9 && \
95
- cd ${RBENV_ROOT}/versions/\$v/lib/ruby/gems/*/gems/rake-compiler-1.2.9 && \
96
- for patch in /home/rubyuser/patches/rake-compiler-1.2.9/*.patch ; do \
59
+ gem install rake-compiler -v1.3.1 && \
60
+ cd ${RBENV_ROOT}/versions/\$v/lib/ruby/gems/*/gems/rake-compiler-1.3.1 && \
61
+ for patch in /home/rubyuser/patches/rake-compiler-1.3.1/*.patch ; do \
97
62
  patch -p1 < \$patch ; \
98
63
  done \
99
64
  done \
@@ -104,9 +69,80 @@ RUN sudo mkdir -p /usr/local/rake-compiler && \
104
69
  sudo chown rubyuser.rubyuser /usr/local/rake-compiler && \
105
70
  ln -s /usr/local/rake-compiler ~/.rake-compiler
106
71
 
72
+ USER root
73
+
74
+ ##
75
+ ## Install cross compilers
76
+ ##
77
+ <% if platform =~ /x64-mingw-ucrt/ %>
78
+ COPY --from=larskanis/mingw64-ucrt:20.04 \
79
+ /build/binutils-mingw-w64-x86-64_*.deb \
80
+ /build/g++-mingw-w64-x86-64_*.deb \
81
+ /build/gcc-mingw-w64-base_*.deb \
82
+ /build/gcc-mingw-w64-x86-64_*.deb \
83
+ /build/mingw-w64-common_*.deb \
84
+ /build/mingw-w64-x86-64-dev_*.deb \
85
+ /debs/
86
+ RUN dpkg -i /debs/*.deb
87
+
88
+ <% elsif platform =~ /aarch64-mingw-ucrt/ %>
89
+
90
+ RUN <<EOF
91
+ if [ "$TARGETPLATFORM" = "linux/amd64" ]; then
92
+ DOWNLOAD_PLATFORM="x86_64";
93
+ elif [ "$TARGETPLATFORM" = "linux/arm64" ]; then
94
+ DOWNLOAD_PLATFORM="aarch64";
95
+ else
96
+ echo "Unsupported platform $TARGETPLATFORM";
97
+ exit 1;
98
+ fi &&
99
+ wget https://github.com/mstorsjo/llvm-mingw/releases/download/20250114/llvm-mingw-20250114-ucrt-ubuntu-20.04-$DOWNLOAD_PLATFORM.tar.xz &&
100
+ tar xf llvm-mingw*.tar.xz &&
101
+ mv `ls -d llvm-mingw-*/` /llvm-mingw &&
102
+ echo "export PATH=/llvm-mingw/bin:\$PATH" >> /etc/rubybashrc &&
103
+ rm -r /llvm-mingw/bin/i686-w64* /llvm-mingw/bin/armv7-w64* /llvm-mingw/bin/x86_64-w64* /llvm-mingw/i686-w64* /llvm-mingw/armv7-w64* /llvm-mingw/x86_64-w64*
104
+ EOF
105
+
106
+ <% elsif platform =~ /linux-musl/ %>
107
+ COPY build/mk_musl_cross.sh /tmp
108
+ RUN /tmp/mk_musl_cross.sh <%= target %>
109
+
110
+ <% else %>
111
+ RUN apt-get -y update && \
112
+ apt-get install -y <%
113
+ if platform =~ /darwin/ %> clang python lzma-dev libxml2-dev libssl-dev libc++-10-dev <% end %><%
114
+ if platform =~ /aarch64-linux-gnu/ %> gcc-aarch64-linux-gnu g++-aarch64-linux-gnu <% end %><%
115
+ if platform =~ /arm-linux-gnu/ %> gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf <% end %><%
116
+ if platform =~ /x86-linux-gnu/ %> gcc-i686-linux-gnu g++-i686-linux-gnu <% end %><%
117
+ if platform =~ /x86_64-linux-gnu/ %> gcc-x86-64-linux-gnu g++-x86-64-linux-gnu <% end %><%
118
+ if platform =~ /x86-mingw32/ %> gcc-mingw-w64-i686 g++-mingw-w64-i686 <% end %><%
119
+ if platform =~ /x64-mingw32/ %> gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 <% end %> && \
120
+ rm -rf /var/lib/apt/lists/*
121
+ <% end %>
122
+
123
+ <% if platform =~ /darwin/ %>
124
+ COPY build/mk_osxcross.sh /tmp
125
+ RUN /tmp/mk_osxcross.sh
126
+
127
+ # Install mig which is a Macos specific RPC code generator, which is part of xcode
128
+ RUN apt-get -y update && \
129
+ apt-get install -y bison flex && \
130
+ rm -rf /var/lib/apt/lists/*
131
+ RUN git clone --branch=cross_platform https://github.com/markmentovai/bootstrap_cmds && \
132
+ cd bootstrap_cmds && \
133
+ autoreconf --install && \
134
+ sh configure && \
135
+ make && \
136
+ sed -E -i 's/^cppflags=(.*)/cppflags=(\1 "-D<%= platform =~ /arm64/ ? "__arm64__" : "__x86_64__" %>" "-I\/opt\/osxcross\/target\/SDK\/MacOSX11.1.sdk\/usr\/include")/' migcom.tproj/mig.sh && \
137
+ sudo make install && \
138
+ cd .. && \
139
+ rm -rf bootstrap_cmds
140
+ <% end %>
141
+
142
+ USER rubyuser
143
+
107
144
  <%
108
145
  #
109
- # Build ruby versions prior to ruby2_keywords using ruby-2.5
110
146
  # Build ruby versions with ruby2_keywords using ruby-3.x
111
147
  #
112
148
  # Note that parallel builds of ruby with make flag `-j` are often flaky, see
@@ -115,23 +151,27 @@ RUN sudo mkdir -p /usr/local/rake-compiler && \
115
151
  xrubies_build_plan = if platform =~ /x64-mingw-ucrt/
116
152
  [
117
153
  # Rubyinstaller-3.1+ is platform x64-mingw-ucrt
118
- ["3.4.1:3.3.7:3.2.6:3.1.6", "3.4.1"],
154
+ ["3.4.8:3.3.10:3.2.9:3.1.7", "3.4.8"],
155
+ ["4.0.0-preview2", "4.0.0-preview2"],
156
+ ]
157
+ elsif platform =~ /aarch64-mingw-ucrt/
158
+ [
159
+ ["3.4.8", "3.1.7"],
119
160
  ]
120
161
  elsif platform =~ /x64-mingw32/
121
162
  [
122
163
  # Rubyinstaller prior to 3.1 is platform x64-mingw32
123
- ["2.6.10:2.5.9:2.4.10", "2.5.9"],
124
- ["3.0.7:2.7.8", "3.1.6"],
164
+ ["3.0.7:2.7.8", "3.1.7"],
125
165
  ]
126
166
  else
127
167
  [
128
- ["2.6.10:2.5.9:2.4.10", "2.5.9"],
129
- ["2.7.8", "3.1.6"],
130
- ["3.4.1:3.3.7:3.2.6:3.1.6:3.0.7", "3.4.1"],
168
+ ["2.7.8", "3.1.7"],
169
+ ["3.4.8:3.3.10:3.2.9:3.1.7:3.0.7", "3.4.8"],
170
+ ["4.0.0-preview2", "4.0.0-preview2"],
131
171
  ]
132
172
  end
133
173
 
134
- strip = '-s' if platform !~ /darwin/
174
+ strip = '-s' if platform !~ /darwin|aarch64-mingw/
135
175
 
136
176
  xrubies_build_plan.each do |xrubies, bootstrap_ruby_version| %>
137
177
  RUN bash -c " \
@@ -139,7 +179,7 @@ RUN bash -c " \
139
179
  export CPPFLAGS='<%= "-D__USE_MINGW_ANSI_STDIO=1" if platform =~ /x64-mingw-ucrt/ %>' && \
140
180
  export CFLAGS='-O1 -fno-omit-frame-pointer -fno-fast-math -fstack-protector-strong <%= strip %>' && \
141
181
  export LDFLAGS='-pipe <%= strip %>' && \
142
- <%= "export LIBS='-l:libssp.a' &&" if platform =~ /mingw/ %> \
182
+ <%= "export LIBS='-l:libssp.a -lpthread' &&" if platform =~ /mingw/ %> \
143
183
  <%= "export CC=#{target}-clang &&" if platform =~ /darwin/ %> \
144
184
  export MAKE='make V=1' && \
145
185
  rake-compiler cross-ruby VERSION=<%= xrubies %> HOST=<%= target %> && \
@@ -160,15 +200,10 @@ RUN find /usr/local/rake-compiler/ruby/*linux*/ -name mkmf.rb | while read f ; d
160
200
  <% if platform =~ /mingw/ %>
161
201
  # RubyInstaller doesn't install libgcc -> link it static.
162
202
  RUN find /usr/local/rake-compiler/ruby/*mingw*/ -name rbconfig.rb | while read f ; do sed -i 's/."LDFLAGS". = "/&-static-libgcc /' $f ; done
163
- # Raise Windows-API to Vista (affects ruby < 2.6 only)
164
- RUN find /usr/local/rake-compiler/ruby -name rbconfig.rb | while read f ; do sed -i 's/0x0501/0x0600/' $f ; done
165
203
  # Don't link to static libruby
166
204
  RUN find /usr/local/rake-compiler/ruby -name lib*-ruby*.dll.a | while read f ; do n=`echo $f | sed s/.dll//` ; mv $f $n ; done
167
205
  <% end %>
168
206
 
169
- # ruby-2.5 links to libcrypt, which isn't necessary for extensions
170
- RUN find /usr/local/rake-compiler/ruby -name rbconfig.rb | while read f ; do sed -i 's/-lcrypt//' $f ; done
171
-
172
207
  <% if platform =~ /darwin/ %>
173
208
  # for rubies which use `-bundle_loader` on darwin
174
209
  # - the upstream change: https://github.com/ruby/ruby/pull/6193
@@ -187,7 +222,7 @@ RUN find /usr/local/rake-compiler/ruby/*/*/lib/ruby -name rbconfig.rb | while re
187
222
  ##
188
223
  USER root
189
224
 
190
- <% if platform =~ /mingw/ %>
225
+ <% if platform =~ /(x64|x86)-mingw/ %>
191
226
  # Install wrappers for strip commands as a workaround for "Protocol error" in boot2docker.
192
227
  COPY build/strip_wrapper_vbox /root/
193
228
  RUN mv /usr/bin/<%= target %>-strip /usr/bin/<%= target %>-strip.bin && \
@@ -200,6 +235,16 @@ RUN printf "1\n" | update-alternatives --config <%= target %>-gcc && \
200
235
  printf "1\n" | update-alternatives --config <%= target %>-g++
201
236
  <% end %>
202
237
 
238
+ <% if platform =~ /aarch64-mingw/ %>
239
+ # Fool libtool to allow building a shared library although linking to libclang_rt.builtins-aarch64.a
240
+ #
241
+ # Linker option "-llibclang_rt.builtins-aarch64.a" is required on Windows on ARM when compiling C++ and when clang is called with -nostdlib (due to be invoked by libtool).
242
+ # Unfortunately libtool then forces a static build.
243
+ # This is a ugly hack to make libtool beleave that the library is a DLL instead of an archive and to allow building a DLL instand.
244
+ #
245
+ RUN sudo cp /llvm-mingw/aarch64-w64-mingw32/bin/libc++.dll /llvm-mingw/aarch64-w64-mingw32/lib/libclang_rt.builtins-aarch64.0
246
+ <% end %>
247
+
203
248
  <% if platform =~ /darwin/ %>
204
249
  # Install wrapper around strip to re-sign binaries (ad-hoc signature)
205
250
  COPY build/strip_wrapper_codesign /root/
@@ -224,8 +269,8 @@ RUN echo 'source /etc/profile.d/rcd-env.sh' >> /etc/rubybashrc
224
269
  # Install sudoers configuration
225
270
  COPY build/sudoers /etc/sudoers.d/rake-compiler-dock
226
271
 
227
- RUN bash -c "rbenv global 3.4.1"
272
+ RUN bash -c "rbenv global 3.4.8"
228
273
 
229
- ENV RUBY_CC_VERSION=3.4.1:3.3.7:3.2.6:3.1.6:3.0.7:2.7.8:2.6.10:2.5.9:2.4.10
274
+ ENV RUBY_CC_VERSION=4.0.0:3.4.8:3.3.10:3.2.9:3.1.7:3.0.7:2.7.8
230
275
 
231
276
  CMD bash
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  **Easy to use and reliable cross compiler environment for building Windows, Linux, Mac and JRuby binary gems.**
4
4
 
5
- It provides cross compilers and Ruby environments for 2.4 and newer versions of the [RubyInstaller](http://rubyinstaller.org/) and Linux runtime environments.
5
+ It provides cross compilers and Ruby environments for 2.6 and newer versions of the [RubyInstaller](http://rubyinstaller.org/) and Linux runtime environments.
6
6
  They are prepared for use with [rake-compiler](https://github.com/rake-compiler/rake-compiler).
7
7
  It is used by [many gems with C or JRuby extentions](https://github.com/rake-compiler/rake-compiler-dock/wiki/Projects-using-rake-compiler-dock).
8
8
 
@@ -16,6 +16,7 @@ The following platforms are supported for cross-compilation by rake-compiler-doc
16
16
 
17
17
  - `aarch64-linux` and `aarch64-linux-gnu`
18
18
  - `aarch64-linux-musl`
19
+ - `aarch64-mingw-ucrt`
19
20
  - `arm-linux` and `arm-linux-gnu`
20
21
  - `arm-linux-musl`
21
22
  - `arm64-darwin`
@@ -72,8 +73,6 @@ Ruby version 3.1 and later ship with a sufficient Rubygems version. For earlier
72
73
  - ruby: "3.0", rubygems: "3.5.5" # or possibly higher
73
74
  - ruby: "2.7", rubygems: "3.4.22"
74
75
  - ruby: "2.6", rubygems: "3.4.22"
75
- - ruby: "2.5", rubygems: "3.3.26"
76
- - ruby: "2.4", rubygems: "3.3.26"
77
76
 
78
77
  **It's strongly suggested that you use rake-compiler v1.2.7 or later to build `linux-musl` and/or `linux-gnu` native gems.** That version of rake-compiler sets `required_rubygems_version` automatically in the native platform gems' gemspecs.
79
78
 
@@ -193,6 +192,7 @@ This can be done like this:
193
192
  PLATFORMS = %w[
194
193
  aarch64-linux-gnu
195
194
  aarch64-linux-musl
195
+ aarch64-mingw-ucrt
196
196
  arm-linux-gnu
197
197
  arm-linux-musl
198
198
  arm64-darwin
@@ -207,7 +207,8 @@ PLATFORMS = %w[
207
207
  ]
208
208
  task 'gem:native' do
209
209
  require 'rake_compiler_dock'
210
- sh "bundle package --all" # Avoid repeated downloads of gems by using gem files from the host.
210
+ sh "bundle config set cache_all true" # Avoid repeated downloads of gems by using gem files from the host.
211
+ sh "bundle package"
211
212
  PLATFORMS.each do |plat|
212
213
  RakeCompilerDock.sh "bundle --local && rake native:#{plat} gem", platform: plat
213
214
  end
@@ -231,7 +232,8 @@ Please note, that parallel builds only work reliable, if the specific platform g
231
232
  task 'prepare' do
232
233
  require 'rake_compiler_dock'
233
234
  require 'io/console'
234
- sh "bundle package --all"
235
+ sh "bundle config set cache_all true"
236
+ sh "bundle package"
235
237
  sh "cp ~/.gem/gem-*.pem build/gem/ || true"
236
238
  ENV["GEM_PRIVATE_KEY_PASSPHRASE"] = STDIN.getpass("Enter passphrase of gem signature key: ")
237
239
  end
@@ -313,6 +315,7 @@ OCI images snapshotted from `main` are published weekly to Github Container Regi
313
315
  - `ghcr.io/rake-compiler/rake-compiler-dock-image:snapshot-mri-x86_64-linux-gnu`
314
316
 
315
317
  These images are intended for integration testing. They may not work properly and should not be considered production ready.
318
+ Snapshot images can be used by setting `RCD_IMAGE_VERSION` environment variable.
316
319
 
317
320
 
318
321
  ## Environment Variables
@@ -328,6 +331,9 @@ The following variables are recognized by rake-compiler-dock:
328
331
  It is ignored when `rubyvm` is set to `:jruby`.
329
332
  * `RCD_IMAGE` - The docker image that is downloaded and started.
330
333
  Defaults to "ghcr.io/rake-compiler/rake-compiler-dock-image:IMAGE_VERSION-PLATFORM" with an image version that is determined by the gem version.
334
+ * `RCD_IMAGE_VERSION` - The docker image version that is downloaded and started.
335
+ Defaults to the version of the rake-compiler-dock gem in use.
336
+ Can be set to `snapshot` in order to use the latest images from main branch.
331
337
 
332
338
  The following variables are passed through to the docker container without modification:
333
339
 
@@ -352,6 +358,42 @@ Other environment variables can be set or passed through to the container like t
352
358
  RakeCompilerDock.sh "rake cross native gem OPENSSL_VERSION=#{ENV['OPENSSL_VERSION']}"
353
359
  ```
354
360
 
361
+ ### Choosing the version of ruby to run in the build container
362
+
363
+ There are [multiple versions of Ruby installed in the build container](https://github.com/rake-compiler/rake-compiler-dock/blob/d3e6b44916d9d63d4c431b8c749a2c58bf1fe8e8/Dockerfile.mri.erb#L77). The latest version will be the default, but you may need to choose a different version to run during your build process.
364
+
365
+ You can do this by passing a `ruby:` keyword argument to `RakeCompilerDock.sh`:
366
+
367
+ ```ruby
368
+ RakeCompilerDock.sh "ruby -v"
369
+ # => ruby 3.4.1 (2024-12-25 revision 48d4efcb85) +PRISM [x86_64-linux]
370
+
371
+ RakeCompilerDock.sh "ruby -v", ruby: "3.1.6"
372
+ # => ruby 3.1.6p260 (2024-05-29 revision a777087be6) [x86_64-linux]48d4efcb85) +PRISM [x86_64-linux]
373
+ ```
374
+
375
+ Or by setting the environment variable `RCD_RUBY_VERSION`:
376
+
377
+ ``` sh
378
+ $ rake-compiler-dock bash -c "ruby -v"
379
+ ruby 3.4.1 (2024-12-25 revision 48d4efcb85) +PRISM [x86_64-linux]
380
+
381
+ $ RCD_RUBY_VERSION=3.1.6 rake-compiler-dock bash -c "ruby -v"
382
+ ruby 3.1.6p260 (2024-05-29 revision a777087be6) [x86_64-linux]
383
+ ```
384
+
385
+ Or by running `rbenv shell` in the command:
386
+
387
+ ``` ruby
388
+ RakeCompilerDock.sh "rbenv shell 3.1.6 && ruby -v", platform: "x86_64-linux-gnu"
389
+ # => ruby 3.1.6p260 (2024-05-29 revision a777087be6) [x86_64-linux]
390
+ ```
391
+
392
+ ``` sh
393
+ $ rake-compiler-dock bash -c "rbenv shell 3.1.6 && ruby -v"
394
+ ruby 3.1.6p260 (2024-05-29 revision a777087be6) [x86_64-linux]
395
+ ```
396
+
355
397
  ### Choosing specific Ruby versions to support
356
398
 
357
399
  If you only want to precompile for certain Ruby versions, you can specify those versions by overwriting the `RUBY_CC_VERSION` environment variable.
@@ -362,7 +404,7 @@ For example, if you wanted to only support Ruby 3.4 and 3.3, you might set this
362
404
  ENV["RUBY_CC_VERSION"] = "3.4.1:3.3.7"
363
405
  ```
364
406
 
365
- In practice, though, hardcoding these versions is brittle because the patch versions in the container may very from release to release.
407
+ In practice, though, hardcoding these versions is brittle because the patch versions in the container may vary from release to release.
366
408
 
367
409
  A more robust way to do this is to use `RakeCompilerDock.ruby_cc_version` which accepts an array of Ruby minor versions or patch version requirements.
368
410