2022-10-05 16:57:46 +00:00
|
|
|
#!/bin/sh
|
2022-10-06 18:03:30 +00:00
|
|
|
set -e
|
2022-10-05 16:57:46 +00:00
|
|
|
|
2022-11-19 12:57:25 +00:00
|
|
|
[ -n "$DEBUG" ] && set -x
|
|
|
|
|
2022-10-05 16:57:46 +00:00
|
|
|
doas apk update
|
|
|
|
|
2022-11-19 12:57:25 +00:00
|
|
|
if [ "$1" = 'aarch64-toolchain' ]; then
|
2022-10-05 16:57:46 +00:00
|
|
|
aarch64-toolchain.sh
|
|
|
|
|
|
|
|
else
|
|
|
|
# Set ENV for cross compile for aarch64
|
2022-11-19 12:57:25 +00:00
|
|
|
if [ "$2" = "cross-arm64" ]; then
|
2024-03-12 15:18:42 +00:00
|
|
|
ALPINE="v3.19"
|
2022-10-05 16:57:46 +00:00
|
|
|
TARGET_ARCH=aarch64
|
|
|
|
SUDO_APK=abuild-apk
|
|
|
|
APORTS=/home/alpine/aports
|
2022-10-06 18:03:30 +00:00
|
|
|
CBUILDROOT=/home/alpine/sysroot-aarch64
|
|
|
|
|
|
|
|
mkdir -p $CBUILDROOT/etc/apk/keys
|
|
|
|
doas apk -X https://dl-cdn.alpinelinux.org/alpine/${ALPINE}/main --no-cache --no-scripts -p $CBUILDROOT --initdb --allow-untrusted --arch aarch64 add alpine-base
|
|
|
|
doas apk -X https://dl-cdn.alpinelinux.org/alpine/${ALPINE}/main --no-cache --arch aarch64 -p $CBUILDROOT --allow-untrusted add alpine-keys
|
|
|
|
doas cp /etc/apk/keys/stefan@zero-downtime.net-61bb6bfb.rsa.pub ${CBUILDROOT}/etc/apk/keys
|
|
|
|
doas cp /etc/apk/repositories ${CBUILDROOT}/etc/apk
|
|
|
|
|
|
|
|
EXTRADEPENDS_TARGET="libgcc libstdc++ musl-dev fortify-headers libc-dev busybox"
|
2022-10-05 16:57:46 +00:00
|
|
|
|
|
|
|
. /usr/share/abuild/functions.sh
|
|
|
|
export CBUILD
|
|
|
|
|
|
|
|
export GOARCH=arm64
|
|
|
|
export GOOS=linux
|
2022-10-06 18:03:30 +00:00
|
|
|
|
|
|
|
doas apk update -p $CBUILDROOT
|
2022-10-05 16:57:46 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
for pkg in ~/$1; do
|
|
|
|
# If checksum is OK, build package
|
|
|
|
APKBUILD=$pkg abuild verify && rc=$? || rc=$?
|
|
|
|
if [ $rc -eq 0 ]; then
|
2022-10-06 18:03:30 +00:00
|
|
|
CHOST=$TARGET_ARCH APKBUILD=$pkg abuild -r
|
2022-10-05 16:57:46 +00:00
|
|
|
|
|
|
|
else
|
|
|
|
APKBUILD=$pkg abuild checksum
|
|
|
|
echo "Please update your APKBUILD with the following checksums after verification:"
|
2022-11-19 12:57:25 +00:00
|
|
|
. $pkg && echo $sha512sums
|
2022-10-05 16:57:46 +00:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|