changeset 2896:e1dfc65af0fb libavcodec

support for building dynamic libraries on Mac OS X based on a patch by Lina Pezzella <J4rg0n -- at -- gentoo -- dot -- org>
author diego
date Mon, 26 Sep 2005 10:05:13 +0000
parents 8fe1dc88294a
children a5360f2a673e
files Makefile libpostproc/Makefile
diffstat 2 files changed, 32 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Sat Sep 24 17:42:56 2005 +0000
+++ b/Makefile	Mon Sep 26 10:05:13 2005 +0000
@@ -377,17 +377,22 @@
 CFLAGS+= -mcpu=ultrasparc -mtune=ultrasparc
 endif
 
+# Darwin specific stuff
+ifeq ($(CONFIG_DARWIN),yes)
+SHFLAGS += -Wl,-install_name,$(libdir)/$(SLIBPREF)avcodec$(SLIBSUF),-current_version,$(SPPVERSION),-compatibility_version,$(SPPVERSION)
+endif
+
 SRCS := $(OBJS:.o=.c) $(ASM_OBJS:.o=.S)
 OBJS := $(OBJS) $(ASM_OBJS)
 
 LIB= $(LIBPREF)avcodec$(LIBSUF)
 LIBAVUTIL= $(SRC_PATH)/libavutil/$(LIBPREF)avutil$(LIBSUF)
 ifeq ($(BUILD_SHARED),yes)
-SLIB= $(SLIBPREF)avcodec$(SLIBSUF)
+SLIBNAME= $(SLIBPREF)avcodec$(SLIBSUF)
 endif
 TESTS= imgresample-test dct-test motion-test fft-test
 
-all: $(LIB) $(SLIB)
+all: $(LIB) $(SLIBNAME)
 
 amrlibs:
 	$(MAKE) -C amr spclib fipoplib
@@ -399,7 +404,7 @@
 	$(AR) rc $@ $(OBJS) $(AMREXTRALIBS)
 	$(RANLIB) $@
 
-$(SLIB): $(OBJS)
+$(SLIBNAME): $(OBJS)
 ifeq ($(CONFIG_PP),yes)
 	$(MAKE) -C libpostproc
 endif
@@ -407,7 +412,7 @@
 	$(CC) $(SHFLAGS) -Wl,--output-def,$(@:.dll=.def) -o $@ $(OBJS) $(EXTRALIBS) $(AMREXTRALIBS)
 	-lib /machine:i386 /def:$(@:.dll=.def)
 else
-	$(CC) $(SHFLAGS) -o $@ $(OBJS) $(EXTRALIBS) $(AMREXTRALIBS) $(LDFLAGS)
+	$(CC) $(SHFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(EXTRALIBS) $(AMREXTRALIBS)
 endif
 
 dsputil.o: dsputil.c dsputil.h
@@ -427,7 +432,7 @@
 dep:	depend
 
 clean: $(CLEANAMR)
-	rm -f *.o *.d *~ .depend $(LIB) $(SLIB) *.so i386/*.o i386/*~ \
+	rm -f *.o *.d *~ .depend $(LIB) $(SLIBNAME) *$(SLIBSUF) i386/*.o i386/*~ \
 	   armv4l/*.o armv4l/*~ \
 	   mlib/*.o mlib/*~ \
 	   alpha/*.o alpha/*~ \
@@ -476,11 +481,11 @@
 ifeq ($(BUILD_SHARED),yes)
 install: all install-headers
 ifeq ($(CONFIG_WIN32),yes)
-	install $(INSTALLSTRIP) -m 755 $(SLIB) "$(prefix)"
+	install $(INSTALLSTRIP) -m 755 $(SLIBNAME) "$(prefix)"
 else
 	install -d $(libdir)
-	install $(INSTALLSTRIP) -m 755 $(SLIB) $(libdir)/libavcodec-$(VERSION).so
-	ln -sf libavcodec-$(VERSION).so $(libdir)/libavcodec.so
+	install $(INSTALLSTRIP) -m 755 $(SLIBNAME) $(libdir)/libavcodec-$(VERSION)$(SLIBSUF)
+	ln -sf libavcodec-$(VERSION)$(SLIBSUF) $(libdir)/libavcodec$(SLIBSUF)
 	$(LDCONFIG) || true
 endif
 ifeq ($(CONFIG_PP),yes)
--- a/libpostproc/Makefile	Sat Sep 24 17:42:56 2005 +0000
+++ b/libpostproc/Makefile	Mon Sep 26 10:05:13 2005 +0000
@@ -4,9 +4,16 @@
 VPATH=$(SRC_PATH)/libavcodec/libpostproc
 
 ifeq ($(SHARED_PP),yes)
-SPPLIB = $(SLIBPREF)postproc$(SLIBSUF)
-SPPMAJOR = 0
-SPPVERSION = $(SPPMAJOR).0.1
+SPPLIBNAME = $(SLIBPREF)postproc$(SLIBSUF)
+ifeq ($(CONFIG_DARWIN),yes)
+SPPLIBMAJOR = $(SLIBPREF)postproc.$(SPPMAJOR)$(SLIBSUF)
+SPPLIB = $(SLIBPREF)postproc.$(SPPVERSION)$(SLIBSUF)
+SHFLAGS += -Wl,-install_name,$(libdir)/$(SPPLIBNAME),-current_version,$(SPPVERSION),-compatibility_version,$(SPPVERSION)
+else
+SPPLIBMAJOR = $(SPPLIBNAME).$(SPPMAJOR)
+SPPLIB = $(SPPLIBNAME).$(SPPVERSION)
+SHFLAGS = -shared -Wl,-soname,$(SPPLIB)
+endif
 endif
 PPLIB = $(LIBPREF)postproc$(LIBSUF)
 
@@ -23,13 +30,13 @@
 .c.o:
 	$(CC) -c $(CFLAGS) $(LIBOBJFLAGS) -I$(SRC_PATH)/libavcodec -I../.. -o $@ $<
 
-all:    $(SWSLIB) $(PPLIB) $(SPPLIB)
+all:    $(SWSLIB) $(PPLIB) $(SPPLIBNAME)
 
 clean:
-	rm -f *.o *.a *~ *.so $(PPLIB) $(SPPLIB)
+	rm -f *.o *.a *~ *$(SLIBSUF) $(PPLIB) $(SPPLIBNAME)
 
 distclean:
-	rm -f Makefile.bak *.o *.a *~ *.so .depend
+	rm -f Makefile.bak *.o *.a *~ *$(SLIBSUF) .depend
 
 dep:    depend
 
@@ -40,9 +47,8 @@
 postprocess_pic.o: postprocess.c
 	$(CC) -c $(CFLAGS) -fomit-frame-pointer -fPIC -DPIC -I.. -I../.. -o $@ $<
 
-$(SPPLIB): $(SPPOBJS)
-	$(CC) -shared -Wl,-soname,$(SPPLIB).$(SPPMAJOR) \
-	-o $(SPPLIB) $(SPPOBJS)
+$(SPPLIBNAME): $(SPPOBJS)
+	$(CC) $(SHFLAGS) -o $(SPPLIBNAME) $(SPPOBJS)
 endif
 
 $(PPLIB): $(PPOBJS)
@@ -53,12 +59,12 @@
 install: all
 ifeq ($(SHARED_PP),yes)
 ifeq ($(CONFIG_WIN32),yes)
-	install $(INSTALLSTRIP) -m 755 $(SPPLIB) "$(prefix)"
+	install $(INSTALLSTRIP) -m 755 $(SPPLIBNAME) "$(prefix)"
 else
 	install -d $(libdir)
-	install $(INSTALLSTRIP) -m 755 $(SPPLIB) $(libdir)/$(SPPLIB).$(SPPVERSION)
-	ln -sf $(SPPLIB).$(SPPVERSION) $(libdir)/$(SPPLIB)
-	ln -sf $(SPPLIB).$(SPPVERSION) $(libdir)/$(SPPLIB).$(SPPMAJOR)
+	install $(INSTALLSTRIP) -m 755 $(SPPLIBNAME) $(libdir)/$(SPPLIB)
+	ln -sf $(SPPLIB) $(libdir)/$(SPPLIBNAME)
+	ln -sf $(SPPLIB) $(libdir)/$(SPPLIBMAJOR)
 	install -d $(libdir)/pkgconfig
 	install -m 644 ../../libpostproc.pc $(libdir)/pkgconfig
 	$(LDCONFIG) || true