pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/doc Update cpuflags to 0.75



details:   https://anonhg.NetBSD.org/pkgsrc/rev/65ba05e0da14
branches:  trunk
changeset: 479057:65ba05e0da14
user:      abs <abs%pkgsrc.org@localhost>
date:      Wed Aug 04 11:39:43 2004 +0000

description:
Update cpuflags to 0.75
  - all:
    Implement 'cpuflags -v' which indicates the values used to determine flags
    Sync the latest fixup options for older gccs
  - cpuflags.NetBSD:
    Use -march=pentium3m and -march=pentium4m for gcc 3.4.x
    Set -mcpu=hypersparc for RT620/625 and -mcpu=cypress for L64811
  - cpuflags.Linux:
    Handle two different Celeron cases (thanks to Marc Recht & Jeremy C. Reed)

diffstat:

 devel/cpuflags/Makefile              |    4 +-
 devel/cpuflags/files/cpuflags.Linux  |   42 ++++++++++-
 devel/cpuflags/files/cpuflags.NetBSD |   42 ++++++++--
 devel/cpuflags/files/cpuflags.SunOS  |  126 ++++++++++++++++++++++++++++------
 doc/CHANGES                          |    4 +-
 5 files changed, 177 insertions(+), 41 deletions(-)

diffs (truncated from 355 to 300 lines):

diff -r 28d6298bbee1 -r 65ba05e0da14 devel/cpuflags/Makefile
--- a/devel/cpuflags/Makefile   Wed Aug 04 11:20:39 2004 +0000
+++ b/devel/cpuflags/Makefile   Wed Aug 04 11:39:43 2004 +0000
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.77 2004/07/28 16:54:03 abs Exp $
+# $NetBSD: Makefile,v 1.78 2004/08/04 11:39:43 abs Exp $
 #
 
-DISTNAME=      cpuflags-0.74
+DISTNAME=      cpuflags-0.75
 CATEGORIES=    sysutils
 MASTER_SITES=  # empty
 DISTFILES=     # empty
diff -r 28d6298bbee1 -r 65ba05e0da14 devel/cpuflags/files/cpuflags.Linux
--- a/devel/cpuflags/files/cpuflags.Linux       Wed Aug 04 11:20:39 2004 +0000
+++ b/devel/cpuflags/files/cpuflags.Linux       Wed Aug 04 11:39:43 2004 +0000
@@ -1,38 +1,68 @@
 #!/bin/sh
-# $NetBSD: cpuflags.Linux,v 1.7 2004/07/28 16:54:03 abs Exp $
+# $NetBSD: cpuflags.Linux,v 1.8 2004/08/04 11:39:44 abs Exp $
 PATH=/sbin:/usr/sbin:/bin:/usr/bin:$PATH
 
+if [ "$1" = -v ] ; then
+    shift
+    opt_v=1
+fi
 if [ -n "$1" ]; then
     CC=$1
 else
     CC=gcc
 fi
 
+display_hw_details()
+    {
+    echo "  proc model      : '$hw_model'"
+    echo "  machine_arch    : '$hw_machine_arch'"
+    echo "  proc flags      : '$hw_flags'"
+    }
+
 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)
+    hw_model=$(awk -F: '/^model name/{sub(" ","",$2);print $2}' /proc/cpuinfo)
+    hw_flags=$(awk -F: '/^flags/{sub(" ","",$2);print $2}' /proc/cpuinfo)
 fi
 
 case $hw_machine_arch in
     # i386
     i386)                              FLAGS='-march=i386'             ;;
     i486)                              FLAGS='-march=i486'             ;;
-    i586)                              FLAGS='-march=pentium'          ;;
     i686) case $hw_model in
+       "AMD Duron(tm) ")               FLAGS='-march=athlon'           ;;
        "AMD Duron(TM)")                FLAGS='-march=athlon'           ;;
        "AMD Athlon(tm) XP "*)          FLAGS='-march=athlon-xp'        ;;
+       "Celeron (Coppermine)")         FLAGS='-march=pentium3'         ;;
+       "Intel(R) Celeron(R) CPU "*)
+           case "$hw_flags" in
+               *" sse2 "*)
+                                       FLAGS='-march=pentium4'         ;;
+           esac 
+
     esac
     ;;
     #
 esac
 
+############
+# Everything from this point common between all cpuflags variants.
+
+if [ -n "$opt_v" ] ; then
+    if [ -z "$NONE" ] ; then
+       echo "CPUFLAGS=Unknown"
+    else
+       echo "CPUFLAGS=None"
+    fi
+    display_hw_details
+    exit
+fi
 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
+    display_hw_details                                                 >&2
 fi
 
 # Fixup options for older gccs.
@@ -100,7 +130,7 @@
 3.3:-march=winchip-c6:-march=i586
 3.3:-march=winchip2:-march=i586
 3.4:-march=athlon64:-march=athlon-xp
-3.4:-march=athlong-fx:-march=athlon-xp
+3.4:-march=athlon-fx:-march=athlon-xp
 3.4:-march=c3-2:-march=c3
 3.4:-march=k8:-march=athlon-xp
 3.4:-march=nocona:-march=pentium4
diff -r 28d6298bbee1 -r 65ba05e0da14 devel/cpuflags/files/cpuflags.NetBSD
--- a/devel/cpuflags/files/cpuflags.NetBSD      Wed Aug 04 11:20:39 2004 +0000
+++ b/devel/cpuflags/files/cpuflags.NetBSD      Wed Aug 04 11:39:43 2004 +0000
@@ -1,13 +1,26 @@
 #!/bin/sh
-# $NetBSD: cpuflags.NetBSD,v 1.53 2004/07/28 16:54:03 abs Exp $
+# $NetBSD: cpuflags.NetBSD,v 1.54 2004/08/04 11:39:44 abs Exp $
 PATH=/sbin:/usr/sbin:/bin:/usr/bin:$PATH
 
+if [ "$1" = -v ] ; then
+    shift
+    opt_v=1
+fi
 if [ -n "$1" ]; then
     CC=$1
 else
     CC=gcc
 fi
 
+display_hw_details()
+    {
+    echo "  hw.model        : '$hw_model'"
+    echo "  hw.machine      : '$hw_machine'"
+    echo "  hw.machine_arch : '$hw_machine_arch'"
+    echo "  cpu details     :"
+    sed -n -e 's/^/    /' -e '/^    cpu/p' /var/run/dmesg.boot
+    }
+
 hw_model=$(sysctl -n hw.model)
 hw_machine=$(sysctl -n hw.machine)
 hw_machine_arch=$(sysctl -n hw.machine_arch)
@@ -63,8 +76,8 @@
        *Intel\ Pentium\ III\ *)        FLAGS='-march=pentium3'         ;;
        *Intel\ Mobile\ Pentium\ III\ *) FLAGS='-march=pentium3'        ;;
        *Intel\ Celeron\ \(Mendocino\)\ *) FLAGS='-march=pentium3 -mno-sse' ;;
-       *Intel\ Pentium\ M\ *)          FLAGS='-march=pentium3'         ;;
-       *Intel\ Mobile\ Pentium\ 4\ *)  FLAGS='-march=pentium4'         ;;
+       *Intel\ Pentium\ M\ *)          FLAGS='-march=pentium3m'        ;;
+       *Intel\ Mobile\ Pentium\ 4\ *)  FLAGS='-march=pentium4m'        ;;
        *Intel\ Pentium\ 4\ *)          FLAGS='-march=pentium4'         ;;
        *VIA\ C3*\ Samuel*)             FLAGS='-march=c3'               ;;
        *AMD\ K6-III*)                  FLAGS='-march=k6-3'             ;;
@@ -131,13 +144,14 @@
 
     sparc | sparc64) case " $hw_model" in                         # Examples
        *[\ \(]MB86900/1A*)     FLAGS='-mcpu=cypress'           ;; # ss1+
+       *[\ \(]L64811*)         FLAGS='-mcpu=cypress'           ;; # sun4/sun4c
        *[\ \(]CY7C601*)        FLAGS='-mcpu=cypress'           ;; # ss2
        *[\ \(]W8601/8701*)     FLAGS='-mcpu=cypress'           ;; # elc
        *[\ \(]MB86904*)        FLAGS='-mcpu=supersparc'        ;; # ss5 usparc
        *[\ \(]MB86907*)        FLAGS='-mcpu=supersparc'        ;; # ss5 usparc
        *[\ \(]TMS390S10*)      FLAGS='-mcpu=supersparc'        ;; # classic  "
        *[\ \(]TMS390Z50*)      FLAGS='-mcpu=supersparc'        ;; # ss10/ss20
-       *[\ \(]RT620/625*)      FLAGS='-mcpu=supersparc'        ;; # ss20 ross
+       *[\ \(]RT620/625*)      FLAGS='-mcpu=hypersparc'        ;; # ss20 ross
        *[\ \(]MB86930*)        FLAGS='-mcpu=sparclite'         ;; # from gcc
        *[\ \(]MB86934*)        FLAGS='-mcpu=sparclite'         ;; # from gcc
        # under 1.5.1 -mcpu=ultrasparc chokes egcs-2.91.66 compiling perl
@@ -154,13 +168,21 @@
 
 esac
 
+############
+# Everything from this point common between all cpuflags variants.
+
+if [ -n "$opt_v" ] ; then
+    if [ -z "$NONE" ] ; then
+       echo "CPUFLAGS=Unknown"
+    else
+       echo "CPUFLAGS=None"
+    fi
+    display_hw_details
+    exit
+fi
 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      : '$hw_machine'"                           >&2
-    echo "  hw.machine_arch : '$hw_machine_arch'"                      >&2
-    echo "  cpu details     :"                                         >&2
-    egrep '^cpu' /var/run/dmesg.boot                                   >&2
+    display_hw_details                                                 >&2
 fi
 
 # Fixup options for older gccs.
@@ -228,7 +250,7 @@
 3.3:-march=winchip-c6:-march=i586
 3.3:-march=winchip2:-march=i586
 3.4:-march=athlon64:-march=athlon-xp
-3.4:-march=athlong-fx:-march=athlon-xp
+3.4:-march=athlon-fx:-march=athlon-xp
 3.4:-march=c3-2:-march=c3
 3.4:-march=k8:-march=athlon-xp
 3.4:-march=nocona:-march=pentium4
diff -r 28d6298bbee1 -r 65ba05e0da14 devel/cpuflags/files/cpuflags.SunOS
--- a/devel/cpuflags/files/cpuflags.SunOS       Wed Aug 04 11:20:39 2004 +0000
+++ b/devel/cpuflags/files/cpuflags.SunOS       Wed Aug 04 11:39:43 2004 +0000
@@ -1,39 +1,121 @@
 #!/bin/sh
-# $NetBSD: cpuflags.SunOS,v 1.2 2002/07/13 11:27:29 wiz Exp $
+# $NetBSD: cpuflags.SunOS,v 1.3 2004/08/04 11:39:44 abs Exp $
+PATH=/sbin:/usr/sbin:/bin:/usr/bin:$PATH
 
-arch=`/usr/bin/uname -m`
+if [ "$1" = -v ] ; then
+    shift
+    opt_v=1
+fi
+if [ -n "$1" ]; then
+    CC=$1
+else
+    CC=gcc
+fi
 
-case $arch in
+display_hw_details()
+    {
+    echo "  arch            : '$hw_arch'"
+    }
+
+hw_arch=`/usr/bin/uname -m`
+
+case $hw_arch in
     sun4c | sun4 )             FLAGS='-mcpu=cypress' ;;
     sun4m )                    FLAGS='-mcpu=supersparc' ;;
     sun4u )                    FLAGS='-mcpu=v9' ;;
 esac
 
+############
+# Everything from this point common between all cpuflags variants.
+
+if [ -n "$opt_v" ] ; then
+    if [ -z "$NONE" ] ; then
+       echo "CPUFLAGS=Unknown"
+    else
+       echo "CPUFLAGS=None"
+    fi
+    display_hw_details
+    exit
+fi
 if [ -z "$FLAGS" -a -z "$NONE" ] ; then
     echo 'Unknown machine - please send details to abs%netbsd.org@localhost'   >&2
-    echo "  arch            : '$arch'"                         >&2
+    display_hw_details                                                 >&2
 fi
 
-# Fixup flags for old gcc
+# 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 | nawk '/gcc version/ {sub("egcs-","");print $3}'`
-    FLAGS=`nawk -v "flags=$FLAGS" -v "gcc_ver=$gcc_ver" '
-       {if (gcc_ver < $1){map[$2] = ""$3}}
-       END{if (flags in map) {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   -mcpu=21164a    
-2.90   -march=i386             -mno-486
-2.90   -march=i486             -m486
-2.90   -march=pentium          -m486
-2.90   -march=pentiumpro       -m486
-2.90   -mcpu=supersparc        -msupersparc
-2.90   -mcpu=sparclite         -msparclite
-2.90   -mcpu=cypress           -mcypress
-2.90   -mcpu=v9                -mv8
-2.90   -mcpu=arm610            -m6
-2.90   -mcpu=strongarm110      -m6
-2.90   -mcpu=arm710            -m6
-2.95   -march=k6               -march=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=athlon
+3.1:-march=athlon-mp:-march=athlon
+3.1:-march=athlon-tbird:-march=athlon
+3.1:-march=athlon-xp:-march=athlon
+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



Home | Main Index | Thread Index | Old Index