Fix build order (make an -> core build -> bundled tools)
This commit is contained in:
@@ -3,21 +3,25 @@ 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)}"
|
||||
SSLTYPE="${SSLTYPE:-unix.nopwd}" # recommended for RFC 3501 compliance
|
||||
TARGET="${TARGET:-lnp}" # what you used successfully
|
||||
CLEAN="${CLEAN:-0}" # set to 1 for a clean build
|
||||
|
||||
usage() {
|
||||
cat <<USAGE
|
||||
Usage: $0
|
||||
|
||||
Build UW-IMAP in a deterministic, legacy-compatible order.
|
||||
|
||||
Environment:
|
||||
SSLTYPE (default: unix.nopwd)
|
||||
TARGET (default: lnp)
|
||||
JOBS (default: detected CPU count)
|
||||
CLEAN (default: 0) set to 1 to remove build artifacts before building
|
||||
|
||||
Example:
|
||||
SSLTYPE=unix.nopwd JOBS=8 $0
|
||||
Examples:
|
||||
$0
|
||||
CLEAN=1 $0
|
||||
SSLTYPE=unix.nopwd TARGET=lnp CLEAN=1 $0
|
||||
USAGE
|
||||
}
|
||||
|
||||
@@ -28,23 +32,40 @@ 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
|
||||
|
||||
# Remove common UW-IMAP build byproducts/symlink trees that can break rebuilds
|
||||
rm -f OSTYPE CFLAGS CCTYPE LDFLAGS OSCFLAGS ARCHIVE SPECIALS an 2>/dev/null || true
|
||||
rm -rf c-client mtest ipopd imapd mailutil mlock dmail tmail rebuild 2>/dev/null || true
|
||||
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}"
|
||||
# Ensure tools/an exists and is executable (should be part of the repo)
|
||||
if [[ ! -f tools/an ]]; then
|
||||
echo "ERROR: tools/an not found. Repository checkout seems incomplete." >&2
|
||||
exit 1
|
||||
fi
|
||||
chmod +x tools/an 2>/dev/null || true
|
||||
|
||||
echo "==> Step 1/3: Prepare symlinks (make an)"
|
||||
# This creates the symlink layout expected by the rest of the build (c-client/, mtest/, ...)
|
||||
make an
|
||||
|
||||
echo "==> Step 2/3: Build core (make ${TARGET} SSLTYPE=${SSLTYPE})"
|
||||
# IMPORTANT: do NOT use -j here; UW-IMAP's legacy build is not reliably parallel-safe.
|
||||
make "${TARGET}" "SSLTYPE=${SSLTYPE}"
|
||||
|
||||
echo "==> Step 3/3: Build bundled tools (make bundled)"
|
||||
# Bundled tools depend on generated headers like c-client/osdep.h.
|
||||
#make bundled || true
|
||||
make bundled
|
||||
|
||||
echo "Build done."
|
||||
echo "Artifacts:"
|
||||
echo " c-client/c-client.a: $(test -f c-client/c-client.a && echo OK || echo MISSING)"
|
||||
echo " c-client/osdep.h: $(test -f c-client/osdep.h && echo OK || echo MISSING)"
|
||||
|
||||
Reference in New Issue
Block a user