alpine-overlay/abuilder

50 lines
1.4 KiB
Plaintext
Raw Normal View History

2022-10-05 16:57:46 +00:00
#!/bin/sh
set -e
2022-10-05 16:57:46 +00:00
[ -n "$DEBUG" ] && set -x
2022-10-05 16:57:46 +00:00
doas apk update
if [ "$1" = 'aarch64-toolchain' ]; then
2022-10-05 16:57:46 +00:00
aarch64-toolchain.sh
else
# Set ENV for cross compile for aarch64
if [ "$2" = "cross-arm64" ]; then
2023-07-04 15:10:30 +00:00
ALPINE="v3.18"
2022-10-05 16:57:46 +00:00
TARGET_ARCH=aarch64
SUDO_APK=abuild-apk
APORTS=/home/alpine/aports
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
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
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 && echo $sha512sums
2022-10-05 16:57:46 +00:00
fi
done
fi