summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authorjperkin <jperkin@pkgsrc.org>2021-11-29 12:38:44 +0000
committerjperkin <jperkin@pkgsrc.org>2021-11-29 12:38:44 +0000
commitfda1745e50bb05d5f5a232a588caee54fe1ad85e (patch)
tree781c73630de14f9c893fcb6a8d693bdb3ff02bae /mk
parenta9da03316a4d755a528b46d8761a79c04c1e2849 (diff)
downloadpkgsrc-fda1745e50bb05d5f5a232a588caee54fe1ad85e.tar.gz
mk: Explicitly set arm64 flags on Darwin/aarch64.
It's currently impossible to run system binaries inside an arm64 chroot, even with SIP turned off, so the only way to build is to use an x86_64 chroot and effectively cross-compile to arm64.
Diffstat (limited to 'mk')
-rw-r--r--mk/platform/Darwin.mk15
1 files changed, 14 insertions, 1 deletions
diff --git a/mk/platform/Darwin.mk b/mk/platform/Darwin.mk
index 14091893e72..ee3df0b092d 100644
--- a/mk/platform/Darwin.mk
+++ b/mk/platform/Darwin.mk
@@ -1,4 +1,4 @@
-# $NetBSD: Darwin.mk,v 1.108 2021/11/29 12:31:56 jperkin Exp $
+# $NetBSD: Darwin.mk,v 1.109 2021/11/29 12:38:44 jperkin Exp $
#
# Variable definitions for the Darwin operating system.
@@ -132,6 +132,19 @@ PKG_FAIL_REASON+= "No suitable Xcode SDK or Command Line Tools installed."
.endif
#
+# Explicitly pass arm64 flags when building for arm64 so that everything works
+# as expected when effectively cross-compiling inside an x86_64 chroot.
+#
+.if ${MACHINE_ARCH} == "aarch64"
+CWRAPPERS_APPEND.cc+= -arch arm64
+CWRAPPERS_APPEND.cxx+= -arch arm64
+CWRAPPERS_APPEND.ld+= -arch arm64
+_WRAP_EXTRA_ARGS.CC+= -arch arm64
+_WRAP_EXTRA_ARGS.CXX+= -arch arm64
+_WRAP_EXTRA_ARGS.LD+= -arch arm64
+.endif
+
+#
# Newer macOS releases remove library files from the file system. The only way
# to test them is via dlopen(), which is obviously impractical for many things.
#