vgmstream/version-make.sh
bnnm 0b14f9a446 builds: modify how version.h is used to fix issues
- version.h is now static (should increase on new releases)
- if compiler flag is passed, will try to use version_auto.h (autogen)
(auto only on compiler flag to avoid include'ing a non-existant file)
- avoid clobbered version.h as may force recompiles
2021-08-10 23:51:48 +02:00

22 lines
521 B
Bash

#!/bin/sh
# make current git version (overwrites version_auto.h)
VERSION_NAME=VGMSTREAM_VERSION
VERSION_FILE=version_auto.h
# test if git exists
if ! command -v git > /dev/null ; then
VERSION=""
else
VERSION=$(git describe --always 2>&1 | tr : _ )
fi
# ignore git stderr "fatal:*" or blank
if [[ $VERSION != fatal* ]] && [ ! -z "$VERSION" ] ; then
echo "#define $VERSION_NAME \"$VERSION\" /* autogenerated */" > $VERSION_FILE
else
echo "Git version not found, can't autogenerate version_auto.h"
fi;