Make builds incremental by preserving source/build dirs (#45)
This commit is contained in:
@@ -6,25 +6,17 @@ cd "$DIR"
|
||||
|
||||
VERSION="6067afde563c3946eebd94f146b3824ab7a97a9c"
|
||||
INSTALL_DIR="$DIR/libyuv/install"
|
||||
VERSION_FILE="$INSTALL_DIR/VERSION"
|
||||
|
||||
# Idempotent: skip if already built at this source revision.
|
||||
if [ -f "$INSTALL_DIR/lib/libyuv.a" ] && [ -f "$VERSION_FILE" ] && [ "$(cat "$VERSION_FILE")" = "$VERSION" ]; then
|
||||
echo "libyuv already present, skipping build."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
NJOBS="$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 2)"
|
||||
|
||||
if [ ! -d "libyuv-src/.git" ]; then
|
||||
git clone https://chromium.googlesource.com/libyuv/libyuv libyuv-src
|
||||
git clone --depth 1 https://chromium.googlesource.com/libyuv/libyuv libyuv-src
|
||||
fi
|
||||
|
||||
git -C libyuv-src fetch --force origin
|
||||
git -C libyuv-src fetch --depth 1 origin "$VERSION"
|
||||
git -C libyuv-src checkout --force "$VERSION"
|
||||
|
||||
BUILD_DIR="$DIR/build/build"
|
||||
rm -rf "$DIR/build"
|
||||
BUILD_DIR="$DIR/build"
|
||||
mkdir -p "$BUILD_DIR"
|
||||
|
||||
cmake -S "$DIR/libyuv-src" -B "$BUILD_DIR" \
|
||||
@@ -47,10 +39,6 @@ rm -rf "$INSTALL_DIR"
|
||||
mkdir -p "$INSTALL_DIR"/{lib,include}
|
||||
cp "$LIBYUV_STATIC" "$INSTALL_DIR/lib/libyuv.a"
|
||||
cp -r "$DIR/libyuv-src/include/." "$INSTALL_DIR/include/"
|
||||
echo "$VERSION" > "$VERSION_FILE"
|
||||
|
||||
# Keep workspace small and deterministic across builds.
|
||||
rm -rf "$DIR/libyuv-src" "$DIR/build"
|
||||
|
||||
echo "Installed libyuv to $INSTALL_DIR"
|
||||
du -sh "$INSTALL_DIR"
|
||||
|
||||
Reference in New Issue
Block a user