]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
SCRIPTS: build-vtest: allow to set a TMPDIR and a DESTDIR 20260212-build-vtest flx04/20260212-build-vtest
authorWilliam Lallemand <wlallemand@haproxy.com>
Thu, 12 Feb 2026 17:48:09 +0000 (18:48 +0100)
committerWilliam Lallemand <wlallemand@haproxy.com>
Thu, 12 Feb 2026 17:48:09 +0000 (18:48 +0100)
Implement a way to set a destination directory using DESTDIR, and a tmp
directory using TMPDIR.

By default:

- DESTDIR is ../vtest like it was done previously
- TMPDIR  is mktemp -d

Only the vtest binary is copied in DESTDIR.

Example:

TMPDIR=/dev/shm/ DESTDIR=/home/user/.local/bin/ ./scripts/build-vtest.sh

scripts/build-vtest.sh

index f74da3145d93397a06b1a6d97acbfc9b04287956..1ff26e1fb1633c271b5206d9d12367677bd8cb66 100755 (executable)
@@ -1,10 +1,12 @@
 #!/bin/sh
 
+DESTDIR=${DESTDIR:-${PWD}/../vtest/}
+TMPDIR=${TMPDIR:-$(mktemp -d)}
 set -eux
 
-curl -fsSL https://github.com/vtest/VTest2/archive/main.tar.gz  -o VTest.tar.gz
-mkdir ../vtest
-tar xvf VTest.tar.gz -C ../vtest --strip-components=1
+curl -fsSL https://github.com/vtest/VTest2/archive/main.tar.gz -o "${TMPDIR}/VTest.tar.gz"
+mkdir -p "${TMPDIR}/vtest"
+tar xvf ${TMPDIR}/VTest.tar.gz -C "${TMPDIR}/vtest" --strip-components=1
 # Special flags due to: https://github.com/vtest/VTest/issues/12
 
 # Note: do not use "make -C ../vtest", otherwise MAKEFLAGS contains "w"
@@ -13,7 +15,7 @@ tar xvf VTest.tar.gz -C ../vtest --strip-components=1
 # MFLAGS works on BSD but misses variable definitions on GNU Make.
 # Better just avoid the -C and do the cd ourselves then.
 
-cd ../vtest
+cd "${TMPDIR}/vtest"
 
 set +e
 CPUS=${CPUS:-$(nproc 2>/dev/null)}
@@ -28,3 +30,6 @@ if test -f /opt/homebrew/include/pcre2.h; then
 else
    make -j${CPUS} FLAGS="-O2 -s -Wall"
 fi
+
+mkdir -p "${DESTDIR}"
+cp "${TMPDIR}/vtest/vtest" "${DESTDIR}"