Make builds incremental by preserving source/build dirs (#45)
This commit is contained in:
@@ -7,18 +7,15 @@ cd "$DIR"
|
||||
VERSION="3.1.0"
|
||||
INSTALL_DIR="$DIR/libjpeg/install"
|
||||
|
||||
# Idempotent: skip if already built
|
||||
if [ -f "$INSTALL_DIR/lib/libjpeg.a" ]; then
|
||||
echo "libjpeg already present, skipping build."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
NJOBS="$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 2)"
|
||||
|
||||
# Clone
|
||||
if [ ! -d "libjpeg-turbo-src" ]; then
|
||||
git clone --depth 1 --branch "${VERSION}" https://github.com/libjpeg-turbo/libjpeg-turbo.git libjpeg-turbo-src
|
||||
# Clone/update source
|
||||
if [ ! -d "libjpeg-turbo-src/.git" ]; then
|
||||
rm -rf libjpeg-turbo-src
|
||||
git clone --depth 1 https://github.com/libjpeg-turbo/libjpeg-turbo.git libjpeg-turbo-src
|
||||
fi
|
||||
git -C libjpeg-turbo-src fetch --depth 1 origin "${VERSION}"
|
||||
git -C libjpeg-turbo-src checkout --force FETCH_HEAD
|
||||
|
||||
# Build
|
||||
PREFIX="$DIR/build/prefix"
|
||||
@@ -50,8 +47,5 @@ cp "$PREFIX/include/jconfig.h" "$INSTALL_DIR/include/"
|
||||
cp "$PREFIX/include/jerror.h" "$INSTALL_DIR/include/"
|
||||
cp "$PREFIX/include/jmorecfg.h" "$INSTALL_DIR/include/"
|
||||
|
||||
# Clean up
|
||||
rm -rf libjpeg-turbo-src "$DIR/build"
|
||||
|
||||
echo "Installed libjpeg to $INSTALL_DIR"
|
||||
du -sh "$INSTALL_DIR"
|
||||
|
||||
Reference in New Issue
Block a user