From owner-freebsd-ports-bugs@FreeBSD.ORG Sun Jun 27 19:50:28 2004 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id F04DD16A4CF for ; Sun, 27 Jun 2004 19:50:28 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id E2D6743D39 for ; Sun, 27 Jun 2004 19:50:28 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) i5RJoD4O088475 for ; Sun, 27 Jun 2004 19:50:13 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.11/8.12.11/Submit) id i5RJoDF9088473; Sun, 27 Jun 2004 19:50:13 GMT (envelope-from gnats) Resent-Date: Sun, 27 Jun 2004 19:50:13 GMT Resent-Message-Id: <200406271950.i5RJoDF9088473@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, "Tom McLaughlin" Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 586E416A4CE for ; Sun, 27 Jun 2004 19:45:41 +0000 (GMT) Received: from straycat.dhs.org (h0050da134090.ne.client2.attbi.com [24.91.148.154]) by mx1.FreeBSD.org (Postfix) with SMTP id 9632A43D54 for ; Sun, 27 Jun 2004 19:45:40 +0000 (GMT) (envelope-from tmclaugh@sdf.lonestar.org) Received: (qmail 17931 invoked from network); 27 Jun 2004 19:45:07 -0000 Received: from compass.straycat.dhs.org (192.168.1.32) by alexandria.straycat.dhs.org with SMTP; 27 Jun 2004 19:45:07 -0000 Message-Id: <1088365507.0@compass.straycat.dhs.org> Date: Sun, 27 Jun 2004 15:45:07 -0400 From: "Tom McLaughlin" To: "FreeBSD gnats submit" X-Send-Pr-Version: gtk-send-pr 0.3.3 cc: riggs@rrr.de Subject: ports/68431: multimedia/mplayer: fix WITHOUT_RUNTIME_CPUDETECTION knob and respect CFLAGS X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jun 2004 19:50:29 -0000 >Number: 68431 >Category: ports >Synopsis: multimedia/mplayer: fix WITHOUT_RUNTIME_CPUDETECTION knob and respect CFLAGS >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Jun 27 19:50:13 GMT 2004 >Closed-Date: >Last-Modified: >Originator: Tom McLaughlin >Release: FreeBSD 5.2-CURRENT i386 >Organization: >Environment: System: FreeBSD 5.2-CURRENT #0: Wed Jun 23 03:45:45 EDT 2004 root@compass.straycat.dhs.org:/usr/obj/usr/src/sys/COMPASS >Description: The mplayer port has problems in certain circumstances using the WITHOUT_RUNTIME_CPUDETECTION knob and respecting CFLAGS. 1) When no CFLAGS are set by the user mplayer builds with extensive optimizations and is also CPU specific. By default mplayer will now only build with -O if there are no overridding CFLAGS set and will no longer be CPU specific. (A minimum optimization level of -O is needed for mplayer to build.) The WITH_OPTIMIZED_CFLAGS knob has been adjusted to reflect mplayer's default build optimizations. 2) When a user does have CFLAGS set the WITHOUT_RUNTIME_CPUDETECTION knob does not work. This has been corrected so that in all cases when WITHOUT_RUNTIME_CPUDETECTION is not set the binary will not be cpu specific (correcting an issue in 1 above) and when set the binary will be cpu specific. 3) General port cleanup A REINPLACE_CMD for pthreads has been removed since it affects nothing in the configure script. patch-ad has been renamed to patch-configure to match the naming conventions of the other patches. Attached patch has been tested and works on 4.10 and 5.2-CURRENT. Maintainer is CC'ed on PR. >How-To-Repeat: >Fix: --- mplayer_cpudetect_cflags.diff begins here --- Index: mplayer/Makefile =================================================================== RCS file: /home/ncvs/ports/multimedia/mplayer/Makefile,v retrieving revision 1.96 diff -u -r1.96 Makefile --- mplayer/Makefile 14 Jun 2004 14:47:12 -0000 1.96 +++ mplayer/Makefile 27 Jun 2004 19:17:34 -0000 @@ -364,7 +364,7 @@ .endif .if defined(WITH_OPTIMIZED_CFLAGS) -CFLAGS+= -O3 -ffast-math -fomit-frame-pointer +CFLAGS+= -O4 -ffast-math -fomit-frame-pointer .endif .if ${HAVE_GNOME:Mgtk12}!="" && !defined(WITHOUT_GUI) @@ -642,11 +642,9 @@ @${REINPLACE_CMD} -e \ 's|libxmms.so.1|libxmms.so|' \ ${CONFIGURE_WRKSRC}/${CONFIGURE_SCRIPT} - @${REINPLACE_CMD} -Ee 's#-pthread|-lc_r#${PTHREAD_LIBS}#g' \ - ${WRKSRC}/configure @${REINPLACE_CMD} -e 's|/dev/dvd|${DEFAULT_DVD_DEVICE}|; \ s|/dev/cdrom|${DEFAULT_CDROM_DEVICE}|' \ - ${WRKSRC}/configure + ${WRKSRC}/${CONFIGURE_SCRIPT} .if defined(WITH_RTC) @${REINPLACE_CMD} -e \ 's|||' \ Index: mplayer/files/patch-ad =================================================================== RCS file: mplayer/files/patch-ad diff -N mplayer/files/patch-ad --- mplayer/files/patch-ad 11 Jun 2004 18:08:51 -0000 1.17 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,134 +0,0 @@ ---- configure.orig Mon Apr 26 11:44:06 2004 -+++ configure Wed Apr 28 16:09:47 2004 -@@ -339,7 +339,7 @@ - - - # 1st pass checking for vital options --_install=install -+_install=@${BSD_INSTALL_PROGRAM} - _ranlib=ranlib - _cc=cc - test "$CC" && _cc="$CC" -@@ -594,22 +594,10 @@ - _cpuinfo="echo" - # Cygwin has /proc/cpuinfo, but only supports Intel CPUs - # FIXME: Remove the cygwin check once AMD CPUs are supported --if test -r /proc/cpuinfo && not cygwin; then -- # Linux with /proc mounted, extract CPU information from it -- _cpuinfo="cat /proc/cpuinfo" --elif test -r /compat/linux/proc/cpuinfo && not x86 ; then -- # FreeBSD with Linux emulation /proc mounted, -- # extract CPU information from it -- _cpuinfo="cat /compat/linux/proc/cpuinfo" --elif darwin ; then -- # use hostinfo on Darwin -- _cpuinfo="hostinfo" --elif x86; then - # all other OSes try to extract CPU information from a small helper - # program TOOLS/cpuinfo instead - $_cc -o TOOLS/cpuinfo TOOLS/cpuinfo.c - _cpuinfo="TOOLS/cpuinfo" --fi - - case "$host_arch" in - i[3-9]86|x86|x86pc|k5|k6|k6-2|k6-3|pentium*|athlon*|i586-i686) -@@ -1656,8 +1644,8 @@ - ;; - - *) -- echo "Unknown parameter: $ac_option" -- exit 1 -+ echo -n "Unknown parameter: $ac_option" -+ echo " (ignoring)." - ;; - - esac -@@ -1667,7 +1655,7 @@ - test -z "$_bindir" && _bindir="$_prefix/bin" - test -z "$_datadir" && _datadir="$_prefix/share/mplayer" - test -z "$_mandir" && _mandir="$_prefix/man" --test -z "$_confdir" && _confdir="$_prefix/etc/mplayer" -+test -z "$_confdir" && _confdir="$_prefix/share/mplayer" - test -z "$_libdir" && _libdir="$_prefix/lib" - test -z "$_mlibdir" && _mlibdir="$MLIBHOME" - -@@ -2258,13 +2246,7 @@ - - - echocheck "memalign()" --# XXX restrict to x86 ? extend to other CPUs/cacheline sizes ? --cat > $TMPC << EOF --#include --int main (void) { (void) memalign(64, sizeof(char)); return 0; } --EOF - _memalign=no --cc_check && _memalign=yes - if test "$_memalign" = yes ; then - _def_memalign='#define HAVE_MEMALIGN 1' - else -@@ -2352,40 +2334,8 @@ - - - echocheck "pthread" --cat > $TMPC << EOF --#include --void* func(void *arg) { return arg; } --int main(void) { pthread_t tid; return pthread_create (&tid, 0, func, 0) == 0 ? 0 : 1; } --EOF --if mingw32 ; then -- _ld_pthread='' --elif ( cc_check && $TMPO ) ; then # QNX -- _ld_pthread='' --elif ( cc_check -lpthread && $TMPO ) ; then -- _ld_pthread='-lpthread' --elif ( cc_check -pthread && $TMPO ) ; then -- _ld_pthread='-pthread' --else -- if test "$_ld_static" ; then -- # for crosscompilation, we cannot execute the program, be happy if we can link statically -- if ( cc_check -lpthread ) ; then -- _ld_pthread='-lpthread' -- elif ( cc_check -pthread ) ; then -- _ld_pthread='-pthread' -- else -- echores "no static pthread found (v4l, vo_gl, ao_alsa, ao_nas, ao_macosx, Win32 loader disabled)" -- _ld_pthread='' ; _nas=no ; _tv_v4l=no ; _macosx=no ; _win32=no -- fi -- else -- echores "no (v4l, vo_gl, ao_alsa, ao_nas, ao_macosx, win32 loader disabled)" -- _ld_pthread='' ; _nas=no ; _tv_v4l=no ; _macosx=no ; _win32=no -- fi --fi --if test "$_ld_pthread" != '' ; then -- echores "yes (using $_ld_pthread)" --else -- echores "no" --fi -+_ld_pthread="${PTHREAD_LIBS}" -+echores "yes (using $_ld_pthread)" - - - echocheck "sys/soundcard.h" -@@ -4458,11 +4408,11 @@ - - - echocheck "RTC" --if linux ; then -+if freebsd ; then - if test "$_rtc" = auto ; then - cat > $TMPC << EOF - #include --#include -+#include - int main(void) { return RTC_IRQP_READ; } - EOF - _rtc=no -@@ -5772,7 +5722,7 @@ - CFLAGS="$CFLAGS -D_REENTRANT" - elif bsd ; then - # FIXME bsd needs this so maybe other OS'es -- CFLAGS="$CFLAGS -D_THREAD_SAFE" -+ CFLAGS="$CFLAGS ${PTHREAD_CFLAGS}" - fi - # 64 bit file offsets? - if test "$_largefiles" = yes || freebsd ; then Index: mplayer/files/patch-configure =================================================================== RCS file: mplayer/files/patch-configure diff -N mplayer/files/patch-configure --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ mplayer/files/patch-configure 27 Jun 2004 19:17:34 -0000 @@ -0,0 +1,153 @@ +--- configure.orig Mon Apr 26 05:44:06 2004 ++++ configure Sun Jun 27 03:30:21 2004 +@@ -339,7 +339,7 @@ + + + # 1st pass checking for vital options +-_install=install ++_install=@${BSD_INSTALL_PROGRAM} + _ranlib=ranlib + _cc=cc + test "$CC" && _cc="$CC" +@@ -594,22 +594,10 @@ + _cpuinfo="echo" + # Cygwin has /proc/cpuinfo, but only supports Intel CPUs + # FIXME: Remove the cygwin check once AMD CPUs are supported +-if test -r /proc/cpuinfo && not cygwin; then +- # Linux with /proc mounted, extract CPU information from it +- _cpuinfo="cat /proc/cpuinfo" +-elif test -r /compat/linux/proc/cpuinfo && not x86 ; then +- # FreeBSD with Linux emulation /proc mounted, +- # extract CPU information from it +- _cpuinfo="cat /compat/linux/proc/cpuinfo" +-elif darwin ; then +- # use hostinfo on Darwin +- _cpuinfo="hostinfo" +-elif x86; then + # all other OSes try to extract CPU information from a small helper + # program TOOLS/cpuinfo instead + $_cc -o TOOLS/cpuinfo TOOLS/cpuinfo.c + _cpuinfo="TOOLS/cpuinfo" +-fi + + case "$host_arch" in + i[3-9]86|x86|x86pc|k5|k6|k6-2|k6-3|pentium*|athlon*|i586-i686) +@@ -1656,8 +1644,8 @@ + ;; + + *) +- echo "Unknown parameter: $ac_option" +- exit 1 ++ echo -n "Unknown parameter: $ac_option" ++ echo " (ignoring)." + ;; + + esac +@@ -1667,7 +1655,7 @@ + test -z "$_bindir" && _bindir="$_prefix/bin" + test -z "$_datadir" && _datadir="$_prefix/share/mplayer" + test -z "$_mandir" && _mandir="$_prefix/man" +-test -z "$_confdir" && _confdir="$_prefix/etc/mplayer" ++test -z "$_confdir" && _confdir="$_prefix/share/mplayer" + test -z "$_libdir" && _libdir="$_prefix/lib" + test -z "$_mlibdir" && _mlibdir="$MLIBHOME" + +@@ -2258,13 +2246,7 @@ + + + echocheck "memalign()" +-# XXX restrict to x86 ? extend to other CPUs/cacheline sizes ? +-cat > $TMPC << EOF +-#include +-int main (void) { (void) memalign(64, sizeof(char)); return 0; } +-EOF + _memalign=no +-cc_check && _memalign=yes + if test "$_memalign" = yes ; then + _def_memalign='#define HAVE_MEMALIGN 1' + else +@@ -2352,40 +2334,8 @@ + + + echocheck "pthread" +-cat > $TMPC << EOF +-#include +-void* func(void *arg) { return arg; } +-int main(void) { pthread_t tid; return pthread_create (&tid, 0, func, 0) == 0 ? 0 : 1; } +-EOF +-if mingw32 ; then +- _ld_pthread='' +-elif ( cc_check && $TMPO ) ; then # QNX +- _ld_pthread='' +-elif ( cc_check -lpthread && $TMPO ) ; then +- _ld_pthread='-lpthread' +-elif ( cc_check -pthread && $TMPO ) ; then +- _ld_pthread='-pthread' +-else +- if test "$_ld_static" ; then +- # for crosscompilation, we cannot execute the program, be happy if we can link statically +- if ( cc_check -lpthread ) ; then +- _ld_pthread='-lpthread' +- elif ( cc_check -pthread ) ; then +- _ld_pthread='-pthread' +- else +- echores "no static pthread found (v4l, vo_gl, ao_alsa, ao_nas, ao_macosx, Win32 loader disabled)" +- _ld_pthread='' ; _nas=no ; _tv_v4l=no ; _macosx=no ; _win32=no +- fi +- else +- echores "no (v4l, vo_gl, ao_alsa, ao_nas, ao_macosx, win32 loader disabled)" +- _ld_pthread='' ; _nas=no ; _tv_v4l=no ; _macosx=no ; _win32=no +- fi +-fi +-if test "$_ld_pthread" != '' ; then +- echores "yes (using $_ld_pthread)" +-else +- echores "no" +-fi ++_ld_pthread="${PTHREAD_LIBS}" ++echores "yes (using $_ld_pthread)" + + + echocheck "sys/soundcard.h" +@@ -4458,11 +4408,11 @@ + + + echocheck "RTC" +-if linux ; then ++if freebsd ; then + if test "$_rtc" = auto ; then + cat > $TMPC << EOF + #include +-#include ++#include + int main(void) { return RTC_IRQP_READ; } + EOF + _rtc=no +@@ -5736,7 +5686,7 @@ + _stripbinaries=no + elif test -z "$CFLAGS" ; then + if test "$host_arch" != "mips" ; then +- CFLAGS="-O4 $_march $_mcpu -pipe -ffast-math -fomit-frame-pointer" ++ CFLAGS="-O" + else + CFLAGS="-O4 $_march $_mcpu -ffast-math -fomit-frame-pointer" + fi +@@ -5746,6 +5696,9 @@ + _stripbinaries=no + fi + else ++ if test "$_runtime_cpudetection" = no ; then ++ CFLAGS="$CFLAGS $_march $_mcpu" ++ fi + cat <Release-Note: >Audit-Trail: >Unformatted: