alpine-overlay/abuilder

49 lines
1.0 KiB
Bash
Executable File

#!/bin/sh
set -ex
if [ -d ~/.abuild ]; then
doas cp ~/.abuild/*.rsa.pub /etc/apk/keys/
fi
doas chown -R alpine:abuild ~/packages /var/cache/distfiles ~/aports
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
TARGET_ARCH=aarch64
SUDO_APK=abuild-apk
APORTS=/home/alpine/aports
export CBUILDROOT="/home/alpine/sysroot-aarch64/"
. /usr/share/abuild/functions.sh
export CBUILD
export CHOST=$TARGET_ARCH
export GOARCH=arm64
export GOOS=linux
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
APKBUILD=$pkg abuild -r
else
APKBUILD=$pkg abuild checksum
echo "Please update your APKBUILD with the following checksums after verification:"
. $pkg/APKBUILD && echo $sha512sums
fi
done
fi