@@ -2822,26 +2822,37 @@ for host in "${ALL_HOSTS[@]}"; do
2822
2822
# tree... but we are not building llvm with libcxx in tree when we build
2823
2823
# swift. So we need to do configure's work here.
2824
2824
if [[ " ${product} " == " llvm" ]]; then
2825
- # Find the location of the c++ header dir.
2826
2825
if [[ " $( uname -s) " == " Darwin" ]] ; then
2827
- HOST_CXX_DIR=$( dirname " ${HOST_CXX} " )
2828
- HOST_CXX_HEADERS_DIR=" $HOST_CXX_DIR /../../usr/include/c++"
2829
- elif [[ " $( uname -s) " == " Haiku" ]] ; then
2830
- HOST_CXX_HEADERS_DIR=" /boot/system/develop/headers/c++"
2831
- elif [[ " ${ANDROID_DATA} " ]] ; then
2832
- # This means we're building natively on Android in the Termux
2833
- # app, which supplies the $PREFIX variable.
2834
- HOST_CXX_HEADERS_DIR=" $PREFIX /include/c++"
2835
- else # Linux
2836
- HOST_CXX_HEADERS_DIR=" /usr/include/c++"
2826
+ # We don't need this for Darwin since libcxx is present in SDKs present
2827
+ # in Xcode 12.5 and onward (build-script requires Xcode 13.0 at a minimum),
2828
+ # and clang knows how to find it there
2829
+ # However, we should take care of removing the symlink
2830
+ # laid down by a previous invocation, so to avoid failures
2831
+ # finding c++ headers should the target folder become invalid
2832
+ BUILT_CXX_INCLUDE_DIR=" $llvm_build_dir /include/c++"
2833
+ if [ -L " $BUILT_CXX_INCLUDE_DIR " ]; then
2834
+ echo " removing the symlink to system headers in the local clang build directory ($BUILT_CXX_INCLUDE_DIR )."
2835
+ call unlink " $BUILT_CXX_INCLUDE_DIR "
2836
+ fi
2837
+ else
2838
+ # Find the location of the c++ header dir.
2839
+ if [[ " $( uname -s) " == " Haiku" ]] ; then
2840
+ HOST_CXX_HEADERS_DIR=" /boot/system/develop/headers/c++"
2841
+ elif [[ " ${ANDROID_DATA} " ]] ; then
2842
+ # This means we're building natively on Android in the Termux
2843
+ # app, which supplies the $PREFIX variable.
2844
+ HOST_CXX_HEADERS_DIR=" $PREFIX /include/c++"
2845
+ else # Linux
2846
+ HOST_CXX_HEADERS_DIR=" /usr/include/c++"
2847
+ fi
2848
+
2849
+ # Find the path in which the local clang build is expecting to find
2850
+ # the c++ header files.
2851
+ BUILT_CXX_INCLUDE_DIR=" $llvm_build_dir /include"
2852
+
2853
+ echo " symlinking the system headers ($HOST_CXX_HEADERS_DIR ) into the local clang build directory ($BUILT_CXX_INCLUDE_DIR )."
2854
+ call ln -s -f " $HOST_CXX_HEADERS_DIR " " $BUILT_CXX_INCLUDE_DIR "
2837
2855
fi
2838
-
2839
- # Find the path in which the local clang build is expecting to find
2840
- # the c++ header files.
2841
- BUILT_CXX_INCLUDE_DIR=" $llvm_build_dir /include"
2842
-
2843
- echo " symlinking the system headers ($HOST_CXX_HEADERS_DIR ) into the local clang build directory ($BUILT_CXX_INCLUDE_DIR )."
2844
- call ln -s -f " $HOST_CXX_HEADERS_DIR " " $BUILT_CXX_INCLUDE_DIR "
2845
2856
fi
2846
2857
2847
2858
# Build.
0 commit comments