From 8e76877a26d92b62c6cb50fa846bc977c59ada3b Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Fri, 2 Apr 2010 00:07:02 -0400 Subject: [PATCH] update makefile and version generation to work with git working copy too --- Makefile.am | 56 ++++++++++++++++++++++++++++++-------------- configure.in | 6 ++--- scripts/tagscript.sh | 1 + 3 files changed, 42 insertions(+), 21 deletions(-) diff --git a/Makefile.am b/Makefile.am index afb5673877..8fad740092 100644 --- a/Makefile.am +++ b/Makefile.am @@ -349,7 +349,21 @@ src/include/switch_version.h: src/include/switch_version.h.in .version $(libfree cat src/include/switch_version.h.in > src/include/switch_version.h ; \ touch .version ; \ else \ - version=`svnversion . -n || echo hacked` ; \ + if [ -d .git ] ; then \ + version=`git log --format="%h %ci" -1 HEAD | head -1 || echo hacked` ; \ + if [ "x$$version" == "xhacked" ] ; then \ + version="hacked-`date -u +%Y%m%dT%H%M%SZ`" ; \ + else \ + version="git-$$version" ; \ + fi ;\ + else \ + version=`svnversion . -n || echo hacked` ; \ + if [ "x$$version" == "xhacked" ] ; then \ + version="hacked-`date -u +%Y%m%dT%H%M%SZ`" ; \ + else \ + version="svn-$$version" ; \ + fi ;\ + fi ; \ oldversion=`cat .version 2>/dev/null || echo "0"` ; \ if test "$$oldversion" != "$$version" || test $$force = 1 ; then \ cat src/include/switch_version.h.in | sed "s/@SWITCH_VERSION_REVISION@/$$version/g" > src/include/switch_version.h ; \ @@ -437,23 +451,29 @@ install-data-local: test -d $(DESTDIR)$(sysconfdir) || $(MAKE) samples-conf test -d $(DESTDIR)$(htdocsdir) || $(MAKE) samples-htdocs -is-svn: - @if [ ! -d .svn ] ; then \ +is-scm: + @if [ ! -d .svn -a ! -d .git ] ; then \ echo ; echo ; \ - echo "**************************************************************************************************" ; \ - echo "You can not update a release tarball or without a svn working copy, please checkout fresh from svn" ; \ - echo "**************************************************************************************************" ; \ + echo "*****************************************************************************************************" ; \ + echo "You can not update a release tarball or without a git or svn working copy please clone our git tree: " ; \ + echo "git clone git://git.freeswitch.org/freeswitch.git " ; \ + echo "or check out our read only svn mirror: " ; \ + echo "svn checkout http://svn.freeswitch.org/svn/freeswitch/trunk " ; \ + echo "*****************************************************************************************************" ; \ echo ; echo ; \ exit 1; \ fi -update: is-svn +update: is-scm @if test -d .svn ; then \ test ! -f .version || rm -f .version ; \ echo Updating... ; \ svn update ; \ + elif test -d .git ; then \ + echo "Pulling updates..." ; \ + git pull ; \ else \ - echo "This source directory is not an svn working copy" ; \ + echo "This source directory is not a git tree or svn working copy" ; \ fi .nodepends: @@ -483,18 +503,18 @@ core_install: install_core everything: install -up: is-svn clean - svn update +up: is-scm clean + $(MAKE) update $(MAKE) -j core $(MAKE) -j modules $(MAKE) install -sync: is-svn - svn update +sync: is-scm + $(MAKE) update $(MAKE) install -speedy-sync: is-svn - svn update +speedy-sync: is-scm + $(MAKE) update $(MAKE) -j install libs/openzap/Makefile: @@ -570,15 +590,15 @@ cluecon: @echo @echo http://www.cluecon.com @sleep 5 -current: cluecon is-svn update-clean - svn update +current: cluecon update-clean is-scm + $(MAKE) update $(MAKE) all $(MAKE) install installall: current -speedy-current: is-svn update-clean - svn update +speedy-current: update-clean is-scm + $(MAKE) update $(MAKE) speedy-sure $(MAKE) install diff --git a/configure.in b/configure.in index de262a86db..16ba3e6999 100644 --- a/configure.in +++ b/configure.in @@ -3,11 +3,11 @@ # Must change all of the below together # For a release, set revision for that tagged release as well and uncomment -AC_INIT([freeswitch], [1.0.trunk], BUG-REPORT-ADDRESS) +AC_INIT([freeswitch], [1.0.head], BUG-REPORT-ADDRESS) AC_SUBST(SWITCH_VERSION_MAJOR, [1]) AC_SUBST(SWITCH_VERSION_MINOR, [0]) -AC_SUBST(SWITCH_VERSION_MICRO, [trunk]) -#AC_SUBST(SWITCH_VERSION_REVISION, [svn-revision-here]) +AC_SUBST(SWITCH_VERSION_MICRO, [head]) +#AC_SUBST(SWITCH_VERSION_REVISION, []) AC_CONFIG_FILES([src/include/switch_version.h.in:src/include/switch_version.h.template]) AC_CONFIG_FILES([.version:.version.in]) diff --git a/scripts/tagscript.sh b/scripts/tagscript.sh index 48a377ffd7..7556c075d0 100755 --- a/scripts/tagscript.sh +++ b/scripts/tagscript.sh @@ -35,6 +35,7 @@ fi sed -e "s|\(AC_SUBST(SWITCH_VERSION_MAJOR, \[\).*\(\])\)|\1$major\2|" \ -e "s|\(AC_SUBST(SWITCH_VERSION_MINOR, \[\).*\(\])\)|\1$minor\2|" \ -e "s|\(AC_SUBST(SWITCH_VERSION_MICRO, \[\).*\(\])\)|\1$micro\2|" \ + -e "s|\(AC_INIT(\[freeswitch\], \[\).*\(\], BUG-REPORT-ADDRESS)\)|\1$major.$minor.$micro\2|" \ -i configure.in if [ -n "$rev" ]; then