Simplistic abuild wrapper for building packages out-of-the-tree.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# SPDX-License-Identifier: MIT | |
## Copyright (C) 2017 Przemyslaw Pawelczyk <przemoc@gmail.com> | |
## | |
## This script is licensed under the terms of the MIT license. | |
## https://opensource.org/licenses/MIT | |
# | |
# abuild.sh | |
# Simplistic abuild wrapper for building packages out-of-the-tree. | |
# | |
# Put it in its own directory, and everything will be generated there. | |
# Why? Because I strongly dislike the idea of polluting local aports clone. | |
# I keep the script in ~/abuild/. You can also put symlink to it in ~/bin/. | |
if [ $# -lt 1 ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then | |
echo "usage: $0 [-f] [-K] [--] [PATH-TO-APKBUILD-FILE-OR-DIR-WITH-IT]..." | |
exit 0 | |
fi | |
ORIGPWD=$(pwd) | |
TOPDIR=$(readlink -f "${0%/*}") | |
echo TOPDIR="$TOPDIR" | |
REPODEST="$TOPDIR/repo" | |
mkdir -p "$REPODEST" | |
echo REPODEST="$REPODEST" | |
export REPODEST | |
SRCDEST="$TOPDIR/sources" | |
mkdir -p "$SRCDEST" | |
echo SRCDEST="$SRCDEST" | |
export SRCDEST | |
srcdir="$TOPDIR/.src" | |
mkdir -p "$srcdir" | |
echo srcdir="$srcdir" | |
export srcdir | |
pkgbasedir="$TOPDIR/.pkg" | |
mkdir -p "$pkgbasedir" | |
echo pkgbasedir="$pkgbasedir" | |
export pkgbasedir | |
FORCE= | |
if [ "$1" = "-f" ]; then | |
FORCE=-f | |
shift | |
fi | |
KEEP= | |
if [ "$1" = "-K" ]; then | |
KEEP=-K | |
shift | |
fi | |
[ "$1" != "--" ] || shift | |
export APKBUILD | |
cd "$TOPDIR" | |
while [ $# -gt 0 ]; do | |
APKBUILD="$1" | |
shift | |
[ "${APKBUILD#/}" != "$APKBUILD" ] || APKBUILD="$ORIGPWD/${APKBUILD#./}" | |
[ "${APKBUILD%/APKBUILD}" != "$APKBUILD" ] || APKBUILD="${APKBUILD%/}/APKBUILD" | |
echo APKBUILD="$APKBUILD" | |
if ! [ -r "$APKBUILD" ]; then | |
echo "$0: $APKBUILD is not readable!" >&2 | |
continue | |
fi | |
abuild $FORCE $KEEP -r | |
done |
Author
przemoc
commented
Feb 6, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment