Source: fuse-emulator-utils
Version: 1.1.1-3
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..538c902
--- /dev/null
+++ b/debian/patches/pkg-config.patch
@@ -0,0 +1,66 @@
+Description: Use pkg-config to determine FFmpeg linker flags
+
+Author: Andreas Cadhalpun <[email protected]>
+Last-Update: <2014-05-18>
+
+--- fuse-emulator-utils-1.1.1.orig/configure.ac
++++ fuse-emulator-utils-1.1.1/configure.ac
+@@ -84,41 +84,50 @@ AC_ARG_WITH(ffmpeg,
+ )
+ AC_MSG_RESULT($ffmpeglib)
+ if test "$ffmpeglib" = yes; then
++  PKG_CHECK_MODULES(LAVU, [libavutil]);
++  PKG_CHECK_MODULES(LAVC, [libavcodec]);
++  PKG_CHECK_MODULES(LAVF, [libavformat]);
++  PKG_CHECK_MODULES(LSWS, [libswscale libavresample]);
++  
++  avu_name=`echo $LAVU_LIBS | sed 's/-l//'`
++  avc_name=`echo $LAVC_LIBS | sed 's/-l//'`
++  avf_name=`echo $LAVF_LIBS | sed 's/-l//'`
++  
+   AC_CHECK_HEADERS(
+     libavformat/avformat.h libswscale/swscale.h libavresample/avresample.h,
+-    FFMPEG_LIBS="-lavformat -lavcodec -lswscale -lavresample -lavutil",
++    FFMPEG_LIBS="$LAVU_LIBS $LAVC_LIBS $LAVF_LIBS $LSWS_LIBS",
+     FFMPEG_LIBS=''; break
+   )
+   if test "x$FFMPEG_LIBS" != "x"
+   then
+     AC_SUBST(FFMPEG_LIBS)
+     AC_DEFINE([USE_FFMPEG], 1, [Defined if ffmpeg available and requested])
+-    AC_CHECK_LIB(avutil, av_dict_set,
++    AC_CHECK_LIB([$avu_name], av_dict_set,
+       AC_DEFINE([HAVE_FFMPEG_AVDICTIONARY],1,[Defined if AVDictionary is available]),
+       true
+     )
+ dnl AC_CHECK_LIB(avcore, av_get_bytes_per_sample,
+-    AC_CHECK_LIB(avutil, av_get_bytes_per_sample,
++    AC_CHECK_LIB([$avu_name], av_get_bytes_per_sample,
+       AC_DEFINE([HAVE_FFMPEG_BYTES_SAMPLE],1,[Defined if av_get_bytes_per_sample available]),
+       true
+     )
+-    AC_CHECK_LIB(avutil, av_get_bits_per_sample_fmt,
++    AC_CHECK_LIB([$avu_name], av_get_bits_per_sample_fmt,
+       AC_DEFINE([HAVE_FFMPEG_SAMPLE_FMT],1,[Defined if av_get_bits_per_sample_fmt available]),
+       true
+     )
+-    AC_CHECK_LIB(avcodec, avcodec_open2,
++    AC_CHECK_LIB([$avc_name], avcodec_open2,
+       AC_DEFINE([HAVE_FFMPEG_AVCODEC_OPEN2],1,[Defined if avcodec_open2 is available]),
+       true
+     )
+-    AC_CHECK_LIB(avformat, avio_open,
++    AC_CHECK_LIB([$avf_name], avio_open,
+       AC_DEFINE([HAVE_FFMPEG_AVIO_OPEN],1,[Defined if avio_open available]),
+       true
+     )
+-    AC_CHECK_LIB(avformat, avformat_new_stream,
++    AC_CHECK_LIB([$avf_name], avformat_new_stream,
+       AC_DEFINE([HAVE_FFMPEG_AVFORMAT_NEW_STREAM],1,[Defined if avformat_new_stream is available]),
+       true
+     )
+-    AC_CHECK_LIB(avformat, avformat_write_header,
++    AC_CHECK_LIB([$avf_name], avformat_write_header,
+       AC_DEFINE([HAVE_FFMPEG_AVFORMAT_WRITE_HEADER],1,[Defined if avformat_write_header available]),
+       true
+     )
diff --git a/debian/patches/series b/debian/patches/series
index f08164b..aa123b4 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
 libav10.patch
 fix-wav-sample-rate.patch
+pkg-config.patch

Reply via email to