haproxy/scripts/build-vtest.sh
William Lallemand accc9003e8
Some checks are pending
Contrib / build (push) Waiting to run
alpine/musl / gcc (push) Waiting to run
VTest / Generate Build Matrix (push) Waiting to run
VTest / (push) Blocked by required conditions
Windows / Windows, gcc, all features (push) Waiting to run
CI: VTest build with git clone + cache
The VTest2 tarball URL at code.vinyl-cache.org/vtest/VTest2/archive/main.tar.gz
no longer works. Switch scripts/build-vtest.sh to use a git clone of the
repository instead.

Add a cache step in the setup-vtest CI action so VTest is only rebuilt
when its HEAD commit changes, keyed on the runner OS and the VTest2 HEAD
SHA.
2026-04-07 18:35:23 +02:00

33 lines
983 B
Bash
Executable file

#!/bin/sh
DESTDIR=${DESTDIR:-${PWD}/../vtest/}
TMPDIR=${TMPDIR:-$(mktemp -d)}
set -eux
git clone https://code.vinyl-cache.org/vtest/VTest2 "${TMPDIR}/vtest"
# Special flags due to: https://github.com/vtest/VTest/issues/12
# Note: do not use "make -C ../vtest", otherwise MAKEFLAGS contains "w"
# and fails (see Options/Recursion in GNU Make doc, it contains the list
# of options without the leading '-').
# MFLAGS works on BSD but misses variable definitions on GNU Make.
# Better just avoid the -C and do the cd ourselves then.
cd "${TMPDIR}/vtest"
set +e
CPUS=${CPUS:-$(nproc 2>/dev/null)}
CPUS=${CPUS:-1}
set -e
#
# temporarily detect Apple Silicon (it's using /opt/homebrew instead of /usr/local)
#
if test -f /opt/homebrew/include/pcre2.h; then
make -j${CPUS} FLAGS="-O2 -s -Wall" INCS="-I. -Isrc -Ilib -I/usr/local/include -I/opt/homebrew/include -pthread"
else
make -j${CPUS} FLAGS="-O2 -s -Wall"
fi
mkdir -p "${DESTDIR}"
cp "${TMPDIR}/vtest/vtest" "${DESTDIR}"