Source: avifile
Version: 1:0.7.48~20090503.ds-15
Severity: wishlist
Tags: patch
Usertags: reintroducing-ffmpeg

Dear maintainer,

I am working on reintroducing FFmpeg to Debian [1-2].

In order to make FFmpeg co-installable with Libav, the libraries were
renamed to lib*-ffmpeg. Thus using linker flags like '-lavcodec' doesn't
work with the FFmpeg packages.

To get the correct linking flags for both FFmpeg and Libav, one can
(and should) use pkg-config.

Attached patch achieves that for this package. Please apply it to
facilitate building your package with FFmpeg in Debian.

If you want to facilitate this even further, you can also add
lib*-ffmpeg-dev alternatives to the Libav build-dependencies.

While the FFmpeg package is still waiting in the NEW queue [3], it can
already be built from the git repository [4].

Best regards,
Andreas


1: https://lists.debian.org/debian-devel/2014/07/msg01010.html
2: https://bugs.debian.org/729203
3: https://ftp-master.debian.org/new/ffmpeg_7:2.3.1-1.html
4: https://anonscm.debian.org/cgit/collab-maint/ffmpeg.git

diff --git a/debian/patches/pkg-config.patch b/debian/patches/pkg-config.patch
new file mode 100644
index 0000000..8cad6eb
--- /dev/null
+++ b/debian/patches/pkg-config.patch
@@ -0,0 +1,46 @@
+Description: Use pkg-config to determine FFmpeg linker flags
+
+Author: Andreas Cadhalpun <[email protected]>
+Last-Update: <2014-08-14>
+
+--- avifile-0.7.48~20090503.ds.orig/configure.in
++++ avifile-0.7.48~20090503.ds/configure.in
+@@ -824,8 +824,15 @@ dnl Configure ffmpeg plugin
+ dnl =======================
+ AM_PATH_FFMPEG
+ 
++PKG_CHECK_MODULES([avcodec],[ libavcodec >= 53.40.0 ])
++PKG_CHECK_MODULES([avformat], [libavformat])
++PKG_CHECK_MODULES([avutil], [libavutil])
++PKG_CHECK_MODULES([avresample], [libavresample])
++
++avc_name=`echo $avcodec_LIBS | sed 's/-l//'`
++
+ tmp_LIBS="$LIBS"
+-AC_CHECK_LIB([avcodec], [avcodec_register_all], [],
++AC_CHECK_LIB([$avc_name], [avcodec_register_all], [],
+   [AC_MSG_ERROR([libavcodec is required to build this package.])])
+ AC_CHECK_FUNCS([avcodec_decode_audio3 avcodec_decode_video2])
+ LIBS="$tmp_LIBS"
+--- avifile-0.7.48~20090503.ds.orig/lib/Makefile.am
++++ avifile-0.7.48~20090503.ds/lib/Makefile.am
+@@ -132,7 +132,7 @@ AM_CPPFLAGS +=\
+  -I$(top_srcdir)/drivers/vidix
+ endif
+ 
+-libaviplay_la_LIBADD += -lavcodec -lavformat
++libaviplay_la_LIBADD += $(avcodec_LIBS) $(avformat_LIBS)
+ 
+ AM_CPPFLAGS += $(DIVX4_CFLAGS) $(XVID_CFLAGS) $(PTHREAD_CFLAGS) $(SDL_CFLAGS)
+ AM_CPPFLAGS += $(X_CFLAGS) $(XFT_CFLAGS) $(FT2_CFLAGS) $(ICONV_CFLAGS)
+--- avifile-0.7.48~20090503.ds.orig/plugins/libffmpeg/Makefile.am
++++ avifile-0.7.48~20090503.ds/plugins/libffmpeg/Makefile.am
+@@ -13,7 +13,7 @@ ffmpeg_la_SOURCES = \
+  libffmpeg.cpp
+ 
+ FFMPEG_CFLAGS = -I$(top_srcdir)/ffmpeg
+-ffmpeg_la_LIBADD = ../../lib/libaviplay.la -lavcodec -lavformat -lavresample -lavutil
++ffmpeg_la_LIBADD = ../../lib/libaviplay.la $(avcodec_LIBS) $(avformat_LIBS) $(avresample_LIBS) $(avutil_LIBS)
+ ffmpeg_la_LDFLAGS = -module -avoid-version
+ 
+ AM_CPPFLAGS = $(LTNOPIC) $(INSTRUMENT) $(FFMPEG_CFLAGS)
diff --git a/debian/patches/series b/debian/patches/series
index 9a1921a..c5d66ea 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -11,3 +11,4 @@ ftbfs-freebsd.patch
 ftbfs-gcc4.7.patch
 fix-ftbfs-libav9.patch
 libav10.patch
+pkg-config.patch

Reply via email to