umorpha-boxes/bin/pkgbuild-deps

28 lines
651 B
Bash
Executable File

#!/usr/bin/env bash
# Copyright (C) 2024 Umorpha Systems
# SPDX-License-Identifier: AGPL-3.0-or-later
set -e
[[ $# == 1 ]]
srcinfo="$1"
pkgfiles=($(awk '
BEGIN { arch="x86_64" }
/pkgver =/ { pkgver=$3 }
/pkgrel =/ { pkgrel=$3 }
/arch = any/ { arch=$3 }
/pkgname =/ {
print $3 "-" pkgver "-" pkgrel "-" arch ".pkg.tar.zst"
}
' <"$srcinfo"))
echo "${pkgfiles[*]/#/'pkg/'} &: ${srcinfo}"
echo ' rm -rf -- $(<D)/src $(<D)/pkg'
echo ' cd $(<D) && PKGDEST=$(abspath $(@D)) makepkg --syncdeps --rmdeps'
for pkgfile in "${pkgfiles[@]}"; do
echo "pkg/${pkgfile%-*-*-*.pkg.tar.zst}.pkg.tar.zst: pkg/${pkgfile}"
echo ' ln -sf $(<F) $@'
done