2024-02-29 21:42:13 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
out=$("$1" 'map(select(.["file"] | contains ("cc_cflags_probe.c"))) | first | .["command"]' < compile_commands.json)
|
|
|
|
out=${out#\"}
|
|
|
|
out=${out%\"}
|
|
|
|
args=($out)
|
|
|
|
|
2024-03-04 20:04:25 +00:00
|
|
|
idx=0
|
|
|
|
cc=${args[idx]}
|
|
|
|
if [ "$cc" = "ccache" ]; then
|
|
|
|
idx=$((idx+1))
|
|
|
|
cc="$cc ${args[idx]}"
|
|
|
|
fi
|
|
|
|
|
2024-02-29 21:42:13 +00:00
|
|
|
declare -a cflags=()
|
|
|
|
|
2024-03-04 20:04:25 +00:00
|
|
|
for arg in ${args[@]:(idx+1)}; do
|
2024-02-29 21:42:13 +00:00
|
|
|
case $arg in
|
|
|
|
-I*|-M*|-o|-c) ;;
|
|
|
|
-*) cflags+="$arg ";;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2024-03-07 20:11:48 +00:00
|
|
|
make_out=$(env CC="$cc" CFLAGS="$cflags" BUILD_STATIC_ONLY=y DESTDIR=. "$2" install -C "$3" -j"$4")
|
2024-02-29 21:42:13 +00:00
|
|
|
exit $?
|