From 93fa0a3a5cb058d526afff69836ee84a1b4db6a9 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 31 Oct 2026 15:55:32 -0700 Subject: Probe and build with the same compiler --- tools/build-development.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'tools/build-development.sh') diff --git a/tools/build-development.sh b/tools/build-development.sh index d340057..00ff569 100755 --- a/tools/build-development.sh +++ b/tools/build-development.sh @@ -22,6 +22,11 @@ cd "$(dirname "$0")/.." # vendor/git. make cleanall +# Named once, so the probe and the build use the same compiler. CC goes on +# make's command line because git's Makefile sets it, which would override +# the one from the environment. +CC=${CC:-cc} + # OpenBSD's compiler has no AddressSanitizer, so the build falls back to the # undefined behaviour checks alone, and to no sanitizer where neither links. probe=$(mktemp "${TMPDIR:-/tmp}/cgit-probe.XXXXXX") @@ -30,13 +35,13 @@ printf 'int main(void){return 0;}\n' >"$probe.c" sanitize="" for checks in address,undefined undefined do - if ${CC:-cc} -fsanitize="$checks" -o "$probe" "$probe.c" >/dev/null 2>&1 + if $CC -fsanitize="$checks" -o "$probe" "$probe.c" >/dev/null 2>&1 then sanitize="SANITIZE=$checks" break fi done -make "$@" CFLAGS="-O0 -g3" DEVELOPER=1 $sanitize \ +make "$@" CC="$CC" CFLAGS="-O0 -g3" DEVELOPER=1 $sanitize \ GENERATE_COMPILATION_DATABASE=yes # clang writes one entry per object under vendor/git/compile_commands, each -- cgit