summaryrefslogtreecommitdiff
path: root/bootstrap/bootstrap
diff options
context:
space:
mode:
authorjperkin <jperkin@pkgsrc.org>2022-09-12 12:32:30 +0000
committerjperkin <jperkin@pkgsrc.org>2022-09-12 12:32:30 +0000
commit3709b206ca697d01c1ed5fcb19d10c1dae639957 (patch)
tree58e662e27a67e2911b68e5392e292acef18a56d5 /bootstrap/bootstrap
parent21d505c1481ddc2329f2317bb22cca4ab261d508 (diff)
downloadpkgsrc-3709b206ca697d01c1ed5fcb19d10c1dae639957.tar.gz
macOS: Support MACOSX_DEPLOYMENT_TARGET.
This allows the user to specify an exact SDK to use, and can be used to build packages for an older release of macOS than the host. The user should ideally set this via environment variable at bootstrap time, and pkgsrc will then encode that into mk.conf and use it for all builds. Tested on macOS 12.x building against an 11.3 SDK for both arm64 and x86_64.
Diffstat (limited to 'bootstrap/bootstrap')
-rwxr-xr-xbootstrap/bootstrap14
1 files changed, 13 insertions, 1 deletions
diff --git a/bootstrap/bootstrap b/bootstrap/bootstrap
index 5aa0cf6fa52..6df8c86093a 100755
--- a/bootstrap/bootstrap
+++ b/bootstrap/bootstrap
@@ -1,6 +1,6 @@
#! /bin/sh
-# $NetBSD: bootstrap,v 1.313 2022/09/09 10:58:15 jperkin Exp $
+# $NetBSD: bootstrap,v 1.314 2022/09/12 12:32:30 jperkin Exp $
#
# Copyright (c) 2001-2011 Alistair Crooks <agc@NetBSD.org>
# All rights reserved.
@@ -589,6 +589,14 @@ Darwin)
machine_arch=`get_machine_arch_darwin`
check_compiler=yes
+ if [ -n "${MACOSX_DEPLOYMENT_TARGET}" ]; then
+ SDK_PATH=`/usr/bin/xcrun \
+ --sdk macosx${MACOSX_DEPLOYMENT_TARGET} \
+ --show-sdk-path 2>/dev/null || echo /nonexistent`
+ CFLAGS="-isysroot ${SDK_PATH} ${CFLAGS}"
+ export CFLAGS
+ fi
+
# Combine major.minor product version for simpler numerical tests.
macos_version=`sw_vers -productVersion | \
awk -F. '{ printf("%02d%02d", $1, $2) }'`
@@ -1393,6 +1401,10 @@ fi
if test -n "$LIBS"; then
echo "LIBS+= $LIBS" >> ${TARGET_MKCONF}
fi
+if test -n "$MACOSX_DEPLOYMENT_TARGET"; then
+ echo "MACOSX_DEPLOYMENT_TARGET= $MACOSX_DEPLOYMENT_TARGET" >>${TARGET_MKCONF}
+ echo "MACOSX_DEPLOYMENT_TARGET= $MACOSX_DEPLOYMENT_TARGET" >>${BOOTSTRAP_MKCONF}
+fi
# opsys specific fiddling
opsys_finish