Source: gpac
Version: 0.5.0+svn5324~dfsg1-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/patches/pkg-config.patch b/debian/patches/pkg-config.patch
new file mode 100644
index 0000000..51ef041
--- /dev/null
+++ b/debian/patches/pkg-config.patch
@@ -0,0 +1,63 @@
+Description: Use pkg-config to determine FFmpeg linker flags
+
+Author: Andreas Cadhalpun <andreas.cadhal...@googlemail.com>
+Last-Update: <2014-08-06>
+
+--- gpac-0.5.0+svn5324~dfsg1.orig/applications/dashcast/Makefile
++++ gpac-0.5.0+svn5324~dfsg1/applications/dashcast/Makefile
+@@ -26,7 +26,7 @@ endif
+ 
+ ifneq ($(CONFIG_LIBAVRESAMPLE),no)
+ CFLAGS+=-DDC_AUDIO_RESAMPLER
+-LINKLIBS+=-lavresample
++LINKLIBS+=$(avr_lflags)
+ endif
+ 
+ #common obj
+--- gpac-0.5.0+svn5324~dfsg1.orig/configure
++++ gpac-0.5.0+svn5324~dfsg1/configure
+@@ -1289,12 +1289,16 @@ fi
+ 
+ ffmpeg_cflags=""
+ ffmpeg_lflags="-lz -lavcodec -lavformat -lavutil -lswscale -lavdevice"
++avr_lflags="-lavresample"
+ if test "$cross_prefix" = "" -a "$pkg_config" != "no"; then
+   if $pkg_config --exists libavcodec libavformat libswscale libavdevice libavutil 2> /dev/null  ; then
+     ffmpeg_cflags=`$pkg_config --cflags libavcodec libavformat libswscale libavutil libavdevice`
+     ffmpeg_lflags=`$pkg_config --libs libavcodec libavformat libswscale libavutil libavdevice`
+     has_ffmpeg="system"
+   fi
++  if $pkg_config --exists libavresample 2> /dev/null  ; then
++    avr_lflags=`$pkg_config --libs libavresample`
++  fi
+ fi
+ 
+ cat > $TMPC << EOF
+@@ -1388,7 +1392,7 @@ int main(void) {
+ }
+ EOF
+ 
+-if $cc -o $TMPO $TMPC $ffmpeg_cflags $ffmpeg_lflags -lavresample 2> /dev/null  ; then
++if $cc -o $TMPO $TMPC $ffmpeg_cflags $ffmpeg_lflags $avr_lflags 2> /dev/null  ; then
+     has_libavresample="yes"
+ else
+     has_libavresample="no"
+@@ -2932,6 +2936,7 @@ echo "DISABLE_DASHCAST=yes" >> config.ma
+ else
+     echo "ffmpeg_cflags=$ffmpeg_cflags" >> config.mak
+     echo "ffmpeg_lflags=$ffmpeg_lflags" >> config.mak
++    echo "avr_lflags=$avr_lflags" >> config.mak
+     echo "CONFIG_LIBAV=$is_libav" >> config.mak
+     echo "CONFIG_LIBAVRESAMPLE=$has_libavresample" >> config.mak
+ fi
+--- gpac-0.5.0+svn5194~dfsg1.orig/modules/ffmpeg_in/Makefile
++++ gpac-0.5.0+svn5194~dfsg1/modules/ffmpeg_in/Makefile
+@@ -25,8 +25,6 @@ endif
+ #old ffmpeg lib
+ ifeq ($(CONFIG_FFMPEG_OLD), yes)
+ CFLAGS+=-DFFMPEG_OLD_HEADERS -I/usr/include
+-else
+-LINKLIBS+=-lswscale
+ endif
+ 
+ #common obj
diff --git a/debian/patches/series b/debian/patches/series
index 49b48c8..7c5b369 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -2,3 +2,4 @@ mp4box-manpage-fix.patch
 gcc-optflags.patch
 libav10.patch
 export_gf_isom_set_pixel_aspect_ratio.patch
+pkg-config.patch

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

Reply via email to