pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/devel/cpuflags/files add file missing in 1.12 - noted ...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/f5675c8b8401
branches:  trunk
changeset: 532512:f5675c8b8401
user:      abs <abs%pkgsrc.org@localhost>
date:      Wed Aug 22 09:18:43 2007 +0000

description:
add file missing in 1.12 - noted by tron

diffstat:

 devel/cpuflags/files/subr_FreeBSD |  80 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 80 insertions(+), 0 deletions(-)

diffs (84 lines):

diff -r f57e5ecb9246 -r f5675c8b8401 devel/cpuflags/files/subr_FreeBSD
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/devel/cpuflags/files/subr_FreeBSD Wed Aug 22 09:18:43 2007 +0000
@@ -0,0 +1,80 @@
+
+AWK=awk
+SED=sed
+
+display_hw_details()
+    {
+    cat <<END
+OS             : '$(uname)'
+hw.model       : '$hw_model'
+hw.machine     : '$hw_machine'
+hw.machine_arch : '$hw_machine_arch'
+cpu details    :
+END
+    $SED -n '/^CPU:/{N;N;N;N;N;N;N;s/\n[^ ].*//g;/\n /p;}' \
+     /var/run/dmesg.boot 2>/dev/null
+    }
+
+extract_hw_details()
+    {
+    hw_model=$(sysctl -n hw.model | $SED 's/(R)//g;s/([tT][mM])//g')
+    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
+       echo
+       exit
+    fi
+    }
+
+determine_arch()
+    {
+    ARCH=
+    # When adding $hw_model tests use maximum context (such as trailing space)
+    case $hw_machine_arch in
+    i386) case $hw_model in
+       Pentium\ II*)                   ARCH='-march=pentium2'          ;;
+       Intel\ Pentium\ III\ *)         ARCH='-march=pentium3'          ;;
+       Intel\ Pentium\ 4\ *)           ARCH='-march=pentium4'          ;;
+       Intel\ Core2\ *)                ARCH='-march=prescott'          ;;
+       AMD\ Athlon\ XP*)               ARCH='-march=athlon-xp'         ;;
+       AMD\ Sempron\ Processor\ *)     ARCH='-march=athlon-xp'         ;;
+       # last resort:
+       *386-class*)                    ARCH='-march=i386'              ;;
+       *486-class*)                    ARCH='-march=i486'              ;;
+       *586-class*)                    ARCH='-march=pentium'           ;;
+       *686-class*)                    ARCH='-march=pentiumpro'        ;;
+    esac ;;
+    amd64) case $hw_model in
+       AMD\ Sempron\ Processor\ *)     ARCH='-march=athlon64'          ;;
+    esac ;;
+    esac
+
+    echo $ARCH
+    }
+
+determine_features()
+    {
+    FEATURES=
+    dmesg_features=$(echo $($SED -n \
+'s/.* Features[0-9]\{0,1\}=0x[0-9a-f]\{1,\}<\(.*\)>$/\1/p' \
+/var/run/dmesg.boot 2>/dev/null | $SED 's/,/ /g'))
+
+    case $hw_machine_arch in
+       i386 | amd64) case " $dmesg_features " in
+           *" SSE3 "*)         FEATURES="-mfpmath=sse -msse3"          ;;
+           *" SSE2 "*)         FEATURES="-mfpmath=sse -msse2"          ;;
+           *" SSE "*)          FEATURES="-mfpmath=sse -msse"           ;;
+           *" MMX "*)          FEATURES="-mmmx"                        ;;
+       esac
+       if [ -z "$FEATURES" ]; then     # FEATURES empty: jail?
+           # failover: try sse from sysctl db
+           if [ "$(sysctl -n hw.instruction_sse 2>/dev/null)" = 1 ]; then
+               FEATURES="-mfpmath=sse -msse"
+           fi
+       fi
+    esac
+
+    echo $FEATURES
+    }



Home | Main Index | Thread Index | Old Index