216 | | depends_run-append port:gcc_select |
| 217 | |
| 218 | foreach cdv {{} 3.9 4.0} { |
| 219 | set cv [join [split ${cdv} "."] ""] |
| 220 | if {${cdv} eq {}} { |
| 221 | variant libcxx description "Build to use libc++ and the corresponding headers from Xcode" {} |
| 222 | } else { |
| 223 | variant libcxx${cv} description "Build to use libc++ and the corresponding headers from port:clang-${cdv}" {} |
| 224 | } |
| 225 | if {[variant_isset libcxx${cv}]} { |
| 226 | if {${cdv} ne {}} { |
| 227 | depends_run-append port:clang-${cdv} |
| 228 | set libcxx_headers "${prefix}/libexec/llvm-${cdv}/include/c++/v1" |
| 229 | } else { |
| 230 | set libcxx_headers "[file dir [exec xcrun --find clang]]/../include/c++/v1" |
| 231 | } |
| 232 | patchfiles-append patch-use-libcxx.diff |
| 233 | post-patch { |
| 234 | reinplace "s|@LLVMHEADERPATH@|${libcxx_headers}|g" ${worksrcpath}/gcc/incpath.c |
| 235 | } |
| 236 | # user is interested in being able to use G++ as broadly as possible; |
| 237 | # configure GCC to use gccas and if necessary install it for the same clang version |
| 238 | default_variants +gccas |
| 239 | if {[variant_isset gccas]} { |
| 240 | variant clang${cv} description "install gccas for the preferred clang version" {} |
| 241 | default_variants-append +clang${cv} |
| 242 | } |
| 243 | notes-append "G++ will search the libc++ headers in ${libcxx_headers} by default;\ |
| 244 | this can be overridden by setting LIBCPP_INCLUDE_PATH. The original libstdc++\ |
| 245 | headers are in ${prefix}/include/${name}-stdinc/c++ ." |
| 246 | } |
| 247 | } |
| 248 | |
| 249 | variant gccas description {use the clang assembler instead of as} {} |
| 250 | if {[variant_isset gccas]} { |
| 251 | depends_lib-replace \ |
| 252 | port:cctools \ |
| 253 | port:gccas |
| 254 | depends_skip_archcheck-replace \ |
| 255 | cctools \ |
| 256 | gccas |
| 257 | configure.args-replace \ |
| 258 | --with-as=${prefix}/bin/as \ |
| 259 | --with-as=${prefix}/bin/gccas |
| 260 | } |
| 261 | |
| 262 | # used when a +libcxx variant is selected; it causes g++ to add |
| 263 | build.env-append GCC_IS_BUILDING_ITSELF=1 |
| 264 | destroot.env-append GCC_IS_BUILDING_ITSELF=1 |
| 265 | |
| 266 | depends_run-append port:gcc_select |
| 337 | # let the build use our selected compiler options. It must be possible |
| 338 | # to set only 1 or 2 variables and cover all build stages, but in practice |
| 339 | # that doesn't turn out to be true. |
| 340 | configure.env-append \ |
| 341 | BOOT_CFLAGS=${configure.optflags} \ |
| 342 | STAGE_CFLAGS=${configure.optflags} \ |
| 343 | STAGE1_CFLAGS=${configure.optflags} \ |
| 344 | STAGE2_CFLAGS=${configure.optflags} \ |
| 345 | STAGE3_CFLAGS=${configure.optflags} \ |
| 346 | STAGE4_CFLAGS=${configure.optflags} \ |
| 347 | BOOT_CXXFLAGS=${configure.optflags} \ |
| 348 | STAGE_CXXFLAGS=${configure.optflags} \ |
| 349 | STAGE1_CXXFLAGS=${configure.optflags} \ |
| 350 | STAGE2_CXXFLAGS=${configure.optflags} \ |
| 351 | STAGE3_CXXFLAGS=${configure.optflags} \ |
| 352 | STAGE4_CXXFLAGS=${configure.optflags} \ |
| 353 | CXXFLAGS_FOR_TARGET=${configure.optflags} \ |
| 354 | CFLAGS_FOR_TARGET=${configure.optflags} |
| 355 | build.env-append \ |
| 356 | BOOT_CFLAGS=${configure.optflags} \ |
| 357 | STAGE_CFLAGS=${configure.optflags} \ |
| 358 | STAGE1_CFLAGS=${configure.optflags} \ |
| 359 | STAGE2_CFLAGS=${configure.optflags} \ |
| 360 | STAGE3_CFLAGS=${configure.optflags} \ |
| 361 | STAGE4_CFLAGS=${configure.optflags} \ |
| 362 | BOOT_CXXFLAGS=${configure.optflags} \ |
| 363 | STAGE_CXXFLAGS=${configure.optflags} \ |
| 364 | STAGE1_CXXFLAGS=${configure.optflags} \ |
| 365 | STAGE2_CXXFLAGS=${configure.optflags} \ |
| 366 | STAGE3_CXXFLAGS=${configure.optflags} \ |
| 367 | STAGE4_CXXFLAGS=${configure.optflags} \ |
| 368 | CXXFLAGS_FOR_TARGET=${configure.optflags} \ |
| 369 | CFLAGS_FOR_TARGET=${configure.optflags} |