Use a portable method to link against internal FFMPEG

In the last iteration, we kept the original method to link the shared
plugin and edited the .a and .la files so satisfy what cerbero needed.
Unfortunately, that required adding .a file into the archive which is
not allowed with iOS ar command for universal builds.

This patch uses standard method to link a static library. One of the
benefit is that it removes some libtool warning about portability.
For the static case, we implement an install hook that installs
FFMPEG internal .a files in the plugin directory (so it does not get
confused with a possible system FFMPEG. This makes the static plugin
usable without depending on cerbero recipe.
This commit is contained in:
Nicolas Dufresne 2017-05-10 21:20:05 -04:00
parent 46691bd0ec
commit 0b48f0e3fd
2 changed files with 17 additions and 29 deletions

View file

@ -319,15 +319,12 @@ else
\$(top_builddir)/gst-libs/ext/libav/libavfilter/libavfilter.a \
\$(top_builddir)/gst-libs/ext/libav/libswresample/libswresample.a \
\$(top_builddir)/gst-libs/ext/libav/libavutil/libavutil.a"
if test "x$enable_static_plugins" = xyes; then
dnl with static linking we can't use the .a archive directly as they would
dnl be included in the final libgstlibav.a as a file and won't be usable.
dnl libav*.a must be copied to the final destination too
LIBAV_LIBS="-lavformat -lavcodec -lswresample -lavutil -lavfilter"
else
dnl libgstlibav.la: libs to statically link to
LIBAV_LIBS="$LIBAV_DEPS"
fi
LIBAV_LIBS="-L\$(top_builddir)/gst-libs/ext/libav/libavformat -lavformat \
-L\$(top_builddir)/gst-libs/ext/libav/libavcodec -lavcodec \
-L\$(top_builddir)/gst-libs/ext/libav/libswresample -lswresample \
-L\$(top_builddir)/gst-libs/ext/libav/libavutil -lavutil \
-L\$(top_builddir)/gst-libs/ext/libav/libavfilter -lavfilter"
dnl
SWSCALE_CFLAGS="-I \$(top_srcdir)/gst-libs/ext/libav \

View file

@ -31,32 +31,23 @@ libgstlibav_la_SOURCES = gstav.c \
libgstlibav_la_CFLAGS = $(LIBAV_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
libgstlibav_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
libgstlibav_la_LIBADD =
if HAVE_LIBAV_UNINSTALLED
libgstlibav_la_LIBADD += $(LIBAV_DEPS)
libgstlibav_la_DEPENDENCIES = $(LIBAV_DEPS)
else
libgstlibav_la_LIBADD += $(LIBAV_LIBS)
endif
libgstlibav_la_LIBADD += $(GST_PLUGINS_BASE_LIBS) \
libgstlibav_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) \
-lgstaudio-$(GST_API_VERSION) -lgstvideo-$(GST_API_VERSION) \
-lgstpbutils-$(GST_API_VERSION) $(GST_BASE_LIBS) \
$(LIBM) $(WIN32_LIBS) -lz $(BZ2_LIBS) $(LZMA_LIBS)
$(LIBAV_LIBS) $(LIBM) $(WIN32_LIBS) -lz $(BZ2_LIBS) $(LZMA_LIBS)
libgstlibav_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) $(DARWIN_LDFLAGS)
if HAVE_LIBAV_UNINSTALLED
libgstlibav_la_DEPENDENCIES = $(LIBAV_DEPS)
if GST_PLUGIN_BUILD_STATIC
libgstlibav.la: $(libgstlibav_la_OBJECTS) $(libgstlibav_la_DEPENDENCIES) $(EXTRA_libgstlibav_la_DEPENDENCIES)
$(AM_V_CCLD)$(libgstlibav_la_LINK) -rpath $(plugindir) $(libgstlibav_la_OBJECTS) $(libgstlibav_la_LIBADD) $(LIBS)
$(AM_V_at)cp $@ $@.tmp
$(AM_V_at)cp .libs/$@i .libs/$@i.tmp
$(AM_V_at)rm $@ .libs/$@i
$(AM_V_at)$(AR) -d .libs/libgstlibav.a $(foreach dep,$(LIBAV_DEPS), $(notdir $(dep)))
$(AM_V_at)$(RANLIB) .libs/libgstlibav.a
$(AM_V_GEN)sed -e "s|^\(dependency_libs='\)|\1 $(LIBAV_LIBS)|" $@.tmp > $@ && rm $@.tmp
$(AM_V_GEN)sed -e "s|^\(dependency_libs='\)|\1 $(LIBAV_LIBS)|" .libs/$@i.tmp > .libs/$@i && rm .libs/$@i.tmp
libgstlibav_la = $(DESTDIR)$(plugindir)/libgstlibav.la
install-data-hook:
$(AM_V_at)cp $(libgstlibav_la) $(libgstlibav_la).tmp
$(AM_V_GEN)sed -e "s|-L$(top_builddir)/gst-libs/ext/libav/lib[a-z]* ||g" \
$(libgstlibav_la).tmp > $(libgstlibav_la) && rm $(libgstlibav_la).tmp
$(AM_V_at)$(INSTALL) -t$(DESTDIR)$(libdir) $(LIBAV_DEPS)
endif
endif