HandBrake-docs/build-tools

43 lines
805 B
Bash
Executable File

#!/bin/bash
# vars
SELF="${BASH_SOURCE[0]}"
BASE_DIR=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd -P)
BASE_DIR="${BASE_DIR:-$(pwd)}"
TOOLS_DIR="${BASE_DIR}/tools"
SYSTEM_NAME=$(uname -s)
# discount
function build_discount {
cd "${TOOLS_DIR}/discount"
if make clean; then
make distclean
fi
if [[ "${SYSTEM_NAME}" == "Darwin" ]]; then
./configure.sh --mandir=/usr/local/share/man
else
./configure.sh
fi
make
}
# base directory (absolute)
cd "${BASE_DIR}"
# main
cd "${TOOLS_DIR}"
ERROR=false
for TOOL in */; do
TOOL="${TOOL%/}" # strip trailing slash
if ! build_${TOOL} >/dev/null 2>&1; then
ERROR=true
echo "Error: Unable to build tool '${TOOL}'." >&2
fi
done
# done
if [[ "${ERROR}" == true ]]; then
exit 1
fi
exit 0