Ticket #53605: gcc6-libcxx.3.diff

File gcc6-libcxx.3.diff, 2.8 KB (added by RJVB (René Bertin), 8 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        notes-append "G++ will search the libc++ headers in ${libcxx_headers} by default;\
     237                        this can be overridden by setting LIBCPP_INCLUDE_PATH. The original libstdc++\
     238                        headers are in ${prefix}/include/${name}-stdinc/c++ ."
     239    }
     240}
     241
     242# used when a +libcxx variant is selected; it causes g++ to add
     243build.env-append        GCC_IS_BUILDING_ITSELF=1
     244destroot.env-append     GCC_IS_BUILDING_ITSELF=1
     245
     246depends_run-append          port:gcc_select
    217247
    218248post-destroot {
    219249    file delete ${destroot}${prefix}/share/info/dir
     
    243273            }
    244274        }
    245275    }
     276    foreach cdv {{} 3.9 4.0} {
     277        set cv [join [split ${cdv} "."] ""]
     278        if {[variant_isset libcxx${cv}]} {
     279            # move the stdc++ headers out of the way
     280            xinstall -m 755 -d ${destroot}${prefix}/include/${name}-stdinc
     281            file rename ${destroot}${prefix}/include/${name}/c++ ${destroot}${prefix}/include/${name}-stdinc/c++
     282            # replace with a symlink to the corresponding libc++ headers
     283            ui_msg "ln -s ${libcxx_headers} ${destroot}${prefix}/include/${name}/c++"
     284#             ln -s ${libcxx_headers} ${destroot}${prefix}/include/${name}/c++
     285        }
     286    }
    246287}
    247288
    248289select.group        gcc