Source: visp
Version: 2.9.0-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..e4e735f
--- /dev/null
+++ b/debian/patches/pkg-config.patch
@@ -0,0 +1,62 @@
+Description: Use pkg-config to determine FFmpeg linker flags
+
+Author: Andreas Cadhalpun <andreas.cadhal...@googlemail.com>
+Last-Update: <2014-08-06>
+
+--- visp-2.9.0.orig/CMakeModules/FindFFMPEG.cmake
++++ visp-2.9.0/CMakeModules/FindFFMPEG.cmake
+@@ -94,9 +94,13 @@
+   )
+ 
+   # Detection of the FFMPEG library on Unix
++  find_package(PkgConfig)
++
++  pkg_check_modules(PC_AVUTIL libavutil)
++  string(REPLACE "-l" "" avu_name "${PC_AVUTIL_LIBRARIES}")
+   FIND_LIBRARY(FFMPEG_AVUTIL_LIBRARY
+     NAMES
+-      avutil
++      ${avu_name} avutil
+     PATHS
+     /usr/lib
+     /usr/local/lib
+@@ -105,9 +109,11 @@
+     $ENV{FFMPEG_DIR}/Release
+     $ENV{FFMPEG_DIR}
+   )
++  pkg_check_modules(PC_AVCODEC libavcodec)
++  string(REPLACE "-l" "" avc_name "${PC_AVCODEC_LIBRARIES}")
+   FIND_LIBRARY(FFMPEG_AVCODEC_LIBRARY
+     NAMES
+-      avcodec
++      ${avc_name} avcodec
+     PATHS
+     /usr/lib
+     /usr/local/lib
+@@ -116,9 +122,11 @@
+     $ENV{FFMPEG_DIR}/Release
+     $ENV{FFMPEG_DIR}
+   )
++  pkg_check_modules(PC_AVFORMAT libavformat)
++  string(REPLACE "-l" "" avf_name "${PC_AVFORMAT_LIBRARIES}")
+   FIND_LIBRARY(FFMPEG_AVFORMAT_LIBRARY
+     NAMES
+-      avformat
++      ${avf_name} avformat
+     PATHS
+     /usr/lib
+     /usr/local/lib
+@@ -139,10 +147,11 @@
+     $ENV{FFMPEG_DIR}/Release
+     $ENV{FFMPEG_DIR}
+   )
+-
++  pkg_check_modules(PC_SWSCALE libswscale)
++  string(REPLACE "-l" "" sws_name "${PC_SWSCALE_LIBRARIES}")
+   FIND_LIBRARY(FFMPEG_SWSCALE_LIBRARY
+     NAMES
+-      swscale
++      ${sws_name} swscale
+     PATHS
+     /usr/lib
+     /usr/local/lib
diff --git a/debian/patches/series b/debian/patches/series
index ba85b07..d886ebf 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -4,3 +4,4 @@
 0004-Remove-commented-lines-in-visp-config.install.in.patch
 0005-Avoid-linking-against-useless-dependency-in-FindGSL..patch
 0006-CMakeLists.txt-install-share-data-in-visp-VERSION-if.patch
+pkg-config.patch

-- 
debian-science-maintainers mailing list
debian-science-maintainers@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/debian-science-maintainers

Reply via email to