Source: jitsi
Version: 2.4.4997-1.2
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..f150d72
--- /dev/null
+++ b/debian/patches/pkg-config.patch
@@ -0,0 +1,37 @@
+Description: Use pkg-config to determine FFmpeg linker flags
+
+Author: Andreas Cadhalpun <[email protected]>
+Last-Update: <2014-05-28>
+
+--- jitsi-2.4.4997.orig/lib/src/libjitsi/src/native/build.xml
++++ jitsi-2.4.4997/lib/src/libjitsi/src/native/build.xml
+@@ -303,6 +303,12 @@
+     <fail message="x264 repository not set!" unless="x264" />
+     <fail message="lame repository not set!" unless="lame" />
+ 
++    <exec command="sh -c 'pkg-config --libs libavformat | sed s/[[:space:]]*$//'" outputproperty="libavformat_LIBS"></exec>
++    <exec command="sh -c 'pkg-config --libs libavcodec | sed s/[[:space:]]*$//'" outputproperty="libavcodec_LIBS"></exec>
++    <exec command="sh -c 'pkg-config --libs libavfilter | sed s/[[:space:]]*$//'" outputproperty="libavfilter_LIBS"></exec>
++    <exec command="sh -c 'pkg-config --libs libavutil | sed s/[[:space:]]*$//'" outputproperty="libavutil_LIBS"></exec>
++    <exec command="sh -c 'pkg-config --libs libswscale | sed s/[[:space:]]*$//'" outputproperty="libswscale_LIBS"></exec>
++
+     <cc outtype="shared" name="gcc" outfile="${native_install_dir}/jnffmpeg" objdir="${obj}">
+       <!-- common compiler flags -->
+       <compilerarg value="-D_JNI_IMPLEMENTATION_" />
+@@ -333,11 +339,11 @@
+         Static libraries MUST be at the end otherwise they will not be added to
+         the shared library.
+       -->
+-      <linkerarg value="-lavformat" location="end" />
+-      <linkerarg value="-lavcodec" location="end" />
+-      <linkerarg value="-lavfilter" location="end" />
+-      <linkerarg value="-lavutil" location="end" />
+-      <linkerarg value="-lswscale" location="end" />
++      <linkerarg value="${libavformat_LIBS}" location="end" />
++      <linkerarg value="${libavcodec_LIBS}" location="end" />
++      <linkerarg value="${libavfilter_LIBS}" location="end" />
++      <linkerarg value="${libavutil_LIBS}" location="end" />
++      <linkerarg value="${libswscale_LIBS}" location="end" />
+       <linkerarg value="-lmp3lame" location="end" />
+       <linkerarg value="-lx264" location="end" />
+ 
diff --git a/debian/patches/series b/debian/patches/series
index bc482d0..bd15329 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -3,3 +3,4 @@ remove-hflip
 guava-update
 libav10.patch
 json.patch
+pkg-config.patch

Reply via email to