aboutsummaryrefslogtreecommitdiff
path: root/depends/hosts/darwin.mk
diff options
context:
space:
mode:
Diffstat (limited to 'depends/hosts/darwin.mk')
-rw-r--r--depends/hosts/darwin.mk34
1 files changed, 30 insertions, 4 deletions
diff --git a/depends/hosts/darwin.mk b/depends/hosts/darwin.mk
index 0d4fab937d..6099fd4c71 100644
--- a/depends/hosts/darwin.mk
+++ b/depends/hosts/darwin.mk
@@ -6,10 +6,30 @@ LD64_VERSION=530
OSX_SDK=$(SDK_PATH)/Xcode-$(XCODE_VERSION)-$(XCODE_BUILD_ID)-extracted-SDK-with-libcxx-headers
-# When cross-compiling for Darwin using Clang, -mlinker-version must be passed to
-# ensure that modern linker features are enabled.
-darwin_CC=clang -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -mlinker-version=$(LD64_VERSION)
-darwin_CXX=clang++ -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -stdlib=libc++ -mlinker-version=$(LD64_VERSION)
+# Flag explanations:
+#
+# -mlinker-version
+#
+# Ensures that modern linker features are enabled. See here for more
+# details: https://github.com/bitcoin/bitcoin/pull/19407.
+#
+# -B$(build_prefix)/bin
+#
+# Explicitly point to our binaries (e.g. cctools) so that they are
+# ensured to be found and preferred over other possibilities.
+#
+# -nostdinc++ -isystem $(OSX_SDK)/usr/include/c++/v1
+#
+# Forces clang to use the libc++ headers from our SDK and completely
+# forget about the libc++ headers from the standard directories
+#
+# TODO: Once we start requiring a clang version that has the
+# -stdlib++-isystem<directory> flag first introduced here:
+# https://reviews.llvm.org/D64089, we should use that instead. Read the
+# differential summary there for more details.
+#
+darwin_CC=clang -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -mlinker-version=$(LD64_VERSION) -B$(build_prefix)/bin
+darwin_CXX=clang++ -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -stdlib=libc++ -mlinker-version=$(LD64_VERSION) -B$(build_prefix)/bin -nostdinc++ -isystem $(OSX_SDK)/usr/include/c++/v1
darwin_CFLAGS=-pipe
darwin_CXXFLAGS=$(darwin_CFLAGS)
@@ -20,5 +40,11 @@ darwin_release_CXXFLAGS=$(darwin_release_CFLAGS)
darwin_debug_CFLAGS=-O1
darwin_debug_CXXFLAGS=$(darwin_debug_CFLAGS)
+darwin_native_binutils=native_cctools
+ifeq ($(strip $(FORCE_USE_SYSTEM_CLANG)),)
darwin_native_toolchain=native_cctools
+else
+darwin_native_toolchain=
+endif
+
darwin_cmake_system=Darwin