From 24966ccf9544d9eb0ec4f10087339e25063ef9bf Mon Sep 17 00:00:00 2001
From: Jeremy Messenger <mezz@FreeBSD.org>
Date: Sat, 25 Aug 2007 21:47:44 +0000
Subject: -Fix the CFLAGS/LDFLAGS. -Fix the build if it has no -O* or/and has
 -O0 by force replace to -O2.

PR:		ports/115076
Submitted by:	Tatsuki Makino <tatsuki_makino@hotmail.com>
---
 multimedia/ffmpeg/Makefile | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/multimedia/ffmpeg/Makefile b/multimedia/ffmpeg/Makefile
index 3e572d889edb..5815b09fea52 100644
--- a/multimedia/ffmpeg/Makefile
+++ b/multimedia/ffmpeg/Makefile
@@ -29,8 +29,8 @@ CONFIGURE_ARGS+=--cc="${CC}" --prefix="${PREFIX}" \
 		--enable-memalign-hack \
 		--enable-shared \
 		--enable-pp \
-		--extra-cflags="${CFLAGS} -I${LOCALBASE}/include" \
-		--extra-ldflags="-L${LOCALBASE}/lib" \
+		--extra-cflags="${FFMPEG_CFLAGS} -I${LOCALBASE}/include" \
+		--extra-ldflags="-L${LOCALBASE}/lib ${FFMPEG_LDFLAGS}" \
 		--extra-libs="${PTHREAD_LIBS}" \
 		--enable-gpl \
 		--enable-pthreads
@@ -63,7 +63,9 @@ MAN1+=	ffmpeg.1 ffserver.1
 .endif
 
 .ifdef(WITH_OPTIMIZED_CFLAGS)
-FFMPEG_CFLAGS+=		-O3 -ffast-math -fomit-frame-pointer
+CFLAGS:=		${CFLAGS:N-O*} -O3 -ffast-math -fomit-frame-pointer
+.else
+CFLAGS:=		${CFLAGS:N-O0} -O2
 .endif
 
 ## a52
@@ -72,7 +74,7 @@ LIB_DEPENDS+=	a52.0:${PORTSDIR}/audio/liba52
 
 CONFIGURE_ARGS+=	--enable-liba52 \
 			--enable-liba52bin
-FFMPEG_LDFLAGS+=		-la52
+FFMPEG_LDFLAGS+=	-la52
 .else
 CONFIGURE_ARGS+=	--disable-liba52
 .endif
-- 
cgit debian/1.2.3+git2.25.1-1-2-gaceb0