Skip to content

Commit

Permalink
feat: add loong64 support
Browse files Browse the repository at this point in the history
  • Loading branch information
msojocs committed May 19, 2024
1 parent 47b6655 commit 8aa6ef8
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 2 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
- { qemu_arch: x86_64, appimage_arch: x86_64 }
- { qemu_arch: armv7, appimage_arch: armhf }
- { qemu_arch: aarch64, appimage_arch: aarch64 }
- { qemu_arch: loong64, appimage_arch: loong64 }

steps:
- name: Checkout
Expand All @@ -46,12 +47,21 @@ jobs:
git rev-parse --short HEAD | xargs >> src/runtime/version
- name: Build
if: matrix.appimage_arch != 'loong64'
env:
ARCHITECTURE: ${{ matrix.appimage_arch }}
run: |
sudo apt-get -y install qemu-user-static
./chroot_build.sh
- name: Build Loongarch
if: matrix.appimage_arch == 'loong64'
env:
ARCHITECTURE: ${{ matrix.appimage_arch }}
run: |
docker run --rm --privileged loongcr.lcpu.dev/multiarch/archlinux --reset -p yes
./build_loong64.sh
- name: Sign
env:
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,9 @@ modules.order
Module.symvers
Mkfile.old
dkms.conf

miniroot
fuse-3.15.0
out
squa*
*.tar.*
19 changes: 17 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,29 @@

set -ex

cleanup () {
if [ -d "$build_dir" ]; then
rm -rf "$build_dir"
fi
}
trap cleanup EXIT

if ! command -v apk; then
echo "This script should be run in an Alpine container"
exit 1
fi

rm -rf fuse-*
rm -rf squashfuse-*

apk update
apk add alpine-sdk util-linux strace file autoconf automake libtool xz

# Build static libfuse3 with patch for https://github.com/AppImage/type2-runtime/issues/10
apk add eudev-dev gettext-dev linux-headers meson # From https://git.alpinelinux.org/aports/tree/main/fuse3/APKBUILD
wget -c -q "https://github.com/libfuse/libfuse/releases/download/fuse-3.15.0/fuse-3.15.0.tar.xz"
if [ ! -f "fuse-3.15.0.tar.xz" ];then
wget -c -q "https://github.com/libfuse/libfuse/releases/download/fuse-3.15.0/fuse-3.15.0.tar.xz"
fi
echo "70589cfd5e1cff7ccd6ac91c86c01be340b227285c5e200baa284e401eea2ca0 fuse-3.15.0.tar.xz" | sha256sum -c
tar xf fuse-3.*.tar.xz
cd fuse-3.*/
Expand All @@ -29,6 +41,9 @@ export CFLAGS="-ffunction-sections -fdata-sections -Os"

# Build static squashfuse
apk add zstd-dev zlib-dev zlib-static # fuse3-dev fuse3-static fuse-static fuse-dev
if [ "$ARCHITECTURE" == "loong64" ];then
apk add --no-cache zstd-static
fi
find / -name "libzstd.*" 2>/dev/null || true
wget -c -q "https://github.com/vasi/squashfuse/archive/e51978c.tar.gz"
echo "f544029ad30d8fbde4e4540c574b8cdc6d38b94df025a98d8551a9441f07d341 e51978c.tar.gz" | sha256sum -c
Expand All @@ -54,4 +69,4 @@ echo -ne 'AI\x02' | dd of=runtime-fuse3 bs=1 count=3 seek=8 conv=notrunc # magic
cd -

mkdir -p out
cp src/runtime/runtime-fuse3 "out/runtime-fuse3-${ARCHITECTURE}"
cp src/runtime/runtime-fuse3 "out/runtime-${ARCHITECTURE}"
23 changes: 23 additions & 0 deletions build_loong64.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

set -ex

repo_root="$(readlink -f "$(dirname "${BASH_SOURCE[0]}")"/.)"
# image="lcr.loongnix.cn/library/alpine:3.19"
image="quay.io/msojocs/alpine-loong64:3.19"
platform="linux/loong64"
uid="$(id -u)"
docker run \
--platform "$platform" \
--rm \
-i \
-e ARCH \
-e GITHUB_ACTIONS \
-e GITHUB_RUN_NUMBER \
-e ARCHITECTURE="loong64" \
-e OUT_UID="$uid" \
-v "$repo_root":/source \
-v "$PWD":/out \
-w /out \
"$image" \
sh /source/build.sh

0 comments on commit 8aa6ef8

Please sign in to comment.