2023-05-01 16:23:47 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2023-09-15 20:59:49 +00:00
|
|
|
CC=$1
|
2023-05-01 16:23:47 +00:00
|
|
|
|
2023-09-15 20:59:49 +00:00
|
|
|
build_number="0"
|
|
|
|
build_commit="unknown"
|
|
|
|
build_compiler="unknown"
|
|
|
|
build_target="unknown"
|
|
|
|
|
|
|
|
if out=$(git rev-list --count HEAD); then
|
2024-06-26 15:33:02 +00:00
|
|
|
# git is broken on WSL so we need to strip extra newlines
|
|
|
|
build_number=$(printf '%s' "$out" | tr -d '\n')
|
2023-09-15 20:59:49 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if out=$(git rev-parse --short HEAD); then
|
2024-06-26 15:33:02 +00:00
|
|
|
build_commit=$(printf '%s' "$out" | tr -d '\n')
|
2023-09-15 20:59:49 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if out=$($CC --version | head -1); then
|
2024-06-26 15:33:02 +00:00
|
|
|
build_compiler=$out
|
2023-05-01 16:23:47 +00:00
|
|
|
fi
|
|
|
|
|
2023-09-15 20:59:49 +00:00
|
|
|
if out=$($CC -dumpmachine); then
|
2024-06-26 15:33:02 +00:00
|
|
|
build_target=$out
|
2023-05-01 16:23:47 +00:00
|
|
|
fi
|
|
|
|
|
2023-11-02 06:50:16 +00: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}\";"
|