aboutsummaryrefslogtreecommitdiff
path: root/scripts/build-info.sh
blob: ed0d6c56a23f8fc783516f73f0ddf58211557512 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh

BUILD_NUMBER="0"
BUILD_COMMIT="unknown"

REV_LIST=$(git rev-list --count HEAD)
if [ $? -eq 0 ]; then
  BUILD_NUMBER=$REV_LIST
fi

REV_PARSE=$(git rev-parse --short HEAD)
if [ $? -eq 0 ]; then
  BUILD_COMMIT=$REV_PARSE
fi

echo "#ifndef BUILD_INFO_H"
echo "#define BUILD_INFO_H"
echo ""
echo "#define BUILD_NUMBER $BUILD_NUMBER" | tr -d '\n'
echo ""
echo "#define BUILD_COMMIT \"$BUILD_COMMIT\"" | tr -d '\n'
echo ""
echo "#endif // BUILD_INFO_H"