Skip to content

Commit 2bc6f74

Browse files
authored
Merge pull request #146 from rake-compiler/flavorjoens-add-341-as-an-rbenv-ruby
Allow gems to set `required_ruby_version = '>= 3.2.0'`
2 parents c4e7dc3 + 1d0351d commit 2bc6f74

File tree

1 file changed

+31
-30
lines changed

1 file changed

+31
-30
lines changed

Dockerfile.mri.erb

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -74,30 +74,30 @@ ENV BASH_ENV=/etc/rubybashrc
7474
##
7575
USER rubyuser
7676

77-
ENV RBENV_RUBIES="2.5.9 3.1.6"
77+
ENV RBENV_RUBIES="2.5.9 3.1.6 3.4.1"
7878

7979
# Install the bootstrap rubies
8080
RUN bash -c " \
81-
echo 'gem: --no-ri --no-rdoc --no-document' >> ~/.gemrc && \
82-
export CFLAGS='-s -O3 -fno-fast-math -fPIC' && \
83-
for v in ${RBENV_RUBIES} ; do \
84-
rbenv install \$v -- --disable-install-doc ; \
85-
done && \
86-
find ${RBENV_ROOT} -type d -print0 | sudo xargs -0 chmod g+w \
87-
"
81+
echo 'gem: --no-ri --no-rdoc --no-document' >> ~/.gemrc && \
82+
export CFLAGS='-s -O3 -fno-fast-math -fPIC' && \
83+
for v in ${RBENV_RUBIES} ; do \
84+
rbenv install \$v -- --disable-install-doc ; \
85+
done && \
86+
find ${RBENV_ROOT} -type d -print0 | sudo xargs -0 chmod g+w \
87+
"
8888

8989
# Install rake-compiler and patch it to build and install static libraries for Linux rubies
9090
COPY build/patches /home/rubyuser/patches
9191
RUN bash -c " \
92-
for v in ${RBENV_RUBIES} ; do \
93-
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 \
97-
patch -p1 < \$patch ; \
98-
done \
99-
done \
100-
"
92+
for v in ${RBENV_RUBIES} ; do \
93+
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 \
97+
patch -p1 < \$patch ; \
98+
done \
99+
done \
100+
"
101101

102102
# Install rake-compiler's cross rubies in global dir instead of /root
103103
RUN sudo mkdir -p /usr/local/rake-compiler && \
@@ -115,7 +115,7 @@ RUN sudo mkdir -p /usr/local/rake-compiler && \
115115
xrubies_build_plan = if platform =~ /x64-mingw-ucrt/
116116
[
117117
# Rubyinstaller-3.1+ is platform x64-mingw-ucrt
118-
["3.4.1:3.3.5:3.2.6:3.1.6", "3.1.6"],
118+
["3.4.1:3.3.5:3.2.6:3.1.6", "3.4.1"],
119119
]
120120
elsif platform =~ /x64-mingw32/
121121
[
@@ -126,24 +126,25 @@ elsif platform =~ /x64-mingw32/
126126
else
127127
[
128128
["2.6.10:2.5.9:2.4.10", "2.5.9"],
129-
["3.4.1:3.3.5:3.2.6:3.1.6:3.0.7:2.7.8", "3.1.6"],
129+
["2.7.8", "3.1.6"],
130+
["3.4.1:3.3.5:3.2.6:3.1.6:3.0.7", "3.4.1"],
130131
]
131132
end
132133

133134
strip = '-s' if platform !~ /darwin/
134135

135136
xrubies_build_plan.each do |xrubies, bootstrap_ruby_version| %>
136137
RUN bash -c " \
137-
rbenv shell <%= bootstrap_ruby_version %> && \
138-
export CPPFLAGS='<%= "-D__USE_MINGW_ANSI_STDIO=1" if platform =~ /x64-mingw-ucrt/ %>' && \
139-
export CFLAGS='-O1 -fno-omit-frame-pointer -fno-fast-math -fstack-protector-strong <%= strip %>' && \
140-
export LDFLAGS='-pipe <%= strip %>' && \
141-
<%= "export LIBS='-l:libssp.a' &&" if platform =~ /mingw/ %> \
142-
<%= "export CC=#{target}-clang &&" if platform =~ /darwin/ %> \
143-
export MAKE='make V=1' && \
144-
rake-compiler cross-ruby VERSION=<%= xrubies %> HOST=<%= target %> && \
145-
rm -rf ~/.rake-compiler/builds ~/.rake-compiler/sources \
146-
"
138+
rbenv shell <%= bootstrap_ruby_version %> && \
139+
export CPPFLAGS='<%= "-D__USE_MINGW_ANSI_STDIO=1" if platform =~ /x64-mingw-ucrt/ %>' && \
140+
export CFLAGS='-O1 -fno-omit-frame-pointer -fno-fast-math -fstack-protector-strong <%= strip %>' && \
141+
export LDFLAGS='-pipe <%= strip %>' && \
142+
<%= "export LIBS='-l:libssp.a' &&" if platform =~ /mingw/ %> \
143+
<%= "export CC=#{target}-clang &&" if platform =~ /darwin/ %> \
144+
export MAKE='make V=1' && \
145+
rake-compiler cross-ruby VERSION=<%= xrubies %> HOST=<%= target %> && \
146+
rm -rf ~/.rake-compiler/builds ~/.rake-compiler/sources \
147+
"
147148
<% end %>
148149
# "
149150

@@ -223,7 +224,7 @@ RUN echo 'source /etc/profile.d/rcd-env.sh' >> /etc/rubybashrc
223224
# Install sudoers configuration
224225
COPY build/sudoers /etc/sudoers.d/rake-compiler-dock
225226

226-
RUN bash -c "rbenv global 3.1.6"
227+
RUN bash -c "rbenv global 3.4.1"
227228

228229
ENV RUBY_CC_VERSION=3.4.1:3.3.5:3.2.6:3.1.6:3.0.7:2.7.8:2.6.10:2.5.9:2.4.10
229230

0 commit comments

Comments
 (0)