diff --git a/scripts/all.sh b/scripts/all.sh index c85ec14..99558e5 100755 --- a/scripts/all.sh +++ b/scripts/all.sh @@ -1,16 +1,13 @@ #!/usr/bin/env bash set -euo pipefail -# Convenience wrapper: -# apply patches -> build -> install -# -# Env: -# SSLTYPE, TARGET, JOBS (see build.sh) -# PREFIX (see install.sh) - ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" cd "$ROOT" +# Defaults suitable for automation +: "${CLEAN:=1}" +: "${PREFIX:=/usr/local/imap}" + ./scripts/apply-patches.sh -./scripts/build.sh -./scripts/install.sh +CLEAN="$CLEAN" ./scripts/build.sh +PREFIX="$PREFIX" ./scripts/install.sh diff --git a/scripts/apply-patches.sh b/scripts/apply-patches.sh index 737fb99..e2ff8c9 100755 --- a/scripts/apply-patches.sh +++ b/scripts/apply-patches.sh @@ -7,7 +7,7 @@ PATCHDIR="${ROOT}/patches" usage() { cat <&2 + echo "ERROR: no 0001–0004 patches found in $PATCHDIR" >&2 exit 1 fi for p in "${patches[@]}"; do - echo "==> Checking $p" + echo "==> Checking $(basename "$p")" if patch --dry-run -p1 < "$p" >/dev/null 2>&1; then echo "==> Applying $(basename "$p")" patch -p1 < "$p" diff --git a/scripts/install.sh b/scripts/install.sh index a1d967c..cf88f40 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -14,9 +14,7 @@ Environment: Installs: - headers to: \$PREFIX/include - static lib to: \$PREFIX/lib/libc-client.a - -Note: - Requires a successful build (c-client/c-client.a exists). + - binaries to: \$PREFIX/bin (if present) USAGE } @@ -36,16 +34,43 @@ if [[ ! -f "$SRC_LIB" ]]; then fi echo "==> Installing to PREFIX=$PREFIX" -install -d -m 0755 "$PREFIX/include" "$PREFIX/lib" +install -d -m 0755 "$PREFIX/include" "$PREFIX/lib" "$PREFIX/bin" echo "==> Installing headers" -# Only install the public headers (all .h in c-client/) install -m 0644 "$SRC_HDR_DIR"/*.h "$PREFIX/include/" echo "==> Installing libc-client.a" install -m 0644 "$SRC_LIB" "$PREFIX/lib/libc-client.a" +echo "==> Installing binaries (if present)" +# Common outputs after 'make bundled' +bins=( + "$ROOT/mtest/mtest" + "$ROOT/imapd/imapd" + "$ROOT/ipopd/ipopd" + "$ROOT/mailutil/mailutil" + "$ROOT/mlock/mlock" + "$ROOT/dmail/dmail" + "$ROOT/tmail/tmail" +) + +installed_any=0 +for b in "${bins[@]}"; do + if [[ -x "$b" ]]; then + install -m 0755 "$b" "$PREFIX/bin/" + echo " installed: $(basename "$b")" + installed_any=1 + else + echo " skipped: $(basename "$b") (not found/executable)" + fi +done + echo "==> Done." echo "Installed:" echo " Headers: $PREFIX/include/*.h" echo " Library: $PREFIX/lib/libc-client.a" +if [[ "$installed_any" -eq 1 ]]; then + echo " Binaries: $PREFIX/bin/" +else + echo " Binaries: none (run ./scripts/build.sh to build bundled tools)" +fi