| 280 | foreach cdv {{} 3.9 4.0} { |
| 281 | set cv [join [split ${cdv} "."] ""] |
| 282 | if {${cdv} eq {}} { |
| 283 | variant libcxx description "Build to use libc++ and the corresponding headers from Xcode" {} |
| 284 | } else { |
| 285 | variant libcxx${cv} description "Build to use libc++ and the corresponding headers from port:clang-${cdv}" {} |
| 286 | } |
| 287 | if {[variant_isset libcxx${cv}]} { |
| 288 | if {${cdv} ne {}} { |
| 289 | depends_run-append port:clang-${cdv} |
| 290 | set libcxx_headers "${prefix}/libexec/llvm-${cdv}/include/c++/v1" |
| 291 | } else { |
| 292 | set libcxx_headers "[file dir [exec xcrun --find clang]]/../include/c++/v1" |
| 293 | } |
| 294 | patchfiles-append patch-use-libcxx.diff |
| 295 | post-patch { |
| 296 | reinplace "s|@LLVMHEADERPATH@|${libcxx_headers}|g" ${worksrcpath}/gcc/incpath.c |
| 297 | } |
| 298 | |
| 299 | # GCC_IS_BUILDING_ITSELF: causes g++ to add a static libstdc++ just like it does when building with/for libstdc++ |
| 300 | # GCC_FORCE_LIBSTDCPP: forces the use of libstdc++ for the current build and ignores the default clang C++ header location |
| 301 | # LIBCPP_INCLUDE_PATH: redefines the location of the clang C++ headers; empty means don't use them at all |
| 302 | # The combination below means: build GCC "as usual" itself |
| 303 | configure.env-append GCC_IS_BUILDING_ITSELF=1 GCC_FORCE_LIBSTDCPP=1 |
| 304 | build.env-append GCC_IS_BUILDING_ITSELF=1 GCC_FORCE_LIBSTDCPP=1 |
| 305 | destroot.env-append GCC_IS_BUILDING_ITSELF=1 GCC_FORCE_LIBSTDCPP=1 |
| 306 | } |
| 307 | } |
| 308 | |