--- ffmpeg-0.4.9_pre1.ebuild.orig 2005-03-02 11:11:50.357080784 +0100 +++ ffmpeg-0.4.9_pre1.ebuild 2005-03-02 11:40:12.511314008 +0100 @@ -15,7 +15,7 @@ LICENSE="LGPL-2" SLOT="0" KEYWORDS="~x86 ~ppc ~sparc ~alpha ~amd64 ~ia64 ppc64 ~arm ~mips ~hppa" -IUSE="altivec debug doc dvd encode aac imlib mmx oggvorbis sdl static truetype" +IUSE="altivec debug doc dvd encode aac imlib mmx oggvorbis pic sdl static truetype" DEPEND="encode? ( >=media-sound/lame-3.92 ) oggvorbis? ( >=media-libs/libvorbis-1.0-r1 ) @@ -32,7 +32,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 @@ -42,20 +42,38 @@ 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 + # Should also cover 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 - # 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 the executables. + filter-flags -fforce-addr local myconf #myconf="${myconf} --disable-opts --enable-pp --enable-shared-pp" myconf="${myconf} --disable-opts --enable-pp --enable-gpl" - use mmx || myconf="${myconf} --disable-mmx" + # Disable mmx accelerated code if not requested, or if PIC is required + # as the provided asm isn't PIC. + ( use pic || use !mmx ) && myconf="${myconf} --disable-mmx" use encode && myconf="${myconf} --enable-mp3lame" use oggvorbis && myconf="${myconf} --enable-vorbis" use aac && myconf="${myconf} --enable-faad --enable-faadbin"