diff options
author | jperkin <jperkin@pkgsrc.org> | 2016-01-24 16:14:44 +0000 |
---|---|---|
committer | jperkin <jperkin@pkgsrc.org> | 2016-01-24 16:14:44 +0000 |
commit | fce78c05d2b89e39cbed6550f41cfcb953a79b76 (patch) | |
tree | c3c974565ac88eddb790ad36e7b99f06ff190a0a /mk | |
parent | f0e3ed42a48ebe6c8c92d305dc49fb165e9d90cb (diff) | |
download | pkgsrc-fce78c05d2b89e39cbed6550f41cfcb953a79b76.tar.gz |
Attempt to bring sanity to how ABI and MACHINE_ARCH are set.
Previously there were at least 5 different ways MACHINE_ARCH could be set,
some statically and some at run time, and in many cases these settings
differed, leading to issues at pkg_add time where there was conflict
between the setting encoded into the package and that used by pkg_install.
Instead, move to a single source of truth where the correct value based on
the host and the chosen (or default) ABI is determined in the bootstrap
script. The value can still be overridden in mk.conf if necessary, e.g.
for cross-compiling.
ABI is now set by default and if unset a default is calculated based on
MACHINE_ARCH. This fixes some OS, e.g. Linux, where the wrong default was
previously chosen.
As a result of the refactoring there is no need for LOWER_ARCH, with
references to it replaced by MACHINE_ARCH. SPARC_TARGET_ARCH is also
removed.
Diffstat (limited to 'mk')
-rw-r--r-- | mk/bsd.prefs.mk | 109 | ||||
-rw-r--r-- | mk/defaults/mk.conf | 7 |
2 files changed, 6 insertions, 110 deletions
diff --git a/mk/bsd.prefs.mk b/mk/bsd.prefs.mk index b3c0d3496bf..9f7ab879f2d 100644 --- a/mk/bsd.prefs.mk +++ b/mk/bsd.prefs.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.prefs.mk,v 1.375 2016/01/12 19:55:41 rillig Exp $ +# $NetBSD: bsd.prefs.mk,v 1.376 2016/01/24 16:14:44 jperkin Exp $ # # This file includes the mk.conf file, which contains the user settings. # @@ -128,13 +128,6 @@ MACHINE_GNU_ARCH?= ${GNU_ARCH.${MACHINE_ARCH}:U${MACHINE_ARCH}} LOWER_OPSYS?= netbsd .elif ${OPSYS} == "AIX" -LOWER_ARCH!= _cpuid=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $$1 }'`; \ - if /usr/sbin/lsattr -El $$_cpuid | grep ' POWER' >/dev/null 2>&1; then \ - echo rs6000; \ - else \ - echo powerpc; \ - fi -MACHINE_ARCH?= ${LOWER_ARCH} . if exists(/usr/bin/oslevel) _OS_VERSION!= /usr/bin/oslevel . else @@ -150,75 +143,30 @@ LOWER_OPSYS?= bsdi .elif ${OPSYS} == "Bitrig" LOWER_OPSYS?= bitrig -LOWER_ARCH!= arch -s -. if ${LOWER_ARCH} == "amd64" -MACHINE_ARCH= x86_64 -. else -MACHINE_ARCH= ${LOWER_ARCH} -. endif -MAKEFLAGS+= LOWER_ARCH=${LOWER_ARCH:Q} -MAKEFLAGS+= MACHINE_ARCH=${MACHINE_ARCH:Q} LOWER_VENDOR?= unknown .elif ${OPSYS} == "Cygwin" LOWER_OPSYS?= cygwin LOWER_VENDOR?= pc -. if !defined(LOWER_ARCH) -LOWER_ARCH!= ${UNAME} -m | sed -e 's/i.86/i386/' -. endif # !defined(LOWER_ARCH) _OS_VERSION!= ${UNAME} -r OS_VERSION= ${_OS_VERSION:C/\(.*\)//} OS_VARIANT!= ${UNAME} -s .elif ${OPSYS} == "Darwin" LOWER_OPSYS?= darwin -.if empty(OS_VERSION:M[1-9].*.*) -# Automatically select the ABI under Mac OS X Snow Leopard. We don't -# use this at the moment because too many third party programs don't -# work with it. -# -# _SYSCTL_HW_OPTIONAL_X86_64!= /usr/sbin/sysctl -n hw.optional.x86_64 -# . if ${_SYSCTL_HW_OPTIONAL_X86_64} == "1" -# ABI= 64 -# .else -# ABI= 32 -#. endif -ABI= 32 -LOWER_ARCH.32= i386 -LOWER_ARCH.64= x86_64 -LOWER_ARCH= ${LOWER_ARCH.${ABI}} -.else -LOWER_ARCH!= ${UNAME} -p -.endif -MACHINE_ARCH= ${LOWER_ARCH} -MAKEFLAGS+= LOWER_ARCH=${LOWER_ARCH:Q} LOWER_OPSYS_VERSUFFIX= ${LOWER_OS_VERSION:C/([0-9]*).*/\1/} LOWER_VENDOR?= apple .elif ${OPSYS} == "DragonFly" OS_VERSION:= ${OS_VERSION:C/-.*$//} LOWER_OPSYS?= dragonfly -LOWER_ARCH!= ${UNAME} -p -. if ${LOWER_ARCH} == "amd64" -MACHINE_ARCH= x86_64 -. else -MACHINE_ARCH= ${LOWER_ARCH} -. endif -MAKEFLAGS+= LOWER_ARCH=${LOWER_ARCH:Q} LOWER_VENDOR?= pc .elif ${OPSYS} == "FreeBSD" OS_VERSION:= ${OS_VERSION:C/-.*$//} LOWER_OPSYS?= freebsd -LOWER_ARCH!= ${UNAME} -p -. if ${LOWER_ARCH} == "amd64" -MACHINE_ARCH= x86_64 -. else -MACHINE_ARCH= ${LOWER_ARCH} -. endif -MAKEFLAGS+= LOWER_ARCH=${LOWER_ARCH:Q} LOWER_OPSYS_VERSUFFIX= ${LOWER_OS_VERSION:C/([0-9]*).*/\1/} -. if ${LOWER_ARCH} == "i386" +. if ${MACHINE_ARCH} == "i386" LOWER_VENDOR?= pc . endif LOWER_VENDOR?= unknown @@ -249,13 +197,9 @@ OS_VERSION= 3.0 LOWER_OPSYS?= mirbsd LOWER_OS_VERSION= ${OS_VERSION} LOWER_OPSYS_VERSUFFIX= ${OS_VERSION} -LOWER_ARCH!= arch -s LOWER_VENDOR?= unknown -MACHINE_ARCH= ${LOWER_ARCH} -MAKEFLAGS+= LOWER_ARCH=${LOWER_ARCH:Q} .elif !empty(OPSYS:MIRIX*) -LOWER_ARCH!= ${UNAME} -p LOWER_OPSYS?= irix LOWER_OPSYS_VERSUFFIX?= ${OS_VERSION} LOWER_VENDOR?= sgi @@ -263,11 +207,6 @@ LOWER_VENDOR?= sgi .elif ${OPSYS} == "Linux" OS_VERSION:= ${OS_VERSION:C/-.*$//} LOWER_OPSYS?= linux -. if !defined(LOWER_ARCH) -LOWER_ARCH!= ${UNAME} -m | sed -e 's/i.86/i386/' -e 's/ppc/powerpc/' -. endif # !defined(LOWER_ARCH) -MACHINE_ARCH= ${LOWER_ARCH} -MAKEFLAGS+= LOWER_ARCH=${LOWER_ARCH:Q} . if exists(/etc/debian_version) LOWER_VENDOR?= debian . elif exists(/etc/mandrake-release) @@ -278,26 +217,15 @@ LOWER_VENDOR?= redhat LOWER_VENDOR?= slackware . elif exists(/etc/ssdlinux_version) LOWER_VENDOR?= ssd -. elif ${LOWER_ARCH} == "i386" +. elif ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64" LOWER_VENDOR?= pc . endif LOWER_VENDOR?= unknown .elif ${OPSYS} == "OpenBSD" LOWER_OPSYS?= openbsd -LOWER_ARCH!= arch -s -. if ${LOWER_ARCH} == "amd64" -MACHINE_ARCH= x86_64 -. else -MACHINE_ARCH= ${LOWER_ARCH} -. endif -MAKEFLAGS+= LOWER_ARCH=${LOWER_ARCH:Q} -MAKEFLAGS+= MACHINE_ARCH=${MACHINE_ARCH:Q} .elif ${OPSYS} == "OSF1" -LOWER_ARCH!= ${UNAME} -p -MAKEFLAGS+= LOWER_ARCH=${LOWER_ARCH:Q} -MACHINE_ARCH?= ${LOWER_ARCH} OS_VERSION:= ${OS_VERSION:C/^V//} LOWER_OPSYS?= osf1 LOWER_OPSYS_VERSUFFIX?= ${OS_VERSION} @@ -305,34 +233,11 @@ LOWER_VENDOR?= dec .elif ${OPSYS} == "HPUX" OS_VERSION:= ${OS_VERSION:C/^B.//} -. if ${MACHINE_ARCH} == "9000" -ABI?= 32 -MACHINE_ARCH.32= hppa -MACHINE_ARCH.64= hppa64 -MACHINE_ARCH= ${MACHINE_ARCH.${ABI}} -. endif LOWER_OPSYS?= hpux LOWER_OPSYS_VERSUFFIX?= ${OS_VERSION} LOWER_VENDOR?= hp .elif ${OPSYS} == "SunOS" -ABI?= 32 -. if ${MACHINE_ARCH} == "sparc" -SPARC_TARGET_ARCH?= sparcv7 -. elif ${MACHINE_ARCH} == "sun4" -MACHINE_ARCH= sparc -SPARC_TARGET_ARCH?= sparcv7 -. elif ${MACHINE_ARCH} == "i86pc" || ${MACHINE_ARCH} == "i86xpv" || ${MACHINE_ARCH} == "i386" -LOWER_ARCH.32= i386 -LOWER_ARCH.64= x86_64 -LOWER_ARCH= ${LOWER_ARCH.${ABI}} -MACHINE_ARCH= ${LOWER_ARCH} -. elif ${MACHINE_ARCH} == "unknown" -. if !defined(LOWER_ARCH) -LOWER_ARCH!= ${UNAME} -p -. endif # !defined(LOWER_ARCH) -MAKEFLAGS+= LOWER_ARCH=${LOWER_ARCH:Q} -. endif LOWER_VENDOR?= sun LOWER_OPSYS?= solaris LOWER_OPSYS_VERSUFFIX= 2.${OS_VERSION:C/5.//} @@ -342,7 +247,7 @@ OS_VARIANT= SmartOS LOWER_VARIANT_VERSION= ${_UNAME_V:C/joyent_//} . elif !empty(_UNAME_V:Momnios-*) OS_VARIANT= OmniOS -LOWER_VARIANT_VERSION!= /usr/bin/awk '{ if (!seen) { print $$3; seen=1 } }' /etc/release +LOWER_VARIANT_VERSION!= /usr/bin/awk '{ if (!seen) { print $$3; seen=1 } }' /etc/release . endif .elif ${OPSYS} == "SCO_SV" @@ -374,12 +279,8 @@ LOWER_OS_VERSION:= ${OS_VERSION:tl} MAKEFLAGS+= LOWER_OPSYS=${LOWER_OPSYS:Q} LOWER_VENDOR?= # empty ("arch--opsys") -LOWER_ARCH?= ${MACHINE_GNU_ARCH} -# Expand now as MACHINE_ARCH can be overriden in mk.conf and -# LOWER_ARCH is typically derived from it. -NATIVE_LOWER_ARCH:= ${LOWER_ARCH} -NATIVE_MACHINE_ARCH:= ${MACHINE_ARCH} +NATIVE_MACHINE_ARCH:= ${MACHINE_ARCH} NATIVE_MACHINE_PLATFORM?= ${OPSYS}-${OS_VERSION}-${NATIVE_MACHINE_ARCH} MACHINE_PLATFORM?= ${OPSYS}-${OS_VERSION}-${MACHINE_ARCH} NATIVE_MACHINE_GNU_PLATFORM?= ${NATIVE_MACHINE_GNU_ARCH}-${LOWER_VENDOR}-${LOWER_OPSYS:C/[0-9]//g}${NATIVE_APPEND_ELF}${LOWER_OPSYS_VERSUFFIX}${NATIVE_APPEND_ABI} diff --git a/mk/defaults/mk.conf b/mk/defaults/mk.conf index d2a6493d1df..4d6e883bc91 100644 --- a/mk/defaults/mk.conf +++ b/mk/defaults/mk.conf @@ -1,4 +1,4 @@ -# $NetBSD: mk.conf,v 1.261 2016/01/20 13:29:29 khorben Exp $ +# $NetBSD: mk.conf,v 1.262 2016/01/24 16:14:44 jperkin Exp $ # # This file provides default values for variables that may be overridden @@ -1593,11 +1593,6 @@ SILC_CLIENT_WITH_PERL?= YES # Possible: YES, NO # Default: YES -#SPARC_TARGET_ARCH= sparcv7 -# Select SPARC target architecture under Solaris. -# Possible: sparcv7, sparcv8 or sparcv9. -# Default: sparcv7 - SSH_SUID?= NO # Used in ssh to enable setuid installation of "ssh" binary. # Possible: YES, or NO. |