mirror of
https://github.com/xenia-project/FFmpeg.git
synced 2024-11-24 03:59:43 +00:00
support for building dynamic libraries on Mac OS X
based on a patch by Lina Pezzella <J4rg0n -- at -- gentoo -- dot -- org> Originally committed as revision 4616 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
399d84012f
commit
4e159595b5
7
configure
vendored
7
configure
vendored
@ -329,11 +329,12 @@ v4l="no"
|
||||
audio_oss="no"
|
||||
dv1394="no"
|
||||
ffserver="no"
|
||||
SHFLAGS="-dynamiclib"
|
||||
SHFLAGS="-dynamiclib -Wl,-single_module,-undefined,dynamic_lookup"
|
||||
extralibs=""
|
||||
darwin="yes"
|
||||
strip="strip -x"
|
||||
LDFLAGS="-Wl,-search_paths_first"
|
||||
LDFLAGS="-Wl,-dynamic,-search_paths_first"
|
||||
SLIBSUF=".dylib"
|
||||
FFSLDFLAGS=-Wl,-bind_at_load
|
||||
;;
|
||||
MINGW32*)
|
||||
@ -1428,6 +1429,8 @@ fi
|
||||
if test "$lshared" = "yes" ; then
|
||||
echo "BUILD_SHARED=yes" >> config.mak
|
||||
echo "PIC=-fPIC -DPIC" >> config.mak
|
||||
echo "SPPMAJOR=0" >> config.mak
|
||||
echo "SPPVERSION=0.0.1" >> config.mak
|
||||
fi
|
||||
echo "EXTRALIBS=$extralibs" >> config.mak
|
||||
version=`grep '#define FFMPEG_VERSION ' "$source_path/libavcodec/avcodec.h" |
|
||||
|
@ -377,17 +377,22 @@ ifeq ($(TARGET_ARCH_SPARC64),yes)
|
||||
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 @@ $(LIB): $(OBJS) $(AMRLIBS)
|
||||
$(AR) rc $@ $(OBJS) $(AMREXTRALIBS)
|
||||
$(RANLIB) $@
|
||||
|
||||
$(SLIB): $(OBJS)
|
||||
$(SLIBNAME): $(OBJS)
|
||||
ifeq ($(CONFIG_PP),yes)
|
||||
$(MAKE) -C libpostproc
|
||||
endif
|
||||
@ -407,7 +412,7 @@ ifeq ($(CONFIG_WIN32),yes)
|
||||
$(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 @@ depend: $(SRCS)
|
||||
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 @@ fft-test: fft-test.o $(LIB)
|
||||
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)
|
||||
|
@ -4,9 +4,16 @@ include ../../config.mak
|
||||
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 @@ CFLAGS = $(OPTFLAGS) $(MLIB_INC) -I. -I.. $(EXTRA_INC)
|
||||
.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 @@ ifeq ($(SHARED_PP),yes)
|
||||
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 @@ $(PPLIB): $(PPOBJS)
|
||||
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
|
||||
|
@ -81,9 +81,11 @@ endif
|
||||
|
||||
LIB= $(LIBPREF)avformat$(LIBSUF)
|
||||
ifeq ($(BUILD_SHARED),yes)
|
||||
SLIB= $(SLIBPREF)avformat$(SLIBSUF)
|
||||
|
||||
AVCLIBS+=-lavcodec$(BUILDSUF) -L../libavcodec
|
||||
SLIBNAME= $(SLIBPREF)avformat$(SLIBSUF)
|
||||
AVCLIBS+=-lavcodec$(BUILDSUF) -L../libavcodec -lavutil$(BUILDSUF) -L../libavutil
|
||||
ifeq ($(CONFIG_DARWIN),yes)
|
||||
SHFLAGS += -Wl,-install_name,$(libdir)/$(SLIBNAME),-current_version,$(SPPVERSION),-compatibility_version,$(SPPVERSION)
|
||||
endif
|
||||
ifeq ($(CONFIG_MP3LAME),yes)
|
||||
AVCLIBS+=-lmp3lame
|
||||
endif
|
||||
@ -91,14 +93,14 @@ endif
|
||||
|
||||
SRCS := $(OBJS:.o=.c) $(PPOBJS:.o=.cpp)
|
||||
|
||||
all: $(LIB) $(SLIB)
|
||||
all: $(LIB) $(SLIBNAME)
|
||||
|
||||
$(LIB): $(OBJS) $(PPOBJS)
|
||||
rm -f $@
|
||||
$(AR) rc $@ $(OBJS) $(PPOBJS)
|
||||
$(RANLIB) $@
|
||||
|
||||
$(SLIB): $(OBJS)
|
||||
$(SLIBNAME): $(OBJS)
|
||||
ifeq ($(CONFIG_WIN32),yes)
|
||||
$(CC) $(SHFLAGS) -Wl,--output-def,$(@:.dll=.def) -o $@ $(OBJS) $(PPOBJS) $(AVCLIBS) $(EXTRALIBS)
|
||||
-lib /machine:i386 /def:$(@:.dll=.def)
|
||||
@ -112,11 +114,11 @@ depend: $(SRCS)
|
||||
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)/libavformat-$(VERSION).so
|
||||
ln -sf libavformat-$(VERSION).so $(libdir)/libavformat.so
|
||||
install $(INSTALLSTRIP) -m 755 $(SLIBNAME) $(libdir)/$(SLIBPREF)avformat-$(VERSION)$(SLIBSUF)
|
||||
ln -sf $(SLIBPREF)avformat-$(VERSION)$(SLIBSUF) $(libdir)/$(SLIBNAME)
|
||||
$(LDCONFIG) || true
|
||||
endif
|
||||
else
|
||||
@ -143,7 +145,7 @@ install-headers:
|
||||
g++ $(subst -Wall,,$(CFLAGS)) -c -o $@ $<
|
||||
|
||||
distclean clean:
|
||||
rm -f *.o *.d .depend *~ *.a *.so $(LIB)
|
||||
rm -f *.o *.d .depend *~ *.a *$(SLIBSUF) $(LIB)
|
||||
|
||||
#
|
||||
# include dependency files if they exist
|
||||
|
@ -22,22 +22,25 @@ SRCS := $(OBJS:.o=.c)
|
||||
|
||||
LIB= $(LIBPREF)avutil$(LIBSUF)
|
||||
ifeq ($(BUILD_SHARED),yes)
|
||||
SLIB= $(SLIBPREF)avutil$(SLIBSUF)
|
||||
SLIBNAME= $(SLIBPREF)avutil$(SLIBSUF)
|
||||
ifeq ($(CONFIG_DARWIN),yes)
|
||||
SHFLAGS += -Wl,-install_name,$(libdir)/$(SLIBNAME),-current_version,$(SPPVERSION),-compatibility_version,$(SPPVERSION)
|
||||
endif
|
||||
endif
|
||||
|
||||
all: $(LIB) $(SLIB)
|
||||
all: $(LIB) $(SLIBNAME)
|
||||
|
||||
$(LIB): $(OBJS)
|
||||
rm -f $@
|
||||
$(AR) rc $@ $(OBJS)
|
||||
$(RANLIB) $@
|
||||
|
||||
$(SLIB): $(OBJS)
|
||||
$(SLIBNAME): $(OBJS)
|
||||
ifeq ($(CONFIG_WIN32),yes)
|
||||
$(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
|
||||
|
||||
%.o: %.c
|
||||
@ -49,7 +52,7 @@ depend: $(SRCS)
|
||||
dep: depend
|
||||
|
||||
clean:
|
||||
rm -f *.o *.d *~ .depend $(LIB) $(SLIB) *.so
|
||||
rm -f *.o *.d *~ .depend $(LIB) $(SLIBNAME) *$(SLIBSUF)
|
||||
|
||||
distclean: clean
|
||||
rm -f Makefile.bak .depend
|
||||
@ -58,11 +61,11 @@ distclean: clean
|
||||
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)/libavutil-$(VERSION).so
|
||||
ln -sf libavutil-$(VERSION).so $(libdir)/libavutil.so
|
||||
install $(INSTALLSTRIP) -m 755 $(SLIBNAME) $(libdir)/libavutil-$(VERSION)$(SLIBSUF)
|
||||
ln -sf libavutil-$(VERSION)$(SLIBSUF) $(libdir)/$(SLIBNAME)
|
||||
$(LDCONFIG) || true
|
||||
endif
|
||||
else
|
||||
|
@ -5,22 +5,22 @@ VPATH=$(SRC_PATH)/vhook
|
||||
CFLAGS=-fPIC $(SHCFLAGS) -I.. -I$(SRC_PATH) -I$(SRC_PATH)/libavformat -I$(SRC_PATH)/libavcodec -I$(SRC_PATH)/libavutil -DHAVE_AV_CONFIG_H
|
||||
|
||||
ifeq ($(CONFIG_DARWIN),yes)
|
||||
SHFLAGS+=-flat_namespace -undefined suppress
|
||||
SHFLAGS += -flat_namespace
|
||||
endif
|
||||
HOOKS=null.so fish.so ppm.so watermark.so
|
||||
HOOKS=null$(SLIBSUF) fish$(SLIBSUF) ppm$(SLIBSUF) watermark$(SLIBSUF)
|
||||
|
||||
ifeq ($(HAVE_IMLIB2),yes)
|
||||
HOOKS += imlib2.so
|
||||
HOOKS += imlib2$(SLIBSUF)
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_FREETYPE2),yes)
|
||||
HOOKS += drawtext.so
|
||||
HOOKS += drawtext$(SLIBSUF)
|
||||
CFLAGS += `freetype-config --cflags`
|
||||
endif
|
||||
|
||||
all: $(HOOKS)
|
||||
|
||||
SRCS := $(HOOKS:.so=.c)
|
||||
SRCS := $(HOOKS:$(SLIBSUF)=.c)
|
||||
|
||||
depend: $(SRCS)
|
||||
$(CC) -MM $(CFLAGS) $^ 1>.depend
|
||||
@ -29,17 +29,21 @@ install:
|
||||
install -d "$(libdir)/vhook"
|
||||
install -m 755 $(HOOKS) "$(libdir)/vhook"
|
||||
|
||||
imlib2.so: imlib2.o
|
||||
imlib2$(SLIBSUF): imlib2.o
|
||||
$(CC) $(LDFLAGS) -g -o $@ $(SHFLAGS) $< -lImlib2
|
||||
|
||||
drawtext.so: drawtext.o
|
||||
drawtext$(SLIBSUF): drawtext.o
|
||||
$(CC) $(LDFLAGS) -g -o $@ $(SHFLAGS) $< `freetype-config --libs`
|
||||
|
||||
%.so: %.o
|
||||
%$(SLIBSUF): %.o
|
||||
ifeq ($(CONFIG_DARWIN),yes)
|
||||
$(CC) $(LDFLAGS) $(SHFLAGS) -Wl,-install_name,$(libdir)/vhoook/$@ -g -o $@ $<
|
||||
else
|
||||
$(CC) $(LDFLAGS) -g -o $@ $(SHFLAGS) $<
|
||||
endif
|
||||
|
||||
clean:
|
||||
rm -f *.o *.d .depend *.so *~
|
||||
rm -f *.o *.d .depend *$(SLIBSUF) *~
|
||||
|
||||
ifneq ($(wildcard .depend),)
|
||||
include .depend
|
||||
|
Loading…
Reference in New Issue
Block a user