From f1cc88a5d65edb26eb63a032f6835008927a02c0 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Tue, 20 Jun 2006 10:24:08 +0000 Subject: [PATCH] =?UTF-8?q?Use=20Subversion=20revision=20for=20FFMPEG=5FVE?= =?UTF-8?q?RSION.=20based=20on=20a=20patch=20by=20Ismail=20D=C3=B6nmez=20i?= =?UTF-8?q?smail$$at$$pardus$$dot$$org$$dot$$tr?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Originally committed as revision 5502 to svn://svn.ffmpeg.org/ffmpeg/trunk --- Makefile | 8 ++++++-- ffmpeg.c | 1 + ffplay.c | 1 + ffserver.c | 1 + libavcodec/avcodec.h | 3 +-- version.sh | 10 ++++++++++ 6 files changed, 20 insertions(+), 4 deletions(-) create mode 100755 version.sh diff --git a/Makefile b/Makefile index a3b94a59b6..8335a8716f 100644 --- a/Makefile +++ b/Makefile @@ -67,7 +67,7 @@ SRCS = $(OBJS:.o=.c) $(ASM_OBJS:.o=.s) FFLIBDIRS = -L./libavformat -L./libavcodec -L./libavutil FFLIBS = -lavformat$(BUILDSUF) -lavcodec$(BUILDSUF) -lavutil$(BUILDSUF) -all: lib $(PROGS_G) $(PROGS) $(PROGTEST) $(VHOOK) $(QTFASTSTART) $(DOC) +all: version.h lib $(PROGS_G) $(PROGS) $(PROGTEST) $(VHOOK) $(QTFASTSTART) $(DOC) lib: $(MAKE) -C libavutil all @@ -90,6 +90,10 @@ ffplay_g$(EXESUF): ffplay.o cmdutils.o .libs cp -p $< $@ $(STRIP) $@ +.PHONY: version.h +version.h: + $(SRC_PATH)/version.sh + output_example$(EXESUF): output_example.o .libs $(CC) $(FFLIBDIRS) $(LDFLAGS) -o $@ output_example.o $(FFLIBS) $(EXTRALIBS) @@ -220,7 +224,7 @@ distclean: clean $(MAKE) -C libpostproc distclean $(MAKE) -C tests distclean $(MAKE) -C vhook distclean - rm -f .depend config.mak config.h *.pc + rm -f .depend config.mak config.h version.h *.pc TAGS: etags *.[ch] libavformat/*.[ch] libavcodec/*.[ch] diff --git a/ffmpeg.c b/ffmpeg.c index 6653c78a9a..3834ff6480 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -40,6 +40,7 @@ #undef time //needed because HAVE_AV_CONFIG_H is defined on top #include +#include "version.h" #include "cmdutils.h" #undef NDEBUG diff --git a/ffplay.c b/ffplay.c index 8cffa8f704..7dc5c6033b 100644 --- a/ffplay.c +++ b/ffplay.c @@ -19,6 +19,7 @@ #define HAVE_AV_CONFIG_H #include "avformat.h" +#include "version.h" #include "cmdutils.h" #include diff --git a/ffserver.c b/ffserver.c index 4fe7b032d7..cb44f61586 100644 --- a/ffserver.c +++ b/ffserver.c @@ -39,6 +39,7 @@ #include #endif +#include "version.h" #include "ffserver.h" /* maximum number of simultaneous HTTP connections */ diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index d128cb9c18..52283aa34b 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -14,9 +14,8 @@ extern "C" { #include "avutil.h" #include /* size_t */ -//FIXME the following 2 really dont belong in here +//FIXME: This really doesn't belong in here.. #define FFMPEG_VERSION_INT 0x000409 -#define FFMPEG_VERSION "HEAD" #define AV_STRINGIFY(s) AV_TOSTRING(s) #define AV_TOSTRING(s) #s diff --git a/version.sh b/version.sh new file mode 100755 index 0000000000..cfed406b26 --- /dev/null +++ b/version.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +svn_revision=`svn info | grep Revision | cut -d' ' -f2 || echo UNKNOWN` +NEW_REVISION="#define FFMPEG_VERSION \"SVN-r$svn_revision\"" +OLD_REVISION=`cat version.h 2> /dev/null` + +# Update version.h only on revision changes to avoid spurious rebuilds +if test "$NEW_REVISION" != "$OLD_REVISION"; then + echo "$NEW_REVISION" > version.h +fi