Files
stk/build.sh
T
anth64 b094b385d5 fix: install depends on release instead of manual pre-build
clean+install in one invocation (make or build.sh/build.bat) wiped the
release build between the pre-build and the install check. install now
has a real release prerequisite so make's own dependency graph handles
rebuilds correctly regardless of target order.
2026-11-14 15:41:11 +01:00

43 lines
843 B
Bash
Executable File

#!/bin/sh
UNAME_S=$(uname -s)
export UNAME_S
OS=$(echo "$UNAME_S" | tr '[:upper:]' '[:lower:]')
case "$OS" in
linux|mingw*|msys*|ucrt*|clang*) MK_FILE="gmake.mk" ;;
*) MK_FILE="bmake.mk" ;;
esac
case "$OS" in
mingw*|msys*|ucrt*|clang*) IS_WIN=1 ;;
*) IS_WIN=0 ;;
esac
HAS_INSTALL=0
HAS_UNINSTALL=0
for arg in "$@"; do
case "$arg" in
install) HAS_INSTALL=1 ;;
uninstall) HAS_UNINSTALL=1 ;;
esac
done
if [ "$HAS_INSTALL" = "1" ] || [ "$HAS_UNINSTALL" = "1" ]; then
if [ "$IS_WIN" = "1" ] || [ "$(id -u)" = "0" ]; then
PRIV=""
elif command -v doas > /dev/null 2>&1; then
PRIV="doas"
elif command -v sudo > /dev/null 2>&1; then
PRIV="sudo"
else
echo "error: install requires root. neither doas nor sudo found." >&2
exit 1
fi
$PRIV make -f "$MK_FILE" "$@"
else
make -f "$MK_FILE" "$@"
fi