Make builds incremental by preserving source/build dirs (#45)

This commit is contained in:
Adeeb Shihadeh
2026-03-04 09:17:55 -08:00
committed by GitHub
parent 2e9aed768a
commit 331d94a683
37 changed files with 221 additions and 367 deletions

View File

@@ -7,18 +7,15 @@ cd "$DIR"
VERSION="1.0.1"
INSTALL_DIR="$DIR/capnproto/install"
# Idempotent: skip if already built
if [ -x "$INSTALL_DIR/bin/capnp" ]; then
echo "capnproto already present, skipping build."
exit 0
fi
NJOBS="$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 2)"
# Clone
if [ ! -d "capnproto-src" ]; then
git clone --depth 1 --branch "v${VERSION}" https://github.com/capnproto/capnproto.git capnproto-src
# Clone/update source
if [ ! -d "capnproto-src/.git" ]; then
rm -rf capnproto-src
git clone --depth 1 https://github.com/capnproto/capnproto.git capnproto-src
fi
git -C capnproto-src fetch --depth 1 origin "v${VERSION}"
git -C capnproto-src checkout --force FETCH_HEAD
# Build
PREFIX="$DIR/build/prefix"
@@ -64,8 +61,5 @@ for obj in filesystem.c++.o main.c++.o test-helpers.c++.o; do
ar d "$INSTALL_DIR/lib/libkj.a" "$obj" 2>/dev/null || true
done
# Clean up
rm -rf capnproto-src "$DIR/build"
echo "Installed capnproto to $INSTALL_DIR"
du -sh "$INSTALL_DIR"