diff options
author | abs <abs@pkgsrc.org> | 2004-08-04 11:39:43 +0000 |
---|---|---|
committer | abs <abs@pkgsrc.org> | 2004-08-04 11:39:43 +0000 |
commit | 876cf499e835e9b29270ba2f9e86f0b175391bdc (patch) | |
tree | b5ff584261995bf3c4eeb90fd5ebb9d8a59ecc52 /devel | |
parent | e820febb122f671bea40650b315e40de4a65a050 (diff) | |
download | pkgsrc-876cf499e835e9b29270ba2f9e86f0b175391bdc.tar.gz |
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 (limited to 'devel')
-rw-r--r-- | devel/cpuflags/Makefile | 4 | ||||
-rwxr-xr-x | devel/cpuflags/files/cpuflags.Linux | 42 | ||||
-rwxr-xr-x | devel/cpuflags/files/cpuflags.NetBSD | 42 | ||||
-rwxr-xr-x | devel/cpuflags/files/cpuflags.SunOS | 126 |
4 files changed, 174 insertions, 40 deletions
diff --git a/devel/cpuflags/Makefile b/devel/cpuflags/Makefile index dd68119c42c..37f72ed82ee 100644 --- a/devel/cpuflags/Makefile +++ b/devel/cpuflags/Makefile @@ -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 --git a/devel/cpuflags/files/cpuflags.Linux b/devel/cpuflags/files/cpuflags.Linux index ac8752a4af8..c6921375042 100755 --- a/devel/cpuflags/files/cpuflags.Linux +++ b/devel/cpuflags/files/cpuflags.Linux @@ -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' >&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 @@ if [ -n "$FLAGS" ]; then 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 --git a/devel/cpuflags/files/cpuflags.NetBSD b/devel/cpuflags/files/cpuflags.NetBSD index a3358fec511..c91fde34a80 100755 --- a/devel/cpuflags/files/cpuflags.NetBSD +++ b/devel/cpuflags/files/cpuflags.NetBSD @@ -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 @@ case $hw_machine_arch in *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 @@ case $hw_machine_arch in 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 @@ case $hw_machine_arch in 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' >&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 @@ if [ -n "$FLAGS" ]; then 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 --git a/devel/cpuflags/files/cpuflags.SunOS b/devel/cpuflags/files/cpuflags.SunOS index fb159838af8..7719523eb3c 100755 --- a/devel/cpuflags/files/cpuflags.SunOS +++ b/devel/cpuflags/files/cpuflags.SunOS @@ -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 + +display_hw_details() + { + echo " arch : '$hw_arch'" + } + +hw_arch=`/usr/bin/uname -m` -case $arch in +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' >&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 +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 +3.3:-march=winchip-c6:-march=i586 +3.3:-march=winchip2:-march=i586 +3.4:-march=athlon64:-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 +3.4:-march=opteron:-march=athlon-xp +3.4:-march=pentium-m:-march=pentium3 +3.4:-march=pentium3m:-march=pentium3 +3.4:-march=pentium4m:-march=pentium4 +3.4:-march=prescott:-march=pentium4 EOD ` fi |