summaryrefslogtreecommitdiff
path: root/devel
diff options
context:
space:
mode:
authorabs <abs@pkgsrc.org>2001-06-29 11:24:51 +0000
committerabs <abs@pkgsrc.org>2001-06-29 11:24:51 +0000
commitf73e6f4726a5d35ed9d8c924a3bef5111a5efc44 (patch)
tree6c790aa1200bad19aa96f51cd2453b547e50ceb9 /devel
parent4689507358c94043a679cec450e6ac27dbf00f1a (diff)
downloadpkgsrc-f73e6f4726a5d35ed9d8c924a3bef5111a5efc44.tar.gz
Update cpuflags to 0.6:
Introduce make fragment to be (optionally) included in mk.conf Document environment variables set in cpuflags.mk Ensure cpuflags.Linux works on gcc 2.7.x
Diffstat (limited to 'devel')
-rw-r--r--devel/cpuflags/Makefile5
-rw-r--r--devel/cpuflags/files/cpuflags.140
-rwxr-xr-xdevel/cpuflags/files/cpuflags.Linux28
-rwxr-xr-xdevel/cpuflags/files/cpuflags.NetBSD7
-rw-r--r--devel/cpuflags/files/cpuflags.mk21
-rw-r--r--devel/cpuflags/pkg/PLIST3
6 files changed, 86 insertions, 18 deletions
diff --git a/devel/cpuflags/Makefile b/devel/cpuflags/Makefile
index ab363839302..e735d25bd3b 100644
--- a/devel/cpuflags/Makefile
+++ b/devel/cpuflags/Makefile
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.5 2001/06/28 22:23:00 abs Exp $
+# $NetBSD: Makefile,v 1.6 2001/06/29 11:24:51 abs Exp $
#
-DISTNAME= cpuflags-0.5
+DISTNAME= cpuflags-0.6
CATEGORIES= sysutils
MASTER_SITES= # empty
DISTFILES= # empty
@@ -20,6 +20,7 @@ NO_BUILD= yes
do-install:
${INSTALL_SCRIPT} ${FILESDIR}/cpuflags.${OPSYS} ${PREFIX}/bin/cpuflags
+ ${INSTALL_DATA} ${FILESDIR}/cpuflags.mk ${PREFIX}/share/mk/cpuflags.mk
${INSTALL_MAN} ${FILESDIR}/cpuflags.1 ${PREFIX}/man/man1/cpuflags.1
.include "../../mk/bsd.pkg.mk"
diff --git a/devel/cpuflags/files/cpuflags.1 b/devel/cpuflags/files/cpuflags.1
index c67960d0831..ba089686e23 100644
--- a/devel/cpuflags/files/cpuflags.1
+++ b/devel/cpuflags/files/cpuflags.1
@@ -1,4 +1,4 @@
-.\" $NetBSD: cpuflags.1,v 1.2 2001/06/07 11:56:46 abs Exp $
+.\" $NetBSD: cpuflags.1,v 1.3 2001/06/29 11:24:51 abs Exp $
.Dd May 31, 2001
.Dt CPUFLAGS 1
@@ -16,22 +16,40 @@ to target the current cpu then nothing is output.
.Pp
In the event of the cpu not being recognised, a warning is sent to stderr.
.Pp
+.Sh ENVIRONMENT
+The makefile fragment
+.Pa /usr/pkg/share/mk/cpuflags.mk
+will set the following
+.Xr make 1
+variables. The first two are explicitly added to MAKE_ENV.
+.Bl -tag -width CPU_FLAGS -compact
+.It
+.It CPU_FLAGS
+The output of cpuflags
+.It CPU_DIR
+CPU_FLAGS with spaces stripped (eg: for use in PACKAGES)
+.It CFLAGS
+Has CPU_FLAGS appended
+.It CXXFLAGS
+Has CPU_FLAGS appended
+.El
+.Sh FILES
+.Bl -tag -width /usr/pkg/share/mk/cpuflags.mk -compact
+.It /usr/pkg/share/mk/cpuflags.mk
+for inclusion by /etc/mk.conf
+.El
.Sh EXAMPLES
.Nm
-can be used to set default flags for building entries from pkgsrc and
-recompiling the NetBSD kernel or userland by adding the following to
-.Pa /etc/mk.conf
+can be used to set default flags for building entries from pkgsrc
+and recompiling the NetBSD kernel or userland by adding the
+following to /etc/mk.conf.
.Bd -literal -offset indent
- .if ! defined(CPU_FLAGS) && exists(/usr/pkg/bin/cpuflags)
- CPU_FLAGS!=/usr/pkg/bin/cpuflags
- MAKE_ENV+=CPU_FLAGS=${CPU_FLAGS}
- CFLAGS+=${CPU_FLAGS}
- CXXFLAGS+=${CPU_FLAGS}
- .endif
+ .sinclude "/usr/pkg/share/mk/cpuflags.mk"
.Ed
.Sh BUGS
.Nm
-does not know about many cpu types yet - updates welcomed to <abs@netbsd.org>
+does not know about many cpu types yet - updates welcomed to <abs@netbsd.org>,
+and does not affect packages using imake.
.Pp
Currently
.Nm
diff --git a/devel/cpuflags/files/cpuflags.Linux b/devel/cpuflags/files/cpuflags.Linux
index 9226f7eafbd..45510ff3290 100755
--- a/devel/cpuflags/files/cpuflags.Linux
+++ b/devel/cpuflags/files/cpuflags.Linux
@@ -1,5 +1,5 @@
#!/bin/sh
-# $NetBSD: cpuflags.Linux,v 1.2 2001/06/07 11:56:46 abs Exp $
+# $NetBSD: cpuflags.Linux,v 1.3 2001/06/29 11:24:51 abs Exp $
hw_model=`uname -m`
@@ -13,6 +13,32 @@ case $hw_model in
*) echo "Unknown hw.model '$hw_model'" >&2
esac
+if [ -n "$FLAGS" ]; then
+ # Linux test lacks \<, so strip the version down to an int
+ gcc_ver=`gcc -v 2>&1 | awk '/gcc version/ {split($3,v,".");print v[1]v[2]}'`
+ case $gcc_ver in
+ egcs* )
+ gcc_ver=28 ;;
+ esac
+
+ # Old gcc, such as 2.7.x in NetBSD 1.3 and RedHat 5.0
+ if [ "$gcc_ver" -lt 28 ]; then
+ FLAGS=`awk -v "flags=$FLAGS" '
+{map["-m"$1] = "-m"$2}
+END{print map[flags]}' <<EOD
+arch=i386 no-486
+arch=i486 486
+arch=pentium 486
+arch=pentiumpro 486
+cpu=supersparc supersparc
+cpu=sparclite sparclite
+cpu=cypress cypress
+cpu=v9 v8
+EOD
+`
+ fi
+fi
+
echo $FLAGS
exit 0
diff --git a/devel/cpuflags/files/cpuflags.NetBSD b/devel/cpuflags/files/cpuflags.NetBSD
index d7b613751ef..0b23b7e24ef 100755
--- a/devel/cpuflags/files/cpuflags.NetBSD
+++ b/devel/cpuflags/files/cpuflags.NetBSD
@@ -1,5 +1,5 @@
#!/bin/sh
-# $NetBSD: cpuflags.NetBSD,v 1.5 2001/06/28 22:23:00 abs Exp $
+# $NetBSD: cpuflags.NetBSD,v 1.6 2001/06/29 11:24:51 abs Exp $
hw_model=`sysctl -n hw.model`
@@ -35,14 +35,15 @@ case $hw_model in
*) echo "Unknown hw.model '$hw_model'" >&2
esac
-if [ -n "$FLAGS" ];then
+if [ -n "$FLAGS" ]; then
gcc_ver=`gcc -v 2>&1 | awk '/gcc version/ {print $3}'`
case $gcc_ver in
egcs* )
gcc_ver=2.8 ;;
esac
- if [ "$gcc_ver" \< 2.8 ];then # Old gcc, such as in NetBSD 1.3
+ # Old gcc, such as 2.7.x in NetBSD 1.3
+ if [ "$gcc_ver" \< 2.8 ]; then
FLAGS=`awk -v "flags=$FLAGS" '
{map["-m"$1] = "-m"$2}
END{print map[flags]}' <<EOD
diff --git a/devel/cpuflags/files/cpuflags.mk b/devel/cpuflags/files/cpuflags.mk
new file mode 100644
index 00000000000..21fbc1c59ee
--- /dev/null
+++ b/devel/cpuflags/files/cpuflags.mk
@@ -0,0 +1,21 @@
+# $Id: cpuflags.mk,v 1.1 2001/06/29 11:24:51 abs Exp $
+# Makefile include fragment to simplify use of cpuflags in pkgsrc
+# abs@netbsd.org - freely distributable, no warrenties, stick no bills.
+
+# Try to optimise based on CPU
+# Does not affect Imakefiles, and any package that overrides CFLAGS/CXXFLAGS
+# Sets four variables:
+#
+# CPU_FLAGS The output of cpuflags
+# CPU_DIR CPU_FLAGS with spaces stripped (eg: for use in PACKAGES)
+# CFLAGS Has CPU_FLAGS appended
+# CXXFLAGS Has CPU_FLAGS appended
+#
+
+.if ! defined(CPU_FLAGS)
+CPU_FLAGS!=/usr/pkg/bin/cpuflags
+CPU_DIR!=echo ${CPU_FLAGS} | sed 's/ //'
+MAKE_ENV+=CPU_FLAGS=${CPU_FLAGS} CPU_DIR=${CPU_DIR}
+CFLAGS+=${CPU_FLAGS}
+CXXFLAGS+=${CPU_FLAGS}
+.endif
diff --git a/devel/cpuflags/pkg/PLIST b/devel/cpuflags/pkg/PLIST
index f051d357004..89528ea6ae7 100644
--- a/devel/cpuflags/pkg/PLIST
+++ b/devel/cpuflags/pkg/PLIST
@@ -1,3 +1,4 @@
-@comment $NetBSD: PLIST,v 1.1.1.1 2001/06/07 09:59:28 abs Exp $
+@comment $NetBSD: PLIST,v 1.2 2001/06/29 11:24:51 abs Exp $
bin/cpuflags
man/man1/cpuflags.1
+share/mk/cpuflags.mk