summaryrefslogtreecommitdiff
path: root/devel/cpuflags
diff options
context:
space:
mode:
authorabs <abs>2008-12-08 17:40:14 +0000
committerabs <abs>2008-12-08 17:40:14 +0000
commit18bfa8334fd1bda53cbca4433d957538589f812e (patch)
tree6b8e6d1fcfbc77c1cdad9ac66f69ed08a8d5adc6 /devel/cpuflags
parentda42c42426705a7bd42a6487230f20880835a86f (diff)
downloadpkgsrc-18bfa8334fd1bda53cbca4433d957538589f812e.tar.gz
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 (limited to 'devel/cpuflags')
-rw-r--r--devel/cpuflags/Makefile4
-rwxr-xr-xdevel/cpuflags/files/subr_NetBSD87
-rw-r--r--devel/cpuflags/files/subr_gcc10
3 files changed, 60 insertions, 41 deletions
diff --git a/devel/cpuflags/Makefile b/devel/cpuflags/Makefile
index 5ad4068a271..0caddaa6673 100644
--- a/devel/cpuflags/Makefile
+++ b/devel/cpuflags/Makefile
@@ -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 --git a/devel/cpuflags/files/subr_NetBSD b/devel/cpuflags/files/subr_NetBSD
index dc1a8c35749..1ffdb226dfb 100755
--- a/devel/cpuflags/files/subr_NetBSD
+++ b/devel/cpuflags/files/subr_NetBSD
@@ -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 @@ display_hw_details()
{
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 @@ extract_hw_details()
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 @@ determine_arch()
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 @@ determine_arch()
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 @@ determine_arch()
*[\ \(]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_arch()
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 --git a/devel/cpuflags/files/subr_gcc b/devel/cpuflags/files/subr_gcc
index 4ae3fa6f79e..3d5bb6d7964 100644
--- a/devel/cpuflags/files/subr_gcc
+++ b/devel/cpuflags/files/subr_gcc
@@ -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 @@ gcc_fixup_arch_flags()
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
}