Add srtp lib package
[openwrt/svn-archive/archive.git] / libs / srtp / patches / 1008_shared-lib.patch
1 Description: Hack build routines to compile shared library
2 Author: loki_val and solar
3 Origin: http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-libs/libsrtp/files/libsrtp-1.4.4-shared.patch
4 Last-Update: 2010-03-19
5 --- a/Makefile.in
6 +++ b/Makefile.in
7 @@ -15,7 +15,7 @@
8
9 .PHONY: all test build_table_apps
10
11 -all: test
12 +all: libsrtp.so test
13
14 runtest: build_table_apps test
15 @echo "running libsrtp test applications..."
16 @@ -67,7 +67,7 @@
17 # implicit rules for object files and test apps
18
19 %.o: %.c
20 - $(COMPILE) -c $< -o $@
21 + $(COMPILE) -fPIC -c $< -o $@
22
23 %$(EXE): %.c
24 $(COMPILE) $(LDFLAGS) $< -o $@ $(SRTPLIB) $(LIBS)
25 @@ -105,6 +105,9 @@
26 ar cr libsrtp.a $^
27 $(RANLIB) libsrtp.a
28
29 +libsrtp.so: $(srtpobj) $(cryptobj) $(gdoi)
30 + $(CC) $(LDFLAGS) -shared -Wl,-soname,libsrtp.so.0 -o libsrtp.so.0.0 $^
31 +
32 # libcryptomath.a contains general-purpose routines that are used to
33 # generate tables and verify cryptoalgorithm implementations - this
34 # library is not meant to be included in production code
35 @@ -198,6 +201,11 @@
36 cp $(srcdir)/crypto/include/*.h $(DESTDIR)$(includedir)/srtp
37 if [ "$(srcdir)" != "." ]; then cp crypto/include/*.h $(DESTDIR)$(includedir)/srtp; fi
38 if [ -f libsrtp.a ]; then cp libsrtp.a $(DESTDIR)$(libdir)/; fi
39 + if [ -f libsrtp.so.0.0 ]; then \
40 + cp libsrtp.so.0.0 $(DESTDIR)$(libdir)/; \
41 + ln -s libsrtp.so.0.0 $(DESTDIR)$(libdir)/libsrtp.so.0; \
42 + ln -s libsrtp.so.0.0 $(DESTDIR)$(libdir)/libsrtp.so; \
43 + fi
44
45 uninstall:
46 rm -f $(DESTDIR)$(includedir)/srtp/*.h
47 @@ -206,7 +214,7 @@
48
49 clean:
50 rm -rf $(cryptobj) $(srtpobj) $(cryptomath) TAGS \
51 - libcryptomath.a libsrtp.a core *.core test/core
52 + libcryptomath.a libsrtp.a libsrtp.so.0.0 core *.core test/core
53 for a in * */* */*/*; do \
54 if [ -f "$$a~" ] ; then rm -f $$a~; fi; \
55 done;