[FFmpeg-cvslog] version.sh: add preprocessing guards

Timothy Gu git at videolan.org
Sat Nov 30 22:12:42 CET 2013


ffmpeg | branch: master | Timothy Gu <timothygu99 at gmail.com> | Fri Nov 29 09:57:30 2013 -0800| [c5806910918eb9adc3b3a821242cc4bc7647a50f] | committer: Michael Niedermayer

version.sh: add preprocessing guards

Signed-off-by: Timothy Gu <timothygu99 at gmail.com>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c5806910918eb9adc3b3a821242cc4bc7647a50f
---

 version.sh |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/version.sh b/version.sh
index c28ffe7..92edcb9 100755
--- a/version.sh
+++ b/version.sh
@@ -42,9 +42,17 @@ if [ -z "$2" ]; then
 fi
 
 NEW_REVISION="#define FFMPEG_VERSION \"$version\""
-OLD_REVISION=$(cat "$2" 2> /dev/null)
+OLD_REVISION=$(cat "$2" 2> /dev/null | head -3 | tail -1)
+
+# String used for preprocessor guard
+GUARD=$(echo "$2" | sed 's/\//_/' | sed 's/\./_/' | tr '[:lower:]' '[:upper:]' | sed 's/LIB//')
 
 # Update version header only on revision changes to avoid spurious rebuilds
 if test "$NEW_REVISION" != "$OLD_REVISION"; then
-    echo "$NEW_REVISION" > "$2"
+    cat << EOF > "$2"
+#ifndef $GUARD
+#define $GUARD
+$NEW_REVISION
+#endif /* $GUARD */
+EOF
 fi



More information about the ffmpeg-cvslog mailing list