Source: shotdetect
Version: 1.0.86-4
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 17a3872..79f34b9 100644
--- a/debian/control
+++ b/debian/control
@@ -8,6 +8,7 @@ Build-Depends: cdbs,
  autotools-dev,
  devscripts,
  debhelper (>= 9~),
+ dh-autoreconf,
  dh-buildinfo,
  libxml2-dev,
  libxslt1-dev,
diff --git a/debian/patches/pkg-config.patch b/debian/patches/pkg-config.patch
new file mode 100644
index 0000000..d109177
--- /dev/null
+++ b/debian/patches/pkg-config.patch
@@ -0,0 +1,43 @@
+Description: Use pkg-config to determine FFmpeg linker flags
+
+Author: Andreas Cadhalpun <[email protected]>
+Last-Update: <2014-05-15>
+
+--- shotdetect-1.0.86.orig/configure.in
++++ shotdetect-1.0.86/configure.in
+@@ -77,13 +77,21 @@ if test -z "$XSLT_CONFIG"; then
+    AC_MSG_ERROR([xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution])
+ fi
+ # Checks for libraries.
++PKG_PROG_PKG_CONFIG([])
++PKG_CHECK_MODULES([avc], [libavcodec])
++PKG_CHECK_MODULES([avf], [libavformat])
++PKG_CHECK_MODULES([avu], [libavutil])
++PKG_CHECK_MODULES([sws], [libswscale])
++avc_name=`echo $avc_LIBS | sed 's/-l//'`
++avf_name=`echo $avf_LIBS | sed 's/-l//'`
++avu_name=`echo $avu_LIBS | sed 's/-l//'`
+ # FIXME: Replace `main' with a function in `-lavcodec':
+ AC_CHECK_LIB(stdc++, main,,AC_MSG_ERROR(shotdetect requires libstdc++))
+-AC_CHECK_LIB([avcodec], [main],,  AC_MSG_ERROR([Please install libavcodec]))
++AC_CHECK_LIB([$avc_name], [main],,  AC_MSG_ERROR([Please install libavcodec]))
+ # FIXME: Replace `main' with a function in `-lavformat':
+-AC_CHECK_LIB([avformat], [main],,  AC_MSG_ERROR([Please install libavformat]))
++AC_CHECK_LIB([$avf_name], [main],,  AC_MSG_ERROR([Please install libavformat]))
+ # FIXME: Replace `main' with a function in `-lavutil':
+-AC_CHECK_LIB([avutil], [main],,  AC_MSG_ERROR([Please install libavutil]))
++AC_CHECK_LIB([$avu_name], [main],,  AC_MSG_ERROR([Please install libavutil]))
+ # FIXME: Replace `main' with a function in `-lgd':
+ AC_CHECK_LIB([gd], [main],,  AC_MSG_ERROR([Please install libgd2 !]))
+ AC_HEADER_STDC
+--- shotdetect-1.0.86.orig/src/Makefile.am
++++ shotdetect-1.0.86/src/Makefile.am
+@@ -1,7 +1,7 @@
+ # Fichier pour automake
+ INCLUDES= -I../include -I../resources/ -I/usr/include/ffmpeg `xslt-config --cflags`
+ bin_PROGRAMS = shotdetect
+-shotdetect_LDADD = -lgd -lz -lswscale -lavformat -lavcodec -lavutil
++shotdetect_LDADD = -lgd -lz $(sws_LIBS) $(avf_LIBS) $(avc_LIBS) $(avu_LIBS)
+ shotdetect_LDFLAGS = `xslt-config --libs`
+ shotdetect_SOURCES = \
+ graph.cpp \
diff --git a/debian/patches/series b/debian/patches/series
index a9283dd..92c9be0 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -4,3 +4,4 @@
 1004-fix_comments_and_names.patch
 
 libav10.patch
+pkg-config.patch
diff --git a/debian/rules b/debian/rules
index 83faa3b..deb080d 100755
--- a/debian/rules
+++ b/debian/rules
@@ -6,6 +6,7 @@ include /usr/share/dpkg/buildflags.mk
 
 include /usr/share/cdbs/1/rules/upstream-tarball.mk
 include /usr/share/cdbs/1/rules/utils.mk
+include /usr/share/cdbs/1/rules/autoreconf.mk
 include /usr/share/cdbs/1/class/autotools.mk
 include /usr/share/cdbs/1/rules/debhelper.mk
 

Reply via email to