[svn-commits] bbryant: trunk r549 - in /trunk: ./ build_tools/
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Thu May 1 18:04:29 CDT 2008
Author: bbryant
Date: Thu May 1 18:04:28 2008
New Revision: 549
URL: http://svn.digium.com/view/libpri?view=rev&rev=549
Log:
Add new API call to libpri ( pri_get_version ) which returns a version string.
Added:
trunk/build_tools/
trunk/build_tools/make_version (with props)
trunk/build_tools/make_version_c (with props)
Modified:
trunk/Makefile
trunk/libpri.h
Modified: trunk/Makefile
URL: http://svn.digium.com/view/libpri/trunk/Makefile?view=diff&rev=549&r1=548&r2=549
==============================================================================
--- trunk/Makefile (original)
+++ trunk/Makefile Thu May 1 18:04:28 2008
@@ -28,6 +28,8 @@
#LIBPRI_COUNTERS=-DLIBPRI_COUNTERS
CC=gcc
+GREP=grep
+AWK=awk
OSARCH=$(shell uname -s)
PROC?=$(shell uname -m)
@@ -39,8 +41,8 @@
STATIC_LIBRARY=libpri.a
DYNAMIC_LIBRARY:=libpri.so.$(SONAME)
-STATIC_OBJS=copy_string.o pri.o q921.o prisched.o q931.o pri_facility.o
-DYNAMIC_OBJS=copy_string.lo pri.lo q921.lo prisched.lo q931.lo pri_facility.lo
+STATIC_OBJS=copy_string.o pri.o q921.o prisched.o q931.o pri_facility.o version.o
+DYNAMIC_OBJS=copy_string.lo pri.lo q921.lo prisched.lo q931.lo pri_facility.lo version.lo
CFLAGS=-Wall -Werror -Wstrict-prototypes -Wmissing-prototypes -g -fPIC $(ALERTING) $(LIBPRI_COUNTERS)
INSTALL_PREFIX=$(DESTDIR)
INSTALL_BASE=/usr
@@ -61,6 +63,10 @@
LDCONFIG_FLAGS = \# # Trick to comment out the period in the command below
#INSTALL_PREFIX = /opt/asterisk # Uncomment out to install in standard Solaris location for 3rd party code
endif
+
+export PRIVERSION
+
+PRIVERSION:=$(shell GREP=$(GREP) AWK=$(AWK) build_tools/make_version .)
#The problem with sparc is the best stuff is in newer versions of gcc (post 3.0) only.
#This works for even old (2.96) versions of gcc and provides a small boost either way.
@@ -141,6 +147,11 @@
$(LDCONFIG) $(LDCONFIG_FLAGS) .
ln -sf libpri.so.$(SONAME) libpri.so
+version.c:
+ @build_tools/make_version_c > $@.tmp
+ @cmp -s $@.tmp $@ || mv $@.tmp $@
+ @rm -f $@.tmp
+
clean:
rm -f *.o *.so *.lo *.so.$(SONAME)
rm -f testprilib $(STATIC_LIBRARY) $(DYNAMIC_LIBRARY)
@@ -151,3 +162,5 @@
.depend:
CC="$(CC)" ./mkdep ${CFLAGS} `ls *.c`
+
+.PHONY: version.c
Added: trunk/build_tools/make_version
URL: http://svn.digium.com/view/libpri/trunk/build_tools/make_version?view=auto&rev=549
==============================================================================
--- trunk/build_tools/make_version (added)
+++ trunk/build_tools/make_version Thu May 1 18:04:28 2008
@@ -1,0 +1,74 @@
+#!/bin/sh
+
+if [ -f ${1}/.version ]; then
+ cat ${1}/.version
+elif [ -d .svn ]; then
+ PARTS=`LANG=C svn info ${1} | ${GREP} URL | ${AWK} '{print $2;}' | sed -e 's:^.*/svn/libpri/::' | sed -e 's:/: :g'`
+ BRANCH=0
+ TEAM=0
+ TAG=0
+
+ REV=`svnversion -c ${1} | cut -d: -f2`
+
+ BASE=`LANG=C svn pg svnmerge-integrated ${1} | cut -d: -f1`
+
+ if [ "${PARTS}" = "trunk" ] ; then
+ echo SVN-trunk-r${REV}
+ exit 0
+ fi
+
+ for PART in $PARTS ; do
+ if [ ${TAG} != 0 ] ; then
+ if [ "${PART}" = "autotag_for_be" ] ; then
+ continue
+ fi
+ if [ "${PART}" = "autotag_for_sx00i" ] ; then
+ continue
+ fi
+ RESULT="${PART}"
+ break
+ fi
+
+ if [ ${BRANCH} != 0 ] ; then
+ if [ -z ${RESULT} ] ; then
+ RESULT="2${PART}"
+ else
+ RESULT="3${RESULT}-${PART}"
+ fi
+ break
+ fi
+
+ if [ ${TEAM} != 0 ] ; then
+ if [ -z ${RESULT} ] ; then
+ RESULT="4${PART}"
+ else
+ RESULT="5${RESULT}-${PART}"
+ fi
+ continue
+ fi
+
+ if [ "${PART}" = "branches" ] ; then
+ BRANCH=1
+ RESULT="branch"
+ continue
+ fi
+
+ if [ "${PART}" = "tags" ] ; then
+ TAG=1
+ continue
+ fi
+
+ if [ "${PART}" = "team" ] ; then
+ TEAM=1
+ continue
+ fi
+ done
+
+ RESULT="libss7"
+
+ if [ ${TAG} != 0 ] ; then
+ echo ${RESULT}
+ else
+ echo SVN-${RESULT}-r${REV}${BASE:+-${BASE}}
+ fi
+fi
Propchange: trunk/build_tools/make_version
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: trunk/build_tools/make_version
------------------------------------------------------------------------------
svn:executable = *
Propchange: trunk/build_tools/make_version
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: trunk/build_tools/make_version
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: trunk/build_tools/make_version_c
URL: http://svn.digium.com/view/libpri/trunk/build_tools/make_version_c?view=auto&rev=549
==============================================================================
--- trunk/build_tools/make_version_c (added)
+++ trunk/build_tools/make_version_c Thu May 1 18:04:28 2008
@@ -1,0 +1,24 @@
+#!/bin/sh
+if [ ! -f ../.flavor ]; then
+ EXTRA=""
+else
+ aadkver=`cat ../.version`
+ aadkflavor=`cat ../.flavor`
+ EXTRA=" (${aadkflavor} ${aadkver})"
+fi
+cat << END
+/*
+ * version.c
+ * Automatically generated
+ */
+
+#include "libpri.h"
+
+static const char pri_version[] = "${PRIVERSION}${EXTRA}";
+
+const char *pri_get_version(void)
+{
+ return pri_version;
+}
+
+END
Propchange: trunk/build_tools/make_version_c
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: trunk/build_tools/make_version_c
------------------------------------------------------------------------------
svn:executable = *
Propchange: trunk/build_tools/make_version_c
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: trunk/build_tools/make_version_c
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: trunk/libpri.h
URL: http://svn.digium.com/view/libpri/trunk/libpri.h?view=diff&rev=549&r1=548&r2=549
==============================================================================
--- trunk/libpri.h (original)
+++ trunk/libpri.h Thu May 1 18:04:28 2008
@@ -681,4 +681,7 @@
#define PRI_TIMER_TM20 28 /* maximum time avaiting XID response */
#define PRI_TIMER_NM20 29 /* number of XID retransmits */
+/* Get PRI version */
+const char *pri_get_version(void);
+
#endif
More information about the svn-commits
mailing list