rake-compiler-dock 0.7.0 → 1.1.0
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.tar.gz.sig +0 -0
- data/.gitignore +4 -0
- data/Dockerfile.jruby +12 -8
- data/Dockerfile.mri.erb +231 -0
- data/History.md +56 -0
- data/README.md +86 -15
- data/Rakefile +44 -4
- data/{lib/rake_compiler_dock → build}/gem_helper.rb +0 -15
- data/build/parallel_docker_build.rb +102 -0
- data/build/patches/{ruby-2.5.3 → ruby-2.5.8}/no_sendfile.patch +1 -1
- data/build/patches/ruby-3.0.0/no_sendfile.patch +24 -0
- data/build/patches2/hoe-3.20.0/0001-Load-encrypted-private-key-using-ENV-GEM_PRIVATE_KEY.patch +32 -0
- data/build/patches2/rake-compiler-1.1.1/0001-Fix-determining-of-ruby-versions-in-rake-native-gem.patch +44 -0
- data/build/patches2/rake-compiler-1.1.1/0003-Allow-building-of-cross-rubies-in-parallel.patch +214 -0
- data/build/patches2/rake-compiler-1.1.1/0004-Enable-build-of-static-libruby.patch +29 -0
- data/build/patches2/rake-compiler-1.1.1/0005-Don-t-mask-out-build-env-vars-for-cross-ruby.patch +30 -0
- data/build/patches2/rake-compiler-1.1.1/0006-Use-RAKE_EXTENSION_TASK_NO_NATIVE-env-var-as-the-def.patch +26 -0
- data/build/patches2/ruby-2.7.0/ruby2_keywords.patch +15 -0
- data/build/patches2/ruby-3.0.0/ruby2_keywords.patch +15 -0
- data/build/runas +4 -1
- data/build/sudoers +1 -1
- data/lib/rake_compiler_dock.rb +10 -0
- data/lib/rake_compiler_dock/docker_check.rb +12 -6
- data/lib/rake_compiler_dock/starter.rb +68 -53
- data/lib/rake_compiler_dock/version.rb +2 -2
- data/test/test_environment_variables.rb +2 -2
- data/test/test_parallel_docker_build.rb +57 -0
- metadata +35 -25
- metadata.gz.sig +0 -0
- data/Dockerfile.mri +0 -122
- data/build/patches/rake-compiler-1.0.6/enable-static.diff +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7bbe8d21de2a30484e2ec2d877bf6e2e2538c7f02d207e924716d9bb99609fbf
|
4
|
+
data.tar.gz: 2069a049a2a9974a98f13bfd704f60f8e07dc5741f2e0f5d18a6c4f122358875
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 197abac03aa2262d6893e4f79dcb9fa63bbf7018afa70d6ea7c189abc390074a36c7892b6745e8399ffbe4309686b5310c382d5227dfe9906d6bd875a561b5af
|
7
|
+
data.tar.gz: 184393bac4b1890e1c19567c7c80ecc3a015e78e8789232c4f00a28d7c2a6ba0209ae94e9c1ffa2dcbd58bcd9eb8a1875732c32263cdbd47499437bc0e3617aa
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/.gitignore
CHANGED
data/Dockerfile.jruby
CHANGED
@@ -1,16 +1,20 @@
|
|
1
|
-
FROM ubuntu:
|
1
|
+
FROM ubuntu:20.04
|
2
2
|
|
3
3
|
RUN apt-get -y update && \
|
4
|
-
apt-get install -y curl git-core xz-utils wget unzip sudo gpg dirmngr openjdk-
|
4
|
+
apt-get install -y curl git-core xz-utils wget unzip sudo gpg dirmngr openjdk-14-jdk-headless && \
|
5
|
+
rm -rf /var/lib/apt/lists/*
|
5
6
|
|
6
7
|
# Add "rvm" as system group, to avoid conflicts with host GIDs typically starting with 1000
|
7
8
|
RUN groupadd -r rvm && useradd -r -g rvm -G sudo -p "" --create-home rvm && \
|
8
9
|
echo "source /etc/profile.d/rvm.sh" >> /etc/rubybashrc
|
9
10
|
USER rvm
|
10
11
|
|
12
|
+
RUN mkdir ~/.gnupg && \
|
13
|
+
echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf
|
14
|
+
|
11
15
|
# install rvm, RVM 1.26.0+ has signed releases, source rvm for usage outside of package scripts
|
12
|
-
RUN gpg --keyserver hkp://
|
13
|
-
(curl -L http://get.rvm.io | sudo bash
|
16
|
+
RUN gpg --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB && \
|
17
|
+
(curl -L http://get.rvm.io | sudo bash) && \
|
14
18
|
bash -c " \
|
15
19
|
source /etc/rubybashrc && \
|
16
20
|
rvmsudo rvm cleanup all "
|
@@ -22,7 +26,7 @@ ENV BASH_ENV /etc/rubybashrc
|
|
22
26
|
# install rubies and fix permissions on
|
23
27
|
RUN bash -c " \
|
24
28
|
export CFLAGS='-s -O3 -fno-fast-math -fPIC' && \
|
25
|
-
for v in jruby-9.2.
|
29
|
+
for v in jruby-9.2.14.0 ; do \
|
26
30
|
rvm install --binary \$v --patch \$(echo ~/patches/ruby-\$v/* | tr ' ' ','); \
|
27
31
|
done && \
|
28
32
|
rvm cleanup all && \
|
@@ -32,7 +36,7 @@ RUN bash -c " \
|
|
32
36
|
# do not generate documentation for gems
|
33
37
|
RUN echo "gem: --no-ri --no-rdoc" >> ~/.gemrc && \
|
34
38
|
bash -c " \
|
35
|
-
rvm all do gem install --no-document bundler rake-compiler hoe rubygems-tasks && \
|
39
|
+
rvm all do gem install --no-document bundler 'bundler:~>1.16' rake-compiler hoe rubygems-tasks && \
|
36
40
|
find /usr/local/rvm -type d -print0 | sudo xargs -0 chmod g+sw "
|
37
41
|
|
38
42
|
# Install rake-compiler's cross rubies in global dir instead of /root
|
@@ -42,8 +46,8 @@ RUN sudo mkdir -p /usr/local/rake-compiler && \
|
|
42
46
|
|
43
47
|
USER root
|
44
48
|
|
45
|
-
RUN bash -c "rvm alias create default jruby-9.2.
|
46
|
-
RUN echo "rvm use jruby-9.2.
|
49
|
+
RUN bash -c "rvm alias create default jruby-9.2.14.0"
|
50
|
+
RUN echo "rvm use jruby-9.2.14.0 > /dev/null" >> /etc/rubybashrc
|
47
51
|
|
48
52
|
# Add rvm to the global bashrc
|
49
53
|
RUN echo "source /etc/profile.d/rvm.sh" >> /etc/bash.bashrc
|
data/Dockerfile.mri.erb
ADDED
@@ -0,0 +1,231 @@
|
|
1
|
+
FROM <%=
|
2
|
+
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"
|
6
|
+
end %>
|
7
|
+
|
8
|
+
<% if platform=~/linux/ %>
|
9
|
+
# install packages which rvm will require
|
10
|
+
RUN yum install -y autoconf gcc-c++ libtool readline-devel sqlite-devel ruby openssl-devel xz cmake sudo less
|
11
|
+
|
12
|
+
# Prepare sudo and delete sudo as alias to gosu
|
13
|
+
RUN rm -f /usr/local/bin/sudo && \
|
14
|
+
groupadd -r sudo && \
|
15
|
+
echo "%sudo ALL=(ALL) ALL" >> /etc/sudoers
|
16
|
+
<% else %>
|
17
|
+
ENV DEBIAN_FRONTEND noninteractive
|
18
|
+
RUN apt-get -y update && \
|
19
|
+
apt-get install -y curl git-core xz-utils build-essential zlib1g-dev libreadline-dev libssl-dev wget unzip sudo gnupg2 dirmngr cmake pkg-config && \
|
20
|
+
rm -rf /var/lib/apt/lists/*
|
21
|
+
<% end %>
|
22
|
+
|
23
|
+
# Add "rvm" as system group, to avoid conflicts with host GIDs typically starting with 1000
|
24
|
+
RUN groupadd -r rvm && useradd -r -g rvm -G sudo -p "" --create-home rvm
|
25
|
+
|
26
|
+
# Make sure rvm and later settings are available in interactive and non-interactive shells
|
27
|
+
RUN echo "source /etc/profile.d/rvm.sh" >> /etc/rubybashrc && \
|
28
|
+
echo "source /etc/rubybashrc" >> /etc/bashrc && \
|
29
|
+
echo "source /etc/rubybashrc" >> /etc/bash.bashrc
|
30
|
+
ENV BASH_ENV /etc/rubybashrc
|
31
|
+
|
32
|
+
USER rvm
|
33
|
+
|
34
|
+
RUN mkdir ~/.gnupg && \
|
35
|
+
chmod 700 ~/.gnupg && \
|
36
|
+
echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf
|
37
|
+
|
38
|
+
# install rvm, RVM 1.26.0+ has signed releases, source rvm for usage outside of package scripts
|
39
|
+
RUN gpg --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB && \
|
40
|
+
(curl -L http://get.rvm.io | sudo bash) && \
|
41
|
+
bash -c " \
|
42
|
+
source /etc/rubybashrc && \
|
43
|
+
rvm autolibs disable && \
|
44
|
+
rvmsudo rvm cleanup all "
|
45
|
+
|
46
|
+
# Import patch files for ruby and gems
|
47
|
+
COPY build/patches /home/rvm/patches/
|
48
|
+
|
49
|
+
# install rubies and fix permissions on
|
50
|
+
ENV RVM_RUBIES 2.5.8 3.0.0
|
51
|
+
RUN bash -c " \
|
52
|
+
export CFLAGS='-s -O3 -fno-fast-math -fPIC' && \
|
53
|
+
for v in ${RVM_RUBIES} ; do \
|
54
|
+
rvm install \$v --patch \$(echo ~/patches/ruby-\$v/* | tr ' ' ','); \
|
55
|
+
done && \
|
56
|
+
rvm cleanup all && \
|
57
|
+
find /usr/local/rvm -type d -print0 | sudo xargs -0 chmod g+sw "
|
58
|
+
|
59
|
+
# Install rake-compiler and typical gems in all Rubies
|
60
|
+
# do not generate documentation for gems
|
61
|
+
RUN echo "gem: --no-ri --no-rdoc" >> ~/.gemrc && \
|
62
|
+
bash -c " \
|
63
|
+
rvm all do gem update --system --no-document && \
|
64
|
+
rvm all do gem install --no-document bundler 'bundler:~>1.16' 'rake-compiler:1.1.1' 'hoe:3.20.0' mini_portile rubygems-tasks mini_portile2 && \
|
65
|
+
find /usr/local/rvm -type d -print0 | sudo xargs -0 chmod g+sw "
|
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 rvm.rvm /usr/local/rake-compiler && \
|
70
|
+
ln -s /usr/local/rake-compiler ~/.rake-compiler
|
71
|
+
|
72
|
+
# Add cross compilers for Windows and Linux
|
73
|
+
USER root
|
74
|
+
|
75
|
+
<% if platform !~ /linux/ %>
|
76
|
+
RUN apt-get -y update && \
|
77
|
+
apt-get install -y <%
|
78
|
+
if platform=~/darwin/ %> clang python lzma-dev libxml2-dev libssl-dev libc++-10-dev <% end %><%
|
79
|
+
if platform=~/x86-mingw32/ %> gcc-mingw-w64-i686 g++-mingw-w64-i686 <% end %><%
|
80
|
+
if platform=~/x64-mingw32/ %> gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 <% end %> && \
|
81
|
+
rm -rf /var/lib/apt/lists/*
|
82
|
+
<% end %>
|
83
|
+
|
84
|
+
RUN bash -c " \
|
85
|
+
rvm alias create default 2.5.8 && \
|
86
|
+
rvm use default "
|
87
|
+
|
88
|
+
<% if platform=~/linux/ %>
|
89
|
+
# Create dev tools x86-linux-*
|
90
|
+
COPY build/mk_i686.rb /root/
|
91
|
+
RUN bash -c " \
|
92
|
+
ruby /root/mk_i686.rb "
|
93
|
+
<% end %>
|
94
|
+
|
95
|
+
<% if platform=~/darwin/ %>
|
96
|
+
RUN git clone -q --depth=1 https://github.com/tpoechtrager/osxcross.git /opt/osxcross && rm -rf /opt/osxcross/.git && \
|
97
|
+
cd /opt/osxcross/tarballs && \
|
98
|
+
curl -L -o MacOSX11.1.sdk.tar.xz https://github.com/larskanis/MacOSX-SDKs/releases/download/11.1/MacOSX11.1.sdk.tar.xz && \
|
99
|
+
tar -xf MacOSX11.1.sdk.tar.xz -C . && \
|
100
|
+
cp -rf /usr/lib/llvm-10/include/c++ MacOSX11.1.sdk/usr/include/c++ && \
|
101
|
+
cp -rf /usr/include/x86_64-linux-gnu/c++/9/bits/ MacOSX11.1.sdk/usr/include/c++/v1/bits && \
|
102
|
+
tar -cJf MacOSX11.1.sdk.tar.xz MacOSX11.1.sdk && \
|
103
|
+
cd /opt/osxcross && \
|
104
|
+
UNATTENDED=1 SDK_VERSION=11.1 OSX_VERSION_MIN=10.13 USE_CLANG_AS=1 ./build.sh && \
|
105
|
+
rm -rf *~ build tarballs/*
|
106
|
+
|
107
|
+
RUN echo "export PATH=/opt/osxcross/target/bin:\$PATH" >> /etc/rubybashrc && \
|
108
|
+
echo "export MACOSX_DEPLOYMENT_TARGET=10.13" >> /etc/rubybashrc && \
|
109
|
+
echo "export OSXCROSS_MP_INC=1" >> /etc/rubybashrc
|
110
|
+
|
111
|
+
# Add links to build tools without target version kind of:
|
112
|
+
# arm64-apple-darwin-clang => arm64-apple-darwin20.1-clang
|
113
|
+
RUN rm /opt/osxcross/target/bin/*-apple-darwin-* ; \
|
114
|
+
find /opt/osxcross/target/bin/ -name '*-apple-darwin[0-9]*' | sort | while read f ; do d=`echo $f | sed s/darwin[0-9\.]*/darwin/`; echo $f '"$@"' | tee $d && chmod +x $d ; done
|
115
|
+
|
116
|
+
# There's no objdump in osxcross but we can use llvm's
|
117
|
+
RUN ln -s /usr/lib/llvm-10/bin/llvm-objdump /opt/osxcross/target/bin/x86_64-apple-darwin-objdump && \
|
118
|
+
ln -s /usr/lib/llvm-10/bin/llvm-objdump /opt/osxcross/target/bin/aarch64-apple-darwin-objdump
|
119
|
+
|
120
|
+
<% end %>
|
121
|
+
|
122
|
+
# Patch rake-compiler to build and install static libraries for Linux rubies
|
123
|
+
USER rvm
|
124
|
+
COPY build/patches2 /home/rvm/patches/
|
125
|
+
RUN bash -c " \
|
126
|
+
for v in ${RVM_RUBIES} ; do \
|
127
|
+
cd /usr/local/rvm/gems/ruby-\$v/gems/rake-compiler-1.1.1 && \
|
128
|
+
echo applying patches to ruby-\$v /home/rvm/patches/rake-compiler-1.1.1/*.patch && \
|
129
|
+
( git apply /home/rvm/patches/rake-compiler-1.1.1/*.patch || true ) && \
|
130
|
+
cd /usr/local/rvm/gems/ruby-\$v/gems/hoe-3.20.0 && \
|
131
|
+
echo applying patches to ruby-\$v /home/rvm/patches/hoe-3.20.0/*.patch && \
|
132
|
+
( git apply /home/rvm/patches/hoe-3.20.0/*.patch || true ) \
|
133
|
+
done "
|
134
|
+
|
135
|
+
# Patch rubies for cross build
|
136
|
+
USER root
|
137
|
+
RUN bash -c " \
|
138
|
+
for v in 2.7.0 3.0.0 ; do \
|
139
|
+
curl -SL http://cache.ruby-lang.org/pub/ruby/\${v:0:3}/ruby-\$v.tar.xz | tar -xJC /root/ && \
|
140
|
+
cd /root/ruby-\$v && \
|
141
|
+
git apply /home/rvm/patches/ruby-\$v/*.patch && \
|
142
|
+
cd .. && \
|
143
|
+
mkdir -p /usr/local/rake-compiler/sources/ && \
|
144
|
+
tar cjf /usr/local/rake-compiler/sources/ruby-\$v.tar.bz2 ruby-\$v && \
|
145
|
+
chown rvm /usr/local/rake-compiler -R && \
|
146
|
+
rm -rf /root/ruby-\$v ; \
|
147
|
+
done "
|
148
|
+
USER rvm
|
149
|
+
|
150
|
+
|
151
|
+
ENV XRUBIES 3.0.0:2.7.0:2.6.0:2.5.0:2.4.0:2.3.0
|
152
|
+
|
153
|
+
<% strip = '-s' if platform !~ /darwin/ %>
|
154
|
+
# Build all xruby versions in parallel
|
155
|
+
# Then cleanup all build artifacts
|
156
|
+
RUN bash -c " \
|
157
|
+
export CFLAGS='-O1 -fno-omit-frame-pointer -fno-fast-math -fstack-protector-strong <%= strip %>' && \
|
158
|
+
export LDFLAGS='-pipe <%= strip %>' && \
|
159
|
+
<%= "export LIBS='-l:libssp.a' &&" if platform =~ /mingw/ %> \
|
160
|
+
<%= "export CC=#{target}-clang &&" if platform =~ /darwin/ %> \
|
161
|
+
export MAKE='make V=1' && \
|
162
|
+
rake-compiler cross-ruby VERSION=$XRUBIES HOST=<%= target %> && \
|
163
|
+
rm -rf ~/.rake-compiler/builds ~/.rake-compiler/sources && \
|
164
|
+
find /usr/local/rvm -type d -print0 | sudo xargs -0 chmod g+sw "
|
165
|
+
|
166
|
+
<% if platform=~/linux/ %>
|
167
|
+
# Avoid linking against libruby shared object.
|
168
|
+
# See also https://github.com/rake-compiler/rake-compiler-dock/issues/13
|
169
|
+
RUN find /usr/local/rake-compiler/ruby/*linux*/ -name libruby.so | xargs rm
|
170
|
+
RUN find /usr/local/rake-compiler/ruby/*linux*/ -name libruby-static.a | while read f ; do cp $f `echo $f | sed s/-static//` ; done
|
171
|
+
RUN find /usr/local/rake-compiler/ruby/*linux*/ -name libruby.a | while read f ; do ar t $f | xargs ar d $f ; done
|
172
|
+
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/' $f ; done
|
173
|
+
<% end %>
|
174
|
+
|
175
|
+
<% if platform=~/mingw/ %>
|
176
|
+
# RubyInstaller doesn't install libgcc -> link it static.
|
177
|
+
RUN find /usr/local/rake-compiler/ruby/*mingw*/ -name rbconfig.rb | while read f ; do sed -i 's/."LDFLAGS". = "/&-static-libgcc /' $f ; done
|
178
|
+
# Raise Windows-API to Vista (affects ruby < 2.6 only)
|
179
|
+
RUN find /usr/local/rake-compiler/ruby -name rbconfig.rb | while read f ; do sed -i 's/0x0501/0x0600/' $f ; done
|
180
|
+
# Don't link to static libruby
|
181
|
+
RUN find /usr/local/rake-compiler/ruby -name *msvcrt-ruby*.dll.a | while read f ; do n=`echo $f | sed s/.dll//` ; mv $f $n ; done
|
182
|
+
<% end %>
|
183
|
+
|
184
|
+
USER root
|
185
|
+
|
186
|
+
# Fix paths in rake-compiler/config.yml
|
187
|
+
RUN sed -i -- "s:/root/.rake-compiler:/usr/local/rake-compiler:g" /usr/local/rake-compiler/config.yml
|
188
|
+
|
189
|
+
|
190
|
+
<% if platform=~/mingw/ %>
|
191
|
+
# Install wrappers for strip commands as a workaround for "Protocol error" in boot2docker.
|
192
|
+
COPY build/strip_wrapper /root/
|
193
|
+
RUN mv /usr/bin/<%= target %>-strip /usr/bin/<%= target %>-strip.bin && \
|
194
|
+
ln /root/strip_wrapper /usr/bin/<%= target %>-strip
|
195
|
+
|
196
|
+
# Use posix pthread for mingw so that C++ standard library for thread could be
|
197
|
+
# available such as std::thread, std::mutex, so on.
|
198
|
+
# https://sourceware.org/pthreads-win32/
|
199
|
+
RUN printf "1\n" | update-alternatives --config <%= target %>-gcc && \
|
200
|
+
printf "1\n" | update-alternatives --config <%= target %>-g++
|
201
|
+
<% end %>
|
202
|
+
|
203
|
+
<% if platform=~/linux/ %>
|
204
|
+
# Enable modern compiler toolset of manylinux image
|
205
|
+
RUN echo "export PATH=\$DEVTOOLSET_ROOTPATH/usr/bin:\$PATH" >> /etc/rubybashrc
|
206
|
+
|
207
|
+
# Add prefixed versions of compiler tools
|
208
|
+
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
|
209
|
+
|
210
|
+
# ruby-2.5 links to libcrypt, which isn't necessary for extensions
|
211
|
+
RUN find /usr/local/rake-compiler/ruby -name rbconfig.rb | while read f ; do sed -i 's/-lcrypt//' $f ; done
|
212
|
+
<% end %>
|
213
|
+
|
214
|
+
<% if platform=~/arm64-darwin/ %>
|
215
|
+
# Add a arm64 darwin target as alternative to aarch64
|
216
|
+
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
|
217
|
+
<% end %>
|
218
|
+
|
219
|
+
# Install SIGINT forwarder
|
220
|
+
COPY build/sigfw.c /root/
|
221
|
+
RUN gcc $HOME/sigfw.c -o /usr/bin/sigfw
|
222
|
+
|
223
|
+
# Install user mapper
|
224
|
+
COPY build/runas /usr/bin/
|
225
|
+
|
226
|
+
# Install sudoers configuration
|
227
|
+
COPY build/sudoers /etc/sudoers.d/rake-compiler-dock
|
228
|
+
|
229
|
+
ENV RUBY_CC_VERSION 3.0.0:2.7.0:2.6.0:2.5.0:2.4.0:2.3.0
|
230
|
+
|
231
|
+
CMD bash
|
data/History.md
CHANGED
@@ -1,3 +1,59 @@
|
|
1
|
+
1.1.0 / 2020-12-28
|
2
|
+
------------------
|
3
|
+
|
4
|
+
* Use ManyLinux2014 as docker base image for linux targets.
|
5
|
+
That way compatibility to very old linux dists can be provided, while still using modern compilers.
|
6
|
+
* Add macOS cross build targets "x86_64-darwin" and "arm64-darwin".
|
7
|
+
They are based on MacOSX-SDK-11.1
|
8
|
+
* Add Ruby-3.0 as native rvm and cross ruby version.
|
9
|
+
* Remove Ruby-2.2 from RUBY_CC_VERSION and cross rubies.
|
10
|
+
* Update to Ubuntu-20.04 for Mingw and JRuby targets.
|
11
|
+
* Set `ExtensionTask#no_native=true` to fix issues with cross_compiling callback not being called.
|
12
|
+
See discussion here: https://github.com/rake-compiler/rake-compiler/pull/171
|
13
|
+
* Allow setting an alternative dockerhub user per `DOCKERHUB_USER`.
|
14
|
+
|
15
|
+
|
16
|
+
1.0.1 / 2020-01-13
|
17
|
+
------------------
|
18
|
+
|
19
|
+
* Fix error when using rake-compiler-dock on non-tty STDIN. #31
|
20
|
+
|
21
|
+
|
22
|
+
1.0.0 / 2020-01-04
|
23
|
+
------------------
|
24
|
+
* Add ruby-2.7.0 cross ruby.
|
25
|
+
* Use per-target docker images.
|
26
|
+
There are currently 5 docker images:
|
27
|
+
* larskanis/rake-compiler-dock-mri-x86-mingw32
|
28
|
+
* larskanis/rake-compiler-dock-mri-x64-mingw32
|
29
|
+
* larskanis/rake-compiler-dock-mri-x86-linux
|
30
|
+
* larskanis/rake-compiler-dock-mri-x86_64-linux
|
31
|
+
* larskanis/rake-compiler-dock-jruby
|
32
|
+
|
33
|
+
Since every image has only the taget specific compilers and rubies, care has to be taken, that only rake tasks are triggered, that belong to the specific target.
|
34
|
+
See the README.md for more information.
|
35
|
+
* Ensure the separate docker images always use as much as possible common docker images layers to avoid increased download sizes.
|
36
|
+
* Pass GEM_PRIVATE_KEY_PASSPHRASE to the container.
|
37
|
+
* Update JRuby to 9.2.9.0 and native CRuby to 2.5.7.
|
38
|
+
* Create empty ~/.gem to be used for gem signing key.
|
39
|
+
* Ensure terminal is in cooked mode after build.
|
40
|
+
This fixes terminal misconfiguration after parallel builds.
|
41
|
+
* Raise Windows-API to Vista (affects ruby < 2.6 only)
|
42
|
+
* Use posix pthread for mingw so that C++ standard library for thread could be available such as std::thread, std::mutex, so on.
|
43
|
+
* Make the system to have GLIBC 2.12 instead of 2.23 so that generated ruby package can run on CentOS 6 with GLIBC 2.12
|
44
|
+
|
45
|
+
|
46
|
+
0.7.2 / 2019-03-18
|
47
|
+
------------------
|
48
|
+
* Fix missing libruby.a of cross rubies. Fixes #26
|
49
|
+
* Downgrade to Ubuntu-16.04 for MRI base image. Fixes #25
|
50
|
+
|
51
|
+
|
52
|
+
0.7.1 / 2019-01-27
|
53
|
+
------------------
|
54
|
+
* Add bundler-2.x to image and keep bundler-1.x for compatibility with projects using a `Gemfile.lock` generated by bundler-1.x .
|
55
|
+
|
56
|
+
|
1
57
|
0.7.0 / 2018-12-26
|
2
58
|
------------------
|
3
59
|
* Add docker image for JRuby extensions, new option `:rubyvm` and `RCD_RUBYVM` environment variable
|
data/README.md
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# rake-compiler-dock
|
2
2
|
|
3
|
-
**Easy to use and reliable cross compiler environment for building Windows and
|
3
|
+
**Easy to use and reliable cross compiler environment for building Windows, Linux and JRuby binary gems.**
|
4
4
|
|
5
|
-
It provides cross compilers and Ruby environments for 2.
|
5
|
+
It provides cross compilers and Ruby environments for 2.2 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
|
-
It is used by [many gems with C
|
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
|
|
9
9
|
This is kind of successor of [rake-compiler-dev-box](https://github.com/tjschuck/rake-compiler-dev-box).
|
10
10
|
It is wrapped as a gem for easier setup, usage and integration and is based on lightweight Docker containers.
|
@@ -16,7 +16,7 @@ Install docker natively on Linux:
|
|
16
16
|
|
17
17
|
$ sudo apt-get install docker.io
|
18
18
|
|
19
|
-
... or install [docker-toolbox for Windows and OSX](https://
|
19
|
+
... 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) .
|
20
20
|
|
21
21
|
Install rake-compiler-dock as a gem. The docker image is downloaded later on demand:
|
22
22
|
|
@@ -30,20 +30,23 @@ Install rake-compiler-dock as a gem. The docker image is downloaded later on dem
|
|
30
30
|
|
31
31
|
## Usage
|
32
32
|
|
33
|
-
Rake-compiler-dock provides the necessary tools to build Ruby extensions for Windows and Linux written in C and C
|
33
|
+
Rake-compiler-dock provides the necessary tools to build Ruby extensions for Windows and Linux written in C and C++ and JRuby written in Java.
|
34
34
|
It is intended to be used in conjunction with [rake-compiler's](https://github.com/rake-compiler/rake-compiler) cross build capability.
|
35
35
|
Your Rakefile should enable cross compilation like so:
|
36
36
|
|
37
|
-
Rake::ExtensionTask.new('my_extension', my_gem_spec) do |ext|
|
37
|
+
exttask = Rake::ExtensionTask.new('my_extension', my_gem_spec) do |ext|
|
38
38
|
ext.cross_compile = true
|
39
39
|
ext.cross_platform = %w[x86-mingw32 x64-mingw32 x86-linux x86_64-linux]
|
40
40
|
end
|
41
41
|
|
42
|
-
|
42
|
+
See below, how to invoke cross builds in your Rakefile.
|
43
|
+
|
44
|
+
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.
|
43
45
|
|
44
46
|
### Interactive Usage
|
45
47
|
|
46
48
|
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.
|
49
|
+
There dedicated are images for `x86-mingw32`, `x64-mingw32`, `x86-linux`, `x86_64-linux` and `jruby` targets.
|
47
50
|
|
48
51
|
`rake-compiler-dock` without arguments starts an interactive shell session.
|
49
52
|
This is best suited to try out and debug a build.
|
@@ -55,16 +58,22 @@ But note, that all other changes to the file system of the container are dropped
|
|
55
58
|
All commands are executed with the same user and group of the host.
|
56
59
|
This is done by copying user account data into the container and sudo to it.
|
57
60
|
|
58
|
-
To build x86
|
61
|
+
To build x86 Windows and x86_64 Linux binary gems interactively, it can be called like this:
|
59
62
|
|
60
63
|
user@host:$ cd your-gem-dir/
|
61
|
-
user@host:$ rake-compiler-dock # this enters a container with an interactive shell
|
64
|
+
user@host:$ rake-compiler-dock # this enters a container with an interactive shell for x86 Windows (default)
|
62
65
|
user@5b53794ada92:$ bundle
|
63
66
|
user@5b53794ada92:$ rake cross native gem
|
64
67
|
user@5b53794ada92:$ exit
|
65
68
|
user@host:$ ls pkg/*.gem
|
66
|
-
your-gem-1.0.0.gem your-gem-1.0.0-
|
67
|
-
|
69
|
+
your-gem-1.0.0.gem your-gem-1.0.0-x86-mingw32.gem
|
70
|
+
|
71
|
+
user@host:$ RCD_PLATFORM=x86_64-linux rake-compiler-dock # this enters a container for amd64 Linux target
|
72
|
+
user@adc55b2b92a9:$ bundle
|
73
|
+
user@adc55b2b92a9:$ rake cross native gem
|
74
|
+
user@adc55b2b92a9:$ exit
|
75
|
+
user@host:$ ls pkg/*.gem
|
76
|
+
your-gem-1.0.0.gem your-gem-1.0.0-x86_64-linux.gem
|
68
77
|
|
69
78
|
Or non-interactive:
|
70
79
|
|
@@ -78,23 +87,79 @@ This is local to the running session, only:
|
|
78
87
|
sudo apt-get update && sudo apt-get install your-package
|
79
88
|
|
80
89
|
You can also choose between different executable ruby versions by `rvm use <version>` .
|
81
|
-
The current default is 2.
|
90
|
+
The current default is 2.5.
|
91
|
+
|
92
|
+
### JRuby support
|
82
93
|
|
94
|
+
Rake-compiler-dock offers a dedicated docker image for JRuby.
|
95
|
+
JRuby doesn't need a complicated cross build environment like C-ruby, but using Rake-compiler-dock for JRuby makes building binary gems more consistent.
|
96
|
+
|
97
|
+
To build java binary gems interactively, it can be called like this:
|
98
|
+
|
99
|
+
user@host:$ cd your-gem-dir/
|
100
|
+
user@host:$ RCD_RUBYVM=jruby rake-compiler-dock # this enters a container with an interactive shell
|
101
|
+
user@5b53794ada92:$ ruby -v
|
102
|
+
jruby 9.2.5.0 (2.5.0) 2018-12-06 6d5a228 OpenJDK 64-Bit Server VM 10.0.2+13-Ubuntu-1ubuntu0.18.04.4 on 10.0.2+13-Ubuntu-1ubuntu0.18.04.4 +jit [linux-x86_64]
|
103
|
+
user@5b53794ada92:$ bundle
|
104
|
+
user@5b53794ada92:$ rake java gem
|
105
|
+
user@5b53794ada92:$ exit
|
106
|
+
user@host:$ ls pkg/*.gem
|
107
|
+
your-gem-1.0.0.gem your-gem-1.0.0-java.gem
|
83
108
|
|
84
109
|
### Add to your Rakefile
|
85
110
|
|
86
|
-
To make the build process
|
111
|
+
To make the build process reproducible for other parties, it is recommended to add rake-compiler-dock to your Rakefile.
|
87
112
|
This can be done like this:
|
88
113
|
|
89
114
|
task 'gem:native' do
|
90
115
|
require 'rake_compiler_dock'
|
91
116
|
sh "bundle package" # Avoid repeated downloads of gems by using gem files from the host.
|
92
|
-
|
117
|
+
%w[ x86-mingw32 x64-mingw32 x86-linux x86_64-linux ].each do |plat|
|
118
|
+
RakeCompilerDock.sh "bundle --local && rake native:#{plat} gem", platform: plat
|
119
|
+
end
|
120
|
+
RakeCompilerDock.sh "bundle --local && rake java gem", rubyvm: :jruby
|
93
121
|
end
|
94
122
|
|
123
|
+
This runs the `bundle` and `rake` commands once for each platform.
|
124
|
+
That is once for the jruby gems and 4 times for the specified MRI platforms.
|
125
|
+
|
126
|
+
### Run builds in parallel
|
127
|
+
|
128
|
+
rake-compiler-dock uses dedicated docker images per build target (since rake-compiler-dock-1.0).
|
129
|
+
Because each target runs in a separate docker container, it is simple to run all targets in parallel.
|
130
|
+
The following example defines `rake gem:native` as a multitask and separates the preparation which should run only once.
|
131
|
+
It also shows how gem signing can be done with parallel builds.
|
132
|
+
Please note, that parallel builds only work reliable, if the specific platform gem is requested (instead of just "rake gem").
|
133
|
+
|
134
|
+
```ruby
|
135
|
+
namespace "gem" do
|
136
|
+
exttask.cross_platform.each do |plat|
|
137
|
+
desc "Build the native binary gems"
|
138
|
+
multitask 'native' => plat
|
139
|
+
|
140
|
+
task 'prepare' do
|
141
|
+
require 'rake_compiler_dock'
|
142
|
+
sh "cp ~/.gem/gem-*.pem build/gem/ || true"
|
143
|
+
require 'io/console'
|
144
|
+
ENV["GEM_PRIVATE_KEY_PASSPHRASE"] = STDIN.getpass("Enter passphrase of gem signature key: ")
|
145
|
+
end
|
146
|
+
|
147
|
+
task plat => 'prepare' do
|
148
|
+
RakeCompilerDock.sh <<-EOT, platform: plat
|
149
|
+
(cp build/gem/gem-*.pem ~/.gem/ || true) &&
|
150
|
+
bundle --local &&
|
151
|
+
rake native:#{plat} pkg/#{exttask.gem_spec.full_name}-#{plat}.gem
|
152
|
+
EOT
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
156
|
+
```
|
157
|
+
|
158
|
+
### Add to your Gemfile
|
159
|
+
|
95
160
|
Rake-compiler-dock uses [semantic versioning](http://semver.org/), so you should add it into your Gemfile, to make sure, that future changes will not break your build.
|
96
161
|
|
97
|
-
gem 'rake-compiler-dock', '~>
|
162
|
+
gem 'rake-compiler-dock', '~> 1.0'
|
98
163
|
|
99
164
|
See [the wiki](https://github.com/rake-compiler/rake-compiler-dock/wiki/Projects-using-rake-compiler-dock) for projects which make use of rake-compiler-dock.
|
100
165
|
|
@@ -105,12 +170,18 @@ Rake-compiler-dock makes use of several environment variables.
|
|
105
170
|
|
106
171
|
The following variables are recognized by rake-compiler-dock:
|
107
172
|
|
173
|
+
* `RCD_RUBYVM` - The ruby VM and toolchain to be used.
|
174
|
+
Must be one of `mri`, `jruby`.
|
175
|
+
* `RCD_PLATFORM` - The target rubygems platform.
|
176
|
+
Must be a space separated list out of `x86-mingw32`, `x64-mingw32`, `x86-linux` and `x86_64-linux`.
|
177
|
+
It is ignored when `rubyvm` is set to `:jruby`.
|
108
178
|
* `RCD_IMAGE` - The docker image that is downloaded and started.
|
109
179
|
Defaults to "larskanis/rake-compiler-dock:IMAGE_VERSION" with an image version that is determined by the gem version.
|
110
180
|
|
111
181
|
The following variables are passed through to the docker container without modification:
|
112
182
|
|
113
183
|
* `http_proxy`, `https_proxy`, `ftp_proxy` - See [Frequently asked questions](https://github.com/rake-compiler/rake-compiler-dock/wiki/FAQ) for more details.
|
184
|
+
* `GEM_PRIVATE_KEY_PASSPHRASE` - To avoid interactive password prompts in the container.
|
114
185
|
|
115
186
|
The following variables are provided to the running docker container:
|
116
187
|
|