summaryrefslogtreecommitdiffstats
path: root/version.sh
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-06-30 15:56:26 +0200
committerwm4 <wm4@nowhere>2015-06-30 15:56:26 +0200
commitdbf21467f0da3d4906c6854fa7dd13190463c3c3 (patch)
tree6ba8fcba91c34525e13e4675e6cf468c7747cc7c /version.sh
parentbf739ca3248c2ce1b0f2ad7c46097c552676e2ba (diff)
downloadmpv-dbf21467f0da3d4906c6854fa7dd13190463c3c3.tar.bz2
mpv-dbf21467f0da3d4906c6854fa7dd13190463c3c3.tar.xz
build: always regenerate version hash
Until now, it only used the hash from the previous configure run, instead of trying to get the latest hash. The "old" build system did this correctly - we just have to use the existing logic in version.sh. Since waf supports separate build dirs, extend version.sh with an argument for setting the path of version.h.
Diffstat (limited to 'version.sh')
-rwxr-xr-xversion.sh14
1 files changed, 10 insertions, 4 deletions
diff --git a/version.sh b/version.sh
index 3eac7ef050..a3d753da44 100755
--- a/version.sh
+++ b/version.sh
@@ -2,16 +2,22 @@
export LC_ALL=C
+version_h="version.h"
+
for ac_option do
+ ac_arg=$(echo $ac_option | cut -d '=' -f 2-)
case "$ac_option" in
--extra=*)
- extra="-$option"
+ extra="-$ac_arg"
+ ;;
+ --versionh=*)
+ version_h="$ac_arg"
;;
--print)
print=yes
;;
*)
- echo "Unknown parameter: $option" >&2
+ echo "Unknown parameter: $ac_option" >&2
exit 1
;;
@@ -42,12 +48,12 @@ if test "$print" = yes ; then
fi
NEW_REVISION="#define VERSION \"${VERSION}\""
-OLD_REVISION=$(head -n 1 version.h 2> /dev/null)
+OLD_REVISION=$(head -n 1 "$version_h" 2> /dev/null)
BUILDDATE="#define BUILDDATE \"$(date)\""
# Update version.h only on revision changes to avoid spurious rebuilds
if test "$NEW_REVISION" != "$OLD_REVISION"; then
- cat <<EOF > version.h
+ cat <<EOF > "$version_h"
$NEW_REVISION
$BUILDDATE
EOF