#
-# rtmpdump build script.
+# rtmpdump build script for OSX darwin.
#
# A quick and dirty Makefile to download/build and install librtmp
#
# 10.4u.sdk is targeted so we can run on the AppleTV. Macports is assumed to
# be used and the required lib depends installed.
#
-# Linux: builds a simple.so without the proper .so version symlinks,
-# maybe someone with good Linux makefile-fu can fix it up.
+# Linux: builds using the existing librtmp make system
#
# Usage:
# make
# sudo make install
-# librtmp 2.2f is this svn version
-RTMPDUMP_VERS = 511
# get OS type from shell
OSTYPE = $(shell uname)
ifeq ($(OSTYPE),Darwin)
-MACHINE = $(shell uname -m)
-ifeq ($(findstring Power,$(MACHINE)), Power)
- arch = ppc
+ SYS=darwin
+ prefix=/opt/local
+ XCFLAGS=-mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -I /opt/local/include
+ XLDFLAGS=-mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -L/opt/local/lib
+ MACHINE = $(shell uname -m)
+ ifeq ($(findstring Power,$(MACHINE)), Power)
+ arch = ppc
+ else
+ arch = i386
+ endif
else
- arch = i386
-endif
-PREFIX=/opt/local
-XCFLAGS=-mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk \
- -fPIC -I /opt/local/include
-XLDFLAGS=-mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk \
- -bundle -flat_namespace -undefined suppress -arch $(arch) -L/opt/local/lib \
- -lpthread -lssl -lcrypto -lz
-else
-PREFIX=/usr/local
-XCFLAGS=-fPIC -DPIC
-XLDFLAGS=-shared -fPIC -rdynamic -lpthread -lssl -lcrypto -lz
+ SYS=posix
endif
-LIBRTMP = librtmp/librtmp.a
+LIBRTMP = librtmp/librtmp/librtmp.so
-all:: librtmp.so
-
-librtmp.so: $(LIBRTMP)
-ifeq ($(OSTYPE),Darwin)
- $(CC) $(XLDFLAGS) -o $@ -Wl,-all_load $<
-else
- $(CC) $(XLDFLAGS) -o $@ -Wl,--whole-archive $< -Wl,--no-whole-archive
-endif
+all:: librtmp/librtmp/librtmp.so
$(LIBRTMP): librtmp/Makefile
- make SYS=posix XCFLAGS="$(XCFLAGS)" XLDFLAGS="$(XLDFLAGS)" -C librtmp
+ make SYS=$(SYS) prefix=$(prefix) XCFLAGS="$(XCFLAGS)" XLDFLAGS="$(XLDFLAGS)" -C librtmp/librtmp
librtmp/Makefile:
- svn export --revision $(RTMPDUMP_VERS) svn://svn.mplayerhq.hu/rtmpdump/trunk/librtmp librtmp
+ svn export svn://svn.mplayerhq.hu/rtmpdump/tags/rel-2.3 librtmp
+ifeq ($(OSTYPE),Darwin)
+ cd librtmp; patch -p1 < ../make_shared_lib_for_darwin-tag2.3.patch
+endif
install:
- mkdir -p $(PREFIX)/include/librtmp
- cp -f librtmp/amf.h $(PREFIX)/include/librtmp
- cp -f librtmp/log.h $(PREFIX)/include/librtmp
- cp -f librtmp/http.h $(PREFIX)/include/librtmp
- cp -f librtmp/rtmp.h $(PREFIX)/include/librtmp
- cp -f librtmp.so $(PREFIX)/lib
+ make SYS=$(SYS) prefix=$(prefix) -C librtmp/librtmp install
clean:
- rm -f librtmp.so
- rm -rf includes
- make -C librtmp clean
+ make SYS=$(SYS) prefix=$(prefix) -C librtmp/librtmp clean
distclean::
- rm -rf librtmp.so librtmp
+ rm -rf librtmp
--- /dev/null
+#!/bin/sh
+
+SRC_LIB_RTMP="/opt/local/lib/librtmp.so.0"
+DST_LIB_RTMP="../../system/librtmp.so"
+
+if [ -f $SRC_LIB_RTMP ]; then
+ # copy librtmp into xbmc's system directory, we
+ # rename it to librtmp.so and skip the symlinking.
+ cp $SRC_LIB_RTMP $DST_LIB_RTMP
+
+ # rename any dependency libs to inside xbmc's app framework
+ for a in $(otool -L "$DST_LIB_RTMP" | grep opt | awk ' { print $1 } ') ; do
+ echo "Processing $a"
+ install_name_tool -change "$a" @executable_path/../Frameworks/$(basename $a) "$DST_LIB_RTMP"
+ done
+fi
--- /dev/null
+Binary files librtmp-org/.DS_Store and librtmp/.DS_Store differ
+diff -uNrp librtmp-org/Makefile librtmp/Makefile
+--- librtmp-org/Makefile 2010-06-30 14:52:14.000000000 -0400
++++ librtmp/Makefile 2010-07-07 12:38:32.000000000 -0400
+@@ -33,10 +33,12 @@ MANDIR=$(DESTDIR)$(mandir)
+
+ LIBS_posix=
+ LIBS_mingw=-lws2_32 -lwinmm -lgdi32
++LIBS_darwin=
+ LIBS=$(CRYPTO_LIB) -lz $(LIBS_$(SYS)) $(XLIBS)
+
+ THREADLIB_posix=-lpthread
+ THREADLIB_mingw=
++THREADLIB_darwin=-lpthread
+ THREADLIB=$(THREADLIB_$(SYS))
+ SLIBS=$(THREADLIB) $(LIBS)
+
+@@ -45,6 +47,7 @@ INCRTMP=librtmp/rtmp_sys.h librtmp/rtmp.
+
+ EXT_posix=
+ EXT_mingw=.exe
++EXT_darwin=
+ EXT=$(EXT_$(SYS))
+
+ all: $(LIBRTMP) progs
+diff -uNrp librtmp-org/librtmp/Makefile librtmp/librtmp/Makefile
+--- librtmp-org/librtmp/Makefile 2010-06-30 16:01:39.000000000 -0400
++++ librtmp/librtmp/Makefile 2010-07-07 14:10:25.000000000 -0400
+@@ -27,8 +27,15 @@ CRYPTO_DEF=$(DEF_$(CRYPTO))
+
+ SO_posix=so.0
+ SO_mingw=dll
++SO_darwin=so.0
+ SO_EXT=$(SO_$(SYS))
+
++SO_LDFLAGS_posix=-shared -Wl,-soname,$@
++SO_LDFLAGS_mingw=
++SO_LDFLAGS_darwin=-bundle -flat_namespace -undefined suppress -fno-common \
++ -headerpad_max_install_names $(XLDFLAGS)
++SO_LDFLAGS=$(SO_LDFLAGS_$(SYS))
++
+ SHARED=yes
+ SODEF_yes=-fPIC
+ SOLIB_yes=librtmp.$(SO_EXT)
+@@ -61,7 +68,7 @@ librtmp.a: $(OBJS)
+ $(AR) rs $@ $?
+
+ librtmp.$(SO_EXT): $(OBJS)
+- $(CC) -shared -Wl,-soname,$@ $(LDFLAGS) -o $@ $^ $> $(CRYPTO_LIB)
++ $(CC) $(SO_LDFLAGS) $(LDFLAGS) -o $@ $^ $> $(CRYPTO_LIB)
+ ln -sf $@ librtmp.so
+
+ log.o: log.c log.h Makefile