diff options
author | jperkin <jperkin@pkgsrc.org> | 2022-09-12 12:32:30 +0000 |
---|---|---|
committer | jperkin <jperkin@pkgsrc.org> | 2022-09-12 12:32:30 +0000 |
commit | 3709b206ca697d01c1ed5fcb19d10c1dae639957 (patch) | |
tree | 58e662e27a67e2911b68e5392e292acef18a56d5 /bootstrap | |
parent | 21d505c1481ddc2329f2317bb22cca4ab261d508 (diff) | |
download | pkgsrc-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')
-rw-r--r-- | bootstrap/README.macOS | 7 | ||||
-rwxr-xr-x | bootstrap/bootstrap | 14 |
2 files changed, 19 insertions, 2 deletions
diff --git a/bootstrap/README.macOS b/bootstrap/README.macOS index 0f89c706c32..6f5be0ab868 100644 --- a/bootstrap/README.macOS +++ b/bootstrap/README.macOS @@ -1,4 +1,4 @@ -$NetBSD: README.macOS,v 1.9 2022/08/01 14:49:09 jperkin Exp $ +$NetBSD: README.macOS,v 1.10 2022/09/12 12:32:30 jperkin Exp $ Please read the general README file as well. @@ -36,6 +36,11 @@ see "No suitable Xcode SDK or Command Line Tools installed." This usually means a pkgsrc developer needs to add another `OSX_SDK_MAP` entry to `mk/platform/Darwin.mk`. +If you wish to build for a specific SDK, first ensure is is available in the +correct location, and then you can set the regular MACOSX_DEPLOYMENT_TARGET +variable during bootstrap and pkgsrc will ensure that SDK is used for both +the bootstrap build as well as all packages built by those tools. + ----- Additional historical details, likely useful with older systems: 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 |