[libss7-commits] bbryant: trunk r159 - in /trunk: ./ build_tools/
SVN commits to the libss7 project
libss7-commits at lists.digium.com
Thu May 1 18:04:58 CDT 2008
Author: bbryant
Date: Thu May 1 18:04:58 2008
New Revision: 159
URL: http://svn.digium.com/view/libss7?view=rev&rev=159
Log:
Add new API call to libss7 ( ss7_get_version ) that will return 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/libss7.h
Modified: trunk/Makefile
URL: http://svn.digium.com/view/libss7/trunk/Makefile?view=diff&rev=159&r1=158&r2=159
==============================================================================
--- trunk/Makefile (original)
+++ trunk/Makefile Thu May 1 18:04:58 2008
@@ -1,12 +1,14 @@
CC=gcc
+GREP=grep
+AWK=awk
OSARCH=$(shell uname -s)
INSTALL_PREFIX?=
INSTALL_BASE=/usr
libdir?=$(INSTALL_BASE)/lib
-STATIC_OBJS=mtp2.o ss7_sched.o ss7.o mtp3.o isup.o
-DYNAMIC_OBJS=mtp2.o ss7_sched.o ss7.o mtp3.o isup.o
+STATIC_OBJS=mtp2.o ss7_sched.o ss7.o mtp3.o isup.o version.o
+DYNAMIC_OBJS=mtp2.o ss7_sched.o ss7.o mtp3.o isup.o version.o
STATIC_LIBRARY=libss7.a
DYNAMIC_LIBRARY=libss7.so.1.0
CFLAGS=-Wall -Werror -Wstrict-prototypes -Wmissing-prototypes -g -fPIC
@@ -19,6 +21,10 @@
ifneq ($(wildcard /usr/include/zaptel/zaptel.h),)
UTILITIES+=ss7test ss7linktest
endif
+
+export SS7VERSION
+
+SS7VERSION:=$(shell GREP=$(GREP) AWK=$(AWK) build_tools/make_version .)
all: depend $(STATIC_LIBRARY) $(DYNAMIC_LIBRARY) $(UTILITIES)
@@ -41,6 +47,7 @@
if test $$(id -u) = 0; then $(LDCONFIG); fi
+
$(STATIC_LIBRARY): $(STATIC_OBJS)
ar rcs $(STATIC_LIBRARY) $(STATIC_OBJS)
ranlib $(STATIC_LIBRARY)
@@ -50,6 +57,11 @@
$(LDCONFIG) $(LDCONFIG_FLAGS) .
ln -sf libss7.so.1 libss7.so
$(SOSLINK)
+
+version.c:
+ @build_tools/make_version_c > $@.tmp
+ @cmp -s $@.tmp $@ || mv $@.tmp $@
+ @rm -f $@.tmp
ss7test: ss7test.c $(STATIC_LIBRARY)
gcc -g -o ss7test ss7test.c libss7.a -lpthread
@@ -66,3 +78,5 @@
.depend:
./mkdep ${CLAGS} `ls *.c`
+
+.PHONY: version.c
Added: trunk/build_tools/make_version
URL: http://svn.digium.com/view/libss7/trunk/build_tools/make_version?view=auto&rev=159
==============================================================================
--- trunk/build_tools/make_version (added)
+++ trunk/build_tools/make_version Thu May 1 18:04:58 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/libss7/::' | 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:executable = *
Added: trunk/build_tools/make_version_c
URL: http://svn.digium.com/view/libss7/trunk/build_tools/make_version_c?view=auto&rev=159
==============================================================================
--- trunk/build_tools/make_version_c (added)
+++ trunk/build_tools/make_version_c Thu May 1 18:04:58 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 "libss7.h"
+
+static const char ss7_version[] = "${SS7VERSION}${EXTRA}";
+
+const char *ss7_get_version(void)
+{
+ return ss7_version;
+}
+
+END
Propchange: trunk/build_tools/make_version_c
------------------------------------------------------------------------------
svn:executable = *
Modified: trunk/libss7.h
URL: http://svn.digium.com/view/libss7/trunk/libss7.h?view=diff&rev=159&r1=158&r2=159
==============================================================================
--- trunk/libss7.h (original)
+++ trunk/libss7.h Thu May 1 18:04:58 2008
@@ -310,6 +310,7 @@
char * ss7_event2str(int event);
+const char *ss7_get_version(void);
/* ISUP call related message functions */
More information about the libss7-commits
mailing list