Skip to content

Commit 5731f09

Browse files
committed
Keep i386 alive and add ARM builds
As a consequence of bionic having gone end-of-life, we move to using Debian oldstable as a consequence. This also required changes to prebuilt-cmake, which now supports a lot more distros for all of x86_64, i386, armhf and aarch64.
1 parent e57e1fc commit 5731f09

File tree

7 files changed

+98
-76
lines changed

7 files changed

+98
-76
lines changed

.github/workflows/main.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
strategy:
88
fail-fast: false
99
matrix:
10-
ARCH: [x86_64, i386]
10+
ARCH: [x86_64, i686, aarch64, armhf]
1111

1212
name: AppImage ${{ matrix.ARCH }}
1313
runs-on: ubuntu-20.04
@@ -18,8 +18,13 @@ jobs:
1818
- uses: actions/checkout@v2
1919
with:
2020
submodules: recursive
21+
22+
- name: Set up QEMU integration for Docker
23+
run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
24+
2125
- name: Build AppImage in Docker
2226
run: bash -ex ci/build-in-docker.sh
27+
2328
- name: Archive artifacts
2429
uses: actions/upload-artifact@v2
2530
with:

ci/Dockerfile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
ARG DOCKER_ARCH
2+
3+
# current Debian oldstable as of Dec 2023
4+
# we use Debian because they still provide i386 builds
5+
FROM ${DOCKER_ARCH}/debian:bullseye
6+
7+
ARG ARCH
8+
ARG DOCKER_ARCH
9+
ARG CMAKE_ARCH
10+
11+
ENV DEBIAN_FRONTEND=noninteractive
12+
13+
RUN apt-get update && \
14+
apt-get install -y \
15+
gcc g++ make libxpm-dev git libcurl4-openssl-dev libssl-dev wget zlib1g-dev libc6-dev bsdmainutils pkgconf libgcrypt20-dev ca-certificates file libglib2.0-0
16+
17+
RUN wget https://artifacts.assassinate-you.net/prebuilt-cmake/cmake-v3.28.0-debian-bullseye-${CMAKE_ARCH}.tar.gz -O- | \
18+
tar xz -C /usr/local --strip-components=1
19+
20+
COPY ./install-gtest.sh /
21+
RUN bash /install-gtest.sh
22+
23+
COPY libgcrypt.pc /usr/lib/i386-linux-gnu/pkgconfig/libgcrypt.pc
24+
RUN triplet="$(find /usr/lib/ -maxdepth 1 -type d -iname '*-linux-gnu*' | head -n1 | rev | cut -d/ -f1 | rev)" && \
25+
sed -i "s|x86_64-linux-gnu|${triplet}|g" /usr/lib/*/pkgconfig/libgcrypt.pc
26+
27+
# work around bug in FindCURL.cmake, which does not parse the pkg-config provided protocols and features into lists causing
28+
# the comparison in the loop to yield false negative results
29+
# this makes it use curl-config which works much better
30+
RUN rm /usr/lib/*/pkgconfig/libcurl.pc
31+
32+
ENV APPIMAGE_EXTRACT_AND_RUN=1
33+
34+
ENV ARCH=${ARCH}

ci/Dockerfile.bionic-i386

Lines changed: 0 additions & 26 deletions
This file was deleted.

ci/Dockerfile.bionic-x86_64

Lines changed: 0 additions & 25 deletions
This file was deleted.

ci/build-appimages.sh

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#! /bin/bash
22

3-
set -x
4-
set -e
3+
set -euxo pipefail
54

65
if [ "$ARCH" == "" ]; then
76
echo "Usage: env ARCH=... bash $0"
@@ -41,24 +40,27 @@ mkdir -p AppDir
4140
make -j"$(nproc)"
4241
make install DESTDIR=AppDir
4342

43+
LD_ARCH="$ARCH"
44+
if [ "$ARCH" == "i686" ]; then LD_ARCH="i386"; fi
45+
4446
# get linuxdeploy
45-
wget https://github.com/TheAssassin/linuxdeploy/releases/download/continuous/linuxdeploy-"$ARCH".AppImage
47+
wget https://github.com/TheAssassin/linuxdeploy/releases/download/continuous/linuxdeploy-"$LD_ARCH".AppImage
4648
chmod +x linuxdeploy*.AppImage
4749

4850
patch_appimage() {
49-
while [[ "$1" != "" ]]; do
51+
while [[ "${1:-}" != "" ]]; do
5052
dd if=/dev/zero of="$1" conv=notrunc bs=1 count=3 seek=8
5153
shift
5254
done
5355
}
54-
patch_appimage linuxdeploy-"$ARCH".AppImage
56+
patch_appimage linuxdeploy-"$LD_ARCH".AppImage
5557

5658
# determine Git commit ID
5759
# linuxdeploy uses this for naming the file
5860
export VERSION=$(cd "$REPO_ROOT" && git rev-parse --short HEAD)
5961

6062
# prepend GitHub actions run number if possible
61-
if [ "$GITHUB_RUN_NUMBER" != "" ]; then
63+
if [ "${GITHUB_RUN_NUMBER:-}" != "" ]; then
6264
export VERSION="$GITHUB_RUN_NUMBER-$VERSION"
6365
fi
6466

@@ -71,7 +73,7 @@ for app in zsync2 zsyncmake2; do
7173
# prepare AppDir with linuxdeploy and create AppImage
7274
export UPD_INFO="gh-releases-zsync|AppImage|zsync2|continuous|$app-*x86_64.AppImage.zsync"
7375

74-
./linuxdeploy-"$ARCH".AppImage --appdir AppDir \
76+
./linuxdeploy-"$LD_ARCH".AppImage --appdir AppDir \
7577
-d "$REPO_ROOT"/resources/"$app".desktop \
7678
-i "$REPO_ROOT"/resources/zsync2.svg \
7779
--output appimage

ci/build-in-docker.sh

Lines changed: 48 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,64 @@
11
#! /bin/bash
22

3-
if [[ "$DIST" == "" ]] || [[ "$ARCH" == "" ]]; then
4-
echo "Usage: env ARCH=... DIST=... bash $0"
3+
if [[ "$ARCH" == "" ]]; then
4+
echo "Usage: env ARCH=... bash $0"
55
exit 1
66
fi
77

8-
set -e
9-
set -x
8+
set -euxo pipefail
9+
10+
case "$ARCH" in
11+
x86_64)
12+
DOCKER_ARCH=amd64
13+
;;
14+
i686)
15+
CMAKE_ARCH=i386
16+
DOCKER_ARCH=i386
17+
;;
18+
armhf)
19+
DOCKER_ARCH=arm32v7
20+
;;
21+
aarch64)
22+
DOCKER_ARCH=arm64v8
23+
;;
24+
*)
25+
echo "Unsupported architecture: $ARCH"
26+
exit 2
27+
esac
28+
29+
CMAKE_ARCH="${CMAKE_ARCH:-"$ARCH"}"
1030

1131
cwd="$PWD"
12-
repo_root="$(readlink -f "$(dirname "$0")"/..)"
32+
repo_root="$(readlink -f "$(dirname "${BASH_SOURCE[0]}")"/..)"
1333

1434
# needed to keep user ID in and outside Docker in sync to be able to write to workspace directory
1535
uid="$(id -u)"
16-
image=zsync2-build:"$DIST"-"$ARCH"-uid"$uid"
17-
dockerfile=Dockerfile."$DIST"-"$ARCH"
18-
19-
if [ ! -f "$repo_root"/ci/"$dockerfile" ]; then
20-
echo "Error: $dockerfile could not be found"
21-
exit 1
22-
fi
36+
image=zsync2-build:"$ARCH"
2337

2438
# building local image to "cache" installed dependencies for subsequent builds
25-
docker build -t "$image" -f "$repo_root"/ci/"$dockerfile" --build-arg UID="$uid" "$repo_root"/ci
39+
docker build \
40+
"${tty_args[@]}" \
41+
-t "$image" \
42+
--build-arg ARCH="$ARCH" \
43+
--build-arg DOCKER_ARCH="$DOCKER_ARCH" \
44+
--build-arg CMAKE_ARCH="$CMAKE_ARCH" \
45+
"$repo_root"/ci
46+
47+
tty_args=()
48+
if [ -t 0 ]; then tty_args+=("-t"); fi
2649

2750
# mount workspace read-only, trying to make sure the build doesn't ever touch the source code files
2851
# of course, this only works reliably if you don't run this script from that directory
2952
# but it's still not the worst idea to do so
30-
docker run --rm -i -e CI=1 -e GITHUB_RUN_NUMBER -v "$repo_root":/ws:ro -v "$cwd":/out "$image" \
31-
bash -xec 'cd /out && bash -xe /ws/ci/build-appimages.sh'
53+
docker run \
54+
--rm \
55+
-i \
56+
"${tty_args[@]}" \
57+
-e CI=1 \
58+
-e GITHUB_RUN_NUMBER \
59+
-v "$repo_root":/ws:ro \
60+
-v "$cwd":/out \
61+
-w /out \
62+
--user "$uid" \
63+
"$image" \
64+
bash /ws/ci/build-appimages.sh

ci/install-gtest.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ trap _cleanup EXIT
1111

1212
cd "$tempdir"
1313

14-
#git clone https://github.com/google/googletest -b release-1.8.1 .
15-
git clone https://github.com/google/googletest -b v1.13.0 .
14+
git clone https://github.com/google/googletest -b v1.13.0 . --depth 1
1615

1716
mkdir build
1817
cd build

0 commit comments

Comments
 (0)