Skip to content

Commit cecdd8a

Browse files
committedDec 17, 2022
[linux/arm64] Use debian multiarch, dunno how to do manylinux....
1 parent 2558eb8 commit cecdd8a

File tree

2 files changed

+50
-6
lines changed

2 files changed

+50
-6
lines changed
 

‎Dockerfile.mri.erb

+7-6
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,13 @@ RUN rm -f /usr/local/bin/sudo && \
2323
echo "%sudo ALL=(ALL) ALL" >> /etc/sudoers
2424
<% else %>
2525
ENV DEBIAN_FRONTEND noninteractive
26-
RUN dpkg --add-architecture <%= foreign_dpkg_arch %> && \
27-
apt-get -y update && \
28-
apt-get install -y sudo wget autoconf cmake curl git-core pkg-config build-essential xz-utils unzip gnupg2 dirmngr && \
29-
apt-get install -y zlib1g-dev:<%= foreign_dpkg_arch %> libreadline-dev:<%= foreign_dpkg_arch %> libsqlite0-dev:<%= foreign_dpkg_arch %> libssl-dev:<%= foreign_dpkg_arch %> libyaml-dev:<%= foreign_dpkg_arch %> libffi-dev:<%= foreign_dpkg_arch %> && \
30-
rm -rf /var/lib/apt/lists/*
26+
COPY ./build/setup_dpkg_multiarch_for_target.sh /
27+
RUN /setup_dpkg_multiarch_for_target.sh <%= foreign_dpkg_arch %>;
28+
29+
RUN apt-get -y -qq update && \
30+
apt-get -y -qq install sudo wget autoconf cmake curl git-core pkg-config build-essential xz-utils unzip gnupg2 dirmngr && \
31+
apt-get -y -qq install zlib1g-dev:<%= foreign_dpkg_arch %> libreadline-dev:<%= foreign_dpkg_arch %> libsqlite0-dev:<%= foreign_dpkg_arch %> libssl-dev:<%= foreign_dpkg_arch %> libyaml-dev:<%= foreign_dpkg_arch %> libffi-dev:<%= foreign_dpkg_arch %> && \
32+
rm -rf /var/lib/apt/lists/*;
3133
<% end %>
3234

3335
# Add "rvm" as system group, to avoid conflicts with host GIDs typically starting with 1000
@@ -92,7 +94,6 @@ RUN apt-get -y update && \
9294
apt-get install -y <%
9395
if platform=~/darwin/ %> clang python lzma-dev libxml2-dev libssl-dev libc++-10-dev <% end %><%
9496
if platform=~/aarch64-linux/ %> gcc-aarch64-linux-gnu g++-aarch64-linux-gnu <% end %><%
95-
if platform=~/x86_64-linux/ %> gcc-x86-64-linux-gnu g++-x86-64-linux-gnu <% end %><%
9697
if platform=~/arm-linux/ %> gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf <% end %><%
9798
if platform=~/x86-mingw32/ %> gcc-mingw-w64-i686 g++-mingw-w64-i686 <% end %><%
9899
if platform=~/x64-mingw32/ %> gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 <% end %> && \
+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/bash
2+
3+
set -exuo pipefail
4+
IFS=$'\n\t'
5+
6+
main() {
7+
local to_uninstall=()
8+
9+
if ! command -v dpkg-architecture; then
10+
echo "dpkg-architecture not found, installing" >&2
11+
apt-get -qq -y update
12+
apt-get -qq -y install --no-install-recommends debhelper lsb-release
13+
rm -rf /var/lib/apt/lists/*
14+
to_uninstall+=("debhelper" "lsb-release")
15+
fi
16+
17+
deb_host_arch="$(dpkg-architecture --query DEB_HOST_ARCH)"
18+
deb_target_arch="$1"
19+
20+
if [ "$deb_target_arch" != "$deb_host_arch" ]; then
21+
echo "Setting up multiarch support for $deb_target_arch" >&2
22+
23+
# Add arch support for target so we can install libs
24+
dpkg --add-architecture "$deb_target_arch"
25+
# Qualify our current source lists to make sure debian doesn't infer stuff
26+
sed -i "s/^deb http/deb [arch=$deb_host_arch] http/" /etc/apt/sources.list
27+
# Add sources for ported target libs
28+
sh -c "echo \"deb [arch=$deb_target_arch] http://ports.ubuntu.com/ubuntu-ports $(lsb_release -cs) main universe restricted multiverse\" >> /etc/apt/sources.list"
29+
sh -c "echo \"deb [arch=$deb_target_arch] http://ports.ubuntu.com/ubuntu-ports $(lsb_release -cs)-updates main universe restricted multiverse\" >> /etc/apt/sources.list"
30+
sh -c "echo \"deb [arch=$deb_target_arch] http://ports.ubuntu.com/ubuntu-ports $(lsb_release -cs)-security main universe restricted multiverse\" >> /etc/apt/sources.list"
31+
apt-get update
32+
else
33+
echo "No need to set up multiarch support for $deb_target_arch"
34+
fi
35+
36+
if [ "${#to_uninstall[@]}" -gt 0 ]; then
37+
apt-get remove -y "${to_uninstall[@]}"
38+
fi
39+
40+
rm "$0"
41+
}
42+
43+
main "$@"

0 commit comments

Comments
 (0)