Source: survex
Version: 1.2.14-1
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/control b/debian/control
index 7a3f60e..910bc2c 100644
--- a/debian/control
+++ b/debian/control
@@ -6,7 +6,7 @@ Uploaders: Wookey <[email protected]>
 Standards-Version: 3.9.5
 Build-Depends: debhelper (>= 9), libx11-dev, libxext-dev, x11proto-core-dev,
     libavcodec-dev, libavformat-dev, libproj-dev, libswscale-dev,
-    libwxgtk3.0-dev, mesa-common-dev, libglu1-mesa-dev, autotools-dev
+    libwxgtk3.0-dev, mesa-common-dev, libglu1-mesa-dev, dh-autoreconf, pkg-config, sgmltools-lite, jadetex, ghostscript
 Homepage: http://survex.com/
 
 Package: survex
diff --git a/debian/patches/pkg-config.patch b/debian/patches/pkg-config.patch
new file mode 100644
index 0000000..6d6475d
--- /dev/null
+++ b/debian/patches/pkg-config.patch
@@ -0,0 +1,49 @@
+Description: Use pkg-config to determine FFmpeg linker flags
+
+Author: Andreas Cadhalpun <[email protected]>
+Last-Update: <2014-05-15>
+
+--- survex-1.2.12.orig/configure.ac
++++ survex-1.2.12/configure.ac
+@@ -193,12 +193,23 @@ AVEN_LIBS=
+ AC_SUBST(AVEN_LIBS)
+ 
+ dnl Check for ffmpeg
+-AC_CHECK_LIB(avcodec, avcodec_register_all,
+-  [AC_CHECK_LIB(avformat, av_register_all,
+-    [AC_CHECK_LIB(swscale, sws_scale,
+-      [AC_CHECK_LIB(avutil, av_malloc,
++
++PKG_CHECK_MODULES(avc, libavcodec)
++PKG_CHECK_MODULES(avf, libavformat)
++PKG_CHECK_MODULES(sws, libswscale)
++PKG_CHECK_MODULES(avu, libavutil)
++
++avc_name=`echo $avc_LIBS | sed 's/-l//'`
++avf_name=`echo $avf_LIBS | sed 's/-l//'`
++sws_name=`echo $sws_LIBS | sed 's/-l//'`
++avu_name=`echo $avu_LIBS | sed 's/-l//'`
++
++AC_CHECK_LIB([$avc_name], avcodec_register_all,
++  [AC_CHECK_LIB([$avf_name], av_register_all,
++    [AC_CHECK_LIB([$sws_name], sws_scale,
++      [AC_CHECK_LIB([$avu_name], av_malloc,
+ 	[AC_CHECK_HEADERS([libavformat/avformat.h],
+-	  [AVEN_LIBS="-lswscale -lavformat -lavcodec -lavutil"
++	  [AVEN_LIBS="$sws_LIBS $avf_LIBS $avc_LIBS $avu_LIBS"
+ 	  save_LIBS=$LIBS
+ 	  LIBS="$LIBS $AVEN_LIBS"
+ 	  AC_CHECK_FUNCS([av_guess_format avio_open avio_close avformat_write_header avcodec_encode_video2 avcodec_free_frame avcodec_open2 avformat_new_stream av_frame_alloc av_frame_free])
+@@ -206,9 +217,9 @@ AC_CHECK_LIB(avcodec, avcodec_register_a
+ 	  AC_CHECK_DECLS([AV_CODEC_ID_NONE], [], [], [#include <libavcodec/avcodec.h>])
+ 	  AC_CHECK_DECLS([AV_PIX_FMT_YUV420P], [], [], [#include <libavutil/pixfmt.h>])
+ 	  LIBS=$save_LIBS])],
+-        [], [-lavformat -lavcodec -lswscale $WX_LIBS])],
+-      [], [-lavformat -lavcodec $WX_LIBS])],
+-    [], [-lavcodec $WX_LIBS])
++        [], [$avf_LIBS $avc_LIBS $sws_LIBS $WX_LIBS])],
++      [], [$avf_LIBS $avc_LIBS $WX_LIBS])],
++    [], [$avc_LIBS $WX_LIBS])
+ ])
+ 
+ dnl Check for libproj
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..9937964
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+pkg-config.patch
diff --git a/debian/rules b/debian/rules
index 2d33f6a..dd9063b 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,4 +1,4 @@
 #!/usr/bin/make -f
 
 %:
-	dh $@
+	dh $@ --with autoreconf

Reply via email to