From d013fafe2fbfaa028ad33cb5a06aeab538e48ca2 Mon Sep 17 00:00:00 2001 From: Lars Kanis Date: Sun, 29 Dec 2024 20:28:56 +0100 Subject: [PATCH] Allow using multiplatform images 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 --- Dockerfile.mri.erb | 15 ++++++++------- build/mk_osxcross.sh | 2 +- mingw64-ucrt/Dockerfile | 6 +++++- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/Dockerfile.mri.erb b/Dockerfile.mri.erb index 68b1714c..ad371d4e 100644 --- a/Dockerfile.mri.erb +++ b/Dockerfile.mri.erb @@ -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 @@ -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/* @@ -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/ %> diff --git a/build/mk_osxcross.sh b/build/mk_osxcross.sh index 2fa609be..ab96e91e 100755 --- a/build/mk_osxcross.sh +++ b/build/mk_osxcross.sh @@ -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 diff --git a/mingw64-ucrt/Dockerfile b/mingw64-ucrt/Dockerfile index eb07f5ab..0f3cd97f 100644 --- a/mingw64-ucrt/Dockerfile +++ b/mingw64-ucrt/Dockerfile @@ -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 @@ -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-* && \