mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-12 01:30:49 +01:00
builds: fix version .sh for standard sh
This commit is contained in:
parent
df7ad9f58c
commit
fc56d08567
@ -14,29 +14,32 @@ if ! command -v git > /dev/null ; then
|
|||||||
VERSION=""
|
VERSION=""
|
||||||
else
|
else
|
||||||
VERSION=$(git describe --tags --always 2>&1 | tr : _ )
|
VERSION=$(git describe --tags --always 2>&1 | tr : _ )
|
||||||
|
if case "$VERSION" in fatal*) true;; *) false;; esac; then
|
||||||
|
VERSION=""
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ignore git stderr "fatal:*" or blank
|
|
||||||
if [[ $VERSION != fatal* ]] && [ ! -z "$VERSION" ] ; then
|
if [ ! -z "$VERSION" ]; then
|
||||||
LINE="$VERSION"
|
LINE="$VERSION"
|
||||||
else
|
else
|
||||||
# try to get version from version.h (static)
|
# try to get version from version.h (static)
|
||||||
#echo "Git version not found, can't autogenerate version (using default)"
|
#echo "Git version not found, can't autogenerate version (using default)"
|
||||||
|
|
||||||
# option to output empty line instead of default version, so plugins can detect git-less builds
|
# option to output empty line instead of default version, so plugins can detect git-less builds
|
||||||
if [ "$VERSION_EMPTY" == "true" ]; then
|
if [ "$VERSION_EMPTY" = "true" ]; then
|
||||||
LINE="/* ignored */"
|
LINE="/* ignored */"
|
||||||
else
|
else
|
||||||
LINE="$VERSION_DEFAULT"
|
LINE="$VERSION_DEFAULT"
|
||||||
while IFS= read -r -u3 item; do
|
while IFS= read -r <&3 ITEM; do
|
||||||
COMP="#define $VERSION_NAME*"
|
COMP="#define $VERSION_NAME"
|
||||||
if [[ $item == $COMP ]] ; then
|
if case "$ITEM" in *"$COMP"*) true;; *) false;; esac; then
|
||||||
# clean "#define ..." leaving rXXXX only
|
# clean "#define ..." leaving rXXXX only
|
||||||
STR_REMOVE1="*$VERSION_NAME \""
|
REGEX_REMOVE1="#define $VERSION_NAME \""
|
||||||
STR_REMOVE2="\"*"
|
REGEX_REMOVE2="\".*"
|
||||||
LINE=$item
|
LINE="$ITEM"
|
||||||
LINE=${LINE/$STR_REMOVE1/}
|
LINE=$(echo $LINE | sed "s/$REGEX_REMOVE1//")
|
||||||
LINE=${LINE/$STR_REMOVE2/}
|
LINE=$(echo $LINE | sed "s/$REGEX_REMOVE2//")
|
||||||
fi
|
fi
|
||||||
done 3< "version.h"
|
done 3< "version.h"
|
||||||
fi
|
fi
|
||||||
|
@ -14,24 +14,27 @@ if ! command -v git > /dev/null ; then
|
|||||||
VERSION=""
|
VERSION=""
|
||||||
else
|
else
|
||||||
VERSION=$(git describe --tags --always 2>&1 | tr : _ )
|
VERSION=$(git describe --tags --always 2>&1 | tr : _ )
|
||||||
|
if case "$VERSION" in fatal*) true;; *) false;; esac; then
|
||||||
|
VERSION=""
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ignore git stderr "fatal:*" or blank
|
|
||||||
if [[ $VERSION != fatal* ]] && [ ! -z "$VERSION" ] ; then
|
if [ ! -z "$VERSION" ]; then
|
||||||
LINE="#define $VERSION_NAME \"$VERSION\" /* autogenerated */"
|
LINE="#define $VERSION_NAME \"$VERSION\" /* autogenerated */"
|
||||||
else
|
else
|
||||||
# try to get version from version.h (static)
|
# try to get version from version.h (static)
|
||||||
echo "Git version not found, can't autogenerate version (using default)"
|
echo "Git version not found, can't autogenerate version (using default)"
|
||||||
|
|
||||||
# option to output empty line instead of default version, so plugins can detect git-less builds
|
# option to output empty line instead of default version, so plugins can detect git-less builds
|
||||||
if [ "$VERSION_EMPTY" == "true" ]; then
|
if [ "$VERSION_EMPTY" = "true" ]; then
|
||||||
LINE="/* ignored */"
|
LINE="/* ignored */"
|
||||||
else
|
else
|
||||||
LINE="#define $VERSION_NAME \"$VERSION_DEFAULT\" /* autogenerated */"
|
LINE="#define $VERSION_NAME \"$VERSION_DEFAULT\" /* autogenerated */"
|
||||||
while IFS= read -r -u3 item; do
|
while IFS= read -r <&3 ITEM; do
|
||||||
COMP="#define $VERSION_NAME*"
|
COMP="#define $VERSION_NAME"
|
||||||
if [[ $item == $COMP ]] ; then
|
if case "$ITEM" in *"$COMP"*) true;; *) false;; esac; then
|
||||||
LINE="$item /* default */"
|
LINE="$ITEM /* default */"
|
||||||
fi
|
fi
|
||||||
done 3< "version.h"
|
done 3< "version.h"
|
||||||
fi
|
fi
|
||||||
@ -43,6 +46,6 @@ LINE_ORIGINAL="none"
|
|||||||
if test -f "version_auto.h"; then
|
if test -f "version_auto.h"; then
|
||||||
LINE_ORIGINAL=$(<version_auto.h)
|
LINE_ORIGINAL=$(<version_auto.h)
|
||||||
fi
|
fi
|
||||||
if [[ $LINE != $LINE_ORIGINAL ]] ; then
|
if [ ! "$LINE" = "$LINE_ORIGINAL" ]; then
|
||||||
echo "$LINE" > "$VERSION_FILE"
|
echo "$LINE" > "$VERSION_FILE"
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user