2023-05-01 18:23:47 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
2023-09-15 22:59:49 +02:00
|
|
|
CC=$1
|
2023-05-01 18:23:47 +02:00
|
|
|
|
2023-09-15 22:59:49 +02:00
|
|
|
build_number="0"
|
|
|
|
build_commit="unknown"
|
|
|
|
build_compiler="unknown"
|
|
|
|
build_target="unknown"
|
|
|
|
|
|
|
|
if out=$(git rev-list --count HEAD); then
|
|
|
|
# git is broken on WSL so we need to strip extra newlines
|
|
|
|
build_number=$(printf '%s' "$out" | tr -d '\n')
|
|
|
|
fi
|
|
|
|
|
|
|
|
if out=$(git rev-parse --short HEAD); then
|
|
|
|
build_commit=$(printf '%s' "$out" | tr -d '\n')
|
|
|
|
fi
|
|
|
|
|
|
|
|
if out=$($CC --version | head -1); then
|
|
|
|
build_compiler=$out
|
2023-05-01 18:23:47 +02:00
|
|
|
fi
|
|
|
|
|
2023-09-15 22:59:49 +02:00
|
|
|
if out=$($CC -dumpmachine); then
|
|
|
|
build_target=$out
|
2023-05-01 18:23:47 +02:00
|
|
|
fi
|
|
|
|
|
2023-11-02 07:50:16 +01:00
|
|
|
echo "int LLAMA_BUILD_NUMBER = ${build_number};"
|
|
|
|
echo "char const *LLAMA_COMMIT = \"${build_commit}\";"
|
|
|
|
echo "char const *LLAMA_COMPILER = \"${build_compiler}\";"
|
|
|
|
echo "char const *LLAMA_BUILD_TARGET = \"${build_target}\";"
|