--- ffmpeg-0.4.9_p20050226.ebuild.orig 2005-03-02 20:48:23.000000000 +0100 +++ ffmpeg-0.4.9_p20050226.ebuild.orig 2005-03-02 21:05:56.000000000 +0100 @@ -15,7 +15,7 @@ LICENSE="LGPL-2" SLOT="0" KEYWORDS="~x86 ~ppc ~sparc ~alpha ~amd64 ~ia64 ~ppc64 ~arm ~mips ~hppa" -IUSE="aac altivec debug doc dv dvd encode imlib mmx oggvorbis oss truetype v4l" +IUSE="aac altivec debug doc dv dvd encode imlib mmx oggvorbis oss pic truetype v4l" DEPEND="imlib? (media-libs/imlib2) truetype? (>=media-libs/freetype-2) @@ -33,7 +33,7 @@ unpack ${A} || die cd ${S} - # for some reason it tries to #include ,b ut doesn't use it + # for some reason it tries to #include , but doesn't use it cd ${S} sed -i s:\#define\ HAVE_X11:\#define\ HAVE_LINUX: ffplay.c @@ -47,19 +47,41 @@ # einfo "Compiler used: gcc-3.4.x Applying patch conditionally." # epatch ${FILESDIR}/0.4.8-gcc3.4-magicF2W.patch #fi + + # If MMX isn't to be built, make the libraries properly PIC + # Also covers bug #16281 + if use pic || use !mmx; then + # ffmpeg doesn't use libtool, so the condition for PIC code + # is __PIC__, not PIC. + sed -i.orig 's/#if\(\(.*def *\)\|\(.*defined *\)\)PIC/#if\1__PIC__/' \ + libavcodec/i386/dsputil_mmx{.c,_rnd.h} \ + libavcodec/msmpeg4.c \ + || die "sed failed (__PIC__)" + # Fixup library makefiles to add '-fPIC'. + sed -i.orig 's/CFLAGS=/CFLAGS=-fPIC /' \ + libav{codec,format}/Makefile \ + || die "sed failed (-fPIC)" + # Fixup liba52 to respect the --disable-mmx configure option + sed -i.orig 's/#ifdef ARCH_X86/#ifdef HAVE_MMX/' \ + libavcodec/liba52/resample.c \ + || die "sed failed (HAVE_MMX)" + fi + } src_compile() { - filter-flags -fforce-addr -fPIC -momit-leaf-frame-pointer - # fixes bug #16281 - - use alpha && append-flags -fPIC - use amd64 && append-flags -fPIC - use hppa && append-flags -fPIC - use ppc && append-flags -fPIC + # Note; library makefiles don't propogate flags from config.mak so + # user-specified CFLAGS are only used in executables. + filter-flags -fforce-addr -momit-leaf-frame-pointer local myconf="" + # Disable mmx accelerated code if not requested, or if PIC is required + # as the provided asm decidedly isn't PIC. + ( use pic || use !mmx ) && \ + myconf="${myconf} --disable-mmx" || \ + myconf="${myconf} --enable-mmx" + use encode && use aac && myconf="${myconf} --enable-faac" if use oggvorbis ; then @@ -71,7 +93,6 @@ use !alpha && myconf="${myconf} $(use_enable aac faad) $(use_enable aac faac) $(use_enable aac faadbin)" econf \ - $(use_enable mmx) \ $(use_enable altivec) \ $(use_enable debug) \ $(use_enable encode mp3lame) \