summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortron <tron@pkgsrc.org>2009-09-22 09:17:50 +0000
committertron <tron@pkgsrc.org>2009-09-22 09:17:50 +0000
commit382da928ee082294faa4c5484d01e513100bb46f (patch)
tree11e4833df5514477c4691484ea2a9d746e893e53
parent91a3fcff3978abe868c9af548386349348d50a68 (diff)
downloadpkgsrc-382da928ee082294faa4c5484d01e513100bb46f.tar.gz
Try again to fix Mac OS X Snow Leopard ABI issue (32-bit vs. 64-bit):
1.) Always set the "ABI" variable. 2.) Default to 64-bit mode if the machine is able to run 64-bit binaries. This seems to match the default behavior of Xcode (Apple's toolchain). 3.) Set "LOWER_ARCH" so it automatically evalutes to the correct value based on the ABI we are compiling for, not on based on the kernel the machine is running. This even works properly if the ABI is set in "/etc/mk.conf" or on the command line. Thanks a lot to OBATA Akio for providing the crucial hint to get this working properly.
-rw-r--r--mk/bsd.prefs.mk14
1 files changed, 13 insertions, 1 deletions
diff --git a/mk/bsd.prefs.mk b/mk/bsd.prefs.mk
index 73ebc9f4979..9ab1fbd7917 100644
--- a/mk/bsd.prefs.mk
+++ b/mk/bsd.prefs.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.prefs.mk,v 1.297 2009/09/21 15:28:03 tron Exp $
+# $NetBSD: bsd.prefs.mk,v 1.298 2009/09/22 09:17:50 tron Exp $
#
# This file includes the mk.conf file, which contains the user settings.
#
@@ -123,7 +123,19 @@ LOWER_OPSYS?= bsdi
.elif ${OPSYS} == "Darwin"
LOWER_OPSYS?= darwin
+.if empty(OS_VERSION:M[1-9].*.*)
+_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
+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/}