Ticket #54289: libcxx-runtime.diff

File libcxx-runtime.diff, 5.2 KB (added by RJVB (René Bertin), 7 years ago)

update for libcxx 5.0.1

  • lang/libcxx/Portfile

    diff --git a/lang/libcxx/Portfile b/lang/libcxx/Portfile
    index ab52872..0fd720f 100644
    a b PortGroup compiler_blacklist_versions 1.0 
    33
    44name                    libcxx
    55epoch                   1
    6 version                 5.0.1
     6version                 5.0.1 ; revision 1
    77categories              lang
    88platforms               darwin
    99license                 MIT NCSA
    long_description ${description} \ 
    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
    platform darwin { 
    6870}
    6971
    7072variant replacemnt_libcxx description {EXPERTS ONLY: Build a replacement libcxxabi and libcxx even if it is already part of the base OS.} {}
     73variant runtime description "Install the libcxx library so that it can be used with DYLD_INSERT_LIBRARIES" {
     74    depends_build-append \
     75                        port:cctools
     76    notes-append "Start applications via ${prefix}/bin/optlibs to use the latest libc++, or\
     77         set DYLD_INSERT_LIBRARIES as illustrated in that script."
     78}
     79
    7180
    72 if {${os.major} < 11 || [variant_isset replacemnt_libcxx]} {
     81if {${os.major} < 11 || [variant_isset replacemnt_libcxx] || [variant_isset runtime]} {
    7382    compiler.blacklist *gcc* {clang < 500}
    7483
    7584    # clang 3.5 and newer are conditionally blacklisted to prevent dependency cycles
    if {${os.major} < 11 || [variant_isset replacemnt_libcxx]} { 
    129138        CXX="${configure.cxx}" \
    130139        RC_XBS=1 \
    131140        RC_ProjectSourceVersion="${version}" \
    132         RC_CFLAGS="[get_canonical_archflags] -I${libcxxabi_worksrcpath}/include -I${libcxx_worksrcpath}/include" \
     141        RC_CFLAGS="[get_canonical_archflags] -I${libcxxabi_worksrcpath}/include -I${libcxx_worksrcpath}/include ${configure.optflags}q" \
    133142        TRIPLE="-apple-darwin${os.major}"
    134143    build.args-append \
    135144        LIBCXXABI_PATH=${libcxxabi_worksrcpath} \
    if {${os.major} < 11 || [variant_isset replacemnt_libcxx]} { 
    146155    # runtime.
    147156
    148157    destroot {
    149         xinstall -m 755 -d ${destroot}${roots_path}/${root_name}/usr/lib
     158        if {[variant_isset replacemnt_libcxx]} {
     159            xinstall -m 755 -d ${destroot}${roots_path}/${root_name}/usr/lib
    150160
    151         xinstall -m 755 ${libcxxabi_worksrcpath}/lib/libc++abi.dylib ${destroot}${roots_path}/${root_name}/usr/lib
     161            xinstall -m 755 ${libcxxabi_worksrcpath}/lib/libc++abi.dylib ${destroot}${roots_path}/${root_name}/usr/lib
    152162
    153         xinstall -m 755 ${libcxx_worksrcpath}/lib/libc++.1.dylib ${destroot}${roots_path}/${root_name}/usr/lib
    154         ln -s libc++.1.dylib ${destroot}${roots_path}/${root_name}/usr/lib/libc++.dylib
     163            xinstall -m 755 ${libcxx_worksrcpath}/lib/libc++.1.dylib ${destroot}${roots_path}/${root_name}/usr/lib
     164            ln -s libc++.1.dylib ${destroot}${roots_path}/${root_name}/usr/lib/libc++.dylib
    155165
    156         system -W ${destroot}${roots_path}/${root_name} "tar czf ../${root_name}.tgz ."
    157         delete ${destroot}${roots_path}/${root_name}
     166            system -W ${destroot}${roots_path}/${root_name} "tar czf ../${root_name}.tgz ."
     167            delete ${destroot}${roots_path}/${root_name}
     168        }
     169        if {[variant_isset runtime]} {
     170            # install only the runtime libraries so they will not be picked up by the linker/editor!
     171            xinstall -m 755 ${libcxxabi_worksrcpath}/lib/libc++abi.dylib ${destroot}${prefix}/lib/libc++abi.1.dylib
     172            xinstall -m 755 ${libcxx_worksrcpath}/lib/libc++.1.dylib ${destroot}${prefix}/lib/
     173            system "install_name_tool -id ${prefix}/lib/libc++abi.1.dylib ${destroot}${prefix}/lib/libc++abi.1.dylib"
     174            system "install_name_tool -id ${prefix}/lib/libc++.1.dylib ${destroot}${prefix}/lib/libc++.1.dylib"
     175            system "install_name_tool -change /usr/lib/libc++abi.dylib ${prefix}/lib/libc++abi.1.dylib ${destroot}${prefix}/lib/libc++.1.dylib"
     176            xinstall -m 755 ${filespath}/optlibs.sh ${destroot}${prefix}/bin/optlibs
     177            reinplace "s|@PREFIX@|${prefix}|g" ${destroot}${prefix}/bin/optlibs
     178        }
    158179    }
    159180} else {
    160181    distfiles
  • new file lang/libcxx/files/optlibs.sh

    diff --git a/lang/libcxx/files/optlibs.sh b/lang/libcxx/files/optlibs.sh
    new file mode 100755
    index 0000000..53988b9
    - +  
     1#!/bin/sh
     2
     3if [ "${DYLD_INSERT_LIBRARIES}" != "" ] ;then
     4        DYLD_INSERT_LIBRARIES="${DYLD_INSERT_LIBRARIES}:@PREFIX@/lib/libc++.1.dylib"
     5else
     6        DYLD_INSERT_LIBRARIES="@PREFIX@/lib/libc++.1.dylib"
     7fi
     8export DYLD_INSERT_LIBRARIES
     9
     10exec "$@"