]> sjero.net Git - linphone/commitdiff
Include git version in liblinphone version if available.
authorGhislain MARY <ghislain.mary@belledonne-communications.com>
Thu, 25 Oct 2012 15:16:07 +0000 (17:16 +0200)
committerGhislain MARY <ghislain.mary@belledonne-communications.com>
Thu, 25 Oct 2012 15:16:07 +0000 (17:16 +0200)
coreapi/.gitignore
coreapi/Makefile.am
coreapi/linphonecore.c

index c5d084fa64ad39cdab4eb498e31c51626800433a..81d1b7647313ee440fdf0a055d1aac2c6801eed5 100644 (file)
@@ -5,3 +5,4 @@ Makefile.in
 *.lo
 *.la
 *.loT
+liblinphone_gitversion.h
index c706751ac1b06ab477524211612d02e1f0ccc5ec..fa0c08b0174dd3ff7f1c3f5626c6f44ae31b92a2 100644 (file)
@@ -1,7 +1,15 @@
+GITVERSION_FILE=liblinphone_gitversion.h
+GITVERSION_FILE_TMP=liblinphone_gitversion.h.tmp
+
+ECHO=/bin/echo
 
 SUBDIRS=. help
 
-EXTRA_DIST=linphonecore_jni.cc
+EXTRA_DIST=linphonecore_jni.cc $(GITVERSION_FILE)
+
+BUILT_SOURCES=$(GITVERSION_FILE)
+
+CLEANFILES=$(GITVERSION_FILE)
 
 ## Process this file with automake to produce Makefile.in
 linphone_includedir=$(includedir)/linphone
@@ -41,7 +49,8 @@ liblinphone_la_SOURCES=\
        lsd.c linphonecore_utils.h \
        ec-calibrator.c \
        conference.c \
-       linphone_tunnel.cc
+       linphone_tunnel.cc \
+       $(GITVERSION_FILE)
        
 if BUILD_WIZARD
 liblinphone_la_SOURCES+=sipwizard.c 
@@ -97,3 +106,16 @@ AM_CFLAGS+= -DBUILD_WIZARD
 endif
 
 AM_CXXFLAGS=$(AM_CFLAGS)
+
+$(GITVERSION_FILE):
+       if test -d $(top_srcdir)/.git ; then \
+               $(ECHO) -n "#define LIBLINPHONE_GIT_VERSION " > $(GITVERSION_FILE_TMP) &&\
+               $(ECHO) \"`cd $(top_srcdir) && git describe`\" >> $(GITVERSION_FILE_TMP) &&\
+               if test "`cat $(GITVERSION_FILE_TMP)`" != "`cat $(srcdir)/$(GITVERSION_FILE)`" ; then \
+                       cp -f $(GITVERSION_FILE_TMP) $(srcdir)/$(GITVERSION_FILE) ; \
+               fi \
+               && rm -f $(GITVERSION_FILE_TMP) ;\
+       fi
+       if ! test -f $(srcdir)/$(GITVERSION_FILE) ; then \
+               $(ECHO) -n "" > $(srcdir)/$(GITVERSION_FILE) ;\
+       fi
index b5f35d59d96b5dfd8cfd7baa8589bc134d72e710..503a71c03b290921711d553e7ec256cad792a6b9 100644 (file)
@@ -42,11 +42,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #include "config.h"
 #endif
 
+#include "liblinphone_gitversion.h"
+
 /*#define UNSTANDART_GSM_11K 1*/
 
 #define ROOT_CA_FILE PACKAGE_DATA_DIR "/linphone/rootca.pem"
 
-static const char *liblinphone_version=LIBLINPHONE_VERSION;
+static const char *liblinphone_version=
+#ifdef LIBLINPHONE_GIT_VERSION
+       LIBLINPHONE_GIT_VERSION
+#else
+       LIBLINPHONE_VERSION
+#endif
+;
 static void set_network_reachable(LinphoneCore* lc,bool_t isReachable, time_t curtime);
 static void linphone_core_run_hooks(LinphoneCore *lc);
 static void linphone_core_free_hooks(LinphoneCore *lc);