From 77072d02124dce44eb0465a68982aede5c0fe250 Mon Sep 17 00:00:00 2001 From: Mario Sergio Fujikawa Ferreira Date: Sun, 3 Nov 2002 07:01:44 +0000 Subject: o Add optimizations if WITH_OPTIMIZED_CFLAGS [1] o Make it CFLAGS safe (I have no idea how this escaped me) o Unless WITHOUT_LIBA52, use liba52 port instead of ffmpeg liba52 code. The liba52 port is more optimized. o Use FreeBSD byteswap optimized routines IF one happens to be using either FreeBSD 4.7-RELEASE or later o Do not bump PORTREVISION Submitted by: "Steve O'Hara-Smith" [1] Reviewed by: "Steve O'Hara-Smith" --- graphics/ffmpeg/Makefile | 30 +++++++++++++++++- graphics/ffmpeg/files/patch-libavcodec::bswap.h | 41 +++++++++++++++++++++++++ 2 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 graphics/ffmpeg/files/patch-libavcodec::bswap.h (limited to 'graphics') diff --git a/graphics/ffmpeg/Makefile b/graphics/ffmpeg/Makefile index dba45bad6419..be8da9146e74 100644 --- a/graphics/ffmpeg/Makefile +++ b/graphics/ffmpeg/Makefile @@ -26,7 +26,6 @@ USE_GMAKE= yes USE_REINPLACE= yes CONFIGURE_ARGS= --cc="${CC}" --prefix="${PREFIX}" \ --make="${GMAKE}" --enable-shared \ - --extra-cflags="-I${LOCALBASE}/include" \ --extra-libs="-lm -L${LOCALBASE}/lib" PLIST_SUB= SHLIB_VERSION=${SHLIB_VERSION} INSTALLS_SHLIB= yes @@ -58,6 +57,16 @@ WITH_VORBIS=yes ## support activation ## +## disable a52 +.ifndef(WITHOUT_A52) +LIB_DEPENDS+= a52.0:${PORTSDIR}/audio/liba52 + +CONFIGURE_ARGS+= --enable-a52 \ + --enable-a52bin +.else +CONFIGURE_ARGS+= --enable-a52 \ + --disable-a52bin +.endif ## disable mmx .ifdef(WITHOUT_MMX) CONFIGURE_ARGS+= --disable-mmx @@ -68,6 +77,13 @@ LIB_DEPENDS+= mp3lame.0:${PORTSDIR}/audio/lame CONFIGURE_ARGS+= --enable-mp3lame .endif +## optimization +.ifdef(WITH_OPTIMIZED_CFLAGS) +CONFIGURE_ARGS+= --extra-cflags="${CFLAGS} -I${LOCALBASE}/include \ + -O3 -ffast-math -fomit-frame-pointer" +.else +CONFIGURE_ARGS+= --extra-cflags="${CFLAGS} -I${LOCALBASE}/include" +.endif ## vorbis .ifdef(WITH_VORBIS) LIB_DEPENDS+= vorbisenc.2:${PORTSDIR}/audio/libvorbis @@ -76,12 +92,20 @@ CONFIGURE_ARGS+= --enable-vorbis .endif pre-everything:: +.ifndef(WITHOUT_LIBA52) + @${ECHO_MSG} "You can disable liba52 support by defining WITHOUT_LIBA52" +.endif .ifndef(WITHOUT_MMX) @${ECHO_MSG} "Define WITHOUT_MMX if your system does not support MMX" .endif .ifndef(WITH_MP3) @${ECHO_MSG} 'Define WITH_MP3 to enable lame MP3 codec' .endif +.ifndef(WITH_OPTIMIZED_CFLAGS) + @${ECHO_MSG} + @${ECHO_MSG} 'You can enable additional compilation optimizations' + @${ECHO_MSG} 'by defining WITH_OPTIMIZED_CFLAGS' +.endif .ifndef(WITH_VORBIS) @${ECHO_MSG} 'Define WITH_VORBIS to enable libvorbisenc VORBIS codec' .endif @@ -118,6 +142,10 @@ post-patch: "s!VIDEO_INPUT METEOR_INPUT_DEV0!VIDEO_INPUT METEOR_INPUT_DEV${WITH_BKTR_DEV}!" \ ${WRKSRC}/libav/grab_bsdbktr.c .endif +.ifndef(WITHOUT_LIBA52) + @${REINPLACE_CMD} -e 's|-ldl||' \ + ${WRKSRC}/configure +.endif post-install: .ifndef(NOPORTDOCS) diff --git a/graphics/ffmpeg/files/patch-libavcodec::bswap.h b/graphics/ffmpeg/files/patch-libavcodec::bswap.h new file mode 100644 index 000000000000..e0c419c1dc42 --- /dev/null +++ b/graphics/ffmpeg/files/patch-libavcodec::bswap.h @@ -0,0 +1,41 @@ +--- libavcodec/bswap.h.orig Sun Nov 3 04:51:51 2002 ++++ libavcodec/bswap.h Sun Nov 3 04:53:30 2002 +@@ -5,6 +5,14 @@ + #include + #else + ++#if (defined(BSD) && (BSD >= 199103)) ++#include ++#endif ++ ++#if defined(__FreeBSD__) && __FreeBSD_version >= 470000 ++#include ++#endif ++ + #ifdef ARCH_X86 + inline static unsigned short ByteSwap16(unsigned short x) + { +@@ -13,7 +21,11 @@ + "0" (x)); + return x; + } ++#if defined(__FreeBSD__) && __FreeBSD_version >= 470000 ++#define bswap_16(x) (be16toh(x)) ++#else + #define bswap_16(x) ByteSwap16(x) ++#endif + + inline static unsigned int ByteSwap32(unsigned int x) + { +@@ -29,7 +41,11 @@ + "0" (x)); + return x; + } ++#if defined(__FreeBSD__) && __FreeBSD_version >= 470000 ++#define bswap_32(x) (be32toh(x)) ++#else + #define bswap_32(x) ByteSwap32(x) ++#endif + + inline static unsigned long long int ByteSwap64(unsigned long long int x) + { -- cgit v1.2.3