Make builds incremental by preserving source/build dirs (#45)
This commit is contained in:
@@ -7,18 +7,16 @@ cd "$DIR"
|
||||
VERSION="2.16.0"
|
||||
INSTALL_DIR="$DIR/cppcheck/install"
|
||||
|
||||
# Idempotent: skip if already built
|
||||
if [ -x "$INSTALL_DIR/cppcheck" ]; then
|
||||
echo "cppcheck already present, skipping build."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
NJOBS="$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 2)"
|
||||
CXX="ccache ${CXX:-c++}"
|
||||
|
||||
# Clone
|
||||
if [ ! -d "cppcheck-src" ]; then
|
||||
git clone --depth 1 --branch "$VERSION" https://github.com/danmar/cppcheck.git cppcheck-src
|
||||
# Clone/update source
|
||||
if [ ! -d "cppcheck-src/.git" ]; then
|
||||
rm -rf cppcheck-src
|
||||
git clone --depth 1 https://github.com/danmar/cppcheck.git cppcheck-src
|
||||
fi
|
||||
git -C cppcheck-src fetch --depth 1 origin "$VERSION"
|
||||
git -C cppcheck-src checkout --force FETCH_HEAD
|
||||
|
||||
# Build
|
||||
cd cppcheck-src
|
||||
@@ -35,8 +33,5 @@ cp -r cppcheck-src/cfg "$INSTALL_DIR/"
|
||||
cp -r cppcheck-src/platforms "$INSTALL_DIR/"
|
||||
strip "$INSTALL_DIR/cppcheck" 2>/dev/null || true
|
||||
|
||||
# Clean up
|
||||
rm -rf cppcheck-src
|
||||
|
||||
echo "Installed cppcheck to $INSTALL_DIR"
|
||||
du -sh "$INSTALL_DIR"
|
||||
|
||||
@@ -15,11 +15,8 @@ class BuildCppcheck(build_py):
|
||||
|
||||
def run(self):
|
||||
pkg_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
marker = os.path.join(pkg_dir, "cppcheck", "install", "cppcheck")
|
||||
|
||||
if not os.path.exists(marker):
|
||||
build_script = os.path.join(pkg_dir, "build.sh")
|
||||
subprocess.check_call(["bash", build_script], cwd=pkg_dir)
|
||||
build_script = os.path.join(pkg_dir, "build.sh")
|
||||
subprocess.check_call(["bash", build_script], cwd=pkg_dir)
|
||||
|
||||
super().run()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user