51 lines
1.3 KiB
Bash
Executable File
51 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
|
|
SSLTYPE="${SSLTYPE:-unix.nopwd}" # recommended
|
|
TARGET="${TARGET:-lnp}" # lnp is what you used successfully
|
|
JOBS="${JOBS:-$(getconf _NPROCESSORS_ONLN 2>/dev/null || echo 1)}"
|
|
|
|
usage() {
|
|
cat <<USAGE
|
|
Usage: $0
|
|
|
|
Environment:
|
|
SSLTYPE (default: unix.nopwd)
|
|
TARGET (default: lnp)
|
|
JOBS (default: detected CPU count)
|
|
|
|
Example:
|
|
SSLTYPE=unix.nopwd JOBS=8 $0
|
|
USAGE
|
|
}
|
|
|
|
if [[ "${1:-}" == "-h" || "${1:-}" == "--help" ]]; then
|
|
usage
|
|
exit 0
|
|
fi
|
|
|
|
cd "$ROOT"
|
|
|
|
# Make sure patches are applied before building (but don't force it here).
|
|
if [[ -d patches ]]; then
|
|
echo "Hint: run ./scripts/apply-patches.sh before building if needed."
|
|
fi
|
|
|
|
CLEAN="${CLEAN:-0}"
|
|
|
|
if [[ "$CLEAN" == "1" ]]; then
|
|
echo "==> Cleaning previous build artifacts"
|
|
make clean || true
|
|
rm -f OSTYPE CFLAGS CCTYPE LDFLAGS OSCFLAGS ARCHIVE SPECIALS
|
|
rm -rf c-client mtest ipopd imapd mailutil mlock dmail tmail rebuild tools/an
|
|
fi
|
|
|
|
echo "==> Building UW-IMAP: make ${TARGET} SSLTYPE=${SSLTYPE}"
|
|
# UW-IMAP makefiles are not always parallel-safe in all subdirs; use -j carefully.
|
|
# We'll still allow -j, but you can set JOBS=1 if you see race issues.
|
|
make -j"${JOBS}" "${TARGET}" "SSLTYPE=${SSLTYPE}"
|
|
|
|
echo "Build done."
|