summaryrefslogtreecommitdiff
path: root/mk/bsd.prefs.mk
diff options
context:
space:
mode:
authortron <tron>2009-09-21 10:56:08 +0000
committertron <tron>2009-09-21 10:56:08 +0000
commit9c16a69a7d9af837eab02dffa54bbf6adc9b7547 (patch)
tree6f9e4599985fe0bc1d6c4fc0c3ee69c16d2e1baa /mk/bsd.prefs.mk
parentb048156157eb424e36549402b0966f928da3fa6c (diff)
downloadpkgsrc-9c16a69a7d9af837eab02dffa54bbf6adc9b7547.tar.gz
Try 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" based on the ABI we are compiling for, not on based on the kernel the machine is running. The "gnupg" package now builds for the 64-Bit API without extra tricks.
Diffstat (limited to 'mk/bsd.prefs.mk')
-rw-r--r--mk/bsd.prefs.mk20
1 files changed, 19 insertions, 1 deletions
diff --git a/mk/bsd.prefs.mk b/mk/bsd.prefs.mk
index 5b44dde08b7..1ce9d23b475 100644
--- a/mk/bsd.prefs.mk
+++ b/mk/bsd.prefs.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.prefs.mk,v 1.295 2009/09/13 13:28:46 tron Exp $
+# $NetBSD: bsd.prefs.mk,v 1.296 2009/09/21 10:56:08 tron Exp $
#
# This file includes the mk.conf file, which contains the user settings.
#
@@ -123,7 +123,25 @@ LOWER_OPSYS?= bsdi
.elif ${OPSYS} == "Darwin"
LOWER_OPSYS?= darwin
+.if empty(OS_VERSION:M[1-9].*.*)
+# Determine the ABI under Mac OS X Snow Leopard and adjust
+# the machine archicture accordingly.
+. if !defined(ABI)
+_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
+. endif
+.if ${ABI} == "32"
+LOWER_ARCH= i386
+.else
+LOWER_ARCH= x86_64
+.endif
+.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/}