From 013c05992638aec975bf3e52d027d3eff0c0a2c0 Mon Sep 17 00:00:00 2001 From: Tom Callaway Date: Mon, 12 Oct 2020 16:10:57 -0400 Subject: [PATCH] add -tools subpackage, thanks to Gerd v. Egidy --- libsrtp-2.3.0-shared-test-fix.patch | 13 +++++++++++ libsrtp-2.3.0-test-util.patch | 12 ++++++++++ libsrtp.spec | 36 +++++++++++++++++++++++++++-- 3 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 libsrtp-2.3.0-shared-test-fix.patch create mode 100644 libsrtp-2.3.0-test-util.patch diff --git a/libsrtp-2.3.0-shared-test-fix.patch b/libsrtp-2.3.0-shared-test-fix.patch new file mode 100644 index 0000000..3300034 --- /dev/null +++ b/libsrtp-2.3.0-shared-test-fix.patch @@ -0,0 +1,13 @@ +diff -up libsrtp-2.3.0/Makefile.in.test-shared libsrtp-2.3.0/Makefile.in +--- libsrtp-2.3.0/Makefile.in.test-shared 2020-10-12 16:00:39.065842309 -0400 ++++ libsrtp-2.3.0/Makefile.in 2020-10-12 16:01:11.244097667 -0400 +@@ -196,7 +196,7 @@ ifeq (1, $(HAVE_PCAP)) + testapp += test/rtp_decoder$(EXE) + endif + +-$(testapp): libsrtp2.a ++$(testapp): libsrtp2.$(SHAREDLIBSUFFIX) + + test/rtpw$(EXE): test/rtpw.c test/rtp.c test/util.c test/getopt_s.c \ + crypto/math/datatypes.c +diff -up libsrtp-2.3.0/Makefile.test-shared libsrtp-2.3.0/Makefile diff --git a/libsrtp-2.3.0-test-util.patch b/libsrtp-2.3.0-test-util.patch new file mode 100644 index 0000000..2ca37a5 --- /dev/null +++ b/libsrtp-2.3.0-test-util.patch @@ -0,0 +1,12 @@ +diff -r -u libsrtp-2.3.0.orig/test/util.c libsrtp-2.3.0/test/util.c +--- libsrtp-2.3.0.orig/test/util.c 2019-12-23 10:58:25.000000000 +0100 ++++ libsrtp-2.3.0/test/util.c 2020-10-09 11:56:31.455502870 +0200 +@@ -49,7 +49,7 @@ + #include + + /* include space for null terminator */ +-char bit_string[MAX_PRINT_STRING_LEN + 1]; ++static char bit_string[MAX_PRINT_STRING_LEN + 1]; + + static inline int hex_char_to_nibble(uint8_t c) + { diff --git a/libsrtp.spec b/libsrtp.spec index fd1ccc5..5ca0f03 100644 --- a/libsrtp.spec +++ b/libsrtp.spec @@ -2,7 +2,7 @@ Name: libsrtp Version: 2.3.0 -Release: 3%{?dist} +Release: 4%{?dist} Summary: An implementation of the Secure Real-time Transport Protocol (SRTP) License: BSD URL: https://github.com/cisco/libsrtp @@ -10,6 +10,10 @@ Source0: https://github.com/cisco/libsrtp/archive/v%{version}.tar.gz BuildRequires: gcc, nss-devel, libpcap-devel # Fix shared lib so ldconfig doesn't complain Patch0: libsrtp-2.3.0-shared-fix.patch +# Fix namespace issue in test/util.c +Patch1: libsrtp-2.3.0-test-util.patch +# Link test binaries against shared lib +Patch2: libsrtp-2.3.0-shared-test-fix.patch %description This package provides an implementation of the Secure Real-time @@ -25,9 +29,18 @@ Requires: pkgconfig The %{name}-devel package contains libraries and header files for developing applications that use %{name}. +%package tools +Summary: Tools for testing and decoding SRTP +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description tools +Tools for testing and decoding SRTP + %prep %setup -q -n %{name}-%{version} %patch0 -p1 -b .sharedfix +%patch1 -p1 -b .utilfix +%patch2 -p1 -b .test-shared-fix %if 0%{?rhel} > 0 %ifarch ppc64 @@ -38,11 +51,24 @@ sed -i 's/-z noexecstack//' Makefile.in %build export CFLAGS="%{optflags} -fPIC" %configure --enable-nss -make %{?_smp_mflags} shared_library +make %{?_smp_mflags} shared_library test %install make install DESTDIR=%{buildroot} find %{buildroot} -name '*.la' -exec rm -f {} ';' +find %{buildroot} -name '*.a' -exec rm -f {} ';' + +install -D -p -m 0755 test/dtls_srtp_driver %{buildroot}%{_bindir}/dtls_srtp_driver +install -D -p -m 0755 test/rdbx_driver %{buildroot}%{_bindir}/rdbx_driver +install -D -p -m 0755 test/replay_driver %{buildroot}%{_bindir}/replay_driver +install -D -p -m 0755 test/roc_driver %{buildroot}%{_bindir}/roc_driver +install -D -p -m 0755 test/rtp_decoder %{buildroot}%{_bindir}/rtp_decoder +install -D -p -m 0755 test/rtpw %{buildroot}%{_bindir}/rtpw +install -D -p -m 0755 test/srtp_driver %{buildroot}%{_bindir}/srtp_driver +install -D -p -m 0755 test/test_srtp %{buildroot}%{_bindir}/test_srtp + +%check +make runtest %ldconfig_scriptlets @@ -56,7 +82,13 @@ find %{buildroot} -name '*.la' -exec rm -f {} ';' %{_libdir}/pkgconfig/libsrtp2.pc %{_libdir}/*.so +%files tools +%{_bindir}/* + %changelog +* Mon Oct 12 2020 Tom Callaway - 2.3.0-4 +- add -tools subpackage (thanks to Gerd v. Egidy) + * Tue Jul 28 2020 Fedora Release Engineering - 2.3.0-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild