File libsrtp-automake.patch of Package libsrtp

From: Jan Engelhardt <jengelh@inai.de>
Date: 2011-10-25 17:51:31.000000000 +0200

Switch to stress-free automake with libtool library generation.
Also add a pkgconfig file for easy detection of presence and paths
by secondary projects.

As libsrtp 1.4.5 has not yet officially been released (as a tarball,
on sf.net) and the API is still changing, using -release
${PACKAGE_VERSION} won't be of help. We really need to count ABI
versions ourselves. So far,

	libsrtp.so.1: srtp 1.4.4
	libsrtp.so.2: srtp 1.4.5-pre (7db9eb2c67ec8da7c016b7422885)

---
 Makefile.am                |   99 +++++++++++++++++++++++++++++++++++++++++++++
 configure.in               |   13 ++++-
 crypto/include/Makefile.am |    7 +++
 include/Makefile.am        |    4 +
 libsrtp.pc.in              |   11 +++++
 5 files changed, 131 insertions(+), 3 deletions(-)

Index: libsrtp/Makefile.am
===================================================================
--- /dev/null
+++ libsrtp/Makefile.am
@@ -0,0 +1,102 @@
+# -*- Makefile -*-
+
+SUBDIRS = crypto/include include
+
+AM_CPPFLAGS = -I${top_srcdir}/crypto/include -I${top_srcdir}/include
+
+pkgconfdir = ${libdir}/pkgconfig
+pkgconf_DATA = libsrtp.pc
+
+lib_LTLIBRARIES = libsrtp.la
+
+noinst_LTLIBRARIES = libcryptomath.la
+
+ciphers = crypto/cipher/cipher.c crypto/cipher/null_cipher.c      \
+          crypto/cipher/aes.c crypto/cipher/aes_icm.c             \
+          crypto/cipher/aes_cbc.c
+
+hashes  = crypto/hash/null_auth.c crypto/hash/sha1.c \
+          crypto/hash/hmac.c crypto/hash/auth.c # crypto/hash/tmmhv2.c
+
+replay  = crypto/replay/rdb.c crypto/replay/rdbx.c               \
+          crypto/replay/ut_sim.c
+
+math    = crypto/math/datatypes.c crypto/math/stat.c
+
+ust     = crypto/ust/ust.c
+
+rng     = crypto/rng/prng.c crypto/rng/ctr_prng.c
+if RAND_LINUX_KERNEL
+rng    += crypto/rng/rand_linux_kernel.c
+else
+rng    += crypto/rng/rand_source.c
+endif
+
+err     = crypto/kernel/err.c
+
+kernel  = crypto/kernel/crypto_kernel.c  crypto/kernel/alloc.c   \
+          crypto/kernel/key.c $(rng) $(err) # $(ust)
+
+cryptsrc = ${ciphers} ${hashes} ${math} ${stat} ${kernel} ${replay}
+
+# libsrtp.a (implements srtp processing)
+
+srtpsrc = srtp/srtp.c srtp/ekt.c
+
+# gdoi is the group domain of interpretation for isakmp, a group key
+# management system which can provide keys for srtp
+if GDOI
+gdoi = gdoi/srtp+gdoi.c
+endif
+
+# so.1 was used in srtp-sharedlib.diff..
+libsrtp_la_SOURCES = ${srtpsrc} ${cryptsrc} ${gdoi}
+libsrtp_la_LDFLAGS = -version-info 2:0:0
+
+libcryptomath_la_SOURCES = crypto/math/math.c crypto/math/gf2_8.c
+
+# test applications
+
+check_PROGRAMS = crypto/test/aes_calc crypto/test/cipher_driver \
+	crypto/test/datatypes_driver crypto/test/kernel_driver \
+	crypto/test/rand_gen crypto/test/sha1_driver \
+	crypto/test/stat_driver \
+	test/srtp_driver test/replay_driver test/roc_driver test/rdbx_driver \
+	test/rtpw test/dtls_srtp_driver
+
+test_rtpw_SOURCES = test/rtpw.c test/rtp.c test/getopt_s.c
+test_rtpw_LDADD   = libsrtp.la
+
+test_srtp_driver_SOURCES = test/srtp_driver.c test/getopt_s.c
+test_srtp_driver_LDADD   = libsrtp.la
+
+test_rdbx_driver_SOURCES = test/rdbx_driver.c test/getopt_s.c
+test_rdbx_driver_LDADD   = libsrtp.la
+
+test_dtls_srtp_driver_SOURCES = test/dtls_srtp_driver.c test/getopt_s.c
+test_dtls_srtp_driver_LDADD   = libsrtp.la
+
+memtest: test/srtp_driver
+	@test/srtp_driver -v -d "alloc" > tmp
+	@grep freed tmp | wc -l > freed
+	@grep allocated tmp | wc -l > allocated
+	@echo "checking for memory leaks (only works with --enable-stdout)"
+	cmp -s allocated freed
+	@echo "passed (same number of alloc() and dealloc() calls found)"
+	@rm freed allocated tmp
+
+# tables_apps are used to generate the tables used in the crypto
+# implementations; these need only be generated during porting, not
+# for building libsrtp or the test applications
+
+check_PROGRAMS += tables/aes_tables
+
+tables_aes_tables_SOURCES = tables/aes_tables.c
+tables_aes_tables_LDADD   = libcryptomath.la
+
+# the target 'plot' runs the timing test (test/srtp_driver -t) then
+# uses gnuplot to produce plots of the results - see the script file
+# 'timing'
+
+plot:	test/srtp_driver
+	test/srtp_driver -t > timing.dat
Index: libsrtp/configure.in
===================================================================
--- libsrtp.orig/configure.in
+++ libsrtp/configure.in
@@ -1,5 +1,5 @@
 dnl Process this file with autoconf to produce a configure script.
-AC_INIT(srtp)
+AC_INIT([srtp], [1.4.5])
 
 dnl Must come before AC_PROG_CC
 if test -z "$CFLAGS"; then
@@ -8,9 +8,13 @@ if test -z "$CFLAGS"; then
 fi
 
 dnl Checks for programs.
-AC_PROG_RANLIB
+AM_INIT_AUTOMAKE([-Wall foreign subdir-objects tar-pax])
 AC_PROG_CC
+AM_PROG_CC_C_O
 AC_PROG_INSTALL
+m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
+AC_DISABLE_STATIC
+AC_PROG_LIBTOOL
 
 dnl Check the byte order
 AC_C_BIGENDIAN
@@ -81,6 +85,7 @@ else
    fi
 fi
 AC_SUBST(RNG_OBJS)
+AM_CONDITIONAL([RAND_LINUX_KERNEL], [test "$enable_linux_kernel" = yes])
 
 
 dnl Checks for header files.
@@ -189,10 +194,12 @@ if test "$enable_gdoi" = "yes"; then
    AC_SUBST(GDOI_OBJS)                              
 fi
 AC_MSG_RESULT($enable_gdoi)
+AM_CONDITIONAL([GDOI], [test "$enable_gdoi" = "yes"])
 
 AC_CONFIG_HEADER(crypto/include/config.h:config_in.h)
 
-AC_OUTPUT(Makefile crypto/Makefile doc/Makefile)
+AC_CONFIG_FILES([Makefile crypto/Makefile crypto/include/Makefile doc/Makefile include/Makefile libsrtp.pc])
+AC_OUTPUT
 
 # This is needed when building outside the source dir.
 AS_MKDIR_P(crypto/ae_xfm)
Index: libsrtp/crypto/include/Makefile.am
===================================================================
--- /dev/null
+++ libsrtp/crypto/include/Makefile.am
@@ -0,0 +1,7 @@
+# -*- Makefile -*-
+
+pkginclude_HEADERS = \
+	aes.h aes_cbc.h aes_icm.h alloc.h auth.h cipher.h crypto.h \
+	crypto_kernel.h crypto_math.h crypto_types.h cryptoalg.h datatypes.h \
+	err.h gf2_8.h hmac.h integers.h kernel_compat.h key.h null_auth.h \
+	null_cipher.h prng.h rand_source.h rdb.h rdbx.h sha1.h stat.h xfm.h
Index: libsrtp/include/Makefile.am
===================================================================
--- /dev/null
+++ libsrtp/include/Makefile.am
@@ -0,0 +1,4 @@
+# -*- Makefile -*-
+
+pkginclude_HEADERS = \
+	getopt_s.h rtp.h rtp_priv.h srtp.h srtp_priv.h ut_sim.h
Index: libsrtp/libsrtp.pc.in
===================================================================
--- /dev/null
+++ libsrtp/libsrtp.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name:		libsrtp
+Description:	Secure Real-time Transport Protocol library
+Version:	1.4.5
+URL:		http://srtp.sf.net/
+Libs:		-L${libdir} -lsrtp
+Cflags:		-I${includedir}/srtp
openSUSE Build Service is sponsored by