Ticket #54289: lcxx+runtime.diff

File lcxx+runtime.diff, 3.1 KB (added by RJVB (René Bertin), 7 years ago)
  • lang/libcxx/Portfile

    old new  
    1414                        replace the host version in order to be used.  On Snow Leopard and earlier, this is done \
    1515                        automatically because there is no existing host version of this library.  On Lion and later, \
    1616                        users must build the port with +replacemnt_libcxx and install the root manually if they wish \
    17                         to replace the existing host implementation.
     17                        to replace the existing host implementation. They can also use the +runtime variant which installs \
     18                        copies of the library that can be loaded via DYLD_INSERT_LIBRARIES or the optlibs script\; \
     19                        applications started that way will then use a more recent libc++ than the host provides.
    1820
    1921homepage                http://libcxx.llvm.org/
    2022
     
    5052}
    5153
    5254variant replacemnt_libcxx description {EXPERTS ONLY: Build a replacement libcxxabi and libcxx even if it is already part of the base OS.} {}
     55variant runtime description "Install the libcxx library so that it can be used with DYLD_INSERT_LIBRARIES" {
     56    depends_build-append \
     57                        port:cctools
     58}
     59
    5360
    54 if {${os.major} < 11 || [variant_isset replacemnt_libcxx]} {
     61if {${os.major} < 11 || [variant_isset replacemnt_libcxx] || [variant_isset runtime]} {
    5562    compiler.blacklist *gcc* {clang < 500}
    5663
    5764    # clang 3.5 and newer are blacklisted to prevent dependency cycles
     
    98107    # runtime.
    99108
    100109    destroot {
    101         xinstall -m 755 -d ${destroot}${roots_path}/${root_name}/usr/lib
    102         xinstall -m 755 ${worksrcpath}/lib/libc++.1.dylib ${destroot}${roots_path}/${root_name}/usr/lib
    103         ln -s libc++.1.dylib ${destroot}${roots_path}/${root_name}/usr/lib/libc++.dylib
     110        if {[variant_isset replacemnt_libcxx]} {
     111            xinstall -m 755 -d ${destroot}${roots_path}/${root_name}/usr/lib
     112            xinstall -m 755 ${worksrcpath}/lib/libc++.1.dylib ${destroot}${roots_path}/${root_name}/usr/lib
     113            ln -s libc++.1.dylib ${destroot}${roots_path}/${root_name}/usr/lib/libc++.dylib
    104114
    105         system "cd ${destroot}${roots_path}/${root_name} && tar czf ../${root_name}.tgz ."
    106         file delete -force ${destroot}${roots_path}/${root_name}
     115            system "cd ${destroot}${roots_path}/${root_name} && tar czf ../${root_name}.tgz ."
     116            file delete -force ${destroot}${roots_path}/${root_name}
     117        }
     118        if {[variant_isset runtime]} {
     119            # install only the runtime library so it will not be picked up by the linker/editor!
     120            xinstall -m 755 ${worksrcpath}/lib/libc++.1.dylib ${destroot}${prefix}/lib/
     121            system "install_name_tool -id ${prefix}/lib/libc++.1.dylib ${destroot}${prefix}/lib/libc++.1.dylib"
     122            xinstall -m 755 ${filespath}/optlibs.sh ${destroot}${prefix}/bin/optlibs
     123            reinplace "s|@PREFIX@|${prefix}|g" ${destroot}${prefix}/bin/optlibs
     124        }
    107125    }
    108126} else {
    109127    distfiles