Ticket #53605: gcc6-libcxx.4.diff

File gcc6-libcxx.4.diff, 5.0 KB (added by RJVB (René Bertin), 7 years ago)
  • lang/gcc6/Portfile

    old new  
    5252    configure.pre_args-append --build=${build_arch}-apple-darwin${os.major}
    5353
    5454    # see https://gcc.gnu.org/ml/gcc-patches/2012-05/msg00672.html
    55     patchfiles-append         patch-float128.diff
     55    patchfiles-append         patch-float128.diff \
     56                              patch-constchar.diff
    5657}
    5758
    5859configure.dir       ${workpath}/build
     
    213214        ln -s libgcc/libstdc++.6.dylib ${destroot}${prefix}/lib/libstdc++.6.dylib
    214215    }
    215216} else {
    216 depends_run-append         port:gcc_select
     217
     218foreach 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
     249variant gccas description {use the clang assembler instead of as} {}
     250if {[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
     263build.env-append        GCC_IS_BUILDING_ITSELF=1
     264destroot.env-append     GCC_IS_BUILDING_ITSELF=1
     265
     266depends_run-append          port:gcc_select
    217267
    218268post-destroot {
    219269    file delete ${destroot}${prefix}/share/info/dir
     
    243293            }
    244294        }
    245295    }
     296    foreach cdv {{} 3.9 4.0} {
     297        set cv [join [split ${cdv} "."] ""]
     298        if {[variant_isset libcxx${cv}]} {
     299            # move the stdc++ headers out of the way
     300            xinstall -m 755 -d ${destroot}${prefix}/include/${name}-stdinc
     301            file rename ${destroot}${prefix}/include/${name}/c++ ${destroot}${prefix}/include/${name}-stdinc/c++
     302        }
     303    }
    246304}
    247305
    248306select.group        gcc
     
    276334configure.universal_cxxflags
    277335configure.universal_ldflags
    278336configure.universal_args
     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.
     340configure.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}
     355build.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}
    279370
    280371livecheck.type      regex
    281372livecheck.url       http://ftp.gnu.org/gnu/gcc/