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
|
|
|
|
|
|
|
if [ -d ~/.abuild ]; then
|
|
|
|
doas cp ~/.abuild/*.rsa.pub /etc/apk/keys/
|
|
|
|
fi
|
|
|
|
|
2022-10-06 18:03:30 +00:00
|
|
|
for f in ~/packages /var/cache/distfiles ~/aports; do
|
|
|
|
[ -d $f ] && doas chown -R alpine:abuild $f
|
|
|
|
done
|
|
|
|
|
2022-10-05 16:57:46 +00:00
|
|
|
doas apk update
|
|
|
|
|
|
|
|
if [ "$1" == 'debug' ]; then
|
|
|
|
sh
|
|
|
|
|
|
|
|
elif [ "$1" == 'aarch64-toolchain' ]; then
|
|
|
|
aarch64-toolchain.sh
|
|
|
|
|
|
|
|
else
|
|
|
|
# Set ENV for cross compile for aarch64
|
|
|
|
if [ "$2" == "aarch64" ]; then
|
2022-10-06 18:03:30 +00:00
|
|
|
ALPINE="v3.16"
|
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
|
|
|
|
doas chown -R alpine:abuild $(dirname $pkg)
|
|
|
|
|
|
|
|
# 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:"
|
|
|
|
. $pkg/APKBUILD && echo $sha512sums
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|