diff options
Diffstat (limited to 'devel/cpuflags')
-rw-r--r-- | devel/cpuflags/Makefile | 6 | ||||
-rw-r--r-- | devel/cpuflags/files/subr_Darwin | 70 | ||||
-rw-r--r-- | devel/cpuflags/files/subr_FreeBSD | 4 | ||||
-rwxr-xr-x | devel/cpuflags/files/subr_NetBSD | 4 |
4 files changed, 77 insertions, 7 deletions
diff --git a/devel/cpuflags/Makefile b/devel/cpuflags/Makefile index 37388f09996..57bcf994f0a 100644 --- a/devel/cpuflags/Makefile +++ b/devel/cpuflags/Makefile @@ -1,6 +1,6 @@ -# $NetBSD: Makefile,v 1.149 2009/11/12 05:38:58 obache Exp $ +# $NetBSD: Makefile,v 1.150 2010/12/05 11:19:39 abs Exp $ -DISTNAME= cpuflags-1.41 +DISTNAME= cpuflags-1.42 CATEGORIES= devel sysutils MASTER_SITES= # empty DISTFILES= # empty @@ -10,7 +10,7 @@ COMMENT= Determine compiler flags to best target current cpu PKG_DESTDIR_SUPPORT= user-destdir -ONLY_FOR_PLATFORM= NetBSD-*-* Linux-*-* SunOS-*-* FreeBSD-*-* +ONLY_FOR_PLATFORM= NetBSD-*-* Linux-*-* SunOS-*-* FreeBSD-*-* Darwin-*-* USE_LANGUAGES= # empty NO_CONFIGURE= yes diff --git a/devel/cpuflags/files/subr_Darwin b/devel/cpuflags/files/subr_Darwin new file mode 100644 index 00000000000..75be09084cb --- /dev/null +++ b/devel/cpuflags/files/subr_Darwin @@ -0,0 +1,70 @@ +# $NetBSD: subr_Darwin,v 1.1 2010/12/05 11:19:39 abs Exp $ + +AWK=awk +SED=sed + +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 : '$cpu' +END + echo "$cpu_details" + } + +extract_hw_details() + { + hw_model=$(sysctl -n hw.model | $SED 's/^ *//') + hw_machine=$(sysctl -n hw.machine) + hw_machine_arch=$(uname -p) + cpu_details=$(hostinfo| $AWK '/^Processor type:/{print $3}') + + # We're almost certainly crosscompiling + if [ -n "$MACHINE" -a "$hw_machine" != "$MACHINE" ]; then + echo + exit + fi + } + +determine_arch() + { + ARCH= + case $hw_machine_arch in + + powerpc) case $cpu_details in # Examples + ppc7450) ARCH='-mcpu=7450' ;; # + ppc750) ARCH='-mcpu=750' ;; # Beige G3 + ppc970) ARCH='-mcpu=970' ;; # + esac ;; + + esac + echo $ARCH + } + +determine_features() + { + FEATURES= + + case $hw_machine_arch in + i386 | x86_64) + if [ -n "$cpu_feature_SSE3" ] ; then + FEATURES="-mfpmath=sse -msse3" + elif [ -n "$cpu_feature_SSE2" ] ; then + FEATURES="-mfpmath=sse -msse2" + elif [ -n "$cpu_feature_SSE" ] ; then + FEATURES="-mfpmath=sse -msse" + fi + ;; + m68k) + case "$(egrep '^fpu0 ' /var/run/dmesg.boot)" in + *\(emulator\)*) FEATURES="-msoft-float" ;; + *\(no\ math\ support\)*) FEATURES="-msoft-float" ;; + esac + ;; + esac + echo $FEATURES + } diff --git a/devel/cpuflags/files/subr_FreeBSD b/devel/cpuflags/files/subr_FreeBSD index 40e7b2f8b34..f95b6fc9f0a 100644 --- a/devel/cpuflags/files/subr_FreeBSD +++ b/devel/cpuflags/files/subr_FreeBSD @@ -1,4 +1,4 @@ -# $NetBSD: subr_FreeBSD,v 1.3 2008/12/10 23:27:17 abs Exp $ +# $NetBSD: subr_FreeBSD,v 1.4 2010/12/05 11:19:39 abs Exp $ AWK=awk SED=sed @@ -23,7 +23,7 @@ extract_hw_details() hw_machine_arch=$(sysctl -n hw.machine_arch) # We're almost certainly crosscompiling - if [ -n "$MACHINE" -a $hw_machine != "$MACHINE" ]; then + if [ -n "$MACHINE" -a "$hw_machine" != "$MACHINE" ]; then echo exit fi diff --git a/devel/cpuflags/files/subr_NetBSD b/devel/cpuflags/files/subr_NetBSD index efd05ccfd23..6beb4d9d15c 100755 --- a/devel/cpuflags/files/subr_NetBSD +++ b/devel/cpuflags/files/subr_NetBSD @@ -1,4 +1,4 @@ -# $NetBSD: subr_NetBSD,v 1.11 2009/03/12 23:57:28 abs Exp $ +# $NetBSD: subr_NetBSD,v 1.12 2010/12/05 11:19:39 abs Exp $ AWK=awk SED=sed @@ -32,7 +32,7 @@ extract_hw_details() fi # We're almost certainly crosscompiling - if [ -n "$MACHINE" -a $hw_machine != "$MACHINE" ]; then + if [ -n "$MACHINE" -a "$hw_machine" != "$MACHINE" ]; then echo exit fi |