rake-compiler-dock 1.4.0 → 1.5.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
- data/.github/workflows/ci.yml +242 -153
- data/.github/workflows/publish-images.yml +11 -7
- data/.gitignore +8 -5
- data/CONTRIBUTING.md +5 -5
- data/Dockerfile.jruby +43 -35
- data/Dockerfile.mri.erb +82 -97
- data/History.md +30 -3
- data/README.md +63 -12
- data/Rakefile +29 -13
- data/build/mk_musl_cross.sh +37 -0
- data/build/patches2/rake-compiler-1.2.5/0004-Enable-build-of-static-libruby.patch +9 -4
- data/build/runas +1 -1
- data/lib/rake_compiler_dock/predefined_user_group.rb +2 -2
- data/lib/rake_compiler_dock/version.rb +2 -2
- data/lib/rake_compiler_dock.rb +2 -1
- data/rake-compiler-dock.gemspec +7 -1
- data/test/rcd_test/Rakefile +19 -1
- data/test/rcd_test/ext/mri/rcd_test_ext.c +14 -0
- data/test/rcd_test/ext/mri/rcd_test_ext.h +5 -0
- data/test/rcd_test/rcd_test.gemspec +9 -8
- data/test/rcd_test/test/test_basic.rb +7 -0
- data/test/test_starter.rb +5 -5
- metadata +5 -6
- data/build/patches/ruby-2.5.9/no_sendfile.patch +0 -24
- data/build/patches/ruby-3.1.3/no_sendfile.patch +0 -24
data/Dockerfile.jruby
CHANGED
@@ -1,60 +1,66 @@
|
|
1
|
-
FROM ubuntu:20.04
|
1
|
+
FROM ubuntu:20.04
|
2
2
|
|
3
3
|
ENV DEBIAN_FRONTEND noninteractive
|
4
4
|
RUN apt-get -y update && \
|
5
|
-
apt-get install -y curl git-core xz-utils
|
5
|
+
apt-get install -y sudo wget curl git-core build-essential xz-utils unzip dirmngr && \
|
6
|
+
apt-get install -y openjdk-11-jdk-headless maven && \
|
6
7
|
rm -rf /var/lib/apt/lists/*
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
##
|
10
|
+
## install rbenv and ruby-build
|
11
|
+
##
|
12
|
+
RUN groupadd -r rubyuser && useradd -r -g rubyuser -G sudo -p "" --create-home rubyuser
|
12
13
|
|
13
|
-
|
14
|
-
echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf
|
14
|
+
ENV RBENV_ROOT=/usr/local/rbenv RBENV_RUBIES="jruby-9.4.0.0"
|
15
15
|
|
16
|
-
#
|
17
|
-
RUN
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
16
|
+
# chown after running `rbenv init` because that command creates some subdirectories
|
17
|
+
RUN git clone https://github.com/rbenv/rbenv.git ${RBENV_ROOT} && \
|
18
|
+
git clone https://github.com/rbenv/ruby-build.git ${RBENV_ROOT}/plugins/ruby-build && \
|
19
|
+
\
|
20
|
+
echo "export RBENV_ROOT=/usr/local/rbenv" >> /etc/rubybashrc && \
|
21
|
+
echo "export PATH=$RBENV_ROOT/bin:\$PATH" >> /etc/rubybashrc && \
|
22
|
+
$RBENV_ROOT/bin/rbenv init - --no-rehash bash >> /etc/rubybashrc && \
|
23
|
+
echo "source /etc/rubybashrc" >> /etc/bashrc && \
|
24
|
+
echo "source /etc/rubybashrc" >> /etc/bash.bashrc && \
|
25
|
+
\
|
26
|
+
chown -R rubyuser:rubyuser ${RBENV_ROOT} && \
|
27
|
+
find ${RBENV_ROOT} -type d -print0 | sudo xargs -0 chmod g+sw
|
28
|
+
ENV BASH_ENV=/etc/rubybashrc
|
22
29
|
|
23
|
-
# Import patch files for ruby and gems
|
24
|
-
COPY build/patches /home/rvm/patches/
|
25
|
-
ENV BASH_ENV /etc/rubybashrc
|
26
30
|
|
27
|
-
|
31
|
+
##
|
32
|
+
## set up rake-compiler and install bootstrap rubies
|
33
|
+
##
|
34
|
+
USER rubyuser
|
35
|
+
|
36
|
+
# Install the bootstrap rubies
|
28
37
|
RUN bash -c " \
|
38
|
+
echo 'gem: --no-ri --no-rdoc --no-document' >> ~/.gemrc && \
|
29
39
|
export CFLAGS='-s -O3 -fno-fast-math -fPIC' && \
|
30
|
-
for v in
|
31
|
-
|
40
|
+
for v in ${RBENV_RUBIES} ; do \
|
41
|
+
rbenv install \$v -- --disable-install-doc ; \
|
32
42
|
done && \
|
33
|
-
|
34
|
-
find /usr/local/rvm -type d -print0 | sudo xargs -0 chmod g+sw \
|
43
|
+
find ${RBENV_ROOT} -type d -print0 | sudo xargs -0 chmod g+w \
|
35
44
|
"
|
36
45
|
|
46
|
+
# Install rake-compiler and patch it to build and install static libraries for Linux rubies
|
47
|
+
COPY build/patches2 /home/rubyuser/patches
|
37
48
|
RUN bash -c " \
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
49
|
+
for v in ${RBENV_RUBIES} ; do \
|
50
|
+
rbenv shell \$v && \
|
51
|
+
gem install rake-compiler -v1.2.5 && \
|
52
|
+
cd ${RBENV_ROOT}/versions/\$v/lib/ruby/gems/*/gems/rake-compiler-1.2.5 && \
|
53
|
+
patch -p1 < /home/rubyuser/patches/rake-compiler-1.2.5/*.patch ; \
|
54
|
+
done \
|
44
55
|
"
|
45
56
|
|
46
57
|
# Install rake-compiler's cross rubies in global dir instead of /root
|
47
58
|
RUN sudo mkdir -p /usr/local/rake-compiler && \
|
48
|
-
sudo chown
|
59
|
+
sudo chown rubyuser.rubyuser /usr/local/rake-compiler && \
|
49
60
|
ln -s /usr/local/rake-compiler ~/.rake-compiler
|
50
61
|
|
51
|
-
USER root
|
52
|
-
|
53
|
-
RUN bash -c "rvm alias create default jruby-9.4.0.0"
|
54
|
-
RUN echo "rvm use jruby-9.4.0.0 > /dev/null" >> /etc/rubybashrc
|
55
62
|
|
56
|
-
|
57
|
-
RUN echo "source /etc/profile.d/rvm.sh" >> /etc/bash.bashrc
|
63
|
+
USER root
|
58
64
|
|
59
65
|
# Install SIGINT forwarder
|
60
66
|
COPY build/sigfw.c /root/
|
@@ -66,4 +72,6 @@ COPY build/runas /usr/local/bin/
|
|
66
72
|
# Install sudoers configuration
|
67
73
|
COPY build/sudoers /etc/sudoers.d/rake-compiler-dock
|
68
74
|
|
75
|
+
RUN bash -c "rbenv global jruby-9.4.0.0"
|
76
|
+
|
69
77
|
CMD bash
|
data/Dockerfile.mri.erb
CHANGED
@@ -1,81 +1,59 @@
|
|
1
1
|
<%
|
2
2
|
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
|
5
|
-
else "ubuntu:20.04
|
3
|
+
when /x86_64-linux-gnu/ then "quay.io/pypa/manylinux2014_x86_64"
|
4
|
+
when /x86-linux-gnu/ then "quay.io/pypa/manylinux2014_i686"
|
5
|
+
else "ubuntu:20.04"
|
6
6
|
end
|
7
7
|
manylinux = !!(image =~ /manylinux/)
|
8
8
|
%>
|
9
9
|
FROM <%= image %>
|
10
10
|
|
11
11
|
##
|
12
|
-
##
|
12
|
+
## Install required base packages for compiling ruby
|
13
13
|
##
|
14
|
-
# Install packages which rvm will require
|
15
14
|
<% if manylinux %>
|
16
15
|
RUN yum install -y sudo ruby less git wget curl autoconf libtool cmake gcc-c++ xz readline-devel sqlite-devel openssl-devel libffi-devel libyaml-devel
|
17
16
|
|
18
|
-
|
17
|
+
## Prepare sudo
|
19
18
|
RUN rm -f /usr/local/bin/sudo && \
|
20
19
|
groupadd -r sudo && \
|
21
20
|
echo "%sudo ALL=(ALL) ALL" >> /etc/sudoers
|
21
|
+
|
22
22
|
<% else %>
|
23
23
|
ENV DEBIAN_FRONTEND noninteractive
|
24
24
|
RUN apt-get -y update && \
|
25
|
-
apt-get install -y sudo wget
|
25
|
+
apt-get install -y sudo wget curl git-core build-essential xz-utils unzip dirmngr && \
|
26
|
+
apt-get install -y autoconf cmake pkg-config zlib1g-dev libreadline-dev libsqlite0-dev libssl-dev libyaml-dev libffi-dev && \
|
26
27
|
rm -rf /var/lib/apt/lists/*
|
27
28
|
<% end %>
|
28
29
|
|
29
|
-
# Add "rvm" as system group, to avoid conflicts with host GIDs typically starting with 1000
|
30
|
-
RUN groupadd -r rvm && useradd -r -g rvm -G sudo -p "" --create-home rvm
|
31
30
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
ENV BASH_ENV /etc/rubybashrc
|
37
|
-
|
38
|
-
USER rvm
|
39
|
-
|
40
|
-
RUN mkdir ~/.gnupg && \
|
41
|
-
chmod 700 ~/.gnupg && \
|
42
|
-
echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf
|
43
|
-
|
44
|
-
# install rvm, RVM 1.26.0+ has signed releases, source rvm for usage outside of package scripts
|
45
|
-
RUN gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB && \
|
46
|
-
(curl -L http://get.rvm.io | sudo bash) && \
|
47
|
-
bash -c " \
|
48
|
-
source /etc/rubybashrc && \
|
49
|
-
rvm autolibs disable && \
|
50
|
-
rvmsudo rvm cleanup all \
|
51
|
-
"
|
31
|
+
##
|
32
|
+
## install rbenv and ruby-build
|
33
|
+
##
|
34
|
+
RUN groupadd -r rubyuser && useradd -r -g rubyuser -G sudo -p "" --create-home rubyuser
|
52
35
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
RUN
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
"
|
36
|
+
ENV RBENV_ROOT=/usr/local/rbenv RBENV_RUBIES="2.5.9 3.1.3"
|
37
|
+
|
38
|
+
# chown after running `rbenv init` because that command creates some subdirectories
|
39
|
+
RUN git clone https://github.com/rbenv/rbenv.git ${RBENV_ROOT} && \
|
40
|
+
git clone https://github.com/rbenv/ruby-build.git ${RBENV_ROOT}/plugins/ruby-build && \
|
41
|
+
\
|
42
|
+
echo "export RBENV_ROOT=/usr/local/rbenv" >> /etc/rubybashrc && \
|
43
|
+
echo "export PATH=$RBENV_ROOT/bin:\$PATH" >> /etc/rubybashrc && \
|
44
|
+
$RBENV_ROOT/bin/rbenv init - --no-rehash bash >> /etc/rubybashrc && \
|
45
|
+
echo "source /etc/rubybashrc" >> /etc/bashrc && \
|
46
|
+
echo "source /etc/rubybashrc" >> /etc/bash.bashrc && \
|
47
|
+
\
|
48
|
+
chown -R rubyuser:rubyuser ${RBENV_ROOT} && \
|
49
|
+
find ${RBENV_ROOT} -type d -print0 | sudo xargs -0 chmod g+sw
|
50
|
+
ENV BASH_ENV=/etc/rubybashrc
|
64
51
|
|
65
|
-
RUN bash -c " \
|
66
|
-
echo "gem: --no-ri --no-rdoc" >> ~/.gemrc && \
|
67
|
-
rvm all do gem update --system --no-document && \
|
68
|
-
rvm all do gem update --no-document && \
|
69
|
-
rvm all do gem install bundler --no-document && \
|
70
|
-
find /usr/local/rvm -type d -print0 | sudo xargs -0 chmod g+sw \
|
71
|
-
"
|
72
52
|
|
73
53
|
##
|
74
|
-
##
|
54
|
+
## Install cross compilers
|
75
55
|
##
|
76
|
-
|
77
|
-
|
78
|
-
<% if platform=~/x64-mingw-ucrt/ %>
|
56
|
+
<% if platform =~ /x64-mingw-ucrt/ %>
|
79
57
|
COPY --from=larskanis/mingw64-ucrt:20.04 \
|
80
58
|
/build/binutils-mingw-w64-x86-64_2.34-6ubuntu1.3+8.8_amd64.deb \
|
81
59
|
/build/g++-mingw-w64-x86-64_9.3.0-17ubuntu1~20.04+22~exp1ubuntu4_amd64.deb \
|
@@ -86,14 +64,18 @@ COPY --from=larskanis/mingw64-ucrt:20.04 \
|
|
86
64
|
/debs/
|
87
65
|
RUN dpkg -i /debs/*.deb
|
88
66
|
|
67
|
+
<% elsif platform =~ /linux-musl/ %>
|
68
|
+
COPY build/mk_musl_cross.sh /tmp
|
69
|
+
RUN /tmp/mk_musl_cross.sh <%= target %>
|
70
|
+
|
89
71
|
<% elsif !manylinux %>
|
90
72
|
RUN apt-get -y update && \
|
91
73
|
apt-get install -y <%
|
92
|
-
if platform
|
93
|
-
if platform
|
94
|
-
if platform
|
95
|
-
if platform
|
96
|
-
if platform
|
74
|
+
if platform =~ /darwin/ %> clang python lzma-dev libxml2-dev libssl-dev libc++-10-dev <% end %><%
|
75
|
+
if platform =~ /aarch64-linux-gnu/ %> gcc-aarch64-linux-gnu g++-aarch64-linux-gnu <% end %><%
|
76
|
+
if platform =~ /arm-linux-gnu/ %> gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf <% end %><%
|
77
|
+
if platform =~ /x86-mingw32/ %> gcc-mingw-w64-i686 g++-mingw-w64-i686 <% end %><%
|
78
|
+
if platform =~ /x64-mingw32/ %> gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 <% end %> && \
|
97
79
|
rm -rf /var/lib/apt/lists/*
|
98
80
|
<% end %>
|
99
81
|
|
@@ -103,34 +85,43 @@ COPY build/mk_i686.rb /root/
|
|
103
85
|
RUN /root/mk_i686.rb
|
104
86
|
<% end %>
|
105
87
|
|
106
|
-
<% if platform
|
107
|
-
COPY build/mk_osxcross.sh /
|
108
|
-
RUN /
|
88
|
+
<% if platform =~ /darwin/ %>
|
89
|
+
COPY build/mk_osxcross.sh /tmp
|
90
|
+
RUN /tmp/mk_osxcross.sh
|
109
91
|
<% end %>
|
110
92
|
|
111
93
|
|
112
94
|
##
|
113
|
-
##
|
95
|
+
## set up rake-compiler and install bootstrap rubies
|
114
96
|
##
|
115
|
-
USER
|
97
|
+
USER rubyuser
|
116
98
|
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
99
|
+
# Install the bootstrap rubies
|
100
|
+
RUN bash -c " \
|
101
|
+
echo 'gem: --no-ri --no-rdoc --no-document' >> ~/.gemrc && \
|
102
|
+
export CFLAGS='-s -O3 -fno-fast-math -fPIC' && \
|
103
|
+
for v in ${RBENV_RUBIES} ; do \
|
104
|
+
rbenv install \$v -- --disable-install-doc ; \
|
105
|
+
done && \
|
106
|
+
find ${RBENV_ROOT} -type d -print0 | sudo xargs -0 chmod g+w \
|
107
|
+
"
|
123
108
|
|
124
|
-
#
|
125
|
-
COPY build/patches2 /home/
|
109
|
+
# Install rake-compiler and patch it to build and install static libraries for Linux rubies
|
110
|
+
COPY build/patches2 /home/rubyuser/patches
|
126
111
|
RUN bash -c " \
|
127
|
-
for v in ${
|
128
|
-
|
129
|
-
|
130
|
-
|
112
|
+
for v in ${RBENV_RUBIES} ; do \
|
113
|
+
rbenv shell \$v && \
|
114
|
+
gem install rake-compiler -v1.2.5 && \
|
115
|
+
cd ${RBENV_ROOT}/versions/\$v/lib/ruby/gems/*/gems/rake-compiler-1.2.5 && \
|
116
|
+
patch -p1 < /home/rubyuser/patches/rake-compiler-1.2.5/*.patch ; \
|
131
117
|
done \
|
132
118
|
"
|
133
119
|
|
120
|
+
# Install rake-compiler's cross rubies in global dir instead of /root
|
121
|
+
RUN sudo mkdir -p /usr/local/rake-compiler && \
|
122
|
+
sudo chown rubyuser.rubyuser /usr/local/rake-compiler && \
|
123
|
+
ln -s /usr/local/rake-compiler ~/.rake-compiler
|
124
|
+
|
134
125
|
<%
|
135
126
|
#
|
136
127
|
# Build ruby versions prior to ruby2_keywords using ruby-2.5
|
@@ -139,7 +130,7 @@ RUN bash -c " \
|
|
139
130
|
# Note that parallel builds of ruby with make flag `-j` are often flaky, see
|
140
131
|
# https://bugs.ruby-lang.org/issues/18506
|
141
132
|
#
|
142
|
-
|
133
|
+
xrubies_build_plan = if platform =~ /x64-mingw-ucrt/
|
143
134
|
[
|
144
135
|
# Rubyinstaller-3.1.0+ is platform x64-mingw-ucrt
|
145
136
|
["3.3.0-rc1:3.2.0:3.1.0", "3.1.3"],
|
@@ -157,35 +148,33 @@ else
|
|
157
148
|
]
|
158
149
|
end
|
159
150
|
|
160
|
-
|
161
|
-
ENV XRUBIES <%= xrubies %>
|
151
|
+
strip = '-s' if platform !~ /darwin/
|
162
152
|
|
163
|
-
|
164
|
-
# Build xruby versions, then cleanup all build artifacts
|
153
|
+
xrubies_build_plan.each do |xrubies, bootstrap_ruby_version| %>
|
165
154
|
RUN bash -c " \
|
166
|
-
|
167
|
-
export CPPFLAGS='<%= "-D__USE_MINGW_ANSI_STDIO=1" if platform
|
155
|
+
rbenv shell <%= bootstrap_ruby_version %> && \
|
156
|
+
export CPPFLAGS='<%= "-D__USE_MINGW_ANSI_STDIO=1" if platform =~ /x64-mingw-ucrt/ %>' && \
|
168
157
|
export CFLAGS='-O1 -fno-omit-frame-pointer -fno-fast-math -fstack-protector-strong <%= strip %>' && \
|
169
158
|
export LDFLAGS='-pipe <%= strip %>' && \
|
170
159
|
<%= "export LIBS='-l:libssp.a' &&" if platform =~ /mingw/ %> \
|
171
160
|
<%= "export CC=#{target}-clang &&" if platform =~ /darwin/ %> \
|
172
161
|
export MAKE='make V=1' && \
|
173
|
-
rake-compiler cross-ruby VERSION
|
174
|
-
rm -rf ~/.rake-compiler/builds ~/.rake-compiler/sources
|
175
|
-
find /usr/local/rvm -type d -print0 | sudo xargs -0 chmod g+sw \
|
162
|
+
rake-compiler cross-ruby VERSION=<%= xrubies %> HOST=<%= target %> && \
|
163
|
+
rm -rf ~/.rake-compiler/builds ~/.rake-compiler/sources \
|
176
164
|
"
|
177
165
|
<% end %>
|
166
|
+
# "
|
178
167
|
|
179
|
-
<% if platform
|
168
|
+
<% if platform =~ /linux/ %>
|
180
169
|
# Avoid linking against libruby shared object.
|
181
170
|
# See also https://github.com/rake-compiler/rake-compiler-dock/issues/13
|
182
171
|
RUN find /usr/local/rake-compiler/ruby/*linux*/ -name libruby.so | xargs rm
|
183
172
|
RUN find /usr/local/rake-compiler/ruby/*linux*/ -name libruby-static.a | while read f ; do cp $f `echo $f | sed s/-static//` ; done
|
184
173
|
RUN find /usr/local/rake-compiler/ruby/*linux*/ -name libruby.a | while read f ; do ar t $f | xargs ar d $f ; done
|
185
|
-
RUN find /usr/local/rake-compiler/ruby/*linux*/ -name mkmf.rb | while read f ; do sed -i ':a;N;$!ba;s/TRY_LINK = [^\n]*\n[^\n]*\n[^\n]*LOCAL_LIBS)/& -lruby-static -lpthread -lrt -ldl <% if platform
|
174
|
+
RUN find /usr/local/rake-compiler/ruby/*linux*/ -name mkmf.rb | while read f ; do sed -i ':a;N;$!ba;s/TRY_LINK = [^\n]*\n[^\n]*\n[^\n]*LOCAL_LIBS)/& -lruby-static -lpthread -lrt -ldl <% if platform =~ /x86/ %> -lcrypt <% end %>/' $f ; done
|
186
175
|
<% end %>
|
187
176
|
|
188
|
-
<% if platform
|
177
|
+
<% if platform =~ /mingw/ %>
|
189
178
|
# RubyInstaller doesn't install libgcc -> link it static.
|
190
179
|
RUN find /usr/local/rake-compiler/ruby/*mingw*/ -name rbconfig.rb | while read f ; do sed -i 's/."LDFLAGS". = "/&-static-libgcc /' $f ; done
|
191
180
|
# Raise Windows-API to Vista (affects ruby < 2.6 only)
|
@@ -197,7 +186,7 @@ RUN find /usr/local/rake-compiler/ruby -name lib*-ruby*.dll.a | while read f ; d
|
|
197
186
|
# ruby-2.5 links to libcrypt, which isn't necessary for extensions
|
198
187
|
RUN find /usr/local/rake-compiler/ruby -name rbconfig.rb | while read f ; do sed -i 's/-lcrypt//' $f ; done
|
199
188
|
|
200
|
-
<% if platform
|
189
|
+
<% if platform =~ /darwin/ %>
|
201
190
|
# ruby-3.2+ on darwin links with `-bundle_loader`,
|
202
191
|
# - see https://github.com/rake-compiler/rake-compiler-dock/issues/87
|
203
192
|
# - note that we do this for "3.[2-9].0" to match rubies 3.2 and later
|
@@ -206,15 +195,13 @@ RUN find /usr/local/rake-compiler/ruby/*/*/lib/ruby/3.[2-9].0* -name rbconfig.rb
|
|
206
195
|
while read f ; do sed -i 's/\["EXTDLDFLAGS"\] = "/&-Wl,-flat_namespace /' $f ; done
|
207
196
|
<% end %>
|
208
197
|
|
198
|
+
|
209
199
|
##
|
210
200
|
## Final adjustments
|
211
201
|
##
|
212
202
|
USER root
|
213
203
|
|
214
|
-
|
215
|
-
RUN sed -i -- "s:/root/.rake-compiler:/usr/local/rake-compiler:g" /usr/local/rake-compiler/config.yml
|
216
|
-
|
217
|
-
<% if platform=~/mingw/ %>
|
204
|
+
<% if platform =~ /mingw/ %>
|
218
205
|
# Install wrappers for strip commands as a workaround for "Protocol error" in boot2docker.
|
219
206
|
COPY build/strip_wrapper_vbox /root/
|
220
207
|
RUN mv /usr/bin/<%= target %>-strip /usr/bin/<%= target %>-strip.bin && \
|
@@ -242,12 +229,13 @@ RUN echo "export PATH=\$DEVTOOLSET_ROOTPATH/usr/bin:\$PATH" >> /etc/rubybashrc
|
|
242
229
|
RUN for f in addr2line gcc gcov-tool ranlib ar dwp gcc-ranlib nm readelf as elfedit gcc-ar gprof objcopy size c++filt g++ gcov ld objdump strings cpp gcc-nm pkg-config strip ; do ln -sf $DEVTOOLSET_ROOTPATH/usr/bin/$f $DEVTOOLSET_ROOTPATH/usr/bin/<%= target %>-$f ; done
|
243
230
|
|
244
231
|
# Use builtin functions of newer gcc to avoid linker issues on Musl based Linux
|
232
|
+
# TODO: remove in v1.6.0 once musl builds have been out for full minor release cycle, see 864be5b2
|
245
233
|
COPY build/math_h.patch /root/
|
246
234
|
RUN cd /usr/include/ && \
|
247
235
|
patch -p1 < /root/math_h.patch
|
248
236
|
<% end %>
|
249
237
|
|
250
|
-
<% if platform
|
238
|
+
<% if platform =~ /arm64-darwin/ %>
|
251
239
|
# Add a arm64 darwin target as alternative to aarch64
|
252
240
|
RUN grep -E 'rbconfig-aarch64-darwin' /usr/local/rake-compiler/config.yml | sed 's/rbconfig-[a-z0-9_]*-darwin/rbconfig-<%= platform %>/' >> /usr/local/rake-compiler/config.yml
|
253
241
|
<% end %>
|
@@ -259,15 +247,12 @@ RUN gcc $HOME/sigfw.c -o /usr/bin/sigfw
|
|
259
247
|
# Install user mapper
|
260
248
|
COPY build/runas /usr/bin/
|
261
249
|
COPY build/rcd-env.sh /etc/profile.d/
|
262
|
-
RUN echo
|
250
|
+
RUN echo 'source /etc/profile.d/rcd-env.sh' >> /etc/rubybashrc
|
263
251
|
|
264
252
|
# Install sudoers configuration
|
265
253
|
COPY build/sudoers /etc/sudoers.d/rake-compiler-dock
|
266
254
|
|
267
|
-
RUN bash -c "
|
268
|
-
rvm alias create default 3.1.3 && \
|
269
|
-
rvm use default \
|
270
|
-
"
|
255
|
+
RUN bash -c "rbenv global 3.1.3"
|
271
256
|
|
272
257
|
ENV RUBY_CC_VERSION 3.3.0:3.2.0:3.1.0:3.0.0:2.7.0:2.6.0:2.5.0:2.4.0
|
273
258
|
|
data/History.md
CHANGED
@@ -1,8 +1,35 @@
|
|
1
|
-
|
1
|
+
# v1.5.0.rc1 / prerelease 2024-01-26
|
2
|
+
|
3
|
+
## Notable changes
|
4
|
+
|
5
|
+
### First-class Linux `musl` libc support
|
6
|
+
|
7
|
+
* Add Linux musl cross build targets `aarch64-linux-musl`, `arm-linux-musl`, `x86-linux-musl`, and `x86_64-linux-musl`. #75, #111 (@flavorjones)
|
8
|
+
* Add Linux cross build targets `aarch64-linux-gnu`, `arm-linux-gnu`, `x86-linux-gnu`, and `x86_64-linux-gnu`. #111 (@flavorjones)
|
9
|
+
* The cross build targets `aarch64-linux`, `arm-linux`, `x86-linux`, and `x86_64-linux` are now aliases for the `*-linux-gnu` targets. #111 (@flavorjones)
|
10
|
+
|
11
|
+
Please read the README for more details.
|
12
|
+
|
13
|
+
|
14
|
+
## Improvements
|
15
|
+
|
16
|
+
* Predefined user and group list is more complete, and represents the union of users and groups
|
17
|
+
across all RCD images.
|
18
|
+
|
19
|
+
|
20
|
+
## Changes
|
21
|
+
|
22
|
+
* Replace `rvm` with `rbenv` and `ruby-build` in the build containers.
|
23
|
+
- `rvm` has been replaced by `rbenv` and `ruby-build`
|
24
|
+
- no longer applying sendfile patches to bootstrap rubies
|
25
|
+
- no longer updating gems belonging to the bootstrap rubies
|
26
|
+
- user `rvm` no longer exists, replaced by `rubyuser`
|
27
|
+
|
28
|
+
|
29
|
+
1.4.0 / 2023-12-27
|
2
30
|
------------------
|
3
31
|
|
4
32
|
* Add Ruby 3.3.0-rc1 cross-compilation support. #109, #105 (@flavorjones)
|
5
|
-
* Add Ruby 3.3.0-preview3 cross-compilation support. #105 (@flavorjones)
|
6
33
|
* Update to rake-compiler 1.2.5. #108 (@flavorjones)
|
7
34
|
|
8
35
|
|
@@ -49,7 +76,7 @@
|
|
49
76
|
* Fix testing for ruby C-API functions in mkmf. #65, #67
|
50
77
|
* Use openjdk 11 to make maven work on ubuntu 20.04. #64
|
51
78
|
* Remove x86_64-w64-mingw32-pkg-config from the x64-mingw-ucrt image. #63
|
52
|
-
* Add a patch for math.h to use gcc builtins and to improve compat with musl based systems. #42
|
79
|
+
* Add a patch for math.h to use gcc builtins and to improve compat with `musl` libc-based systems. #42
|
53
80
|
|
54
81
|
|
55
82
|
1.2.0 / 2022-01-04
|
data/README.md
CHANGED
@@ -10,6 +10,43 @@ This is kind of successor of [rake-compiler-dev-box](https://github.com/tjschuck
|
|
10
10
|
It is wrapped as a gem for easier setup, usage and integration and is based on lightweight Docker containers.
|
11
11
|
It is also more reliable, since the underlying docker images are versioned and immutable.
|
12
12
|
|
13
|
+
## Supported platforms
|
14
|
+
|
15
|
+
The following platforms are supported for cross-compilation by rake-compiler-dock:
|
16
|
+
|
17
|
+
- `aarch64-linux` and `aarch64-linux-gnu`
|
18
|
+
- `aarch64-linux-musl`
|
19
|
+
- `arm-linux` and `arm-linux-gnu`
|
20
|
+
- `arm-linux-musl`
|
21
|
+
- `arm64-darwin`
|
22
|
+
- `jruby`
|
23
|
+
- `x64-mingw-ucrt`
|
24
|
+
- `x64-mingw32`
|
25
|
+
- `x86-linux` and `x86-linux-gnu`
|
26
|
+
- `x86-linux-musl`
|
27
|
+
- `x86-mingw32`
|
28
|
+
- `x86_64-darwin`
|
29
|
+
- `x86_64-linux` and `x86_64-linux-gnu`
|
30
|
+
- `x86_64-linux-musl`
|
31
|
+
|
32
|
+
### Windows
|
33
|
+
|
34
|
+
`x64-mingw-ucrt` should be used for Ruby 3.1 and later on windows. `x64-mingw32` should be used for Ruby 3.0 and earlier. This is to match the [changed platform of RubyInstaller-3.1](https://rubyinstaller.org/2021/12/31/rubyinstaller-3.1.0-1-released.html).
|
35
|
+
|
36
|
+
### GNU and Musl
|
37
|
+
|
38
|
+
Platform names with a `*-linux` suffix are aliases for `*-linux-gnu`, since the Rubygems default is to assume `gnu` if no libc is specified.
|
39
|
+
|
40
|
+
Some C extensions may not require separate GNU and Musl builds, in which case it's acceptable to ship a single `*-linux` gem to cover both platforms.
|
41
|
+
|
42
|
+
The `*-linux-gnu` and `*-linux-musl` platform name suffixes require Rubygems 3.3.22 or later (or Bundler 2.3.21 or later) at installation time. Ruby version 3.0 and later ship with a sufficient Rubygems version, but versions compatible with earlier Rubies are:
|
43
|
+
|
44
|
+
- ruby: "2.7", rubygems: "3.4.22"
|
45
|
+
- ruby: "2.6", rubygems: "3.4.22"
|
46
|
+
- ruby: "2.5", rubygems: "3.3.26"
|
47
|
+
- ruby: "2.4", rubygems: "3.3.26"
|
48
|
+
|
49
|
+
|
13
50
|
## Installation
|
14
51
|
|
15
52
|
Install docker [following the instructions on the docker website](https://docs.docker.com/engine/install/) ... or install [docker-toolbox for Windows and OSX](https://github.com/docker/toolbox/releases) or boot2docker on [Windows](https://github.com/boot2docker/windows-installer/releases) or [OS X](https://github.com/boot2docker/osx-installer/releases) .
|
@@ -37,6 +74,8 @@ exttask = Rake::ExtensionTask.new('my_extension', my_gem_spec) do |ext|
|
|
37
74
|
end
|
38
75
|
```
|
39
76
|
|
77
|
+
where you should choose your platforms from the list in the "Supported platforms" section.
|
78
|
+
|
40
79
|
See below, how to invoke cross builds in your Rakefile.
|
41
80
|
|
42
81
|
Additionally it may also be used to build ffi based binary gems like [libusb](https://github.com/larskanis/libusb), but currently doesn't provide any additional build helpers for this use case, beyond docker invocation and cross compilers.
|
@@ -44,9 +83,6 @@ Additionally it may also be used to build ffi based binary gems like [libusb](ht
|
|
44
83
|
### Interactive Usage
|
45
84
|
|
46
85
|
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.
|
48
|
-
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+.
|
49
|
-
This is to match the [changed platform of RubyInstaller-3.1](https://rubyinstaller.org/2021/12/31/rubyinstaller-3.1.0-1-released.html).
|
50
86
|
|
51
87
|
`rake-compiler-dock` without arguments starts an interactive shell session.
|
52
88
|
This is best suited to try out and debug a build.
|
@@ -68,12 +104,12 @@ To build x86 Windows and x86_64 Linux binary gems interactively, it can be calle
|
|
68
104
|
user@host:$ ls pkg/*.gem
|
69
105
|
your-gem-1.0.0.gem your-gem-1.0.0-x86-mingw32.gem
|
70
106
|
|
71
|
-
user@host:$ RCD_PLATFORM=x86_64-linux rake-compiler-dock # this enters a container for amd64 Linux target
|
107
|
+
user@host:$ RCD_PLATFORM=x86_64-linux-gnu rake-compiler-dock # this enters a container for amd64 Linux GNU target
|
72
108
|
user@adc55b2b92a9:$ bundle
|
73
109
|
user@adc55b2b92a9:$ rake cross native gem
|
74
110
|
user@adc55b2b92a9:$ exit
|
75
111
|
user@host:$ ls pkg/*.gem
|
76
|
-
your-gem-1.0.0.gem your-gem-1.0.0-x86_64-linux.gem
|
112
|
+
your-gem-1.0.0.gem your-gem-1.0.0-x86_64-linux-gnu.gem
|
77
113
|
|
78
114
|
Or non-interactive:
|
79
115
|
|
@@ -92,7 +128,7 @@ For Linux:
|
|
92
128
|
|
93
129
|
sudo yum install your-package
|
94
130
|
|
95
|
-
You can also choose between different executable ruby versions by `
|
131
|
+
You can also choose between different executable ruby versions by `rbenv shell <version>` .
|
96
132
|
The current default is 3.1.
|
97
133
|
|
98
134
|
### JRuby support
|
@@ -118,10 +154,25 @@ To make the build process reproducible for other parties, it is recommended to a
|
|
118
154
|
This can be done like this:
|
119
155
|
|
120
156
|
```ruby
|
157
|
+
PLATFORMS = %w[
|
158
|
+
aarch64-linux-gnu
|
159
|
+
aarch64-linux-musl
|
160
|
+
arm-linux-gnu
|
161
|
+
arm-linux-musl
|
162
|
+
arm64-darwin
|
163
|
+
x64-mingw-ucrt
|
164
|
+
x64-mingw32
|
165
|
+
x86-linux-gnu
|
166
|
+
x86-linux-musl
|
167
|
+
x86-mingw32
|
168
|
+
x86_64-darwin
|
169
|
+
x86_64-linux-gnu
|
170
|
+
x86_64-linux-musl
|
171
|
+
]
|
121
172
|
task 'gem:native' do
|
122
173
|
require 'rake_compiler_dock'
|
123
174
|
sh "bundle package --all" # Avoid repeated downloads of gems by using gem files from the host.
|
124
|
-
|
175
|
+
PLATFORMS.each do |plat|
|
125
176
|
RakeCompilerDock.sh "bundle --local && rake native:#{plat} gem", platform: plat
|
126
177
|
end
|
127
178
|
RakeCompilerDock.sh "bundle --local && rake java gem", rubyvm: :jruby
|
@@ -187,10 +238,10 @@ jobs:
|
|
187
238
|
name: "native-gem"
|
188
239
|
runs-on: ubuntu-latest
|
189
240
|
container:
|
190
|
-
image: "ghcr.io/rake-compiler/rake-compiler-dock-image:1.2.2-mri-x86_64-linux"
|
241
|
+
image: "ghcr.io/rake-compiler/rake-compiler-dock-image:1.2.2-mri-x86_64-linux-gnu"
|
191
242
|
steps:
|
192
243
|
- uses: actions/checkout@v2
|
193
|
-
- run: bundle install && bundle exec rake gem:x86_64-linux:rcd
|
244
|
+
- run: bundle install && bundle exec rake gem:x86_64-linux-gnu:rcd
|
194
245
|
- uses: actions/upload-artifact@v2
|
195
246
|
with:
|
196
247
|
name: native-gem
|
@@ -198,7 +249,7 @@ jobs:
|
|
198
249
|
retention-days: 1
|
199
250
|
```
|
200
251
|
|
201
|
-
Where the referenced rake task might be defined by:
|
252
|
+
Where the referenced rake task might be defined by something like:
|
202
253
|
|
203
254
|
``` ruby
|
204
255
|
cross_platforms = ["x64-mingw32", "x86_64-linux", "x86_64-darwin", "arm64-darwin"]
|
@@ -223,7 +274,7 @@ For an example of rake tasks that support this style of invocation, visit https:
|
|
223
274
|
|
224
275
|
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.:
|
225
276
|
|
226
|
-
- `ghcr.io/rake-compiler/rake-compiler-dock-image:snapshot-mri-x86_64-linux`
|
277
|
+
- `ghcr.io/rake-compiler/rake-compiler-dock-image:snapshot-mri-x86_64-linux-gnu`
|
227
278
|
|
228
279
|
These images are intended for integration testing. They may not work properly and should not be considered production ready.
|
229
280
|
|
@@ -237,7 +288,7 @@ The following variables are recognized by rake-compiler-dock:
|
|
237
288
|
* `RCD_RUBYVM` - The ruby VM and toolchain to be used.
|
238
289
|
Must be one of `mri`, `jruby`.
|
239
290
|
* `RCD_PLATFORM` - The target rubygems platform.
|
240
|
-
Must be a space separated list out of
|
291
|
+
Must be a space separated list out of the platforms listed under "Supported platforms" above.
|
241
292
|
It is ignored when `rubyvm` is set to `:jruby`.
|
242
293
|
* `RCD_IMAGE` - The docker image that is downloaded and started.
|
243
294
|
Defaults to "ghcr.io/rake-compiler/rake-compiler-dock-image:IMAGE_VERSION-PLATFORM" with an image version that is determined by the gem version.
|