From bc879adb4aa622a048f21b749b20dcbecce3b0fd Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Mon, 17 Jun 2024 06:34:35 +0000 Subject: [PATCH] Allow environment variables to override clang/LLVM paths --- install.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/install.sh b/install.sh index 39c3af5..197155c 100755 --- a/install.sh +++ b/install.sh @@ -17,13 +17,17 @@ $(birdc show route table flowspec6 primary all)" echo "const uint8_t COMPILE_TIME_RAND[] = { $(dd if=/dev/urandom of=/dev/stdout bs=1 count=8 2>/dev/null | hexdump -e '4/1 "0x%02x, "') };" > rand.h +[ "$CLANG" != "" ] || CLANG="clang" +[ "$LLC" != "" ] || LLC="llc" +[ "$LLVM_LINK" != "" ] || LLVM_LINK="llvm-link" + STATS_RULES="$(echo "$RULES" | ./genrules.py --8021q=drop-vlan --v6frag=ignore-parse-if-rule --ihl=parse-options)" -clang $CLANG_ARGS -g -std=c99 -pedantic -Wall -Wextra -Wno-pointer-arith -Wno-unused-variable -Wno-unused-function -Oz -emit-llvm -c xdp.c -o xdp.bc +$CLANG $CLANG_ARGS -g -std=c99 -pedantic -Wall -Wextra -Wno-pointer-arith -Wno-unused-variable -Wno-unused-function -Oz -emit-llvm -c xdp.c -o xdp.bc if [ "$2" != "" ]; then - clang $4 -g -std=c99 -pedantic -Wall -Wextra -Wno-pointer-arith -Oz -emit-llvm -c "$2" -o wrapper.bc - llvm-link xdp.bc wrapper.bc | llc -O3 -march=bpf -mcpu=probe -filetype=obj -o xdp + $CLANG $4 -g -std=c99 -pedantic -Wall -Wextra -Wno-pointer-arith -Oz -emit-llvm -c "$2" -o wrapper.bc + $LLVM_LINK xdp.bc wrapper.bc | $LLC -O3 -march=bpf -mcpu=probe -filetype=obj -o xdp else - cat xdp.bc | llc -O3 -march=bpf -mcpu=probe -filetype=obj -o xdp + cat xdp.bc | $LLC -O3 -march=bpf -mcpu=probe -filetype=obj -o xdp fi # Note that sometimes the automated fallback does not work properly so we have to || generic here -- 2.39.5