# $Id: Portfile 153827 2016-10-12 21:31:54Z jeremyhu@macports.org $ PortSystem 1.0 PortGroup compiler_blacklist_versions 1.0 name libcxxabi version 3.7.0 revision 1 epoch 1 categories lang platforms darwin license MIT NCSA maintainers jeremyhu description libc++abi is a new implementation of low level support for a C++ runtime. long_description ${description} \ Because objects cannot be passed between different versions of the C++ runtime, this port must \ replace the host version in order to be used. On Snow Leopard and earlier, this is done \ automatically because there is no existing host version of this library. On Lion and later, \ users must build the port with +replacemnt_libcxx and install the root manually if they wish \ to replace the existing host implementation. homepage http://libcxxabi.llvm.org/ master_sites http://www.llvm.org/releases/${version}/ dist_subdir llvm use_xz yes distname ${name}-${version}.src checksums rmd160 d06ebae3fc873f47588c544e5e516b695c8c0809 \ sha256 48b074fd334958b2d8bab893c897a0c8258328782cdec2d229c7bce432b49beb set roots_path ${prefix}/var/system_roots/ set root_name ${name}-${version}-${revision} patch.pre_args -p1 patchfiles \ 0001-Update-buildit-script-to-read-EXTRA_LDFLAGS-from-the.patch \ 0002-Revert-Make-libc-abi-use-the-implementation-of-__num.patch variant universal {} default_variants +universal use_configure no platform darwin { if {${os.major} < 9} { pre-fetch { ui_error "${name} is not supported on Tiger or earlier." error "unsupported platform" } } if {${os.major} < 11} { post-activate { system "cd / && tar xzf ${roots_path}/${root_name}.tgz" } } } variant replacemnt_libcxx description {EXPERTS ONLY: Build a replacement libcxxabi and libcxx even if it is already part of the base OS.} {} if {${os.major} < 11 || [variant_isset replacemnt_libcxx]} { compiler.blacklist *gcc* {clang < 300} # clang 3.5 and newer are blacklisted to prevent dependency cycles foreach ver {3.5 3.6 3.7 3.8 3.9 devel} { if {![file exists ${prefix}/bin/clang-mp-${ver}]} { compiler.blacklist-append macports-clang-${ver} } } supported_archs i386 x86_64 ppc if {[variant_isset universal] && [lsearch ${universal_archs} ppc] != -1} { # http://trac.macports.org/wiki/LibcxxOnOlderSystems#Leopardppc compiler.whitelist macports-clang-3.6 } if {${os.major} < 10} { depends_build-append \ port:libunwind \ port:libmacho pre-build { system "nm -g ${prefix}/lib/libmacho.a 2> /dev/null | grep ' \[DST\] ' | awk '{print \$3}' > ${worksrcpath}/unexported_symbols_macho" system "nm -g ${prefix}/lib/libunwind.a 2> /dev/null | grep ' \[DST\] ' | awk '{print \$3}' | grep -v '^__Unwind' > ${worksrcpath}/unexported_symbols_unwind" system "cat ${worksrcpath}/unexported_symbols_macho ${worksrcpath}/unexported_symbols_unwind > ${worksrcpath}/unexported_symbols" } build.env-append \ EXTRA_LDFLAGS="${prefix}/lib/libmacho.a ${prefix}/lib/libunwind.a -unexported_symbols_list ${worksrcpath}/unexported_symbols" } build.dir ${worksrcpath}/lib build.cmd ./buildit build.env-append \ CC="${configure.cc} ${configure.cppflags}" \ CXX="${configure.cxx} ${configure.cppflags}" \ RC_XBS=1 \ RC_CFLAGS="[get_canonical_archflags]" \ RC_ProjectSourceVersion="${version}" \ TRIPLE="-apple-darwin${os.major}" # We want to use the host's libc++abi everywhere because we want to ensure # that only *ONE* copy of this library is in any process's address space. # On Snow Leopard, this port provides this library in /usr for binary # compatibility with Lion and later. # # On newer OS version, this port does not install the content to /usr and # just leaves it to expert users who may want to replace their system # runtime. destroot { xinstall -m 755 -d ${destroot}${roots_path}/${root_name}/usr/lib xinstall -m 755 ${worksrcpath}/lib/libc++abi.dylib ${destroot}${roots_path}/${root_name}/usr/lib xinstall -m 755 -d ${destroot}${roots_path}/${root_name}/usr/include xinstall -m 644 ${worksrcpath}/include/__cxxabi_config.h ${destroot}${roots_path}/${root_name}/usr/include xinstall -m 644 ${worksrcpath}/include/cxxabi.h ${destroot}${roots_path}/${root_name}/usr/include system "cd ${destroot}${roots_path}/${root_name} && tar czf ../${root_name}.tgz ." file delete -force ${destroot}${roots_path}/${root_name} } } else { distfiles patchfiles fetch {} build {} destroot { xinstall -d ${destroot}${prefix}/share/doc/${name} system "echo ${name} is an empty port on this OS version because the functionality is already provided by the OS. > ${destroot}${prefix}/share/doc/${name}/README.txt" } } livecheck.type none