pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/devel/cpuflags Update cpuflags to 0.73:



details:   https://anonhg.NetBSD.org/pkgsrc/rev/b9ca0bf11b11
branches:  trunk
changeset: 478644:b9ca0bf11b11
user:      abs <abs%pkgsrc.org@localhost>
date:      Tue Jul 27 19:25:44 2004 +0000

description:
Update cpuflags to 0.73:
        sync cpuflags.Linux with cpuflags.NetBSD, at least optimise for
        Duron in cpuflags.Linux

diffstat:

 devel/cpuflags/Makefile              |    4 +-
 devel/cpuflags/files/cpuflags.Linux  |  117 ++++++++++++++++++++++++++--------
 devel/cpuflags/files/cpuflags.NetBSD |   33 ++++-----
 3 files changed, 105 insertions(+), 49 deletions(-)

diffs (235 lines):

diff -r c660f6a5b83d -r b9ca0bf11b11 devel/cpuflags/Makefile
--- a/devel/cpuflags/Makefile   Tue Jul 27 17:59:58 2004 +0000
+++ b/devel/cpuflags/Makefile   Tue Jul 27 19:25:44 2004 +0000
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.75 2004/07/06 23:00:10 abs Exp $
+# $NetBSD: Makefile,v 1.76 2004/07/27 19:25:44 abs Exp $
 #
 
-DISTNAME=      cpuflags-0.72
+DISTNAME=      cpuflags-0.73
 CATEGORIES=    sysutils
 MASTER_SITES=  # empty
 DISTFILES=     # empty
diff -r c660f6a5b83d -r b9ca0bf11b11 devel/cpuflags/files/cpuflags.Linux
--- a/devel/cpuflags/files/cpuflags.Linux       Tue Jul 27 17:59:58 2004 +0000
+++ b/devel/cpuflags/files/cpuflags.Linux       Tue Jul 27 19:25:44 2004 +0000
@@ -1,44 +1,105 @@
 #!/bin/sh
-# $NetBSD: cpuflags.Linux,v 1.5 2001/11/27 12:26:12 abs Exp $
+# $NetBSD: cpuflags.Linux,v 1.6 2004/07/27 19:25:44 abs Exp $
+PATH=/sbin:/usr/sbin:/bin:/usr/bin:$PATH
+
+if [ -n "$1" ]; then
+    CC=$1
+else
+    CC=gcc
+fi
 
-hw_model=`uname -m`
+hw_machine_arch=$(uname -m)
+if [ ! -f /proc/cpuinfo ] ; then
+    echo "Unable to open /proc/cpuinfo"
+    hw_model=Unknown
+else
+    hw_model=$(awk -F: '/model name/{sub(" ","",$2);print $2}' /proc/cpuinfo)
+fi
 
-case $hw_model in
+case $hw_machine_arch in
     # i386
-    i386)      FLAGS='-march=i386'             ;;
-    i486)      FLAGS='-march=i486'             ;;
-    i586)      FLAGS='-march=pentium'          ;;
-    i686)      FLAGS='-march=pentiumpro'       ;;
+    i386)                              FLAGS='-march=i386'     ;;
+    i486)                              FLAGS='-march=i486'     ;;
+    i586)                              FLAGS='-march=pentium'  ;;
+    i686) case $hw_model in
+       "AMD Duron(TM)")                FLAGS='-march=athlon'   ;;
+    esac
+    ;;
     #
-    *)         echo "Unknown hw.model '$hw_model'"                     >&2
-               echo "Please send machine details to abs%netbsd.org@localhost"  >&2
-                                               ;;
 esac
 
-# Fixup flags for old gcc
+if [ -z "$FLAGS" -a -z "$NONE" ] ; then
+    echo 'Unknown machine - please send details to abs%netbsd.org@localhost'   >&2
+    echo "  hw.model        : '$hw_model'"                             >&2
+    echo "  hw.machine_arch : '$hw_machine_arch'"                      >&2
+fi
+
+# Fixup options for older gccs.
+# Entries can be recursive - eg:
+#   -march=k6-3 -> -march=k6 -> -march=pentium -> -march=i486
+#
+# The format of table is
+#   gcc_version_in_which_option_was_introduced new_option  old_option
+
 if [ -n "$FLAGS" ]; then
-    gcc_ver=`gcc -v 2>&1 | awk '/gcc version/ {sub("egcs-","");print $3}'`
-    FLAGS=`awk -v "flags=$FLAGS" -v "gcc_ver=$gcc_ver" '
-       {if (gcc_ver < $1){map["-m"$2] = "-m"$3}}
-       END{if (map[flags]) {print map[flags]}else {print flags}}
+    gcc_ver=`${CC} -dumpversion | sed 's/^egcs-//'`
+    FLAGS=`awk -F: -v "flags=$FLAGS" -v "gcc_ver=$gcc_ver" '
+       { if (gcc_ver < $1){map[$2] = ""$3} }
+       END { while (flags in map) {flags = map[flags]} print flags }
        ' <<EOD
-2.90   arch=i386               no-486
-2.90   arch=i486               486
-2.90   arch=pentium            486
-2.90   arch=pentiumpro         486
-2.90   cpu=supersparc          supersparc
-2.90   cpu=sparclite           sparclite
-2.90   cpu=cypress             cypress
-2.90   cpu=v9                  v8
-2.90   cpu=arm610              6
-2.90   cpu=strongarm110        6
-2.90   cpu=arm710              6
-2.95   arch=k6                 arch=pentium
+2.90:-march=i386:-mno-486
+2.90:-march=i486:-m486
+2.90:-march=pentium:-m486
+2.90:-march=pentiumpro:-m486
+2.90:-mcpu=21164a:
+2.90:-mcpu=arm610:-m6
+2.90:-mcpu=arm710:-m6
+2.90:-mcpu=cypress:-mcypress
+2.90:-mcpu=sparclite:-msparclite
+2.90:-mcpu=strongarm110:-m6
+2.90:-mcpu=supersparc:-msupersparc
+2.90:-mcpu=v9:-mv8
+2.95:-march=k6:-march=pentium
+3.0:-march=athlon:-march=pentiumpro
+3.1:-march=athlon-4:-march=pentiumpro
+3.1:-march=athlon-mp:-march=pentiumpro
+3.1:-march=athlon-tbird:-march=pentiumpro
+3.1:-march=athlon-xp:-march=pentiumpro
+3.1:-march=k6-2:-march=k6
+3.1:-march=k6-3:-march=k6
+3.1:-march=pentium-mmx:-march=pentium
+3.1:-march=pentium2:-march=pentiumpro
+3.1:-march=pentium3 -mno-sse:-march=pentiumpro
+3.1:-march=pentium3:-march=pentiumpro
+3.1:-march=pentium4:-march=pentiumpro
+3.1:-march=r2000:-cpu=r2000
+3.1:-march=r3000:-cpu=r3000
+3.1:-march=r3900:-cpu=r3900
+3.1:-march=r4000:-cpu=r4000
+3.1:-march=r4100:-cpu=r4100
+3.1:-march=r4300:-cpu=r4300
+3.1:-march=r4400:-cpu=r4400
+3.1:-march=r4600:-cpu=r4600
+3.1:-march=r5000:-cpu=r5000
+3.1:-march=r6000:-cpu=r6000
+3.1:-march=r8000:-cpu=r8000
+3.1:-mcpu=21264a:-mcpu=21264
+3.1:-mtune=r2000:-cpu=r2000
+3.1:-mtune=r3000:-cpu=r3000
+3.1:-mtune=r3900:-cpu=r3900
+3.1:-mtune=r4000:-cpu=r4000
+3.1:-mtune=r4100:-cpu=r4100
+3.1:-mtune=r4300:-cpu=r4300
+3.1:-mtune=r4400:-cpu=r4400
+3.1:-mtune=r4600:-cpu=r4600
+3.1:-mtune=r5000:-cpu=r5000
+3.1:-mtune=r6000:-cpu=r6000
+3.1:-mtune=r8000:-cpu=r8000
+3.3:-march=c3:-march=i586
 EOD
 `
 fi
 
-
 echo $FLAGS
 
 exit 0
diff -r c660f6a5b83d -r b9ca0bf11b11 devel/cpuflags/files/cpuflags.NetBSD
--- a/devel/cpuflags/files/cpuflags.NetBSD      Tue Jul 27 17:59:58 2004 +0000
+++ b/devel/cpuflags/files/cpuflags.NetBSD      Tue Jul 27 19:25:44 2004 +0000
@@ -1,15 +1,16 @@
 #!/bin/sh
-# $NetBSD: cpuflags.NetBSD,v 1.51 2004/07/06 23:00:10 abs Exp $
+# $NetBSD: cpuflags.NetBSD,v 1.52 2004/07/27 19:25:44 abs Exp $
+PATH=/sbin:/usr/sbin:/bin:/usr/bin:$PATH
 
-if [ -x /sbin/sysctl ] ;then
-    SYSCTL=/sbin/sysctl
+if [ -n "$1" ]; then
+    CC=$1
 else
-    SYSCTL=/usr/sbin/sysctl    # NetBSD 1.3
+    CC=gcc
 fi
 
-hw_machine=`$SYSCTL -n hw.machine`
-hw_machine_arch=`$SYSCTL -n hw.machine_arch`
-hw_model=`$SYSCTL -n hw.model`
+hw_model=$(sysctl -n hw.model)
+hw_machine=$(sysctl -n hw.machine)
+hw_machine_arch=$(sysctl -n hw.machine_arch)
 
 # We're almost certainly crosscompiling
 if [ -n "$MACHINE" -a $hw_machine != "$MACHINE" ]; then
@@ -17,18 +18,12 @@
     exit
 fi
 
-if [ -n "$1" ]; then
-    CC=$1
-else
-    CC=gcc
-fi
-
 # When adding $hw_model tests use maximum context (such as trailing space)
 case $hw_machine_arch in
 
     alpha)
        # cpu0 at mainbus0: ID 0 (primary), 21164A-0 (unknown ...
-       case "`egrep '^cpu0 ' /var/run/dmesg.boot`" in
+       case "$(egrep '^cpu0 ' /var/run/dmesg.boot)" in
            *[\(\ ]2106[46][-A\ \)]*)   FLAGS="-mcpu=21064"     ;;
            *[\(\ ]21164[-\ \)]*)       FLAGS="-mcpu=21164"     ;;
            *[\(\ ]21164A[-\ \)]*)      FLAGS="-mcpu=21164a"    ;;
@@ -94,7 +89,7 @@
        *\(68040*|*\ MC68040\ *) FLAGS='-m68040'        ;; # Untested
        *\(68060*|*\ MC68060\ *) FLAGS='-m68060'        ;; # Upgr amiga 3000
     esac
-    case "`egrep '^fpu0 ' /var/run/dmesg.boot`" in
+    case "$(egrep '^fpu0 ' /var/run/dmesg.boot)" in
        *\(emulator\)*)         FLAGS="$FLAGS -msoft-float" ;; 
        *\(no\ math\ support\)*) FLAGS="$FLAGS -msoft-float" ;; 
     esac
@@ -102,7 +97,7 @@
 
     mipseb|mipsel)
        # cpu0 at mainbus0: QED R4600 Orion CPU (0x2020) Rev. 2.0 with ...
-       case "`egrep '^cpu0 ' /var/run/dmesg.boot`" in
+       case "$(egrep '^cpu0 ' /var/run/dmesg.boot)" in
            *\ MIPS\ R2000\ *)  FLAGS="-march=r2000"       ;;
            *\ MIPS\ R3000\ *)  FLAGS="-march=r3000"       ;;
            *\ MIPS\ R3000A\ *) FLAGS="-march=r3000"       ;;
@@ -176,8 +171,8 @@
 #   gcc_version_in_which_option_was_introduced new_option  old_option
 
 if [ -n "$FLAGS" ]; then
-    gcc_ver=`${CC} -dumpversion | sed 's/^egcs-//'`
-    FLAGS=`awk -F: -v "flags=$FLAGS" -v "gcc_ver=$gcc_ver" '
+    gcc_ver=$(${CC} -dumpversion | sed 's/^egcs-//')
+    FLAGS=$(awk -F: -v "flags=$FLAGS" -v "gcc_ver=$gcc_ver" '
        { if (gcc_ver < $1){map[$2] = ""$3} }
        END { while (flags in map) {flags = map[flags]} print flags }
        ' <<EOD
@@ -231,7 +226,7 @@
 3.1:-mtune=r8000:-cpu=r8000
 3.3:-march=c3:-march=i586
 EOD
-`
+)
 fi
 
 echo $FLAGS



Home | Main Index | Thread Index | Old Index