pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/devel/cpuflags Updated devel/cpuflags to 1.22



details:   https://anonhg.NetBSD.org/pkgsrc/rev/585dd94cf4cd
branches:  trunk
changeset: 551145:585dd94cf4cd
user:      abs <abs%pkgsrc.org@localhost>
date:      Mon Dec 08 17:40:14 2008 +0000

description:
Updated devel/cpuflags to 1.22

  - Updates for NetBSD:
    - Report OS version in verbose mode
    - Cleanup the parsing of "cpuctl identify 0" / "grep ^cpu0: dmesg"
    - Add cases for:
      - 'AMD Athlon 64 X2 (686-class)' - thanks Ryo HAYASAKA
      - 'Intel Pentium M (Yonah) (686-class)' - thanks Juho Juopperi
      - 'Intel Pentium III (Katmai) (686-class)'
    - Adjust '-march=core2' facllback to pentium-m - thanks Thomas E. Spanjaard
    - Pickup -'msse3'
  - Updates for gcc:
    - Add some more x86 -march cases from gcc 4.3

diffstat:

 devel/cpuflags/Makefile          |   4 +-
 devel/cpuflags/files/subr_NetBSD |  87 ++++++++++++++++++++++-----------------
 devel/cpuflags/files/subr_gcc    |  10 +++-
 3 files changed, 60 insertions(+), 41 deletions(-)

diffs (183 lines):

diff -r 09b153ede2ce -r 585dd94cf4cd devel/cpuflags/Makefile
--- a/devel/cpuflags/Makefile   Mon Dec 08 17:24:19 2008 +0000
+++ b/devel/cpuflags/Makefile   Mon Dec 08 17:40:14 2008 +0000
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.127 2008/12/05 00:41:31 abs Exp $
+# $NetBSD: Makefile,v 1.128 2008/12/08 17:40:14 abs Exp $
 
-DISTNAME=      cpuflags-1.21
+DISTNAME=      cpuflags-1.22
 CATEGORIES=    devel sysutils
 MASTER_SITES=  # empty
 DISTFILES=     # empty
diff -r 09b153ede2ce -r 585dd94cf4cd devel/cpuflags/files/subr_NetBSD
--- a/devel/cpuflags/files/subr_NetBSD  Mon Dec 08 17:24:19 2008 +0000
+++ b/devel/cpuflags/files/subr_NetBSD  Mon Dec 08 17:40:14 2008 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: subr_NetBSD,v 1.5 2008/12/05 00:41:31 abs Exp $
+# $NetBSD: subr_NetBSD,v 1.6 2008/12/08 17:40:14 abs Exp $
 
 AWK=awk
 SED=sed
@@ -7,16 +7,13 @@
     {
     cat <<END
 OS             : '$(uname)'
+OS version     : '$(uname -r)'
 hw.model       : '$hw_model'
 hw.machine     : '$hw_machine'
 hw.machine_arch : '$hw_machine_arch'
-cpu details    : '$cpu'
+CPU            : '$cpu'
+$cpu_details
 END
-    
-    sed -n -e 's/^/    /' -e '/^    cpu/p' /var/run/dmesg.boot
-    if [ -x /usr/sbin/cpuctl ]; then
-       cpuctl identify 0
-    fi
     }
 
 extract_hw_details()
@@ -26,10 +23,11 @@
     hw_machine_arch=$(sysctl -n hw.machine_arch)
     if [ "$hw_machine_arch" = i386 -o "$hw_machine_arch" = x86_64 ] ; then
        if [ -x /usr/sbin/cpuctl ] ; then
-           cpu=$(cpuctl identify 0|awk '/cpu0:/{sub("cpu0: ","");print;exit}')
+           cpu_details="$(cpuctl identify 0 | grep ^cpu0:)"
        else
-           cpu=$(awk '/cpu0:/{sub("cpu0: ","");print;exit}'</var/run/dmesg.boot)
+           cpu_details="$(grep ^cpu0: /var/run/dmesg.boot)"
        fi
+       cpu=$(echo "$cpu_details"|awk '/cpu0:/{sub("cpu0: ","");print;exit}')
     fi
 
     # We're almost certainly crosscompiling
@@ -94,29 +92,33 @@
 
     i386 | x86_64)
        case "$cpu" in
-           'AMD Athlon 64 or Athlon 64 FX or Opteron '*) ARCH='-march=opteron' ;;
-           'AMD Athlon 64 or Sempron (686-class)'*) ARCH='-march=athlon64' ;;
-           'AMD Dual-Core Opteron or Athlon 64 X2 '*) ARCH='-march=opteron' ;;
-           'AMD Athlon Model 4 (Thunderbird) '*) ARCH='-march=athlon-tbird' ;;
-           'Intel (686-class)'*)               ARCH='-march=pentiumpro' ;;
-           'Intel Celeron (686-class)'*)       ARCH='-march=pentiumpro' ;;
-           'Intel Core 2 (Merom) (686-class)'*) ARCH='-march=core2' ;;
-           'Intel Pentium 4 (686-class)'*)     ARCH='-march=pentium4' ;;
-           'Intel Pentium II (686-class)'*)    ARCH='-march=pentium2' ;;
-           'Intel Pentium III (686-class)'*)   ARCH='-march=pentium3' ;;
-           'Intel Pentium III Xeon (686-class)'*) ARCH='-march=pentium3' ;;
-           'Intel Pentium M (Dothan) (686-class)'*) ARCH='-march=pentium-m' ;;
-           # Fallback classes
-           *'(586-class)'*)                    ARCH='-march=pentium' ;;
-           *'(486-class)'*)                    ARCH='-march=i486' ;;
+       'AMD Athlon 64 X2 (686-class)'*)           ARCH='-march=athlon64' ;;
+       'AMD Athlon 64 or Athlon 64 FX or Opteron '*) ARCH='-march=opteron' ;;
+       'AMD Athlon 64 or Sempron (686-class)'*)   ARCH='-march=athlon64' ;;
+       'AMD Athlon Model 4 (Thunderbird) '*)      ARCH='-march=athlon-tbird' ;;
+       'AMD Dual-Core Opteron or Athlon 64 X2 '*) ARCH='-march=opteron' ;;
+       'Intel (686-class)'*)                      ARCH='-march=pentiumpro' ;;
+       'Intel Celeron (686-class)'*)              ARCH='-march=pentiumpro' ;;
+       'Intel Core 2 (Merom) (686-class)'*)       ARCH='-march=core2' ;;
+       'Intel Pentium 4 (686-class)'*)            ARCH='-march=pentium4' ;;
+       'Intel Pentium II (686-class)'*)           ARCH='-march=pentium2' ;;
+       'Intel Pentium III (686-class)'*)          ARCH='-march=pentium3' ;;
+       'Intel Pentium III (Katmai) (686-class)'*) ARCH='-march=pentium3' ;;
+       'Intel Pentium III Xeon (686-class)'*)     ARCH='-march=pentium3' ;;
+       'Intel Pentium M (Dothan) (686-class)'*)   ARCH='-march=pentium-m' ;;
+       'Intel Pentium M (Yonah) (686-class)'*)    ARCH='-march=pentium-m' ;;
+
+       # Fallback classes
+       *'(586-class)'*)                           ARCH='-march=pentium' ;;
+       *'(486-class)'*)                           ARCH='-march=i486' ;;
        esac
        ;;
 
     m68k) case $hw_model in                               # Examples
-       *\(68020*|*\ MC68020\ *) ARCH='-m68020' ;; # Untested
-       *\(68030*|*\ MC68030\ *) ARCH='-m68030' ;; # Mac LC III
-       *\(68040*|*\ MC68040\ *) ARCH='-m68040' ;; # Untested
-       *\(68060*|*\ MC68060\ *) ARCH='-m68060' ;; # Upgraded amiga 3000
+       *\(68020*|*\ MC68020\ *) ARCH='-m68020' ;; # Untested
+       *\(68030*|*\ MC68030\ *) ARCH='-m68030' ;; # Mac LC III
+       *\(68040*|*\ MC68040\ *) ARCH='-m68040' ;; # Untested
+       *\(68060*|*\ MC68060\ *) ARCH='-m68060' ;; # Upgraded amiga 3000
     esac
     ;;
 
@@ -159,7 +161,7 @@
        7410\ *)                ARCH='-mcpu=7400'       ;; # powerbook g4
        7447A\ *)               ARCH='-mcpu=7450'       ;; #
        7450\ *)                ARCH='-mcpu=7450'       ;; # tibook 550
-        750\ *)                       ARCH='-mcpu=750'       ;; # orig. iBook
+       750\ *)                ARCH='-mcpu=750'       ;; # orig. iBook
 
     esac ;;
 
@@ -168,11 +170,11 @@
        *[\ \(]L64811*)         ARCH='-mcpu=cypress'            ;; # sun4/sun4c
        *[\ \(]CY7C601*)        ARCH='-mcpu=cypress'            ;; # ss2
        *[\ \(]W8601/8701*)     ARCH='-mcpu=cypress'            ;; # elc
-       *[\ \(]MB86904*)        ARCH='-mcpu=supersparc' ;; # ss5 usparc
-       *[\ \(]MB86907*)        ARCH='-mcpu=supersparc' ;; # ss5 usparc
-       *[\ \(]TMS390S10*)      ARCH='-mcpu=supersparc' ;; # classic  "
-       *[\ \(]TMS390Z50*)      ARCH='-mcpu=supersparc' ;; # ss10/ss20
-       *[\ \(]RT620/625*)      ARCH='-mcpu=hypersparc' ;; # ss20 ross
+       *[\ \(]MB86904*)        ARCH='-mcpu=supersparc' ;; # ss5 usparc
+       *[\ \(]MB86907*)        ARCH='-mcpu=supersparc' ;; # ss5 usparc
+       *[\ \(]TMS390S10*)      ARCH='-mcpu=supersparc' ;; # classic  "
+       *[\ \(]TMS390Z50*)      ARCH='-mcpu=supersparc' ;; # ss10/ss20
+       *[\ \(]RT620/625*)      ARCH='-mcpu=hypersparc' ;; # ss20 ross
        *[\ \(]MB86930*)        ARCH='-mcpu=sparclite'          ;; # from gcc
        *[\ \(]MB86934*)        ARCH='-mcpu=sparclite'          ;; # from gcc
        # under 1.5.1 -mcpu=ultrasparc chokes egcs-2.91.66 compiling perl
@@ -190,11 +192,22 @@
 determine_features()
     {
     FEATURES=
+
     case $hw_machine_arch in
-       i386)
-           if [ "$(sysctl -n machdep.sse2)" = 1 ] ; then
+       i386 | x86_64)
+           # Set cpu_feature_FOO=1 for each 'FOO' feature reported
+           eval $(echo "$cpu_details" | awk -F , '
+           /cpu0: features/ {
+               sub(".*<","");
+               sub(">.*","");
+               gsub("[^,A-Z0-9]","_");
+               for (i = 1; i < NR; i++) { print "cpu_feature_"$i"=1" } }
+               ')
+           if [ -n "$cpu_feature_SSE3" ] ; then
+               FEATURES="-mfpmath=sse -msse3"
+           elif [ -n "$cpu_feature_SSE2" ] ; then
                FEATURES="-mfpmath=sse -msse2"
-           elif [ "$(sysctl -n machdep.sse)" = 1 ] ; then
+           elif [ -n "$cpu_feature_SSE" ] ; then
                FEATURES="-mfpmath=sse -msse"
            fi
            ;;
diff -r 09b153ede2ce -r 585dd94cf4cd devel/cpuflags/files/subr_gcc
--- a/devel/cpuflags/files/subr_gcc     Mon Dec 08 17:24:19 2008 +0000
+++ b/devel/cpuflags/files/subr_gcc     Mon Dec 08 17:40:14 2008 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: subr_gcc,v 1.4 2008/12/04 11:45:35 abs Exp $
+# $NetBSD: subr_gcc,v 1.5 2008/12/08 17:40:14 abs Exp $
 
 # Return gcc version string
 gcc_ver()
@@ -109,6 +109,12 @@
 3.4:-msse3:
 4.2:-m3dnow:
 4.2:-march=native:
-4.3:-march=core2:-march=pentium3
+4.3:-march=amdfam10:-march=athlon64
+4.3:-march=athlon64-sse3:-march=athlon64
+4.3:-march=barcelona:-march=athlon64
+4.3:-march=core2:-march=pentium-m
+4.3:-march=geode:-march=k6-3
+4.3:-march=k8-sse3:-march=k8
+4.3:-march=opteron-sse3:-march=opteron
 EOD
     }



Home | Main Index | Thread Index | Old Index