Skip to content

Commit

Permalink
Allow using multiplatform images
Browse files Browse the repository at this point in the history
This way we can provide not only images running on x86_64 but also aarch64.
The docker platform names are "linux/amd64" and "linux/arm64".

Fixes #78
  • Loading branch information
larskanis committed Dec 29, 2024
1 parent cc37afb commit d013faf
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
15 changes: 8 additions & 7 deletions Dockerfile.mri.erb
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ ENV BASH_ENV=/etc/rubybashrc
##
<% if platform =~ /x64-mingw-ucrt/ %>
COPY --from=larskanis/mingw64-ucrt:20.04 \
/build/binutils-mingw-w64-x86-64_2.34-6ubuntu1.3+8.8_amd64.deb \
/build/g++-mingw-w64-x86-64_9.3.0-17ubuntu1~20.04+22~exp1ubuntu4_amd64.deb \
/build/gcc-mingw-w64-base_9.3.0-17ubuntu1~20.04+22~exp1ubuntu4_amd64.deb \
/build/gcc-mingw-w64-x86-64_9.3.0-17ubuntu1~20.04+22~exp1ubuntu4_amd64.deb \
/build/mingw-w64-common_7.0.0-2_all.deb \
/build/mingw-w64-x86-64-dev_7.0.0-2_all.deb \
/build/binutils-mingw-w64-x86-64_*.deb \
/build/g++-mingw-w64-x86-64_*.deb \
/build/gcc-mingw-w64-base_*.deb \
/build/gcc-mingw-w64-x86-64_*.deb \
/build/mingw-w64-common_*.deb \
/build/mingw-w64-x86-64-dev_*.deb \
/debs/
RUN dpkg -i /debs/*.deb

Expand All @@ -57,6 +57,7 @@ if platform =~ /darwin/ %> clang python lzma-dev libxml2-dev libssl-d
if platform =~ /aarch64-linux-gnu/ %> gcc-aarch64-linux-gnu g++-aarch64-linux-gnu <% end %><%
if platform =~ /arm-linux-gnu/ %> gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf <% end %><%
if platform =~ /x86-linux-gnu/ %> gcc-i686-linux-gnu g++-i686-linux-gnu <% end %><%
if platform =~ /x86_64-linux-gnu/ %> gcc-x86-64-linux-gnu g++-x86-64-linux-gnu <% end %><%
if platform =~ /x86-mingw32/ %> gcc-mingw-w64-i686 g++-mingw-w64-i686 <% end %><%
if platform =~ /x64-mingw32/ %> gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 <% end %> && \
rm -rf /var/lib/apt/lists/*
Expand Down Expand Up @@ -148,7 +149,7 @@ RUN bash -c " \
RUN find /usr/local/rake-compiler/ruby/*linux*/ -name libruby.so | xargs rm
RUN find /usr/local/rake-compiler/ruby/*linux*/ -name libruby-static.a | while read f ; do cp $f `echo $f | sed s/-static//` ; done
RUN find /usr/local/rake-compiler/ruby/*linux*/ -name libruby.a | while read f ; do ar t $f | xargs ar d $f ; done
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_64/ %> -lcrypt <% if platform !~ /musl/ %> -lz <% end %> <% end %>/' $f ; done
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/' $f ; done
<% end %>

<% if platform =~ /mingw/ %>
Expand Down
2 changes: 1 addition & 1 deletion build/mk_osxcross.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ set -x
curl -L -o MacOSX11.1.sdk.tar.xz https://github.com/larskanis/MacOSX-SDKs/releases/download/11.1/MacOSX11.1.sdk.tar.xz
tar -xf MacOSX11.1.sdk.tar.xz -C .
cp -rf /usr/lib/llvm-10/include/c++ MacOSX11.1.sdk/usr/include/c++
cp -rf /usr/include/x86_64-linux-gnu/c++/9/bits/ MacOSX11.1.sdk/usr/include/c++/v1/bits
cp -rf /usr/include/*-linux-gnu/c++/9/bits/ MacOSX11.1.sdk/usr/include/c++/v1/bits
tar -cJf MacOSX11.1.sdk.tar.xz MacOSX11.1.sdk

set +x
Expand Down
6 changes: 5 additions & 1 deletion mingw64-ucrt/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ RUN cd mingw-w64-* && \

# Install UCRT enabled deb-packages
RUN dpkg -i mingw-w64-common_7.0.0-2_all.deb \
mingw-w64-tools_7.0.0-2_amd64.deb \
mingw-w64-tools_7.0.0-2_*.deb \
mingw-w64-x86-64-dev_7.0.0-2_all.deb

# Download gcc-binutils sources for mingw
Expand All @@ -52,6 +52,10 @@ RUN apt-get source gcc-mingw-w64 && \
cd gcc-mingw-w64-* && \
mk-build-deps -ir -t "apt-get -o Debug::pkgProblemResolver=yes -y --no-install-recommends"

# Add version based alias
RUN ln -s `which autoconf` `which autoconf`2.69 && \
ln -s `which autom4te` `which autom4te`2.69

# Build gcc (only C and C++) based on UCRT headers and crt
ADD gcc-mingw-w64-*.patch ./
RUN cd gcc-mingw-w64-* && \
Expand Down

0 comments on commit d013faf

Please sign in to comment.