From 52a9822b60bcd0c083ab12d9de88a3ae9fe00b32 Mon Sep 17 00:00:00 2001 From: Hans Date: Mon, 18 Nov 2024 21:19:20 +0800 Subject: [PATCH] ci: fix cross build --- .github/workflows/release.yml | 1 + scripts/build-linux.sh | 4 +++- scripts/prepare-linux.sh | 4 +++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bd4b8a8..ab70b76 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -53,6 +53,7 @@ jobs: run: | docker run --rm \ -v $(pwd):/work \ + -e ARCH=arm64 \ dockcross/linux-arm64:latest \ bash -c "./scripts/prepare-linux.sh && ./scripts/build-linux.sh" - name: Build (macOS) diff --git a/scripts/build-linux.sh b/scripts/build-linux.sh index 8bbf859..943f519 100755 --- a/scripts/build-linux.sh +++ b/scripts/build-linux.sh @@ -4,7 +4,9 @@ set -e # General -if [ $(uname -m) == "x86_64" ]; then +ARCH=${ARCH:-${1:-$(uname -m)}} + +if [ $ARCH == "x86_64" ]; then yarn clean && yarn build-native yarn clean && yarn build-native --CDLLAMA_VULKAN=1 --CDVARIANT=vulkan else diff --git a/scripts/prepare-linux.sh b/scripts/prepare-linux.sh index d27cdf3..4702306 100755 --- a/scripts/prepare-linux.sh +++ b/scripts/prepare-linux.sh @@ -12,7 +12,9 @@ function run_as_root() { export DEBIAN_FRONTEND=noninteractive -if [ $(uname -m) == "x86_64" ]; then +ARCH=${ARCH:-${1:-$(uname -m)}} + +if [ $ARCH == "x86_64" ]; then DISTRO=$(lsb_release -c -s) wget -qO- https://packages.lunarg.com/lunarg-signing-key-pub.asc | run_as_root tee /etc/apt/trusted.gpg.d/lunarg.asc run_as_root wget -qO /etc/apt/sources.list.d/lunarg-vulkan-1.3.280-$DISTRO.list https://packages.lunarg.com/vulkan/1.3.280/lunarg-vulkan-1.3.280-$DISTRO.list