Am 10.06.2010 10:37, schrieb Howard Chu:
If you submit a patch I'll take a look. I'm not ready to go there yet
myself, there are other loose ends that still need to be tied up first.


Here you go!
>From 34dd288920eaf70f4a6abcecf8a63c185b9912e6 Mon Sep 17 00:00:00 2001
From: Fabian Greffrath <fab...@greffrath.com>
Date: Thu, 10 Jun 2010 11:22:54 +0200
Subject: [PATCH] Build a shared library.

---
 librtmp/Makefile |   36 +++++++++++++++++++++++++++++++-----
 1 files changed, 31 insertions(+), 5 deletions(-)

diff --git a/librtmp/Makefile b/librtmp/Makefile
index 88fd611..bc5b939 100644
--- a/librtmp/Makefile
+++ b/librtmp/Makefile
@@ -28,12 +28,17 @@ INCDIR=$(DESTDIR)$(incdir)
 LIBDIR=$(DESTDIR)$(libdir)
 MANDIR=$(DESTDIR)$(mandir)
 
-all:	librtmp.a
+LIBRARY=librtmp.a
+LIBRARY_SO=librtmp.so
+LIBRARY_SO_VER=librtmp.so.0
+
+all:	$(LIBRARY) $(LIBRARY_SO)
 
 clean:
-	rm -f *.o *.a
+	rm -f *.a *.lo *.o *.so *.so.*
 
-librtmp.a: rtmp.o log.o amf.o hashswf.o parseurl.o
+# Static library
+$(LIBRARY): rtmp.o log.o amf.o hashswf.o parseurl.o
 	$(AR) rs $@ $?
 
 log.o: log.c log.h Makefile
@@ -42,13 +47,34 @@ amf.o: amf.c amf.h bytes.h log.h Makefile
 hashswf.o: hashswf.c http.h rtmp.h rtmp_sys.h Makefile
 parseurl.o: parseurl.c rtmp.h rtmp_sys.h log.h Makefile
 
+%.o: %.c
+	$(CC) $(CFLAGS) -o $@ -c $<
+
+# shared library
+$(LIBRARY_SO_VER): rtmp.lo log.lo amf.lo hashswf.lo parseurl.lo
+	$(CC) -shared -Wl,-soname,$@ $(LDFLAGS) -o $@ $?
+
+$(LIBRARY_SO): $(LIBRARY_SO_VER)
+	ln -sf $? $@
+
+log.lo: log.c log.h Makefile
+rtmp.lo: rtmp.c rtmp.h rtmp_sys.h handshake.h dh.h log.h amf.h Makefile
+amf.lo: amf.c amf.h bytes.h log.h Makefile
+hashswf.lo: hashswf.c http.h rtmp.h rtmp_sys.h Makefile
+parseurl.lo: parseurl.c rtmp.h rtmp_sys.h log.h Makefile
+
+%.lo: %.c
+	$(CC) $(CFLAGS) -fPIC -o $@ -c $<
+
 librtmp.pc: librtmp.pc.in Makefile
 	sed -e "s;@prefix@;$(prefix);" -e "s;@VERSION@;$(VERSION);" \
 		-e "s;@CRYPTO_REQ@;$(CRYPTO_REQ);" librtmp.pc.in > $@
 
-install:	librtmp.a librtmp.pc
+install:	$(LIBRARY) $(LIBRARY_SO) librtmp.pc
 	-mkdir -p $(INCDIR) $(LIBDIR)/pkgconfig $(MANDIR)/man3
 	cp amf.h http.h log.h rtmp.h $(INCDIR)
-	cp librtmp.a $(LIBDIR)
+	cp $(LIBRARY) $(LIBDIR)
+	cp $(LIBRARY_SO) $(LIBDIR)
+	cp $(LIBRARY_SO_VER) $(LIBDIR)
 	cp librtmp.pc $(LIBDIR)/pkgconfig
 	cp librtmp.3 $(MANDIR)/man3
-- 
1.7.1

_______________________________________________
pkg-multimedia-maintainers mailing list
pkg-multimedia-maintainers@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/pkg-multimedia-maintainers

Reply via email to