From fe595857dddfadb85df51af67620f035e7651c7d Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Thu, 25 Oct 2012 15:48:53 +0200 Subject: [PATCH 1/3] Include linphonecore_jni.h only if USE_JAVAH is defined. --- build/android/common.mk | 4 ++++ coreapi/linphonecore_jni.cc | 2 ++ 2 files changed, 6 insertions(+) diff --git a/build/android/common.mk b/build/android/common.mk index 8772e9003..c49d511bd 100644 --- a/build/android/common.mk +++ b/build/android/common.mk @@ -75,6 +75,10 @@ LOCAL_CFLAGS += -DHAVE_X264 endif endif +ifeq ($(USE_JAVAH),1) +LOCAL_CFLAGS += -DUSE_JAVAH +endif + LOCAL_C_INCLUDES += \ $(LOCAL_PATH) \ $(LOCAL_PATH)/include \ diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 69f9b3cc4..5ebf57892 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -17,7 +17,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include +#ifdef USE_JAVAH #include "linphonecore_jni.h" +#endif #include "linphonecore_utils.h" #include From b7b4e75eda15c43883b7b01a2e308215e280428a Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Thu, 25 Oct 2012 17:16:07 +0200 Subject: [PATCH 2/3] Include git version in liblinphone version if available. --- coreapi/.gitignore | 1 + coreapi/Makefile.am | 26 ++++++++++++++++++++++++-- coreapi/linphonecore.c | 10 +++++++++- 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/coreapi/.gitignore b/coreapi/.gitignore index c5d084fa6..81d1b7647 100644 --- a/coreapi/.gitignore +++ b/coreapi/.gitignore @@ -5,3 +5,4 @@ Makefile.in *.lo *.la *.loT +liblinphone_gitversion.h diff --git a/coreapi/Makefile.am b/coreapi/Makefile.am index c706751ac..fa0c08b01 100644 --- a/coreapi/Makefile.am +++ b/coreapi/Makefile.am @@ -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 diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index b5f35d59d..503a71c03 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -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); From 37681f0e663e199c5f7b4e541028a5d9bc52913e Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Fri, 26 Oct 2012 10:40:14 +0200 Subject: [PATCH 3/3] Improve handling of git version. --- coreapi/Makefile.am | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/coreapi/Makefile.am b/coreapi/Makefile.am index fa0c08b01..0c10c05da 100644 --- a/coreapi/Makefile.am +++ b/coreapi/Makefile.am @@ -1,5 +1,7 @@ GITVERSION_FILE=liblinphone_gitversion.h GITVERSION_FILE_TMP=liblinphone_gitversion.h.tmp +GITDESCRIBE=$(shell git describe) +GITREVISION=$(shell git rev-parse HEAD) ECHO=/bin/echo @@ -107,15 +109,17 @@ 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) ;\ +make_gitversion_h: + if test "$(GITDESCRIBE)" != "" ; then \ + $(ECHO) -n "#define LIBLINPHONE_GIT_VERSION \"$(GITDESCRIBE)\"" > $(GITVERSION_FILE_TMP) ; \ + elif test "$(GITREVISION)" != "" ; then \ + $(ECHO) -n "#define LIBLINPHONE_GIT_VERSION \"$(LINPHONE_VERSION)_$(GITREVISION)\"" > $(GITVERSION_FILE_TMP) ; \ + else \ + $(ECHO) -n "" > $(GITVERSION_FILE_TMP) ; \ fi - if ! test -f $(srcdir)/$(GITVERSION_FILE) ; then \ - $(ECHO) -n "" > $(srcdir)/$(GITVERSION_FILE) ;\ + 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) ; + +$(GITVERSION_FILE): make_gitversion_h