FreeBSD Bugzilla – Attachment 104222 Details for
Bug 144363
New port: devel/cpuflags - Determine compiler flags to best target current cpu
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
file.shar
file.shar (text/plain), 44.33 KB, created by
Quentin Stievenart
on 2010-02-28 14:50:02 UTC
(
hide
)
Description:
file.shar
Filename:
MIME Type:
Creator:
Quentin Stievenart
Created:
2010-02-28 14:50:02 UTC
Size:
44.33 KB
patch
obsolete
># This is a shell archive. Save it in a file, remove anything before ># this line, and then unpack it by entering "sh file". Note, it may ># create directories; files and directories will be owned by you and ># have default permissions. ># ># This archive contains: ># ># cpuflags ># cpuflags/Makefile ># cpuflags/files ># cpuflags/files/cpuflags.1.out ># cpuflags/files/Makefile ># cpuflags/files/cpuflags.1 ># cpuflags/files/cpuflags.mk ># cpuflags/files/cpuflags.sh ># cpuflags/files/optimize_gcc.mk ># cpuflags/files/subr_FreeBSD ># cpuflags/files/subr_Linux ># cpuflags/files/subr_NetBSD ># cpuflags/files/subr_SunOS ># cpuflags/files/subr_gcc ># cpuflags/files/subr_x86 ># cpuflags/files/cpuflags.mk.out ># cpuflags/files/cpuflags.sh.out ># cpuflags/pkg-descr ># cpuflags/pkg-plist ># >echo c - cpuflags >mkdir -p cpuflags > /dev/null 2>&1 >echo x - cpuflags/Makefile >sed 's/^X//' >cpuflags/Makefile << '6212d2583f214320017db5d86f786767' >X# New ports collection makefile for: phoenix >X# Date created: 2010/02/28 >X# Whom: Quentin Stievenart <acieroid@awesom.eu> >X# >X# $FreeBSD$ >X# $NetBSD: Makefile,v 1.149 2009/11/12 05:38:58 obache Exp $ >X >XPORTNAME= cpuflags >XPORTVERSION= 1.41 >XCATEGORIES= devel sysutils >XMASTER_SITES= # empty >XDISTFILES= # empty >X >XMAINTAINER= acieroid@awesom.eu >XCOMMENT= Determine compiler flags to best target current cpu >X >XUSE_LANGUAGES= # empty >X >Xdo-extract: >X ${MKDIR} ${WRKSRC} >X ${CP} ${FILESDIR}/Makefile ${WRKSRC} >X ${CP} ${FILESDIR}/c* ${WRKSRC} >X ${CP} ${FILESDIR}/o* ${WRKSRC} >X ${CP} ${FILESDIR}/s* ${WRKSRC} >X >Xpost-install: >X ${SED} -i -e "s,@@SH@@,${SH:Q}," ${PREFIX}/bin/cpuflags >X >X.include <bsd.port.mk> >6212d2583f214320017db5d86f786767 >echo c - cpuflags/files >mkdir -p cpuflags/files > /dev/null 2>&1 >echo x - cpuflags/files/cpuflags.1.out >sed 's/^X//' >cpuflags/files/cpuflags.1.out << '5329eab1c9650e924ea7b0bf8396ee28' >X.\" $NetBSD: cpuflags.1,v 1.21 2008/07/21 10:46:16 abs Exp $ >X.\" >X.\" Copyright (c) 2008 The NetBSD Foundation, Inc. >X.\" All rights reserved. >X.\" >X.\" This code is derived from software contributed to The NetBSD Foundation >X.\" by David Brownlee <abs@NetBSD.org> >X.\" >X.\" Redistribution and use in source and binary forms, with or without >X.\" modification, are permitted provided that the following conditions >X.\" are met: >X.\" 1. Redistributions of source code must retain the above copyright >X.\" notice, this list of conditions and the following disclaimer. >X.\" 2. Redistributions in binary form must reproduce the above copyright >X.\" notice, this list of conditions and the following disclaimer in the >X.\" documentation and/or other materials provided with the distribution. >X.\" >X.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS >X.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED >X.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >X.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS >X.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >X.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >X.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >X.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >X.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >X.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE >X.\" POSSIBILITY OF SUCH DAMAGE. >X.\" >X.Dd May 31, 2001 >X.Dt CPUFLAGS 1 >X.Os >X.Sh NAME >X.Nm cpuflags >X.Nd determine compiler flags to best target current CPU >X.Sh SYNOPSIS >X.Nm >X.Op cc_pathname >X.Sh DESCRIPTION >X.Nm >Xdetermines the current CPU type and gcc version, then outputs appropriate >Xcompiler options to best target code for that CPU. >XIf no options exist to target the current CPU then nothing is output. >X.Pp >XIn the event of the CPU not being recognised, a warning is sent to stderr. >X.Pp >XIf >X.Pa cc_pathname >Xis not specified it defaults to the first >X.Pa cc >Xfound in the path. >X.Sh ENVIRONMENT >XThe BSD makefile fragment >X.Pa /usr/local/share/mk/cpuflags.mk >Xwill set the following >X.Xr make 1 >Xvariables, plus add CPU_FLAGS and CPU_DIR to .MAKEFLAGS for sub-makes. >X.Pp >X.Bl -tag -width CPU_FLAGS -compact >X.It CPU_FLAGS >XThe output of cpuflags >X.It CPU_DIR >XCPU_FLAGS with spaces stripped (eg: for use in PACKAGES) >X.It CFLAGS >XHas CPU_FLAGS appended >X.It CXXFLAGS >XHas CPU_FLAGS appended >X.El >X.Sh FILES >X.Bl -tag -width /usr/local/share/mk/optimize_gcc.mk -compact >X.It /usr/local/share/mk/cpuflags.mk >XSet appropriate compiler flags based on the output from >X.Nm . >XSuitable for inclusion in /etc/mk.conf >X.It /usr/local/share/mk/optimize_gcc.mk >XAttempt to set additional -mXXX gcc flags based on gcc version and packages >Xbeing compiled. >XNote: This is experimental and not supported. >X.El >X.Sh EXAMPLES >X.Nm >Xcan be used to set default flags for building entries from pkgsrc >Xand recompiling the >X.Nx >Xkernel or userland by adding the following to >X.Pa /etc/mk.conf : >X.Bd -literal -offset indent >X .sinclude "/usr/local/share/mk/cpuflags.mk" >X.Ed >X.Pp >XTo experiment with optimisations that can break generated code there is >Xoptimize_gcc.mk. >XThis is unsupported, but for full effect add the following to >X.Pa /etc/mk.conf : >X.Bd -literal -offset indent >X .sinclude "/usr/local/share/mk/cpuflags.mk" >X .sinclude "/usr/local/share/mk/optimize_gcc.mk" >X.Ed >X.Pp >XOn all except low memory machines compilation can be speeded up by adding the >Xfollowing to /etc/mk.conf. >X(Note this will not affect the binaries produced) >X.Bd -literal -offset indent >XCOPTS?= -pipe ${DEFCOPTS} >XCFLAGS+=-pipe >X.Ed >X.Sh BUGS >X.Nm >Xstill needs to learn about more CPU types - updates welcomed >Xto >X.Aq abs@NetBSD.org . >XAlso the Makefile fragments and examples are BSD make >Xspecific - gmake examples welcomed. >X.Pp >XCurrently >X.Nm >Xis also gcc specific. >X.Sh NOTES >X.Nm >Xis based on input from many sources. >XI would like to thank them all, in particular Yakovetsky Vladimir. >5329eab1c9650e924ea7b0bf8396ee28 >echo x - cpuflags/files/Makefile >sed 's/^X//' >cpuflags/files/Makefile << '8ac7704e111e6c10cda4a9e54475dc1c' >X# $Id: Makefile,v 1.14 2009/11/12 05:40:36 obache Exp $ >X >XVERSION=1.14 >X >XPREFIX?=/usr/local >XOPSYS?=`uname` >X >XMANDIR?=${PREFIX}/man/man1 >XSUBRDIR?=${PREFIX}/share/cpuflags >XSHAREMKDIR?=${PREFIX}/share/mk >XBINDIR?=${PREFIX}/bin >XINSTALL_DATA?=install >XINSTALL_MAN?=install >XINSTALL_SCRIPT?=install >XINSTALL_PROGRAM_DIR?=mkdir -p >XINSTALL_MAN_DIR?=mkdir -p >XINSTALL_DATA_DIR?=mkdir -p >XSED?=sed >X >Xall: >X ${SED} -e 's|@PREFIX@|${PREFIX}|g' cpuflags.1 > cpuflags.1.out >X ${SED} -e 's|@PREFIX@|${PREFIX}|g' cpuflags.mk > cpuflags.mk.out >X ${SED} -e 's|@PREFIX@|${PREFIX}|g' cpuflags.sh > cpuflags.sh.out >X >Xclean: >X rm -rf *.out DIST >X >Xinstall: >X ${INSTALL_PROGRAM_DIR} ${DESTDIR}${BINDIR} >X ${INSTALL_MAN_DIR} ${DESTDIR}${MANDIR} >X ${INSTALL_DATA_DIR} ${DESTDIR}${SHAREMKDIR} >X ${INSTALL_DATA_DIR} ${DESTDIR}${SUBRDIR} >X ${INSTALL_SCRIPT} cpuflags.sh.out ${DESTDIR}${BINDIR}/cpuflags >X ${INSTALL_MAN} cpuflags.1.out ${DESTDIR}${MANDIR}/cpuflags.1 >X ${INSTALL_DATA} optimize_gcc.mk ${DESTDIR}${SHAREMKDIR}/optimize_gcc.mk >X ${INSTALL_DATA} cpuflags.mk.out ${DESTDIR}${SHAREMKDIR}/cpuflags.mk >X ${INSTALL_DATA} subr_* ${DESTDIR}${SUBRDIR} >X >Xdist: >X mkdir -p DIST/cpuflags-${VERSION} >X cp Makefile [a-z]* DIST/cpuflags-${VERSION} >X (cd DIST;pax -w cpuflags-${VERSION}|bzip2 -9 > cpuflags-${VERSION}.tbz) >X rm -rf DIST/cpuflags-${VERSION} >8ac7704e111e6c10cda4a9e54475dc1c >echo x - cpuflags/files/cpuflags.1 >sed 's/^X//' >cpuflags/files/cpuflags.1 << 'd8eb01a2a074ffa2b2122db002c2ba15' >X.\" $NetBSD: cpuflags.1,v 1.21 2008/07/21 10:46:16 abs Exp $ >X.\" >X.\" Copyright (c) 2008 The NetBSD Foundation, Inc. >X.\" All rights reserved. >X.\" >X.\" This code is derived from software contributed to The NetBSD Foundation >X.\" by David Brownlee <abs@NetBSD.org> >X.\" >X.\" Redistribution and use in source and binary forms, with or without >X.\" modification, are permitted provided that the following conditions >X.\" are met: >X.\" 1. Redistributions of source code must retain the above copyright >X.\" notice, this list of conditions and the following disclaimer. >X.\" 2. Redistributions in binary form must reproduce the above copyright >X.\" notice, this list of conditions and the following disclaimer in the >X.\" documentation and/or other materials provided with the distribution. >X.\" >X.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS >X.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED >X.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >X.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS >X.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >X.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >X.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >X.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >X.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >X.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE >X.\" POSSIBILITY OF SUCH DAMAGE. >X.\" >X.Dd May 31, 2001 >X.Dt CPUFLAGS 1 >X.Os >X.Sh NAME >X.Nm cpuflags >X.Nd determine compiler flags to best target current CPU >X.Sh SYNOPSIS >X.Nm >X.Op cc_pathname >X.Sh DESCRIPTION >X.Nm >Xdetermines the current CPU type and gcc version, then outputs appropriate >Xcompiler options to best target code for that CPU. >XIf no options exist to target the current CPU then nothing is output. >X.Pp >XIn the event of the CPU not being recognised, a warning is sent to stderr. >X.Pp >XIf >X.Pa cc_pathname >Xis not specified it defaults to the first >X.Pa cc >Xfound in the path. >X.Sh ENVIRONMENT >XThe BSD makefile fragment >X.Pa @PREFIX@/share/mk/cpuflags.mk >Xwill set the following >X.Xr make 1 >Xvariables, plus add CPU_FLAGS and CPU_DIR to .MAKEFLAGS for sub-makes. >X.Pp >X.Bl -tag -width CPU_FLAGS -compact >X.It CPU_FLAGS >XThe output of cpuflags >X.It CPU_DIR >XCPU_FLAGS with spaces stripped (eg: for use in PACKAGES) >X.It CFLAGS >XHas CPU_FLAGS appended >X.It CXXFLAGS >XHas CPU_FLAGS appended >X.El >X.Sh FILES >X.Bl -tag -width @PREFIX@/share/mk/optimize_gcc.mk -compact >X.It @PREFIX@/share/mk/cpuflags.mk >XSet appropriate compiler flags based on the output from >X.Nm . >XSuitable for inclusion in /etc/mk.conf >X.It @PREFIX@/share/mk/optimize_gcc.mk >XAttempt to set additional -mXXX gcc flags based on gcc version and packages >Xbeing compiled. >XNote: This is experimental and not supported. >X.El >X.Sh EXAMPLES >X.Nm >Xcan be used to set default flags for building entries from pkgsrc >Xand recompiling the >X.Nx >Xkernel or userland by adding the following to >X.Pa /etc/mk.conf : >X.Bd -literal -offset indent >X .sinclude "@PREFIX@/share/mk/cpuflags.mk" >X.Ed >X.Pp >XTo experiment with optimisations that can break generated code there is >Xoptimize_gcc.mk. >XThis is unsupported, but for full effect add the following to >X.Pa /etc/mk.conf : >X.Bd -literal -offset indent >X .sinclude "@PREFIX@/share/mk/cpuflags.mk" >X .sinclude "@PREFIX@/share/mk/optimize_gcc.mk" >X.Ed >X.Pp >XOn all except low memory machines compilation can be speeded up by adding the >Xfollowing to /etc/mk.conf. >X(Note this will not affect the binaries produced) >X.Bd -literal -offset indent >XCOPTS?= -pipe ${DEFCOPTS} >XCFLAGS+=-pipe >X.Ed >X.Sh BUGS >X.Nm >Xstill needs to learn about more CPU types - updates welcomed >Xto >X.Aq abs@NetBSD.org . >XAlso the Makefile fragments and examples are BSD make >Xspecific - gmake examples welcomed. >X.Pp >XCurrently >X.Nm >Xis also gcc specific. >X.Sh NOTES >X.Nm >Xis based on input from many sources. >XI would like to thank them all, in particular Yakovetsky Vladimir. >d8eb01a2a074ffa2b2122db002c2ba15 >echo x - cpuflags/files/cpuflags.mk >sed 's/^X//' >cpuflags/files/cpuflags.mk << '47f15c7559cb71f7d6f4c88bfb6a379b' >X# $Id: cpuflags.mk,v 1.20 2009/01/28 23:30:50 abs Exp $ >X# Makefile include fragment to simplify use of cpuflags in pkgsrc >X# abs@absd.org - freely distributable, no warrenties, stick no bills. >X >X# Try to optimise based on CPU >X# Does not affect any package that overrides CFLAGS/CXXFLAGS/CCOPTIONS >X# Sets five variables: >X# >X# CPU_FLAGS The output of cpuflags >X# CFLAGS Has CPU_FLAGS appended >X# CXXFLAGS Has CPU_FLAGS appended >X# >X# CPU_DIR CPU_FLAGS with spaces stripped (eg: for use in PACKAGES) >X >X >X.ifndef CPU_FLAGS >X >X. if exists(${.PARSEDIR}/cpuflags.sh) >X_CPUFLAGS_SH=${SH} ${.PARSEDIR}/cpuflags.sh >X. else >X_CPUFLAGS_SH=@PREFIX@/bin/cpuflags >X. endif >X >X. if defined(CCPATH) >XCPU_FLAGS!=${_CPUFLAGS_SH} ${CCPATH} >X. elif defined(BSD_PKG_MK) || ${USETOOLS:Uyes} == "no" >XCPU_FLAGS!=${_CPUFLAGS_SH} ${CC} >X. else >XCPU_FLAGS!=${_CPUFLAGS_SH} >X. endif >X_CPUFLAGS_SH= >X >X.endif # CPU_FLAGS >X >X.ifndef CPU_DIR >XCPU_DIR!=echo ${CPU_FLAGS} | sed 's/ //g' >X.endif >X >X.if !defined(MAKEFLAGS) || empty(MAKEFLAGS:MCPU_FLAGS) >XMAKEFLAGS+=CPU_FLAGS=${CPU_FLAGS:Q} CPU_DIR=${CPU_DIR:Q} # For sub makes >X.endif >X >X.ifdef BSD_PKG_MK # Try to catch various package opts >XCFLAGS+=${CPU_FLAGS} >XCXXFLAGS+=${CPU_FLAGS} >XMAKE_FLAGS+=CCOPTIONS="${CPU_FLAGS}" # Override CCOPTIONS for imake >X >X.elif !defined(IMAGESIZE) && ${DBG} != "-Os" >X# Assume in base system & not building space optimised distrib, set COPTS >XCOPTS?=${CPU_FLAGS} ${DEFCOPTS} >X# Include ${DEFCOPTS} and set ?= to allow overriding in kernel builds >X >X.endif >47f15c7559cb71f7d6f4c88bfb6a379b >echo x - cpuflags/files/cpuflags.sh >sed 's/^X//' >cpuflags/files/cpuflags.sh << 'bc0067e2f88bc89fa6707b9d8fb4e923' >X#!@@SH@@ >X# $NetBSD: cpuflags.sh,v 1.7 2009/01/28 23:30:50 abs Exp $ >XPATH=/sbin:/usr/sbin:/bin:/usr/bin:$PATH >X >X# cd to the directory containing the binary, so we can usefully check for >X# include files from there >Xcase "$0" in >X /*) cd $(dirname $0);; >X *) cd $(dirname $PWD/$0);; >Xesac >X >Xinclude() >X { >X file=$1 >X if [ -f ./$file ] ; then >X file=./$file >X else >X file=@PREFIX@/share/cpuflags/$file >X fi >X verbose . $file >X . $file >X } >X >Xverbose() >X { >X [ -n "$opt_v" ] && echo $* >&2 >X return 0 >X } >X >XUNAME=$(uname) >X >Xif [ "$1" = -v ] ; then >X shift >X opt_v=1 >Xfi >X >Xif [ -n "$1" ]; then >X CC=$1 >Xelse >X CC=gcc >Xfi >X >X# Each UNAME subr_ file is expected to set AWK & SED, and to provide the >X# following methods: >X# extract_hw_details: Must be called before determine_arch/determine_features >X# determine_arch: Returns cpu arch >X# determine_features: Returns cpu features >X# display_hw_details: Human readable output for current machine >X# >Xinclude subr_${UNAME} >X >X# This provides gcc_ser(), gcc_ver() and gcc_fixup_arch_flags() >X# >Xinclude subr_gcc >X >X# native arch >XM_ARCH_NATIVE='-march=native' >X >X# Determine the flags for this OS/machine >Xextract_hw_details >Xif [ $(gcc_ser $CC) -gt 4002 ] ; then >X ARCH="$M_ARCH_NATIVE" >Xelse >X ARCH=$(determine_arch) >Xfi >XFEATURES=$(determine_features) >X >Xtest "x$ARCH" != "x$M_ARCH_NATIVE" && # gcc have not autodetection >X case "$hw_machine_arch" in # all known x86 mnemonics >X i386|i486|i586|i686|x86_64|amd64|i86pc) >X include subr_x86 # this provides flags_fixup_x86arch() >X l_arch=$(flags_fixup_x86arch "$ARCH" "$FEATURES") >X test -n "$l_arch" && ARCH="-march=$l_arch" >X esac >X >X# Fixup any flags which are too new for our gcc version >X# >XCPUFLAGS=$(gcc_fixup_arch_flags $CC $ARCH $FEATURES) >XCPUFLAGS=$(echo $CPUFLAGS) >X >Xif [ -n "$opt_v" ] ; then >X if [ -n "$NOARCH" ] ; then >X ARCH="No flags for this architecture" >X fi >X if [ -z "$ARCH" ]; then >X ARCH=Unknown >X fi >X cat <<END >XARCH : $ARCH >XFEATURES : $FEATURES >XCPUFLAGS : $CPUFLAGS >XGCC version : $(gcc_ver $CC) >XEND >X display_hw_details >X exit; >Xfi >X >Xif [ -z "$ARCH" -a -z "$NOARCH" ] ; then >X echo 'Unknown machine - please send cpuflags details to abs@absd.org' >&2 >X display_hw_details >&2 >Xfi >X >Xecho $CPUFLAGS >Xexit 0 >bc0067e2f88bc89fa6707b9d8fb4e923 >echo x - cpuflags/files/optimize_gcc.mk >sed 's/^X//' >cpuflags/files/optimize_gcc.mk << '474d85b9892ff78756e3ac9fd8a0b65d' >X# $Id: optimize_gcc.mk,v 1.36 2009/04/21 16:47:48 tnn Exp $ >X >X# This file is 'experimental' - which is doublespeak for unspeakably >X# ugly, and quite broken by design. >X# >X# The intention is to pass additional flags to gcc to further optimise >X# generated code. It _will_ make it impossible to debug, may fail to >X# compile some code, and even generate curdled binaries. It is completely >X# unsupported. Any questions should be directed to <abs@absd.org>. >X >X.ifdef BSD_PKG_MK # Try to catch various package opts >X >X# ----------------------------------------------------------------------------- >X# Per package exclusions >X >X# firefox-1: v1.0, NetBSD i386/2.0 >XPKG_EXCLUDE_OMIT_FRAME_POINTER+=www/firefox >XPKG_EXCLUDE_FAST_MATH+=www/firefox >X >X# seamonkey-1.0.5: gcc-4.1.2 NetBSD 4.99.3 i386 >XPKG_EXCLUDE_OMIT_FRAME_POINTER+=www/seamonkey www/seamonkey-gtk1 >X >XPKG_EXCLUDE_OMIT_FRAME_POINTER+=mail/thunderbird mail/thunderbird-gtk1 >XPKG_EXCLUDE_OMIT_FRAME_POINTER+=mail/thunderbird15 mail/thunderbird15-gtk1 >X >XPKG_EXCLUDE_OMIT_FRAME_POINTER+=lang/lua >XPKG_EXCLUDE_OMIT_FRAME_POINTER+=lang/ruby18-base # NetBSD i386/3.0 >X >X# perl5: '49/49!=1 in test' >XPKG_EXCLUDE_FAST_MATH+=lang/perl5 >X >XPKG_EXCLUDE_INLINE_FUNCTIONS+=emulators/qemu net/userppp multimedia/vlc >X >X# binutils-2.17: Linux 2.6.21.5 i686, gcc-4.1.3 >XPKG_EXCLUDE_INLINE_FUNCTIONS+=cross/binutils devel/binutils >X >X# procmail-3.22: debian_linux-2.6.21.5/gcc-4.1.3, gcc-4.1.2 NetBSD 4.0_BETA2 >XPKG_EXCLUDE_INLINE_FUNCTIONS+=mail/procmail >X >X# aspell-0.60.5: gcc-4.1.2 NetBSD 4.0_BETA2 i386 >XPKG_EXCLUDE_INLINE_FUNCTIONS+=textproc/aspell >X >X# gcc3.3.3 NetBSD i386/3.0 breaks kde3 >XPKG_EXCLUDE_FAST_MATH+=x11/qt3-libs >X >X# gcc4.1.3 NetBSD i386/4.99.29 breaks liboil >XPKG_EXCLUDE_OMIT_FRAME_POINTER+=devel/liboil >X >X# ----------------------------------------------------------------------------- >X# Assign default flags, then remove values based on settings above >X# >XCOPT_FLAGS=-finline-functions -fomit-frame-pointer -ffast-math >X >X.if !empty(PKG_EXCLUDE_OMIT_FRAME_POINTER:M${PKGPATH}) >XCOPT_FLAGS:= ${COPT_FLAGS:S/-fomit-frame-pointer//} >X.endif >X >X.if !empty(PKG_EXCLUDE_INLINE_FUNCTIONS:M${PKGPATH}) >XCOPT_FLAGS:= ${COPT_FLAGS:S/-finline-functions//} >X.endif >X >X.if !empty(PKG_EXCLUDE_FAST_MATH:M${PKGPATH}) >XCOPT_FLAGS:= ${COPT_FLAGS:S/-ffast-math//} >X.endif >X >XCFLAGS+=${COPT_FLAGS} >XCXXFLAGS+=${COPT_FLAGS} >XMAKE_FLAGS+=CCOPTIONS="${COPT_FLAGS}" # Override CCOPTIONS for imake >X >X.else # (BSD_PKG_MK) Assume in NetBSD base system, only COPTS >X >X.if ${USETOOLS:Uyes} == "no" >XCOPT_FLAGS+=-fomit-frame-pointer >X# Include ${DEFCOPTS} and set ?= to allow overriding in kernel builds >X.if !defined(COPTS) >XCOPTS=${DEFCOPTS} ${COPT_FLAGS} >X.else >XCOPTS+=${COPT_FLAGS} >X.endif >X.endif >X >X.endif >474d85b9892ff78756e3ac9fd8a0b65d >echo x - cpuflags/files/subr_FreeBSD >sed 's/^X//' >cpuflags/files/subr_FreeBSD << '38a7d7015f5b9d60dc32e57dbf8d2919' >X# $NetBSD: subr_FreeBSD,v 1.3 2008/12/10 23:27:17 abs Exp $ >X >XAWK=awk >XSED=sed >X >Xdisplay_hw_details() >X { >X cat <<END >XOS : '$(uname)' >Xhw.model : '$hw_model' >Xhw.machine : '$hw_machine' >Xhw.machine_arch : '$hw_machine_arch' >Xcpu details : >XEND >X $SED -n '/^CPU:/{N;N;N;N;N;N;N;s/\n[^ ].*//g;/\n /p;}' \ >X /var/run/dmesg.boot 2>/dev/null >X } >X >Xextract_hw_details() >X { >X hw_model=$(sysctl -n hw.model | $SED 's/(R)//g;s/([tT][mM])//g') >X hw_machine=$(sysctl -n hw.machine) >X hw_machine_arch=$(sysctl -n hw.machine_arch) >X >X # We're almost certainly crosscompiling >X if [ -n "$MACHINE" -a $hw_machine != "$MACHINE" ]; then >X echo >X exit >X fi >X } >X >Xdetermine_arch() >X { >X ARCH= >X # When adding $hw_model tests use maximum context (such as trailing space) >X case $hw_machine_arch in >X i386) case $hw_model in >X Pentium\ II*) ARCH='-march=pentium2' ;; >X Intel\ Pentium\ III\ *) ARCH='-march=pentium3' ;; >X Intel\ Pentium\ 4\ *) ARCH='-march=pentium4' ;; >X Intel\ Core2\ *) ARCH='-march=core2' ;; >X AMD\ Athlon\ XP*) ARCH='-march=athlon-xp' ;; >X AMD\ Sempron\ Processor\ *) ARCH='-march=athlon-xp' ;; >X # last resort: >X *386-class*) ARCH='-march=i386' ;; >X *486-class*) ARCH='-march=i486' ;; >X *586-class*) ARCH='-march=pentium' ;; >X *686-class*) ARCH='-march=pentiumpro' ;; >X esac ;; >X amd64) case $hw_model in >X AMD\ Sempron\ Processor\ *) ARCH='-march=athlon64' ;; >X esac ;; >X esac >X >X echo $ARCH >X } >X >Xdetermine_features() >X { >X FEATURES= >X dmesg_features=$(echo $($SED -n \ >X's/.* Features[0-9]\{0,1\}=0x[0-9a-f]\{1,\}<\(.*\)>$/\1/p' \ >X/var/run/dmesg.boot 2>/dev/null | $SED 's/,/ /g')) >X >X case $hw_machine_arch in >X i386 | amd64) case " $dmesg_features " in >X *" SSE3 "*) FEATURES="-mfpmath=sse -msse3" ;; >X *" SSE2 "*) FEATURES="-mfpmath=sse -msse2" ;; >X *" SSE "*) FEATURES="-mfpmath=sse -msse" ;; >X *" MMX "*) FEATURES="-mmmx" ;; >X esac >X if [ -z "$FEATURES" ]; then # FEATURES empty: jail? >X # failover: try sse from sysctl db >X if [ "$(sysctl -n hw.instruction_sse 2>/dev/null)" = 1 ]; then >X FEATURES="-mfpmath=sse -msse" >X fi >X fi >X esac >X >X echo $FEATURES >X } >38a7d7015f5b9d60dc32e57dbf8d2919 >echo x - cpuflags/files/subr_Linux >sed 's/^X//' >cpuflags/files/subr_Linux << 'cb1819e4e86ca842f3570256394c5137' >X# $NetBSD: subr_Linux,v 1.2 2008/12/10 23:27:17 abs Exp $ >X >XAWK=awk >XSED=sed >X >Xdisplay_hw_details() >X { >X cat <<END >XOS : '$(uname)' >Xproc model : '$hw_model' >Xmachine_arch : '$hw_machine_arch' >Xproc flag : '$feat_flags' >XEND >X } >X >Xextract_hw_details() >X { >X hw_machine_arch=$(uname -m) >X if [ ! -f /proc/cpuinfo ] ; then >X echo "Unable to open /proc/cpuinfo" >X hw_model=Unknown >X else >X hw_model=$($AWK -F: '/^model name/{sub(" ","",$2);print $2;exit}' /proc/cpuinfo) >X feat_flags=$($AWK -F: '/^flags/{sub(" ","",$2);print $2;exit}' /proc/cpuinfo) >X fi >X } >X >Xdetermine_arch() >X { >X ARCH= >X case $hw_machine_arch in >X parisc) case $hw_model in >X "Mirage 100+") ARCH='-march=1.1' ;; >X esac ;; >X i386) ARCH='-march=i386' ;; >X i486) ARCH='-march=i486' ;; >X i586) ARCH='-march=pentium' ;; >X i686 | x86_64) >X include subr_x86 # this provides map_x86_brand_string() >X ARCH=$(map_x86_brand_string "$cpu_brand") >X if [ -z "$ARCH" ] ; then >X case $hw_model in >X "AMD Athlon(TM) XP "*) ARCH='-march=athlon-xp' ;; >X "AMD Athlon(tm) 64"*) ARCH='-march=athlon64' ;; >X "AMD Athlon(tm) XP"*) ARCH='-march=athlon-xp' ;; >X "AMD Duron(TM)") ARCH='-march=athlon' ;; >X "AMD Duron(tm) ") ARCH='-march=athlon' ;; >X "AMD Opteron(tm) Processor "*) ARCH='-march=opteron' ;; >X "AMD Sempron(tm) Processor "*) ARCH='-march=athlon-xp' ;; >X >X # Intel PIII & earlier - later Intel handled by map_x86_brand_string >X "Celeron (Coppermine)") ARCH='-march=pentium3' ;; >X "Pentium II (Deschutes)") ARCH='-march=pentium2' ;; >X "Pentium III (Coppermine)") ARCH='-march=pentium3' ;; >X "Pentium III (Katmai)") ARCH='-march=pentium3' ;; >X esac >X fi ;; >X esac >X echo $ARCH >X } >X >Xdetermine_features() >X { >X FEATURES= >X case $hw_machine_arch in >X i586|i686|x86_64) >X case " $feat_flags " in >X *" ssse3 "*) FEATURES='-mfpmath=sse -msse3' ;; >X *" sse2 "*) FEATURES='-mfpmath=sse -msse2' ;; >X *" sse "*) FEATURES='-mfpmath=sse -msse' ;; >X *" mmx "*) FEATURES='-mmmx' ;; >X esac ;; >X esac >X echo $FEATURES >X } >cb1819e4e86ca842f3570256394c5137 >echo x - cpuflags/files/subr_NetBSD >sed 's/^X//' >cpuflags/files/subr_NetBSD << '11965e523b800db5fd0162adad1d1bff' >X# $NetBSD: subr_NetBSD,v 1.11 2009/03/12 23:57:28 abs Exp $ >X >XAWK=awk >XSED=sed >X >Xdisplay_hw_details() >X { >X cat <<END >XOS : '$(uname)' >XOS version : '$(uname -r)' >Xhw.model : '$hw_model' >Xhw.machine : '$hw_machine' >Xhw.machine_arch : '$hw_machine_arch' >XCPU : '$cpu' >XEND >X extract_x86_cpu_vars >X echo "$cpu_details" >X } >X >Xextract_hw_details() >X { >X hw_model=$(sysctl -n hw.model | $SED 's/^ *//') >X hw_machine=$(sysctl -n hw.machine) >X hw_machine_arch=$(sysctl -n hw.machine_arch) >X if [ "$hw_machine_arch" = i386 -o "$hw_machine_arch" = x86_64 ] ; then >X if [ -x /usr/sbin/cpuctl ] ; then >X cpu_details="$(cpuctl identify 0 | grep ^cpu0:)" >X else >X cpu_details="$(grep ^cpu0: /var/run/dmesg.boot)" >X fi >X eval "$(extract_x86_cpu_vars)" >X fi >X >X # We're almost certainly crosscompiling >X if [ -n "$MACHINE" -a $hw_machine != "$MACHINE" ]; then >X echo >X exit >X fi >X } >X >Xextract_x86_cpu_vars() >X { >X # Set: cpu_feature_FOO=1 for each 'FOO' feature reported >X # cpu_name="NAME" taken from the first cpu0: line >X # cpu_brand="BRAND" the CPU branding string >X echo "$cpu_details" | $AWK ' >X { if (/cpu0:/ && !n) { sub("cpu0: ",""); n=1; print "cpu_name=\""$0"\"" } } >X /cpu0: ".*"/ { sub("[^\"]*", ""); print "cpu_brand="$0 } >X /cpu0: features/ { >X sub(".*<",""); >X sub(">.*",""); >X gsub("[^,A-Z0-9]","_"); >X split($0, features, /,/) >X for (f in features) >X print "cpu_feature_"features[f]"=1"; >X } >X /cpu0: family/ { >X for (i = 2; i < NF; i = i + 2) { >X f=$(i+1); >X sub(/^0/, "", f); >X print "cpu_"$i"="f >X } >X } >X ' >X } >X >Xdetermine_arch() >X { >X ARCH= >X # When adding $hw_model tests use maximum context (such as trailing space) >X case $hw_machine_arch in >X >X alpha) >X # cpu0 at mainbus0: ID 0 (primary), 21164A-0 (unknown ... >X case "$(egrep '^cpu0 ' /var/run/dmesg.boot)" in >X *[\(\ ]2106[46][-A\ \)]*) ARCH="-mcpu=21064" ;; >X *[\(\ ]21164[-\ \)]*) ARCH="-mcpu=21164" ;; >X *[\(\ ]21164A[-\ \)]*) ARCH="-mcpu=21164a" ;; >X *[\(\ ]21264[-\ \)]*) ARCH="-mcpu=21264" ;; >X *[\(\ ]21264[AB][-\ \)]*) ARCH="-mcpu=21264a" ;; >X *\ PCA56-2) ARCH="-mcpu=21164pc" ;; >X esac >X ;; >X >X arm | arm32) case $hw_model in >X ARM610*) ARCH="-mcpu=arm610" ;; # risc pc >X ARM710*) ARCH="-mcpu=arm710" ;; # risc pc >X i80321\ *) ARCH="-mcpu=xscale" ;; # iyonix >X SA-110*) >X case $hw_machine in # arm32 split post 1.5 >X cats|shark|hpcarm|netwinder) >X ARCH="-mcpu=strongarm110" ;; >X acorn32) >X ARCH="-march=armv3m -mtune=strongarm" ;; >X *) >X # memorybus in strongarm risc pc machines cannot support >X # certain strongarm instructions, but in 1.5 and earlier >X # all strongarm machines are 'arm32', so uname and sysctl >X # no use >X if egrep -q 'ofbus0|footbridge0' /var/run/dmesg.boot \ >X 2>/dev/null ; then >X ARCH="-mcpu=strongarm110" # shark/cats >X else >X ARCH="-march=armv3m -mtune=strongarm" # risc pc >X fi >X esac ;; >X esac ;; >X >X hppa) >X case "$(egrep '^cpu0 ' /var/run/dmesg.boot)" in >X *\ PA7100\ *) ARCH="-march=1.1 -mschedule=7100" ;; # untested >X *\ PA7150\ *) ARCH="-march=1.1 -mschedule=7100" ;; # untested >X *\ PA7100LC\ *) ARCH="-march=1.1 -mschedule=7100LC" ;; # untested >X *\ PA7200\ *) ARCH="-march=1.1 -mschedule=7200" ;; # untested >X *\ PA7300LC\ *) ARCH="-march=1.1 -mschedule=7300" ;; # B180L >X *\ PA8*) ARCH="-march=2.0 -mschedule=8000" ;; # untested >X esac >X ;; >X >X i386 | x86_64) >X include subr_x86 # this provides map_x86_brand_string() >X ARCH=$(map_x86_brand_string) >X if [ -z "$ARCH" ] ; then >X case "$cpu_name" in >X 'AMD Athlon 64 X2 (686-class)'*) ARCH='-march=athlon64' ;; >X 'AMD Athlon 64 or Athlon 64 FX or Opteron '*) ARCH='-march=opteron' ;; >X 'AMD Athlon 64 or Sempron (686-class)'*) ARCH='-march=athlon64' ;; >X 'AMD Athlon Model 4 (Thunderbird) '*) ARCH='-march=athlon-tbird' ;; >X 'AMD Dual-Core Opteron or Athlon 64 X2 '*) ARCH='-march=opteron' ;; >X 'AMD Family 10h (686-class)'*) ARCH='-march=amdfam10' ;; >X 'AMD K6-2 (586-class)'*) ARCH="-march=k6-2" ;; >X >X # Intel PIII & earlier - later Intel handled by map_x86_brand_string >X 'Intel (686-class)'*) ARCH='-march=pentiumpro' ;; >X 'Intel Pentium II (686-class)'*) ARCH='-march=pentium2' ;; >X 'Intel Pentium III (686-class)'*) ARCH='-march=pentium3' ;; >X 'Intel Pentium III (Katmai) (686-class)'*) ARCH='-march=pentium3' ;; >X 'Intel Pentium III Xeon (686-class)'*) ARCH='-march=pentium3' ;; >X >X # Fallback classes >X *'(586-class)'*) ARCH='-march=pentium' ;; >X *'(486-class)'*) ARCH='-march=i486' ;; >X esac >X fi >X ;; >X >X m68k) case $hw_model in # Examples >X *\(68020*|*\ MC68020\ *) ARCH='-m68020' ;; # Untested >X *\(68030*|*\ MC68030\ *) ARCH='-m68030' ;; # Mac LC III >X *\(68040*|*\ MC68040\ *) ARCH='-m68040' ;; # Untested >X *\(68060*|*\ MC68060\ *) ARCH='-m68060' ;; # Upgraded amiga 3000 >X esac >X ;; >X >X mipseb|mipsel) >X # cpu0 at mainbus0: QED R4600 Orion CPU (0x2020) Rev. 2.0 with ... >X case $hw_model in >X Infineon\ ADM5120) ARCH='-march=4kc' ;; >X *) >X case "$(egrep '^cpu0 ' /var/run/dmesg.boot)" in >X *\ MIPS\ R2000\ *) ARCH="-march=r2000" ;; >X *\ MIPS\ R3000\ *) ARCH="-march=r3000" ;; >X *\ MIPS\ R3000A\ *) ARCH="-march=r3000" ;; >X *\ Toshiba\ TX3912\ *) ARCH="-march=r3900" ;; >X *\ Toshiba\ TX392[27]\ *) ARCH="-march=r3900" ;; >X *\ MIPS\ R4000\ *) ARCH="-mtune=r4000 -mips2" ;; # mips3 >X *\ MIPS\ R4400\ *) ARCH="-mtune=r4400 -mips2" ;; # mips3 >X *\ NEC\ VR4100\ *) ARCH="-mtune=r4100 -mips2" ;; # mips3 >X *\ NEC\ VR4300\ *) ARCH="-mtune=r4300 -mips2" ;; # mips3 >X *\ QED\ R4600\ *) ARCH="-mtune=r4600 -mips2" ;; # mips3 >X *\ MIPS\ R5000\ *) ARCH="-mtune=r5000 -mips2" ;; # mips4 >X *\ QED\ RM5200\ *) ARCH="-mtune=r5000 -mips2" ;; # mips4 >X *\ MIPS\ R6000\ *) ARCH="-mtune=r6000 -mips2" ;; >X *\ MIPS\ R8000\ *) ARCH="-mtune=r8000 -mips2" ;; # mips4 >X *\ MIPS\ R10000\ *) ARCH="-march=mips4 -mabi=32" ;; # mips4 >X esac ;; >X esac >X ;; >X >X powerpc) case $hw_model in # Examples >X 601\ *) ARCH='-mcpu=601' ;; # Untested >X 602\ *) ARCH='-mcpu=602' ;; # Untested >X 603\ *) ARCH='-mcpu=603' ;; # Untested >X 603e\ *|603ev\ *) ARCH='-mcpu=603e' ;; # Umax C500 / PM4400 >X 604\ *) ARCH='-mcpu=604' ;; # Mac 8500 >X 604e\ *) ARCH='-mcpu=604e' ;; # upgr B&W G3 >X 604ev\ *) ARCH='-mcpu=604e' ;; # usually 604e >X 620\ *) ARCH='-mcpu=620' ;; # Untested >X 7400\ *) ARCH='-mcpu=7400' ;; # AGP G4/400 Mac >X 740\ *) ARCH='-mcpu=740' ;; # Untested >X 7410\ *) ARCH='-mcpu=7400' ;; # powerbook g4 >X 7447A\ *) ARCH='-mcpu=7450' ;; # >X 7450\ *) ARCH='-mcpu=7450' ;; # tibook 550 >X 750\ *) ARCH='-mcpu=750' ;; # orig. iBook >X >X esac ;; >X >X sparc | sparc64) case " $hw_model" in # Examples >X *[\ \(]MB86900/1A*) ARCH='-mcpu=cypress' ;; # ss1+ >X *[\ \(]L64811*) ARCH='-mcpu=cypress' ;; # sun4/sun4c >X *[\ \(]CY7C601*) ARCH='-mcpu=cypress' ;; # ss2 >X *[\ \(]W8601/8701*) ARCH='-mcpu=cypress' ;; # elc >X *[\ \(]MB86904*) ARCH='-mcpu=supersparc' ;; # ss5 usparc >X *[\ \(]MB86907*) ARCH='-mcpu=supersparc' ;; # ss5 usparc >X *[\ \(]TMS390S10*) ARCH='-mcpu=supersparc' ;; # classic " >X *[\ \(]TMS390Z50*) ARCH='-mcpu=supersparc' ;; # ss10/ss20 >X *[\ \(]RT620/625*) ARCH='-mcpu=hypersparc' ;; # ss20 ross >X *[\ \(]MB86930*) ARCH='-mcpu=sparclite' ;; # from gcc >X *[\ \(]MB86934*) ARCH='-mcpu=sparclite' ;; # from gcc >X # under 1.5.1 -mcpu=ultrasparc chokes egcs-2.91.66 compiling perl >X *[\ \(]SUNW,UltraSPARC*) ARCH='-mcpu=v9' ;; # Ultra >X esac ;; >X >X vax) # No VAX specific gcc optimisations available >X NOARCH=1 >X ;; >X >X esac >X echo $ARCH >X } >X >Xdetermine_features() >X { >X FEATURES= >X >X case $hw_machine_arch in >X i386 | x86_64) >X if [ -n "$cpu_feature_SSE3" ] ; then >X FEATURES="-mfpmath=sse -msse3" >X elif [ -n "$cpu_feature_SSE2" ] ; then >X FEATURES="-mfpmath=sse -msse2" >X elif [ -n "$cpu_feature_SSE" ] ; then >X FEATURES="-mfpmath=sse -msse" >X fi >X ;; >X m68k) >X case "$(egrep '^fpu0 ' /var/run/dmesg.boot)" in >X *\(emulator\)*) FEATURES="-msoft-float" ;; >X *\(no\ math\ support\)*) FEATURES="-msoft-float" ;; >X esac >X ;; >X esac >X echo $FEATURES >X } >11965e523b800db5fd0162adad1d1bff >echo x - cpuflags/files/subr_SunOS >sed 's/^X//' >cpuflags/files/subr_SunOS << '87b81c8e8ad52d4865c183d0842ffcd6' >X# $NetBSD: subr_SunOS,v 1.5 2009/03/04 00:32:44 abs Exp $ >X >XAWK=nawk >XSED=sed >X >Xdisplay_hw_details() >X { >X cat <<END >XOS : '$(uname)' >Xarch : '$hw_arch' >Xpsrinfo : '$hw_psrinfo' >XEND >X } >X >Xextract_hw_details() >X { >X hw_arch=$(/usr/bin/uname -m) >X # Just gets the first CPU >X hw_psrinfo=$(psrinfo -pv | $AWK 'NR==3{sub(" *","");print}') >X } >X >Xdetermine_arch() >X { >X ARCH= >X case $hw_arch in >X sun4c | sun4 ) ARCH='-mcpu=cypress' ;; >X sun4m ) ARCH='-mcpu=supersparc' ;; >X sun4u ) ARCH='-mcpu=v9' ;; >X i86pc ) >X include subr_x86 # this provides map_x86_brand_string() >X ARCH=$(map_x86_brand_string "$cpu_brand") >X if [ -z "$ARCH" ] ; then >X case "$hw_psrinfo" in >X *) >X esac >X fi >X ;; >X esac >X echo $ARCH >X } >X >Xdetermine_features() >X { >X echo >X } >87b81c8e8ad52d4865c183d0842ffcd6 >echo x - cpuflags/files/subr_gcc >sed 's/^X//' >cpuflags/files/subr_gcc << 'ca950381fd63c80812aee8527d1b963a' >X# $NetBSD: subr_gcc,v 1.6 2009/01/12 22:11:58 abs Exp $ >X >X# Return gcc version string >Xgcc_ver() >X { >X gcc=$1 >X ${gcc} -dumpversion | $SED -e 's/^[^0-9\.]\{1,\}//' -e 's/[^0-9\.]\{1,\}$//' >X } >X >Xgcc_ser() >X { >X gcc=$1 >X gcc_ver $gcc | $AWK -F. '{ print ($1*1000+$2)}' >X } >X >Xgcc_fixup_arch_flags() >X { >X gcc=$1 >X shift >X gcc_arch_flags="$*" >X >X # Fixup options for older gccs. >X # Entries can be recursive - eg: >X # -march=k6-3 -> -march=k6 -> -march=pentium -> -march=i486 >X # >X # The format of table is >X # gcc_version_in_which_option_was_introduced : new_option : old_option >X >X $AWK -F: -v "flags=$gcc_arch_flags" -v "gcc_ver=$(gcc_ver $gcc)" ' >X { if (gcc_ver < $1) { map[$2] = ""$3 } } >X END { >X FS=" "; split(flags, flaglist); >X for (af in flaglist) { >X flag = flaglist[af]; >X while (flag in map) { >X flag = map[flag] >X } >X print flag >X } >X } >X ' <<EOD >X2.90:-march=i386:-mno-486 >X2.90:-march=i486:-m486 >X2.90:-march=pentium:-m486 >X2.90:-march=pentiumpro:-m486 >X2.90:-mcpu=21164a: >X2.90:-mcpu=arm610:-m6 >X2.90:-mcpu=arm710:-m6 >X2.90:-mcpu=cypress:-mcypress >X2.90:-mcpu=sparclite:-msparclite >X2.90:-mcpu=strongarm110:-m6 >X2.90:-mcpu=supersparc:-msupersparc >X2.90:-mcpu=v9:-mv8 >X2.95:-march=k6:-march=pentium >X3.0:-march=athlon:-march=pentiumpro >X3.1:-march=athlon-4:-march=athlon >X3.1:-march=athlon-mp:-march=athlon >X3.1:-march=athlon-tbird:-march=athlon >X3.1:-march=athlon-xp:-march=athlon >X3.1:-march=k6-2:-march=k6 >X3.1:-march=k6-3:-march=k6 >X3.1:-march=pentium-mmx:-march=pentium >X3.1:-march=pentium2:-march=pentiumpro >X3.1:-march=pentium3 -mno-sse:-march=pentiumpro >X3.1:-march=pentium3:-march=pentiumpro >X3.1:-march=pentium4:-march=pentiumpro >X3.1:-march=r2000:-cpu=r2000 >X3.1:-march=r3000:-cpu=r3000 >X3.1:-march=r3900:-cpu=r3900 >X3.1:-march=r4000:-cpu=r4000 >X3.1:-march=r4100:-cpu=r4100 >X3.1:-march=r4300:-cpu=r4300 >X3.1:-march=r4400:-cpu=r4400 >X3.1:-march=r4600:-cpu=r4600 >X3.1:-march=r5000:-cpu=r5000 >X3.1:-march=r6000:-cpu=r6000 >X3.1:-march=r8000:-cpu=r8000 >X3.1:-mcpu=21264a:-mcpu=21264 >X3.1:-mcpu=7400:-mcpu=750 >X3.1:-mcpu=7450:-mcpu=750 >X3.1:-mfpmath=sse: >X3.1:-mmmx: >X3.1:-msse2: >X3.1:-msse: >X3.1:-mtune=r2000:-cpu=r2000 >X3.1:-mtune=r3000:-cpu=r3000 >X3.1:-mtune=r3900:-cpu=r3900 >X3.1:-mtune=r4000:-cpu=r4000 >X3.1:-mtune=r4100:-cpu=r4100 >X3.1:-mtune=r4300:-cpu=r4300 >X3.1:-mtune=r4400:-cpu=r4400 >X3.1:-mtune=r4600:-cpu=r4600 >X3.1:-mtune=r5000:-cpu=r5000 >X3.1:-mtune=r6000:-cpu=r6000 >X3.1:-mtune=r8000:-cpu=r8000 >X3.3:-march=c3:-march=i586 >X3.3:-march=winchip-c6:-march=i586 >X3.3:-march=winchip2:-march=i586 >X3.4:-march=athlon-fx:-march=athlon-xp >X3.4:-march=athlon64:-march=athlon-xp >X3.4:-march=c3-2:-march=c3 >X3.4:-march=k8:-march=athlon-xp >X3.4:-march=nocona:-march=pentium4 >X3.4:-march=opteron:-march=athlon-xp >X3.4:-march=pentium-m:-march=pentium3 >X3.4:-march=pentium3m:-march=pentium3 >X3.4:-march=pentium4m:-march=pentium4 >X3.4:-march=prescott:-march=pentium4 >X3.4:-msse3: >X4.2:-m3dnow: >X4.2:-march=native: >X4.3:-march=amdfam10:-march=athlon64 >X4.3:-march=athlon64-sse3:-march=athlon64 >X4.3:-march=barcelona:-march=athlon64 >X4.3:-march=core2:-march=nocona >X4.3:-march=geode:-march=k6-3 >X4.3:-march=k8-sse3:-march=k8 >X4.3:-march=opteron-sse3:-march=opteron >XEOD >X } >ca950381fd63c80812aee8527d1b963a >echo x - cpuflags/files/subr_x86 >sed 's/^X//' >cpuflags/files/subr_x86 << 'd025faf5d44c6c30859a97fd0d33fb13' >X# $NetBSD: subr_x86,v 1.13 2009/03/30 21:02:25 abs Exp $ >X >X# Apparently the only way to reliably determine the architecture of a recent >X# Intel CPU is to use the cpu brand string - as they reused family and >X# extended family bitflags... annoying >X# Even better, they appear to have reused brand strings between Northwood >X# and Prescott pentium4s. Thats just... special. >X >X# AMD, in contrast decided to keep things simple: >X# (thanks to Christoph Egger for this list) >X# Family 0x6: AMD K7 >X# Family 0xf: AMD K8 >X# Family 0x10: AMD Barcelona/Phenom >X# Family 0x11: AMD Turion Ultra >X >Xmap_x86_brand_string() >X { >X case "$cpu_brand" in >X "AMD*") >X case "$cpu_family-$cpu_model" in >X 5-6 | 5-7 ) echo '-march=k6' ;; >X 5-8 ) echo '-march=k6-2' ;; >X 5-9 ) echo '-march=k6-3' ;; >X 6-1 | 6-2 | 6-3 ) echo '-march=athlon' ;; >X 6-4 | 6-6 | 6-7 | 6-8 | 6-a ) echo '-march=athlon-4' ;; >X esac >X ;; >X >X "VIA Nehemiah"*) echo '-march=c3' ;; >X >X "Genuine Intel(R) CPU T2400"*) echo '-march=core2' ;; >X "Genuine Intel(R) CPU T2500"*) echo '-march=core2' ;; >X "Intel(R) Atom(TM) CPU "*) echo '-march=core2 -mtune=pentium' ;;#So far >X "Intel(R) Celeron(R) CPU E1400"*) echo '-march=core2' ;; >X "Intel(R) Celeron(R) CPU 2.40GHz") echo '-march=pentium4' ;; >X "Intel(R) Celeron(R) M processor "*) echo '-march=pentium-m' ;; >X "Intel(R) Celeron(TM) CPU 1400MHz") echo '-march=pentium3' ;; >X "Intel(R) Core 2 "*) echo '-march=core2' ;; >X "Intel(R) Core(TM)2 "*) echo '-march=core2' ;; >X "Intel(R) Pentium(R) 4 CPU"*) >X if [ -n "$cpu_feature_SSE3" ] ; then >X echo '-march=prescott' >X else >X echo '-march=pentium4' >X fi ;; >X "Intel(R) Pentium(R) M processor "*) echo '-march=pentium-m' ;; >X "Intel(R) Xeon(R) CPU 3040"*) echo '-march=core2' ;; >X "Intel(R) Xeon(R) CPU 3050"*) echo '-march=core2' ;; >X "Intel(R) Xeon(R) CPU E5310"*) echo '-march=core2' ;; >X "Intel(r) Xeon(r) CPU E5430"*) echo '-march=core2' ;; >X "Pentium(R) Dual-Core CPU E5200"*) echo '-march=core2' ;; >X >X esac >X } >X >Xflags_fixup_x86arch() >X { >X arch=$1 >X features=$2 >X # Fixup ARCH for x86 >X # >X # The format of table is >X # feature:lowend_arch:fix_arch >X # >X $AWK -v "arch=${arch#-march=}" -v "features=$features" ' >X BEGIN { split(features,ar); FS=":" } >X { for (af in ar) >X { if ((ar[af] == $1) && (arch == $3)) { print $2; exit;} } >X } >X ' <<EOD >X-msse:pentium3:i386 >X-msse:pentium3:i486 >X-msse:pentium3:i586 >X-msse:pentium3:i686 >X-msse:pentium3:pentium >X-msse:pentium3:pentium-mmx >X-msse:pentium3:pentiumpro >X-msse:pentium3:pentium2 >X-msse:athlon:k6 >X-msse:athlon:k6-2 >X-msse:athlon:k6-3 >X-msse2:pentium4:i386 >X-msse2:pentium4:i386 >X-msse2:pentium4:i486 >X-msse2:pentium4:i586 >X-msse2:pentium4:i686 >X-msse2:pentium4:pentium >X-msse2:pentium4:pentium-mmx >X-msse2:pentium4:pentiumpro >X-msse2:pentium4:pentium2 >X-msse2:pentium4:pentium3 >X-msse2:pentium4:pentium3m >X-msse2:k8:k6 >X-msse2:k8:k6-2 >X-msse2:k8:k6-3 >X-msse2:k8:athlon >X-msse2:k8:athlon-tbird >X-msse2:k8:athlon-4 >X-msse2:k8:athlon-xp >X-msse2:k8:athlon-mp >X-msse3:prescott:i386 >X-msse3:prescott:i386 >X-msse3:prescott:i486 >X-msse3:prescott:i586 >X-msse3:prescott:i686 >X-msse3:prescott:pentium >X-msse3:prescott:pentium-mmx >X-msse3:prescott:pentiumpro >X-msse3:prescott:pentium2 >X-msse3:prescott:pentium3 >X-msse3:prescott:pentium3m >X-msse3:prescott:pentium-m >X-msse3:prescott:pentium4 >X-msse3:prescott:pentium4m >X-msse3:k8:k6 >X-msse3:k8:k6-2 >X-msse3:k8:k6-3 >X-msse3:k8:athlon >X-msse3:k8:athlon-tbird >X-msse3:k8:athlon-4 >X-msse3:k8:athlon-xp >X-msse3:k8:athlon-mp >X-m3dnow:athlon:k6 >X-m3dnow:athlon:k6-2 >X-m3dnow:athlon:k6-3 >XEOD >X >X## in future >X#-mssse3:nocona:prescott ... >X#-msse4:nehalem:nocona ... >X } >d025faf5d44c6c30859a97fd0d33fb13 >echo x - cpuflags/files/cpuflags.mk.out >sed 's/^X//' >cpuflags/files/cpuflags.mk.out << '1324b50fc2aa435e69553786c49dd2bd' >X# $Id: cpuflags.mk,v 1.20 2009/01/28 23:30:50 abs Exp $ >X# Makefile include fragment to simplify use of cpuflags in pkgsrc >X# abs@absd.org - freely distributable, no warrenties, stick no bills. >X >X# Try to optimise based on CPU >X# Does not affect any package that overrides CFLAGS/CXXFLAGS/CCOPTIONS >X# Sets five variables: >X# >X# CPU_FLAGS The output of cpuflags >X# CFLAGS Has CPU_FLAGS appended >X# CXXFLAGS Has CPU_FLAGS appended >X# >X# CPU_DIR CPU_FLAGS with spaces stripped (eg: for use in PACKAGES) >X >X >X.ifndef CPU_FLAGS >X >X. if exists(${.PARSEDIR}/cpuflags.sh) >X_CPUFLAGS_SH=${SH} ${.PARSEDIR}/cpuflags.sh >X. else >X_CPUFLAGS_SH=/usr/local/bin/cpuflags >X. endif >X >X. if defined(CCPATH) >XCPU_FLAGS!=${_CPUFLAGS_SH} ${CCPATH} >X. elif defined(BSD_PKG_MK) || ${USETOOLS:Uyes} == "no" >XCPU_FLAGS!=${_CPUFLAGS_SH} ${CC} >X. else >XCPU_FLAGS!=${_CPUFLAGS_SH} >X. endif >X_CPUFLAGS_SH= >X >X.endif # CPU_FLAGS >X >X.ifndef CPU_DIR >XCPU_DIR!=echo ${CPU_FLAGS} | sed 's/ //g' >X.endif >X >X.if !defined(MAKEFLAGS) || empty(MAKEFLAGS:MCPU_FLAGS) >XMAKEFLAGS+=CPU_FLAGS=${CPU_FLAGS:Q} CPU_DIR=${CPU_DIR:Q} # For sub makes >X.endif >X >X.ifdef BSD_PKG_MK # Try to catch various package opts >XCFLAGS+=${CPU_FLAGS} >XCXXFLAGS+=${CPU_FLAGS} >XMAKE_FLAGS+=CCOPTIONS="${CPU_FLAGS}" # Override CCOPTIONS for imake >X >X.elif !defined(IMAGESIZE) && ${DBG} != "-Os" >X# Assume in base system & not building space optimised distrib, set COPTS >XCOPTS?=${CPU_FLAGS} ${DEFCOPTS} >X# Include ${DEFCOPTS} and set ?= to allow overriding in kernel builds >X >X.endif >1324b50fc2aa435e69553786c49dd2bd >echo x - cpuflags/files/cpuflags.sh.out >sed 's/^X//' >cpuflags/files/cpuflags.sh.out << 'cb0084420d2c60e8cd6e3c9c54dfcce5' >X#!@@SH@@ >X# $NetBSD: cpuflags.sh,v 1.7 2009/01/28 23:30:50 abs Exp $ >XPATH=/sbin:/usr/sbin:/bin:/usr/bin:$PATH >X >X# cd to the directory containing the binary, so we can usefully check for >X# include files from there >Xcase "$0" in >X /*) cd $(dirname $0);; >X *) cd $(dirname $PWD/$0);; >Xesac >X >Xinclude() >X { >X file=$1 >X if [ -f ./$file ] ; then >X file=./$file >X else >X file=/usr/local/share/cpuflags/$file >X fi >X verbose . $file >X . $file >X } >X >Xverbose() >X { >X [ -n "$opt_v" ] && echo $* >&2 >X return 0 >X } >X >XUNAME=$(uname) >X >Xif [ "$1" = -v ] ; then >X shift >X opt_v=1 >Xfi >X >Xif [ -n "$1" ]; then >X CC=$1 >Xelse >X CC=gcc >Xfi >X >X# Each UNAME subr_ file is expected to set AWK & SED, and to provide the >X# following methods: >X# extract_hw_details: Must be called before determine_arch/determine_features >X# determine_arch: Returns cpu arch >X# determine_features: Returns cpu features >X# display_hw_details: Human readable output for current machine >X# >Xinclude subr_${UNAME} >X >X# This provides gcc_ser(), gcc_ver() and gcc_fixup_arch_flags() >X# >Xinclude subr_gcc >X >X# native arch >XM_ARCH_NATIVE='-march=native' >X >X# Determine the flags for this OS/machine >Xextract_hw_details >Xif [ $(gcc_ser $CC) -gt 4002 ] ; then >X ARCH="$M_ARCH_NATIVE" >Xelse >X ARCH=$(determine_arch) >Xfi >XFEATURES=$(determine_features) >X >Xtest "x$ARCH" != "x$M_ARCH_NATIVE" && # gcc have not autodetection >X case "$hw_machine_arch" in # all known x86 mnemonics >X i386|i486|i586|i686|x86_64|amd64|i86pc) >X include subr_x86 # this provides flags_fixup_x86arch() >X l_arch=$(flags_fixup_x86arch "$ARCH" "$FEATURES") >X test -n "$l_arch" && ARCH="-march=$l_arch" >X esac >X >X# Fixup any flags which are too new for our gcc version >X# >XCPUFLAGS=$(gcc_fixup_arch_flags $CC $ARCH $FEATURES) >XCPUFLAGS=$(echo $CPUFLAGS) >X >Xif [ -n "$opt_v" ] ; then >X if [ -n "$NOARCH" ] ; then >X ARCH="No flags for this architecture" >X fi >X if [ -z "$ARCH" ]; then >X ARCH=Unknown >X fi >X cat <<END >XARCH : $ARCH >XFEATURES : $FEATURES >XCPUFLAGS : $CPUFLAGS >XGCC version : $(gcc_ver $CC) >XEND >X display_hw_details >X exit; >Xfi >X >Xif [ -z "$ARCH" -a -z "$NOARCH" ] ; then >X echo 'Unknown machine - please send cpuflags details to abs@absd.org' >&2 >X display_hw_details >&2 >Xfi >X >Xecho $CPUFLAGS >Xexit 0 >cb0084420d2c60e8cd6e3c9c54dfcce5 >echo x - cpuflags/pkg-descr >sed 's/^X//' >cpuflags/pkg-descr << 'd5984ec882cd8b80641256de671b5b2f' >Xcpuflags returns the appropriate gcc flags to optimise compilation for the >Xcurrent CPU. >d5984ec882cd8b80641256de671b5b2f >echo x - cpuflags/pkg-plist >sed 's/^X//' >cpuflags/pkg-plist << '3729dbe6fc865b8bb1fa747e4f0c7d43' >X@comment $NetBSD: PLIST,v 1.6 2009/06/14 17:48:38 joerg Exp $ >Xbin/cpuflags >Xman/man1/cpuflags.1 >Xshare/cpuflags/subr_FreeBSD >Xshare/cpuflags/subr_Linux >Xshare/cpuflags/subr_NetBSD >Xshare/cpuflags/subr_SunOS >Xshare/cpuflags/subr_gcc >Xshare/cpuflags/subr_x86 >Xshare/mk/cpuflags.mk >Xshare/mk/optimize_gcc.mk >3729dbe6fc865b8bb1fa747e4f0c7d43 >exit
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 144363
: 104222 |
104223