rake-compiler-dock 1.10.0 → 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.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/.github/workflows/ci.yml +16 -10
- data/.github/workflows/publish-images.yml +759 -42
- data/.github/workflows/publish-images.yml.erb +121 -0
- data/.github/workflows/release-images.yml +823 -50
- data/CHANGELOG.md +20 -1
- data/Dockerfile.jruby +3 -3
- data/Dockerfile.mri.erb +66 -61
- data/Rakefile +91 -32
- data/build/gem_helper.rb +1 -1
- data/build/parallel_docker_build.rb +55 -18
- data/build/patches/{rake-compiler-1.2.9 → rake-compiler-1.3.1}/0004-Enable-build-of-static-libruby.patch +1 -1
- data/build/patches/{rake-compiler-1.2.9 → rake-compiler-1.3.1}/0005-build-miniruby-first.patch +2 -3
- data/build/patches/rake-compiler-1.3.1/0006-ruby-4-rubyspec-capiext.patch +16 -0
- data/lib/rake_compiler_dock/version.rb +2 -2
- data/lib/rake_compiler_dock.rb +8 -7
- data/test/test_parallel_docker_build.rb +2 -2
- data/test/test_versions.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +5 -3
- metadata.gz.sig +0 -0
data/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,25 @@
|
|
|
1
1
|
# `rake-compiler/rake-compiler-dock` Changelog
|
|
2
2
|
|
|
3
|
-
## 1.
|
|
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
|
|
4
23
|
|
|
5
24
|
- Add support for ARM64 host images and release rake-compiler-dock host images for ARM64 and x86_64. #140
|
|
6
25
|
- Add new target platform `aarch64-mingw-ucrt` aka Windows on ARM. #152
|
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.
|
|
52
|
-
cd ${RBENV_ROOT}/versions/\$v/lib/ruby/gems/*/gems/rake-compiler-1.
|
|
53
|
-
for patch in /home/rubyuser/patches/rake-compiler-1.
|
|
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
|
@@ -12,6 +12,65 @@ RUN apt-get -y update && \
|
|
|
12
12
|
apt-get install -y autoconf cmake pkg-config zlib1g-dev libreadline-dev libsqlite0-dev libssl-dev libyaml-dev libffi-dev && \
|
|
13
13
|
rm -rf /var/lib/apt/lists/*
|
|
14
14
|
|
|
15
|
+
##
|
|
16
|
+
## install rbenv and ruby-build
|
|
17
|
+
##
|
|
18
|
+
RUN groupadd -r rubyuser && useradd -r -g rubyuser -G sudo -p "" --create-home rubyuser
|
|
19
|
+
|
|
20
|
+
ENV RBENV_ROOT=/usr/local/rbenv
|
|
21
|
+
|
|
22
|
+
# chown after running `rbenv init` because that command creates some subdirectories
|
|
23
|
+
RUN git clone https://github.com/rbenv/rbenv.git ${RBENV_ROOT} && \
|
|
24
|
+
git clone https://github.com/rbenv/ruby-build.git ${RBENV_ROOT}/plugins/ruby-build && \
|
|
25
|
+
\
|
|
26
|
+
echo "export RBENV_ROOT=/usr/local/rbenv" >> /etc/rubybashrc && \
|
|
27
|
+
echo "export PATH=$RBENV_ROOT/bin:\$PATH" >> /etc/rubybashrc && \
|
|
28
|
+
$RBENV_ROOT/bin/rbenv init - --no-rehash bash >> /etc/rubybashrc && \
|
|
29
|
+
echo "source /etc/rubybashrc" >> /etc/bashrc && \
|
|
30
|
+
echo "source /etc/rubybashrc" >> /etc/bash.bashrc && \
|
|
31
|
+
\
|
|
32
|
+
chown -R rubyuser:rubyuser ${RBENV_ROOT} && \
|
|
33
|
+
find ${RBENV_ROOT} -type d -print0 | sudo xargs -0 chmod g+sw
|
|
34
|
+
ENV BASH_ENV=/etc/rubybashrc
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
##
|
|
38
|
+
## set up rake-compiler and install bootstrap rubies
|
|
39
|
+
##
|
|
40
|
+
USER rubyuser
|
|
41
|
+
|
|
42
|
+
ENV RBENV_RUBIES="3.1.7 3.4.8 4.0.0-preview2"
|
|
43
|
+
|
|
44
|
+
# Install the bootstrap rubies
|
|
45
|
+
RUN bash -c " \
|
|
46
|
+
echo 'gem: --no-ri --no-rdoc --no-document' >> ~/.gemrc && \
|
|
47
|
+
export CFLAGS='-s -O3 -fno-fast-math -fPIC' && \
|
|
48
|
+
for v in ${RBENV_RUBIES} ; do \
|
|
49
|
+
rbenv install \$v -- --disable-install-doc ; \
|
|
50
|
+
done && \
|
|
51
|
+
find ${RBENV_ROOT} -type d -print0 | sudo xargs -0 chmod g+w \
|
|
52
|
+
"
|
|
53
|
+
|
|
54
|
+
# Install rake-compiler and patch it to build and install static libraries for Linux rubies
|
|
55
|
+
COPY build/patches /home/rubyuser/patches
|
|
56
|
+
RUN bash -c " \
|
|
57
|
+
for v in ${RBENV_RUBIES} ; do \
|
|
58
|
+
rbenv shell \$v && \
|
|
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 \
|
|
62
|
+
patch -p1 < \$patch ; \
|
|
63
|
+
done \
|
|
64
|
+
done \
|
|
65
|
+
"
|
|
66
|
+
|
|
67
|
+
# Install rake-compiler's cross rubies in global dir instead of /root
|
|
68
|
+
RUN sudo mkdir -p /usr/local/rake-compiler && \
|
|
69
|
+
sudo chown rubyuser.rubyuser /usr/local/rake-compiler && \
|
|
70
|
+
ln -s /usr/local/rake-compiler ~/.rake-compiler
|
|
71
|
+
|
|
72
|
+
USER root
|
|
73
|
+
|
|
15
74
|
##
|
|
16
75
|
## Install cross compilers
|
|
17
76
|
##
|
|
@@ -80,64 +139,8 @@ RUN git clone --branch=cross_platform https://github.com/markmentovai/bootstrap_
|
|
|
80
139
|
rm -rf bootstrap_cmds
|
|
81
140
|
<% end %>
|
|
82
141
|
|
|
83
|
-
|
|
84
|
-
##
|
|
85
|
-
## install rbenv and ruby-build
|
|
86
|
-
##
|
|
87
|
-
RUN groupadd -r rubyuser && useradd -r -g rubyuser -G sudo -p "" --create-home rubyuser
|
|
88
|
-
|
|
89
|
-
ENV RBENV_ROOT=/usr/local/rbenv
|
|
90
|
-
|
|
91
|
-
# chown after running `rbenv init` because that command creates some subdirectories
|
|
92
|
-
RUN git clone https://github.com/rbenv/rbenv.git ${RBENV_ROOT} && \
|
|
93
|
-
git clone https://github.com/rbenv/ruby-build.git ${RBENV_ROOT}/plugins/ruby-build && \
|
|
94
|
-
\
|
|
95
|
-
echo "export RBENV_ROOT=/usr/local/rbenv" >> /etc/rubybashrc && \
|
|
96
|
-
echo "export PATH=$RBENV_ROOT/bin:\$PATH" >> /etc/rubybashrc && \
|
|
97
|
-
$RBENV_ROOT/bin/rbenv init - --no-rehash bash >> /etc/rubybashrc && \
|
|
98
|
-
echo "source /etc/rubybashrc" >> /etc/bashrc && \
|
|
99
|
-
echo "source /etc/rubybashrc" >> /etc/bash.bashrc && \
|
|
100
|
-
\
|
|
101
|
-
chown -R rubyuser:rubyuser ${RBENV_ROOT} && \
|
|
102
|
-
find ${RBENV_ROOT} -type d -print0 | sudo xargs -0 chmod g+sw
|
|
103
|
-
ENV BASH_ENV=/etc/rubybashrc
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
##
|
|
107
|
-
## set up rake-compiler and install bootstrap rubies
|
|
108
|
-
##
|
|
109
142
|
USER rubyuser
|
|
110
143
|
|
|
111
|
-
ENV RBENV_RUBIES="3.1.7 3.4.5"
|
|
112
|
-
|
|
113
|
-
# Install the bootstrap rubies
|
|
114
|
-
RUN bash -c " \
|
|
115
|
-
echo 'gem: --no-ri --no-rdoc --no-document' >> ~/.gemrc && \
|
|
116
|
-
export CFLAGS='-s -O3 -fno-fast-math -fPIC' && \
|
|
117
|
-
for v in ${RBENV_RUBIES} ; do \
|
|
118
|
-
rbenv install \$v -- --disable-install-doc ; \
|
|
119
|
-
done && \
|
|
120
|
-
find ${RBENV_ROOT} -type d -print0 | sudo xargs -0 chmod g+w \
|
|
121
|
-
"
|
|
122
|
-
|
|
123
|
-
# Install rake-compiler and patch it to build and install static libraries for Linux rubies
|
|
124
|
-
COPY build/patches /home/rubyuser/patches
|
|
125
|
-
RUN bash -c " \
|
|
126
|
-
for v in ${RBENV_RUBIES} ; do \
|
|
127
|
-
rbenv shell \$v && \
|
|
128
|
-
gem install rake-compiler -v1.2.9 && \
|
|
129
|
-
cd ${RBENV_ROOT}/versions/\$v/lib/ruby/gems/*/gems/rake-compiler-1.2.9 && \
|
|
130
|
-
for patch in /home/rubyuser/patches/rake-compiler-1.2.9/*.patch ; do \
|
|
131
|
-
patch -p1 < \$patch ; \
|
|
132
|
-
done \
|
|
133
|
-
done \
|
|
134
|
-
"
|
|
135
|
-
|
|
136
|
-
# Install rake-compiler's cross rubies in global dir instead of /root
|
|
137
|
-
RUN sudo mkdir -p /usr/local/rake-compiler && \
|
|
138
|
-
sudo chown rubyuser.rubyuser /usr/local/rake-compiler && \
|
|
139
|
-
ln -s /usr/local/rake-compiler ~/.rake-compiler
|
|
140
|
-
|
|
141
144
|
<%
|
|
142
145
|
#
|
|
143
146
|
# Build ruby versions with ruby2_keywords using ruby-3.x
|
|
@@ -148,11 +151,12 @@ RUN sudo mkdir -p /usr/local/rake-compiler && \
|
|
|
148
151
|
xrubies_build_plan = if platform =~ /x64-mingw-ucrt/
|
|
149
152
|
[
|
|
150
153
|
# Rubyinstaller-3.1+ is platform x64-mingw-ucrt
|
|
151
|
-
["3.4.
|
|
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"],
|
|
152
156
|
]
|
|
153
157
|
elsif platform =~ /aarch64-mingw-ucrt/
|
|
154
158
|
[
|
|
155
|
-
["3.4.
|
|
159
|
+
["3.4.8", "3.1.7"],
|
|
156
160
|
]
|
|
157
161
|
elsif platform =~ /x64-mingw32/
|
|
158
162
|
[
|
|
@@ -162,7 +166,8 @@ elsif platform =~ /x64-mingw32/
|
|
|
162
166
|
else
|
|
163
167
|
[
|
|
164
168
|
["2.7.8", "3.1.7"],
|
|
165
|
-
["3.4.
|
|
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"],
|
|
166
171
|
]
|
|
167
172
|
end
|
|
168
173
|
|
|
@@ -264,8 +269,8 @@ RUN echo 'source /etc/profile.d/rcd-env.sh' >> /etc/rubybashrc
|
|
|
264
269
|
# Install sudoers configuration
|
|
265
270
|
COPY build/sudoers /etc/sudoers.d/rake-compiler-dock
|
|
266
271
|
|
|
267
|
-
RUN bash -c "rbenv global 3.4.
|
|
272
|
+
RUN bash -c "rbenv global 3.4.8"
|
|
268
273
|
|
|
269
|
-
ENV RUBY_CC_VERSION=3.4.
|
|
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
|
|
270
275
|
|
|
271
276
|
CMD bash
|
data/Rakefile
CHANGED
|
@@ -11,21 +11,19 @@ RakeCompilerDock::GemHelper.install_tasks
|
|
|
11
11
|
def build_mri_images(platforms, host_platforms, output: )
|
|
12
12
|
plats = host_platforms.map(&:first).join(",")
|
|
13
13
|
platforms.each do |platform, _|
|
|
14
|
-
sdf = "tmp/docker/Dockerfile.mri.#{platform}
|
|
14
|
+
sdf = "tmp/docker/Dockerfile.mri.#{platform}"
|
|
15
15
|
image_name = RakeCompilerDock::Starter.container_image_name(platform: platform)
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
RakeCompilerDock.docker_build(sdf, tag: image_name.sub("linux-gnu", "linux"), platform: plats, output: output)
|
|
21
|
-
end
|
|
17
|
+
tags = [image_name]
|
|
18
|
+
tags << image_name.sub("linux-gnu", "linux") if image_name.include?("linux-gnu")
|
|
19
|
+
RakeCompilerDock.docker_build(sdf, tag: tags, platform: plats, output: output)
|
|
22
20
|
end
|
|
23
21
|
end
|
|
24
22
|
|
|
25
23
|
def build_jruby_images(host_platforms, output: )
|
|
26
24
|
image_name = RakeCompilerDock::Starter.container_image_name(rubyvm: "jruby")
|
|
27
25
|
plats = host_platforms.map(&:first).join(",")
|
|
28
|
-
sdf = "tmp/docker/Dockerfile.jruby
|
|
26
|
+
sdf = "tmp/docker/Dockerfile.jruby"
|
|
29
27
|
RakeCompilerDock.docker_build(sdf, tag: image_name, platform: plats, output: output)
|
|
30
28
|
end
|
|
31
29
|
|
|
@@ -48,48 +46,56 @@ platforms = [
|
|
|
48
46
|
]
|
|
49
47
|
|
|
50
48
|
host_platforms = [
|
|
51
|
-
# tuple is [docker platform,
|
|
52
|
-
["linux/amd64",
|
|
53
|
-
["linux/arm64",
|
|
49
|
+
# tuple is [docker platform, RUBY_PLATFORM matcher]
|
|
50
|
+
["linux/amd64", /^x86_64|^x64|^amd64/],
|
|
51
|
+
["linux/arm64", /^aarch64|arm64/],
|
|
54
52
|
]
|
|
55
|
-
local_platform = host_platforms.find { |_,
|
|
53
|
+
local_platform = host_platforms.find { |_,reg| reg =~ RUBY_PLATFORM } or
|
|
56
54
|
raise("RUBY_PLATFORM #{RUBY_PLATFORM} is not supported as host")
|
|
57
55
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
mkdir_p "tmp/docker"
|
|
56
|
+
mkdir_p "tmp/docker"
|
|
61
57
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
File.write(sdf, df)
|
|
67
|
-
CLEAN.include(sdf)
|
|
68
|
-
end
|
|
69
|
-
sdf = "tmp/docker/Dockerfile.jruby.#{rake_platform}"
|
|
70
|
-
df = File.read("Dockerfile.jruby")
|
|
58
|
+
docker_platform, _ = local_platform
|
|
59
|
+
platforms.each do |platform, target|
|
|
60
|
+
sdf = "tmp/docker/Dockerfile.mri.#{platform}"
|
|
61
|
+
df = ERB.new(File.read("Dockerfile.mri.erb"), trim_mode: ">").result(binding)
|
|
71
62
|
File.write(sdf, df)
|
|
63
|
+
CLEAN.include(sdf)
|
|
64
|
+
end
|
|
65
|
+
sdf = "tmp/docker/Dockerfile.jruby"
|
|
66
|
+
df = File.read("Dockerfile.jruby")
|
|
67
|
+
File.write(sdf, df)
|
|
72
68
|
|
|
73
|
-
|
|
69
|
+
parallel_docker_build = RakeCompilerDock::ParallelDockerBuild.new(platforms.map{|pl, _| "tmp/docker/Dockerfile.mri.#{pl}" } + ["tmp/docker/Dockerfile.jruby"], workdir: "tmp/docker", task_prefix: "common-")
|
|
70
|
+
|
|
71
|
+
namespace :build do
|
|
72
|
+
parallel_docker_build.define_file_tasks platform: docker_platform
|
|
73
|
+
|
|
74
|
+
# The jobs in the CI pipeline are already organized in a tree structure.
|
|
75
|
+
# So we can avoid unnecessary rebuilds by omitting the dependecies.
|
|
76
|
+
unless ENV['RCD_TASK_DEPENDENCIES'] = "false"
|
|
77
|
+
parallel_docker_build.define_tree_tasks
|
|
78
|
+
parallel_docker_build.define_final_tasks
|
|
79
|
+
end
|
|
74
80
|
|
|
75
81
|
platforms.each do |platform, target|
|
|
76
|
-
sdf = "tmp/docker/Dockerfile.mri.#{platform}
|
|
82
|
+
sdf = "tmp/docker/Dockerfile.mri.#{platform}"
|
|
77
83
|
|
|
78
84
|
# Load image after build on local platform only
|
|
79
85
|
desc "Build and load image for platform #{platform} on #{docker_platform}"
|
|
80
86
|
task platform => sdf do
|
|
81
87
|
build_mri_images([platform], [local_platform], output: 'load')
|
|
82
88
|
end
|
|
83
|
-
multitask :
|
|
89
|
+
multitask :images => platform
|
|
84
90
|
end
|
|
85
91
|
|
|
86
|
-
sdf = "tmp/docker/Dockerfile.jruby
|
|
92
|
+
sdf = "tmp/docker/Dockerfile.jruby"
|
|
87
93
|
# Load image after build on local platform only
|
|
88
94
|
desc "Build and load image for JRuby on #{docker_platform}"
|
|
89
95
|
task :jruby => sdf do
|
|
90
96
|
build_jruby_images([local_platform], output: 'load')
|
|
91
97
|
end
|
|
92
|
-
multitask :
|
|
98
|
+
multitask :images => :jruby
|
|
93
99
|
|
|
94
100
|
all_mri_images = platforms.map(&:first)
|
|
95
101
|
desc "Build images for all MRI platforms in parallel"
|
|
@@ -102,14 +108,12 @@ namespace :build do
|
|
|
102
108
|
all_images = all_mri_images + ["jruby"]
|
|
103
109
|
desc "Build images for all platforms in parallel"
|
|
104
110
|
if ENV['RCD_USE_BUILDX_CACHE']
|
|
105
|
-
task :
|
|
111
|
+
task :images => all_images
|
|
106
112
|
else
|
|
107
|
-
multitask :
|
|
113
|
+
multitask :images => all_images
|
|
108
114
|
end
|
|
109
115
|
end
|
|
110
116
|
|
|
111
|
-
task :build => "build:all"
|
|
112
|
-
|
|
113
117
|
namespace :release do
|
|
114
118
|
host_pl = host_platforms.map(&:first).join(",")
|
|
115
119
|
|
|
@@ -130,6 +134,48 @@ namespace :release do
|
|
|
130
134
|
desc "Push all docker images on #{host_pl}"
|
|
131
135
|
multitask :images => platform
|
|
132
136
|
end
|
|
137
|
+
|
|
138
|
+
desc "Show download sizes of the release images"
|
|
139
|
+
task :sizes do
|
|
140
|
+
require "yaml"
|
|
141
|
+
|
|
142
|
+
ths = platforms.map do |pl, _|
|
|
143
|
+
image_name = RakeCompilerDock::Starter.container_image_name(platform: pl)
|
|
144
|
+
Thread.new do
|
|
145
|
+
[ pl,
|
|
146
|
+
IO.popen("docker manifest inspect #{image_name} -v", &:read)
|
|
147
|
+
]
|
|
148
|
+
end
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
hlayers = Hash.new{|h,k| h[k] = {} }
|
|
152
|
+
isize_sums = Hash.new{|h,k| h[k] = 0 }
|
|
153
|
+
|
|
154
|
+
ths.map(&:value).each do |pl, ystr|
|
|
155
|
+
y = YAML.load(ystr)
|
|
156
|
+
y = [y] unless y.is_a?(Array)
|
|
157
|
+
y.each do |img|
|
|
158
|
+
next unless img
|
|
159
|
+
host_pl = "#{img.dig("Descriptor", "platform", "architecture")}-#{
|
|
160
|
+
img.dig("Descriptor", "platform", "os")}"
|
|
161
|
+
next if host_pl=="unknown-unknown"
|
|
162
|
+
lays = img.dig("OCIManifest", "layers") || img.dig("SchemaV2Manifest", "layers")
|
|
163
|
+
isize = lays.map do |lay|
|
|
164
|
+
hlayers[host_pl][lay["digest"]] = lay["size"]
|
|
165
|
+
end.sum
|
|
166
|
+
isize_sums[host_pl] += isize
|
|
167
|
+
puts format("%-15s %-20s:%12d MB", host_pl, pl, isize/1024/1024)
|
|
168
|
+
end
|
|
169
|
+
end
|
|
170
|
+
puts "----------"
|
|
171
|
+
isize_sums.each do |host_pl, isize|
|
|
172
|
+
puts format("%-15s %-20s:%12d MB", host_pl, "all-separate", isize/1024/1024)
|
|
173
|
+
end
|
|
174
|
+
hlayers.each do |host_pl, layers|
|
|
175
|
+
asize = layers.values.sum
|
|
176
|
+
puts format("%-15s %-20s:%12d MB", host_pl, "all-combined", asize/1024/1024)
|
|
177
|
+
end
|
|
178
|
+
end
|
|
133
179
|
end
|
|
134
180
|
|
|
135
181
|
namespace :prepare do
|
|
@@ -174,3 +220,16 @@ task :update_lists do
|
|
|
174
220
|
EOT
|
|
175
221
|
end
|
|
176
222
|
end
|
|
223
|
+
|
|
224
|
+
desc "Update CI publish workflows from erb"
|
|
225
|
+
namespace :ci do
|
|
226
|
+
task :update_workflows do
|
|
227
|
+
erb = ERB.new(File.read(".github/workflows/publish-images.yml.erb"))
|
|
228
|
+
sdf = ".github/workflows/publish-images.yml"
|
|
229
|
+
release = false
|
|
230
|
+
File.write(sdf, erb.result(binding))
|
|
231
|
+
sdf = ".github/workflows/release-images.yml"
|
|
232
|
+
release = true
|
|
233
|
+
File.write(sdf, erb.result(binding))
|
|
234
|
+
end
|
|
235
|
+
end
|
data/build/gem_helper.rb
CHANGED
|
@@ -17,7 +17,7 @@ module RakeCompilerDock
|
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
def headline
|
|
20
|
-
'([^\w]*)(\d+\.\d+\.\d+)([^\w]+)([2Y][0Y][0-9Y][0-9Y]-[0-1M][0-9M]-[0-3D][0-9D])([^\w]*|$)'
|
|
20
|
+
'([^\w]*)(\d+\.\d+\.\d+(?:\.\w+)?)([^\w]+)([2Y][0Y][0-9Y][0-9Y]-[0-1M][0-9M]-[0-3D][0-9D])([^\w]*|$)'
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
def reldate
|
|
@@ -25,7 +25,7 @@ module RakeCompilerDock
|
|
|
25
25
|
def docker_build(filename, tag: nil, output: false, platform: )
|
|
26
26
|
cmd = docker_build_cmd(platform)
|
|
27
27
|
return if cmd.nil?
|
|
28
|
-
tag_args = ["-t",
|
|
28
|
+
tag_args = Array(tag).flat_map{|t| ["-t", t] } if tag
|
|
29
29
|
push_args = ["--push"] if output == 'push'
|
|
30
30
|
push_args = ["--load"] if output == 'load'
|
|
31
31
|
Class.new.extend(FileUtils).sh(*cmd, "-f", filename, ".", "--platform", platform, *tag_args, *push_args)
|
|
@@ -36,7 +36,11 @@ module RakeCompilerDock
|
|
|
36
36
|
class ParallelDockerBuild
|
|
37
37
|
include Rake::DSL
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
attr_reader :file_deps
|
|
40
|
+
attr_reader :tree_deps
|
|
41
|
+
attr_reader :final_deps
|
|
42
|
+
|
|
43
|
+
def initialize(dockerfiles, workdir: "tmp/docker", inputdir: ".", task_prefix: "common-")
|
|
40
44
|
FileUtils.mkdir_p(workdir)
|
|
41
45
|
|
|
42
46
|
files = parse_dockerfiles(dockerfiles, inputdir)
|
|
@@ -45,8 +49,11 @@ module RakeCompilerDock
|
|
|
45
49
|
vcs = find_commons(files)
|
|
46
50
|
# pp vcs
|
|
47
51
|
|
|
48
|
-
|
|
49
|
-
@
|
|
52
|
+
@file_deps = {}
|
|
53
|
+
@tree_deps = {}
|
|
54
|
+
@final_deps = {}
|
|
55
|
+
|
|
56
|
+
write_docker_files(vcs, workdir, task_prefix)
|
|
50
57
|
end
|
|
51
58
|
|
|
52
59
|
# Read given dockerfiles from inputdir and split into a list of commands.
|
|
@@ -100,27 +107,57 @@ module RakeCompilerDock
|
|
|
100
107
|
end.compact.to_h
|
|
101
108
|
end
|
|
102
109
|
|
|
103
|
-
# Write intermediate dockerfiles to workdir and
|
|
104
|
-
|
|
105
|
-
# The rake tasks are named after the dockerfiles given to #new .
|
|
106
|
-
# This also adds dependant intermediate tasks as prerequisites.
|
|
107
|
-
def define_common_tasks(vcs, workdir, task_prefix, plines=[])
|
|
110
|
+
# Write intermediate dockerfiles to workdir and fill properties
|
|
111
|
+
def write_docker_files(vcs, workdir, task_prefix, plines=[])
|
|
108
112
|
vcs.map do |files, (lines, nvcs)|
|
|
109
|
-
fn = "#{task_prefix}#{Digest::SHA1.hexdigest(files.join)}"
|
|
110
|
-
File.
|
|
111
|
-
|
|
112
|
-
|
|
113
|
+
fn = "#{task_prefix}#{Digest::SHA1.hexdigest(files.join)[0, 7]}"
|
|
114
|
+
wfn = File.join(workdir, fn)
|
|
115
|
+
File.write(wfn, (plines + lines).join)
|
|
116
|
+
@file_deps[fn] = wfn
|
|
117
|
+
|
|
118
|
+
files.each do |file|
|
|
119
|
+
@final_deps[file] = fn
|
|
113
120
|
end
|
|
114
121
|
|
|
115
|
-
nfn =
|
|
122
|
+
nfn = write_docker_files(nvcs, workdir, task_prefix, plines + lines)
|
|
116
123
|
nfn.each do |file|
|
|
117
|
-
|
|
118
|
-
end
|
|
119
|
-
files.each do |file|
|
|
120
|
-
task file => fn
|
|
124
|
+
@tree_deps[file] = fn
|
|
121
125
|
end
|
|
122
126
|
fn
|
|
123
127
|
end
|
|
124
128
|
end
|
|
129
|
+
|
|
130
|
+
# Define rake tasks for building common docker files
|
|
131
|
+
#
|
|
132
|
+
# The rake tasks are named after the dockerfiles given to #new .
|
|
133
|
+
# This also adds dependant intermediate tasks as prerequisites.
|
|
134
|
+
def define_rake_tasks(**build_options)
|
|
135
|
+
define_file_tasks(**build_options)
|
|
136
|
+
define_tree_tasks
|
|
137
|
+
define_final_tasks
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
def define_file_tasks(**build_options)
|
|
141
|
+
file_deps.each do |fn, wfn|
|
|
142
|
+
# p file_deps: {fn => wfn}
|
|
143
|
+
task fn do
|
|
144
|
+
RakeCompilerDock.docker_build(wfn, **build_options)
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
def define_tree_tasks
|
|
150
|
+
tree_deps.each do |file, prereq|
|
|
151
|
+
# p tree_deps: {file => prereq}
|
|
152
|
+
task file => prereq
|
|
153
|
+
end
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
def define_final_tasks
|
|
157
|
+
final_deps.each do |file, prereq|
|
|
158
|
+
# p final_deps: {file => prereq}
|
|
159
|
+
task file => prereq
|
|
160
|
+
end
|
|
161
|
+
end
|
|
125
162
|
end
|
|
126
163
|
end
|
data/build/patches/{rake-compiler-1.2.9 → rake-compiler-1.3.1}/0005-build-miniruby-first.patch
RENAMED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
diff --git a/tasks/bin/cross-ruby.rake b/tasks/bin/cross-ruby.rake
|
|
2
|
-
index d37ab97b..
|
|
2
|
+
index d37ab97b..512afbf4 100644
|
|
3
3
|
--- a/tasks/bin/cross-ruby.rake
|
|
4
4
|
+++ b/tasks/bin/cross-ruby.rake
|
|
5
|
-
@@ -129,6 +129,
|
|
5
|
+
@@ -129,6 +129,11 @@
|
|
6
6
|
|
|
7
7
|
# make
|
|
8
8
|
file "#{build_dir}/ruby.exe" => ["#{build_dir}/Makefile"] do |t|
|
|
9
|
-
+ puts "MIKE: #{ruby_cc_version}: #{mingw_target}"
|
|
10
9
|
+ if ruby_cc_version.start_with?("ruby-3.1") && mingw_target =~ /darwin/
|
|
11
10
|
+ # for later 3.1.x releases, we need to explicitly build miniruby
|
|
12
11
|
+ # see https://bugs.ruby-lang.org/issues/19239
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
diff --git a/tasks/bin/cross-ruby.rake b/tasks/bin/cross-ruby.rake
|
|
2
|
+
index 3d23eed6..904c12e0 100644
|
|
3
|
+
--- a/tasks/bin/cross-ruby.rake
|
|
4
|
+
+++ b/tasks/bin/cross-ruby.rake
|
|
5
|
+
@@ -150,6 +150,11 @@
|
|
6
|
+
|
|
7
|
+
# make
|
|
8
|
+
file "#{build_dir}/ruby.exe" => ["#{build_dir}/Makefile"] do |t|
|
|
9
|
+
+ if ruby_cc_version.start_with?("ruby-4.0")
|
|
10
|
+
+ # https://bugs.ruby-lang.org/issues/21792 - hopefully will be fixed by 4.0.0 final
|
|
11
|
+
+ FileUtils.rm_f("#{USER_HOME}/sources/#{ruby_cc_version}/spec/ruby/optional/capi/ext/digest_spec.c")
|
|
12
|
+
+ end
|
|
13
|
+
+
|
|
14
|
+
if ruby_cc_version.start_with?("ruby-3.1") && mingw_target =~ /darwin/
|
|
15
|
+
# for later 3.1.x releases, we need to explicitly build miniruby
|
|
16
|
+
# see https://bugs.ruby-lang.org/issues/19239
|
data/lib/rake_compiler_dock.rb
CHANGED
|
@@ -82,8 +82,8 @@ module RakeCompilerDock
|
|
|
82
82
|
#
|
|
83
83
|
# RakeCompilerDock.cross_rubies
|
|
84
84
|
# # => {
|
|
85
|
-
# # "3.4" => "3.4.
|
|
86
|
-
# # "3.3" => "3.3.
|
|
85
|
+
# # "3.4" => "3.4.8",
|
|
86
|
+
# # "3.3" => "3.3.10",
|
|
87
87
|
# # "3.2" => "3.2.9",
|
|
88
88
|
# # "3.1" => "3.1.7",
|
|
89
89
|
# # "3.0" => "3.0.7",
|
|
@@ -92,8 +92,9 @@ module RakeCompilerDock
|
|
|
92
92
|
#
|
|
93
93
|
def cross_rubies
|
|
94
94
|
{
|
|
95
|
-
"
|
|
96
|
-
"3.
|
|
95
|
+
"4.0" => "4.0.0",
|
|
96
|
+
"3.4" => "3.4.8",
|
|
97
|
+
"3.3" => "3.3.10",
|
|
97
98
|
"3.2" => "3.2.9",
|
|
98
99
|
"3.1" => "3.1.7",
|
|
99
100
|
"3.0" => "3.0.7",
|
|
@@ -112,13 +113,13 @@ module RakeCompilerDock
|
|
|
112
113
|
#
|
|
113
114
|
# For example:
|
|
114
115
|
# RakeCompilerDock.ruby_cc_version("2.7", "3.4")
|
|
115
|
-
# # => "3.4.
|
|
116
|
+
# # => "3.4.8:2.7.8"
|
|
116
117
|
#
|
|
117
118
|
# RakeCompilerDock.ruby_cc_version("~> 3.2")
|
|
118
|
-
# # => "3.4.
|
|
119
|
+
# # => "3.4.8:3.3.10:3.2.9"
|
|
119
120
|
#
|
|
120
121
|
# RakeCompilerDock.ruby_cc_version(Gem::Requirement.new("~> 3.2"))
|
|
121
|
-
# # => "3.4.
|
|
122
|
+
# # => "3.4.8:3.3.10:3.2.9"
|
|
122
123
|
#
|
|
123
124
|
def ruby_cc_version(*requirements)
|
|
124
125
|
cross = cross_rubies
|
|
@@ -39,12 +39,12 @@ class TestParallelDockerBuild < Test::Unit::TestCase
|
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
private def hd(str)
|
|
42
|
-
"y" + Digest::SHA1.hexdigest(str)
|
|
42
|
+
"y" + Digest::SHA1.hexdigest(str)[0, 7]
|
|
43
43
|
end
|
|
44
44
|
|
|
45
45
|
def test_tasks
|
|
46
46
|
Dir.chdir(@tmpdir) do
|
|
47
|
-
RakeCompilerDock::ParallelDockerBuild.new(%w[ File0 File1 File2 File3 ], task_prefix: "y")
|
|
47
|
+
RakeCompilerDock::ParallelDockerBuild.new(%w[ File0 File1 File2 File3 ], task_prefix: "y").define_rake_tasks
|
|
48
48
|
end
|
|
49
49
|
|
|
50
50
|
assert_operator Rake::Task["File0"].prerequisites, :include?, hd("File0File1")
|
data/test/test_versions.rb
CHANGED
|
@@ -55,7 +55,7 @@ class TestVersions < Test::Unit::TestCase
|
|
|
55
55
|
assert_equal(expected, RakeCompilerDock.ruby_cc_version("~> 3.2.0", "~> 3.4.0"))
|
|
56
56
|
assert_equal(expected, RakeCompilerDock.ruby_cc_version(Gem::Requirement.new("~> 3.2.0"), Gem::Requirement.new("~> 3.4.0")))
|
|
57
57
|
|
|
58
|
-
expected = [cross["3.4"], cross["3.3"], cross["3.2"]].join(":")
|
|
58
|
+
expected = [cross["4.0"], cross["3.4"], cross["3.3"], cross["3.2"]].join(":")
|
|
59
59
|
assert_equal(expected, RakeCompilerDock.ruby_cc_version(">= 3.2"))
|
|
60
60
|
assert_equal(expected, RakeCompilerDock.ruby_cc_version(Gem::Requirement.new(">= 3.2")))
|
|
61
61
|
|
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rake-compiler-dock
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.11.0.rc1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Lars Kanis
|
|
@@ -95,6 +95,7 @@ files:
|
|
|
95
95
|
- ".dockerignore"
|
|
96
96
|
- ".github/workflows/ci.yml"
|
|
97
97
|
- ".github/workflows/publish-images.yml"
|
|
98
|
+
- ".github/workflows/publish-images.yml.erb"
|
|
98
99
|
- ".github/workflows/release-images.yml"
|
|
99
100
|
- ".gitignore"
|
|
100
101
|
- CHANGELOG.md
|
|
@@ -113,8 +114,9 @@ files:
|
|
|
113
114
|
- build/mk_osxcross.sh
|
|
114
115
|
- build/mk_pkg_config.sh
|
|
115
116
|
- build/parallel_docker_build.rb
|
|
116
|
-
- build/patches/rake-compiler-1.
|
|
117
|
-
- build/patches/rake-compiler-1.
|
|
117
|
+
- build/patches/rake-compiler-1.3.1/0004-Enable-build-of-static-libruby.patch
|
|
118
|
+
- build/patches/rake-compiler-1.3.1/0005-build-miniruby-first.patch
|
|
119
|
+
- build/patches/rake-compiler-1.3.1/0006-ruby-4-rubyspec-capiext.patch
|
|
118
120
|
- build/rcd-env.sh
|
|
119
121
|
- build/runas
|
|
120
122
|
- build/sigfw.c
|
metadata.gz.sig
CHANGED
|
Binary file
|