Patchwork gstreamer: gst-ffmpeg: fix build issues for libav

login
register
mail settings
Submitter Yao Zhao
Date Aug. 2, 2012, 9:15 p.m.
Message ID <1343942157-15997-1-git-send-email-yao.zhao@windriver.com>
Download mbox | patch
Permalink /patch/33721/
State New
Headers show

Comments

Yao Zhao - Aug. 2, 2012, 9:15 p.m.
1.The included libav configure is not generated by autotools
  patch use-correct-toolchain.patch patched its configure to
use correct toolchain wrapper.

2.add bzip2 dependency explicitly.
  or configure will detect whether libbz2 is installed, if bzip2
is triggered earlier then it will be detected, if not then won't

3.detect whether toolchain supports altivec, if not then add
disable-altivec to libav's configure line or configure will fail

4.move the GSTREAMER_DEBUG to libav's configure, it is not the
option for the main configure.

Signed-off-by: Yao Zhao <yao.zhao@windriver.com>
---
 .../gst-ffmpeg-0.10.13/use-correct-toolchain.patch |   26 ++++++++++++++++++++
 .../gstreamer/gst-ffmpeg_0.10.13.bb                |   26 ++++++++++++++++++--
 2 files changed, 50 insertions(+), 2 deletions(-)
 create mode 100644 meta/recipes-multimedia/gstreamer/gst-ffmpeg-0.10.13/use-correct-toolchain.patch
Derek Buitenhuis - Aug. 4, 2012, 6:57 p.m.
On 02/08/2012 5:15 PM, Yao Zhao wrote:
> 1.The included libav configure is not generated by autotools
>   patch use-correct-toolchain.patch patched its configure to
> use correct toolchain wrapper.

Why are you patching the toolchain instead of passing the correct parameters
to configure (--enable-cross-compile, --cross-prefix-..., etc)?

> 2.add bzip2 dependency explicitly.
>   or configure will detect whether libbz2 is installed, if bzip2
> is triggered earlier then it will be detected, if not then won't

Looks OK.

> 3.detect whether toolchain supports altivec, if not then add
> disable-altivec to libav's configure line or configure will fail

Wrong fix.

http://git.libav.org/?p=libav.git;a=blob;f=configure;h=b139008d2b1aa5faea3f33c2a1922d0e1cb1fa5c;hb=HEAD#l2318

It should be fixed by passing the proper CPU to libav's configure as an argument.

> 4.move the GSTREAMER_DEBUG to libav's configure, it is not the
> option for the main configure.

OK.

- Derek
Koen Kooi - Aug. 5, 2012, 11:52 a.m.
Op 4 aug. 2012, om 20:57 heeft Derek Buitenhuis <derek.buitenhuis@gmail.com> het volgende geschreven:

> On 02/08/2012 5:15 PM, Yao Zhao wrote:
>> 1.The included libav configure is not generated by autotools
>>  patch use-correct-toolchain.patch patched its configure to
>> use correct toolchain wrapper.
> 
> Why are you patching the toolchain instead of passing the correct parameters
> to configure (--enable-cross-compile, --cross-prefix-..., etc)?
> 
>> 2.add bzip2 dependency explicitly.
>>  or configure will detect whether libbz2 is installed, if bzip2
>> is triggered earlier then it will be detected, if not then won't
> 
> Looks OK.
> 
>> 3.detect whether toolchain supports altivec, if not then add
>> disable-altivec to libav's configure line or configure will fail
> 
> Wrong fix.
> 
> http://git.libav.org/?p=libav.git;a=blob;f=configure;h=b139008d2b1aa5faea3f33c2a1922d0e1cb1fa5c;hb=HEAD#l2318
> 
> It should be fixed by passing the proper CPU to libav's configure as an argument.


I find it a lot easier to build gst-ffmpeg against an external libav, that way you don't have to jump through all these hoops to get a proper libav. That's what the meta-oe bbappend does :) 

regards,

Koen
Derek Buitenhuis - Aug. 5, 2012, 4:27 p.m.
On 05/08/2012 7:52 AM, Koen Kooi wrote:
> I find it a lot easier to build gst-ffmpeg against an external libav, that way you don't have to jump through all these hoops to get a proper libav. That's what the meta-oe bbappend does :) 

I've always wondered why Libav was not its own recipe. It seems like it
would be a lot easier to maintain... calling its configure from gst's
configure is... unpleasant. :)

- Derek
Koen Kooi - Aug. 5, 2012, 5:31 p.m.
Op 5 aug. 2012, om 18:27 heeft Derek Buitenhuis <derek.buitenhuis@gmail.com> het volgende geschreven:

> On 05/08/2012 7:52 AM, Koen Kooi wrote:
>> I find it a lot easier to build gst-ffmpeg against an external libav, that way you don't have to jump through all these hoops to get a proper libav. That's what the meta-oe bbappend does :) 
> 
> I've always wondered why Libav was not its own recipe.

It's been in meta-oe for ages. I guess we should move gst-ffmpeg (which is called gst-libav nowadays) into meta-multimedia together with libav.
Khem Raj - Aug. 5, 2012, 7:11 p.m.
On Sun, Aug 5, 2012 at 10:31 AM, Koen Kooi <koen@dominion.thruhere.net> wrote:
> It's been in meta-oe for ages. I guess we should move gst-ffmpeg (which is called gst-libav nowadays) into meta-multimedia together with libav.

+1
Derek Buitenhuis - Aug. 5, 2012, 10:16 p.m.
On 05/08/2012 3:11 PM, Khem Raj wrote:
> On Sun, Aug 5, 2012 at 10:31 AM, Koen Kooi <koen@dominion.thruhere.net> wrote:
>> It's been in meta-oe for ages. I guess we should move gst-ffmpeg (which is called gst-libav nowadays) into meta-multimedia together with libav.
> 
> +1

As an upstream developer, I volunteer to maintain the recipe if need be. :)

- Derek
Yao Zhao - Aug. 7, 2012, 3:24 p.m.
On 12-08-04 02:57 PM, Derek Buitenhuis wrote:
> On 02/08/2012 5:15 PM, Yao Zhao wrote:
>> 1.The included libav configure is not generated by autotools
>>    patch use-correct-toolchain.patch patched its configure to
>> use correct toolchain wrapper.
> Why are you patching the toolchain instead of passing the correct parameters
> to configure (--enable-cross-compile, --cross-prefix-..., etc)?
in the configure,
ar_default="${cross_prefix}${ar_default}"
cc_default="${cross_prefix}${cc_default}"
nm_default="${cross_prefix}${nm_default}"
pkg_config_default="${cross_prefix}${pkg_config_default}"
ranlib="${cross_prefix}${ranlib}"

cc_default is the gcc so cc_default will be for example: 
powerpc-xxx-gcc, it won't use the toolcain wrapper.

I will try whether command line will solve these too.

>> 2.add bzip2 dependency explicitly.
>>    or configure will detect whether libbz2 is installed, if bzip2
>> is triggered earlier then it will be detected, if not then won't
> Looks OK.
>
>> 3.detect whether toolchain supports altivec, if not then add
>> disable-altivec to libav's configure line or configure will fail
> Wrong fix.
>
> http://git.libav.org/?p=libav.git;a=blob;f=configure;h=b139008d2b1aa5faea3f33c2a1922d0e1cb1fa5c;hb=HEAD#l2318
>
> It should be fixed by passing the proper CPU to libav's configure as an argument.

         e500v2)
             cpuflags="-mcpu=8548 -mhard-float -mfloat-gprs=double"
             disable altivec
         ;;
         e500)
             cpuflags="-mcpu=8540 -mhard-float"
             disable altivec
         ;;

I am fixing for e500mc which is not a case here and I am not sure what 
exactly the cpuflags should be.
Any idea?

yao
>> 4.move the GSTREAMER_DEBUG to libav's configure, it is not the
>> option for the main configure.
> OK.
>
> - Derek
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
Derek Buitenhuis - Aug. 7, 2012, 5 p.m.
On 07/08/2012 11:24 AM, Yao Zhao wrote:
>>> 1.The included libav configure is not generated by autotools
>>>    patch use-correct-toolchain.patch patched its configure to
>>> use correct toolchain wrapper.
>> Why are you patching the toolchain instead of passing the correct parameters
>> to configure (--enable-cross-compile, --cross-prefix-..., etc)?
> in the configure,
> ar_default="${cross_prefix}${ar_default}"
> cc_default="${cross_prefix}${cc_default}"
> nm_default="${cross_prefix}${nm_default}"
> pkg_config_default="${cross_prefix}${pkg_config_default}"
> ranlib="${cross_prefix}${ranlib}"
> 
> cc_default is the gcc so cc_default will be for example: 
> powerpc-xxx-gcc, it won't use the toolcain wrapper.
> 
> I will try whether command line will solve these too.

Perhaps you are looking for --cc=<something>?

Same thing can be done with --ld, and pals if you desire.

Remember to set --arch, maybe --cpu and --target-os too, as well as --enable-cross-compile.

>>> 3.detect whether toolchain supports altivec, if not then add
>>> disable-altivec to libav's configure line or configure will fail
>> Wrong fix.
>>
>> http://git.libav.org/?p=libav.git;a=blob;f=configure;h=b139008d2b1aa5faea3f33c2a1922d0e1cb1fa5c;hb=HEAD#l2318
>>
>> It should be fixed by passing the proper CPU to libav's configure as an argument.
> 
>          e500v2)
>              cpuflags="-mcpu=8548 -mhard-float -mfloat-gprs=double"
>              disable altivec
>          ;;
>          e500)
>              cpuflags="-mcpu=8540 -mhard-float"
>              disable altivec
>          ;;
> 
> I am fixing for e500mc which is not a case here and I am not sure what 
> exactly the cpuflags should be.
> Any idea?

http://lists.libav.org/pipermail/libav-devel/2012-August/032990.html

Working on it.

- Derek
Derek Buitenhuis - Aug. 7, 2012, 8:06 p.m.
On 07/08/2012 1:00 PM, Derek Buitenhuis wrote:
>> I am fixing for e500mc which is not a case here and I am not sure what 
>> > exactly the cpuflags should be.
>> > Any idea?
> http://lists.libav.org/pipermail/libav-devel/2012-August/032990.html
> 
> Working on it.

And done:

http://git.libav.org/?p=libav.git;a=commit;h=4ab26cb4cc9af2ab2199105aa273aa23e1f27911

- Derek

Patch

diff --git a/meta/recipes-multimedia/gstreamer/gst-ffmpeg-0.10.13/use-correct-toolchain.patch b/meta/recipes-multimedia/gstreamer/gst-ffmpeg-0.10.13/use-correct-toolchain.patch
new file mode 100644
index 0000000..4e04789
--- /dev/null
+++ b/meta/recipes-multimedia/gstreamer/gst-ffmpeg-0.10.13/use-correct-toolchain.patch
@@ -0,0 +1,26 @@ 
+use correct toolchain wrapper for libav
+
+Upstream-Status: Inappropriate [configuration]
+
+Signed-off-by: Yao Zhao <yao.zhao@windriver.com> 
+
+--- a/gst-libs/ext/libav/configure
++++ b/gst-libs/ext/libav/configure
+@@ -1885,6 +1885,17 @@
+ tmpfile TMPSH .sh
+ tmpfile TMPASM .asm
+ 
++# What we really want to use.  Note that
++# ld should be cc or we will get "unknown options"
++# errors while linking.
++#
++cc=$CC
++as=$CC
++ld=$CC
++nm=$NM
++ar=$AR
++ranlib=$RANLIB
++
+ unset -f mktemp
+ 
+ chmod +x $TMPE
diff --git a/meta/recipes-multimedia/gstreamer/gst-ffmpeg_0.10.13.bb b/meta/recipes-multimedia/gstreamer/gst-ffmpeg_0.10.13.bb
index a166290..168232a 100644
--- a/meta/recipes-multimedia/gstreamer/gst-ffmpeg_0.10.13.bb
+++ b/meta/recipes-multimedia/gstreamer/gst-ffmpeg_0.10.13.bb
@@ -11,7 +11,7 @@  LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
                     file://gst-libs/ext/libav/COPYING.LGPLv2.1;md5=e344c8fa836c3a41c4cbd79d7bd3a379 \
                     file://gst-libs/ext/libav/COPYING.LGPLv3;md5=e6a600fd5e1d9cbde2d983680233ad02"
 HOMEPAGE = "http://www.gstreamer.net/"
-DEPENDS = "gstreamer gst-plugins-base zlib"
+DEPENDS = "gstreamer gst-plugins-base zlib bzip2"
 
 inherit autotools pkgconfig
 
@@ -19,6 +19,7 @@  SRC_URI = "http://gstreamer.freedesktop.org/src/${BPN}/${BPN}-${PV}.tar.bz2 \
            file://lower-rank.diff \
            file://configure-fix.patch \
            file://h264_qpel_mmx.patch \
+           file://use-correct-toolchain.patch \
 "
 
 SRC_URI[md5sum] = "7f5beacaf1312db2db30a026b36888c4"
@@ -27,7 +28,28 @@  SRC_URI[sha256sum] = "76fca05b08e00134e3cb92fa347507f42cbd48ddb08ed3343a912def18
 PR = "r3"
 
 GSTREAMER_DEBUG ?= "--disable-debug"
-EXTRA_OECONF = "--with-ffmpeg-extra-configure=\"--target-os=linux\" ${GSTREAMER_DEBUG}"
+
+FFMPEG_EXTRA_CONFIGURE = "--with-ffmpeg-extra-configure"
+FFMPEG_EXTRA_CONFIGURE_COMMON_ARG = "--target-os=linux \
+  ${GSTREAMER_DEBUG}"
+FFMPEG_EXTRA_CONFIGURE_COMMON = \
+'${FFMPEG_EXTRA_CONFIGURE}="${FFMPEG_EXTRA_CONFIGURE_COMMON_ARG}"'
+
+EXTRA_OECONF = "${FFMPEG_EXTRA_CONFIGURE_COMMON}"
+# if no altivec support on some powerpc arch
+# return -1 if no found or found !-1
+def arch_feature_find(d, feature, bbvar="CC"):
+       v = d.getVar(bbvar, True)
+       if v is None:
+               return -1
+
+       return v.find(feature)
+
+FFMPEG_EXTRA_PPC = '${FFMPEG_EXTRA_CONFIGURE}=" \
+${FFMPEG_EXTRA_CONFIGURE_COMMON_ARG}\
+${@" --disable-altivec" if arch_feature_find(d, '-mno-altivec') != -1 else ''} \
+"'
+EXTRA_OECONF_append_powerpc = " ${FFMPEG_EXTRA_PPC} "
 
 # yasm not found, use --disable-yasm for a crippled build for libav
 EXTRA_OECONF_append_x86-64 = " --disable-yasm "