Source: hedgewars
Version: 0.9.20.5-7
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..d34d7f5
--- /dev/null
+++ b/debian/patches/pkg-config.patch
@@ -0,0 +1,50 @@
+Description: Use pkg-config to determine FFmpeg linker flags
+
+Author: Andreas Cadhalpun <[email protected]>
+Last-Update: <2014-05-18>
+
+--- hedgewars-0.9.20.5.orig/cmake_modules/FindFFMPEG.cmake
++++ hedgewars-0.9.20.5/cmake_modules/FindFFMPEG.cmake
+@@ -28,12 +28,15 @@ find_package(PkgConfig)
+ if(PKG_CONFIG_FOUND)
+     if(NOT LIBAVCODEC_INCLUDE_DIR OR NOT LIBAVCODEC_LIBRARY)
+         pkg_check_modules(_FFMPEG_AVCODEC libavcodec)
++        string(REPLACE "-l" "" avc_name "${_FFMPEG_AVCODEC_LIBRARIES}")
+     endif()
+     if(NOT LIBAVFORMAT_LIBRARY)
+         pkg_check_modules(_FFMPEG_AVFORMAT libavformat)
++        string(REPLACE "-l" "" avf_name "${_FFMPEG_AVFORMAT_LIBRARIES}")
+     endif()
+     if(NOT LIBAVUTIL_LIBRARY)
+         pkg_check_modules(_FFMPEG_AVUTIL libavutil)
++        string(REPLACE "-l" "" avu_name "${_FFMPEG_AVUTIL_LIBRARIES}")
+     endif()
+ endif(PKG_CONFIG_FOUND)
+ 
+@@ -47,22 +50,23 @@ find_path(LIBAVCODEC_INCLUDE_DIR
+ 
+ #TODO: add other include paths
+ 
++
+ find_library(LIBAVCODEC_LIBRARY
+-    NAMES avcodec
++    NAMES ${avc_name} avcodec
+     PATHS ${_FFMPEG_AVCODEC_LIBRARY_DIRS}   #pkg-config
+           /usr/lib /usr/local/lib           #system level
+           /opt/local/lib /sw/lib            #macports & fink
+ )
+ 
+ find_library(LIBAVFORMAT_LIBRARY
+-    NAMES avformat
++    NAMES ${avf_name} avformat
+     PATHS ${_FFMPEG_AVFORMAT_LIBRARY_DIRS}  #pkg-config
+           /usr/lib /usr/local/lib           #system level
+           /opt/local/lib /sw/lib            #macports & fink
+ )
+ 
+ find_library(LIBAVUTIL_LIBRARY
+-    NAMES avutil
++    NAMES ${avu_name} avutil
+     PATHS ${_FFMPEG_AVUTIL_LIBRARY_DIRS}    #pkg-config
+           /usr/lib /usr/local/lib           #system level
+           /opt/local/lib /sw/lib            #macports & fink
diff --git a/debian/patches/series b/debian/patches/series
index aede80e..9ac970d 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -2,3 +2,4 @@
 using_system_fonts.patch
 noversionupdate.patch
 0001-Fixed-desktop-file-By-adding-an-xpm-icon.patch
+pkg-config.patch

Reply via email to