1
0
Fork 0
mirror of https://github.com/pygos/build.git synced 2024-11-16 00:17:11 +01:00
build/util/pkgcmd.sh

42 lines
994 B
Bash
Raw Normal View History

run_pkg_command_common() {
local NAME="$1"
local FUNCTION="$2"
local PKGDIR="$3"
local DEPLOYDIR="$PKGDEPLOYDIR/$4"
local OUT="$PKGBUILDDIR/$5"
local CHECKFILE="$PKGLOGDIR/.${6}-${FUNCTION}"
echo "$NAME - $FUNCTION"
if [ -e "$CHECKFILE" ]; then
return
fi
unset -f build deploy prepare
unset -v VERSION TARBALL URL SRCDIR SHA256SUM
source "$SCRIPTDIR/$PKGDIR/$NAME/build"
local LOGFILE="$PKGLOGDIR/${7}-${FUNCTION}.log"
local SRC="$PKGSRCDIR/$SRCDIR"
mkdir -p "$DEPLOYDIR" "$OUT" "${DEPLOYDIR}-dev"
pushd "$OUT" > /dev/null
$FUNCTION "$SRC" "$OUT" "$DEPLOYDIR" "${DEPLOYDIR}-dev" &>> "$LOGFILE" < /dev/null
popd > /dev/null
(rmdir "$DEPLOYDIR" || true) 2> /dev/null ;
(rmdir "$OUT" || true) 2> /dev/null ;
(rmdir "${DEPLOYDIR}-dev" || true) 2> /dev/null ;
touch "$CHECKFILE"
}
run_pkg_command() {
run_pkg_command_common "$1" "$2" "pkg" "$1" "$1" "$1" "$1"
}
run_tcpkg_command() {
run_pkg_command_common "$1" "$2" "tcpkg" "toolchain" "tc-$1" "tc-$1" "tc-$1"
}