Ticket #54198: gcc7+with_libgcc+libcxx.diff

File gcc7+with_libgcc+libcxx.diff, 2.2 KB (added by RJVB (René Bertin), 7 years ago)

incremental diff adding support for (use of) libc++

  • lang/gcc7/Portfile

    a b  
    277277    depends_lib-delete path:lib/libgcc/libgcc_s.1.dylib:libgcc
    278278}
    279279
     280foreach 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
    280309post-destroot {
    281310    file delete ${destroot}${prefix}/share/info/dir
    282311
     
    309338    }
    310339    ## end default gcc7 variant
    311340    }
     341    foreach cdv {{} 3.9 4.0} {
     342        set cv [join [split ${cdv} "."] ""]
     343        if {[variant_isset libcxx${cv}]} {
     344            # move the stdc++ headers out of the way
     345            xinstall -m 755 -d ${destroot}${prefix}/include/${name}-stdinc
     346            file rename ${destroot}${prefix}/include/${name}/c++ ${destroot}${prefix}/include/${name}-stdinc/c++
     347        }
     348    }
    312349}
    313350
    314351select.group        gcc