Skip to content

Commit bd9684f

Browse files
authored
Support of arm64 (#563) (#564)
Thank you very much @sbernhard
1 parent 659a905 commit bd9684f

File tree

4 files changed

+98
-24
lines changed

4 files changed

+98
-24
lines changed

.github/workflows/build.yml

Lines changed: 43 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,59 @@ on:
1010

1111
env:
1212
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
13-
13+
1414
jobs:
1515
build:
16-
runs-on: ubuntu-20.04
16+
runs-on: ${{ matrix.config.runner }}
17+
strategy:
18+
matrix:
19+
config:
20+
- runner: ubuntu-20.04
21+
image: ubuntu:20.04
22+
- runner: ubuntu-22.04-arm
23+
image: ubuntu:22.04
1724
container:
18-
image: ubuntu:20.04
25+
image: ${{ matrix.config.image }}
1926
options: --privileged
2027
steps:
2128
- name: Checkout code
2229
uses: actions/checkout@v4
2330

31+
- name: Print configuration
32+
run: echo "Running build on ${{ matrix.config }}"
33+
2434
- name: Install dependencies
2535
run: |
36+
export DEBIAN_FRONTEND="noninteractive"
2637
apt-get update
27-
apt-get install -y sudo libarchive-tools curl zsync squashfs-tools aria2 desktop-file-utils wget fuse binutils file
38+
apt-get install -y sudo libarchive-tools curl zsync squashfs-tools aria2 desktop-file-utils wget fuse binutils file imagemagick gcc
39+
40+
- name: Build pkg2appimage
41+
run: |
42+
bash -ex dogfeeding.sh
43+
44+
- name: Test to create Hello AppImage
45+
run: |
46+
chmod +x ./out/pkg2appimage*.AppImage*
47+
./out/pkg2appimage*.AppImage* recipes/hello.yml
48+
49+
- name: Verify AppImage Creation and Test
50+
run: |
51+
if ls out/hello-*.AppImage 1> /dev/null 2>&1; then
52+
echo "hello AppImage successfully created."
53+
./out/hello-*.AppImage | tee output.txt
54+
if grep -q "Hello, world!" output.txt; then
55+
echo "hello AppImage test passed."
56+
else
57+
echo "hello AppImage test failed." >&2
58+
exit 1
59+
fi
60+
else
61+
echo "Failed to create hello AppImage." >&2
62+
exit 1
63+
fi
2864
29-
- name: Build and Release
65+
- name: Release
3066
run: |
31-
bash -ex dogfeeding.sh
32-
wget -c https://github.com/probonopd/uploadtool/raw/master/upload.sh
33-
bash upload.sh ./out/pkg2appimage*.AppImage*
67+
wget -c https://github.com/probonopd/uploadtool/raw/master/upload.sh
68+
bash upload.sh ./out/pkg2appimage*.AppImage*

dogfeeding.sh

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ cd build/
1313
apt download -y dpkg # We are still using dpkg-deb to extract debs, so we need to bundle it
1414

1515
wget -c "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-$SYSTEM_ARCH.AppImage" # FIXME: Make arch independent
16-
wget -c "https://github.com/ImageMagick/ImageMagick/releases/download/7.0.8-17/ImageMagick-0b0ce48-gcc-$SYSTEM_ARCH.AppImage" # FIXME: Make arch independent
1716
chmod +x ./*.AppImage
1817

1918
./appimagetool-*.AppImage --appimage-extract && mv ./squashfs-root ./pkg2appimage.AppDir
@@ -22,14 +21,12 @@ cd ./pkg2appimage.AppDir
2221
find ../*.deb -exec dpkg-deb -x {} . \; || true
2322

2423
rm *.desktop || true
25-
mv ./usr/share/applications/appimagetool.desktop ./usr/share/applications/pkg2appimage.desktop
24+
mv ./usr/share/applications/appimagetool.desktop ./usr/share/applications/pkg2appimage.desktop
2625
sed -i -e 's|Name=appimagetool|Name=pkg2appimage|g' ./usr/share/applications/pkg2appimage.desktop
2726
sed -i -e 's|Exec=appimagetool|Exec=pkg2appimage|g' ./usr/share/applications/pkg2appimage.desktop
2827
sed -i -e 's|Comment=.*|Comment=Create AppImages from Debian/Ubuntu repositories|g' ./usr/share/applications/pkg2appimage.desktop
2928
cp ./usr/share/applications/pkg2appimage.desktop .
3029

31-
cp ../ImageMagick-*.AppImage usr/bin/convert
32-
3330
# We don't suffer from NIH
3431
# mkdir -p usr/src/
3532
# wget -q "https://raw.githubusercontent.com/mikix/deb2snap/master/src/preload.c" -O - | \

functions.sh

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ grep docker /proc/1/cgroup >/dev/null && export DOCKER_BUILD=1 || true
3535
# Detect system architecture to know which binaries of AppImage tools
3636
# should be downloaded and used.
3737
case "$(uname -i)" in
38+
aarch64|arm64)
39+
# echo "aarch64 system architecture"
40+
SYSTEM_ARCH="aarch64";;
3841
x86_64|amd64)
3942
# echo "x86-64 system architecture"
4043
SYSTEM_ARCH="x86_64";;
@@ -47,6 +50,9 @@ case "$(uname -i)" in
4750
unknown|AuthenticAMD|GenuineIntel)
4851
# uname -i not answer on debian, then:
4952
case "$(uname -m)" in
53+
aarch64|arm64)
54+
# echo "aarch64 system architecture"
55+
SYSTEM_ARCH="aarch64";;
5056
x86_64|amd64)
5157
# echo "x86-64 system architecture"
5258
SYSTEM_ARCH="x86_64";;
@@ -249,7 +255,7 @@ generate_type2_appimage()
249255
GLIBC_NEEDED=$(glibc_needed)
250256
_APP_DIR="${PWD}/$APP.AppDir/"
251257
export OWD="${PWD}"
252-
258+
253259
if ( [ ! -z "$KEY" ] ) && ( ! -z "$TRAVIS" ) ; then
254260
wget https://github.com/AppImage/AppImageKit/files/584665/data.zip -O data.tar.gz.gpg
255261
( set +x ; echo $KEY | gpg2 --batch --passphrase-fd 0 --no-tty --skip-verify --output data.tar.gz --decrypt data.tar.gz.gpg )
@@ -375,16 +381,29 @@ patch_strings_in_file() {
375381

376382
function apt-get.update(){
377383
echo -n > cache.txt
378-
384+
379385
cat Packages.gz | gunzip -c | grep -E "^Package:|^Filename:|^Depends:|^Version:" >> cache.txt || true
380-
386+
387+
local arch=$SYSTEM_ARCH
388+
case "$SYSTEM_ARCH" in
389+
x86_64)
390+
arch="amd64";;
391+
aarch64)
392+
arch="arm64";;
393+
i686)
394+
arch="i386";;
395+
*)
396+
echo "Unsupported system architecture"
397+
exit 1;;
398+
esac
399+
381400
echo APT_GET_UPDATE
382401
while read line; do
383402
local line=$(echo "${line}" | sed 's|[[:space:]]| |g')
384403
local repo_info=($(echo ${line} | tr " " "\n"))
385404
local base_url=${repo_info[1]}
386405
local dist_name=${repo_info[2]}
387-
406+
388407
echo line=${line}
389408
echo repo_info=${repo_info}
390409
echo base_url=${base_url}
@@ -398,7 +417,7 @@ function apt-get.update(){
398417
else
399418
for i in $(seq 3 $((${#repo_info[@]} - 1))); do
400419
echo "Caching ${base_url} ${dist_name} ${repo_info[${i}]}..."
401-
local repo_url="${base_url}/dists/${dist_name}/${repo_info[${i}]}/binary-amd64/Packages.gz"
420+
local repo_url="${base_url}/dists/${dist_name}/${repo_info[${i}]}/binary-${arch}/Packages.gz"
402421
wget -q "${repo_url}" -O - | gunzip -c | grep -E "^Package:|^Filename:|^Depends:|^Version:" | sed "s|^Filename: |Filename: ${base_url}/|g" >> cache.txt
403422
done
404423
fi
@@ -409,18 +428,18 @@ function apt-get.do-download(){
409428
[ -f "status" ] && {
410429
grep -q ^"Package: ${1}"$ status && return
411430
}
412-
431+
413432
local package_name=$(echo ${1} | cut -d= -f1)
414433
local package_version=`echo ${1} | cut -s -d= -f2-`
415434

416435
echo "${already_downloaded_package[@]}" | sed 's| |\n|g' | grep -q ^"${package_name}"$ && return
417-
436+
418437
if ! test -z "${package_version}" ; then
419438
local package_url=`cat cache.txt | grep -v ^"Depends: " \
420439
| grep -A 3 ^"Package: ${package_name}"$ \
421440
| grep -A 2 ^"Version: ${package_version}" \
422441
| grep ^"Filename: " \
423-
| cut -c 11-`
442+
| cut -c 11-`
424443
else
425444
local package_url=`cat cache.txt | grep -v ^"Depends: " \
426445
| grep -A 3 -m 1 ^"Package: ${package_name}"$ \
@@ -429,7 +448,7 @@ function apt-get.do-download(){
429448
fi
430449

431450
already_downloaded_package+=(${package_name})
432-
451+
433452
local dependencies=($(cat cache.txt | grep -A 2 -m 1 ^"Package: ${package_name}"$ \
434453
| grep ^"Depends: " \
435454
| cut -c 9- \
@@ -440,17 +459,17 @@ function apt-get.do-download(){
440459
echo PACKAGE NAME: ${package_name}
441460
echo PACKAGE_VERSION: ${package_version}
442461
echo PACKAGE_URL: ${package_url}
443-
462+
444463
[ ! -f "${package_url}" ] && {
445464
[ ! "${package_url}" = "" ] && {
446465
wget -c "${package_url}"
447466
} || {
448467
echo ${1} >> teste_123
449468
}
450469
}
451-
470+
452471
unset package_url
453-
472+
454473
for depend in "${dependencies[@]}"; do
455474
apt-get.do-download ${depend}
456475
done

recipes/hello.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
app: hello
2+
union: true
3+
4+
ingredients:
5+
dist: focal
6+
sources:
7+
- deb http://us.archive.ubuntu.com/ubuntu/ focal main # works for amd64
8+
- deb http://ports.ubuntu.com/ubuntu-ports/ focal main # works for arm64
9+
10+
script:
11+
- ls
12+
- cat > hello.desktop <<\EOF
13+
- [Desktop Entry]
14+
- Type=Application
15+
- Name=hello
16+
- Exec=hello
17+
- Icon=hello
18+
- Categories=Utility
19+
- Comment=Example package based on GNU hello
20+
- EOF
21+
- wget -c https://github.com/iconoir-icons/iconoir/blob/main/icons/regular/spock-hand-gesture.svg -o hello.svg
22+
- mkdir -p usr/share/icons/hicolor/scalable/apps/
23+
- cp hello.svg usr/share/icons/hicolor/scalable/apps/hello.svg

0 commit comments

Comments
 (0)