source: trunk/dports/lang/libcxxabi/Portfile

Last change on this file was 153827, checked in by jeremyhu@…, 13 months ago

libcxxabi: Blacklist clang-3.9 and clang-devel

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 5.3 KB
Line 
1# $Id: Portfile 153827 2016-10-12 21:31:54Z ryandesign@macports.org $
2
3PortSystem              1.0
4PortGroup               compiler_blacklist_versions 1.0
5
6name                    libcxxabi
7version                 3.7.0
8revision                1
9epoch                   1
10categories              lang
11platforms               darwin
12license                 MIT NCSA
13maintainers             jeremyhu
14description             libc++abi is a new implementation of low level support for a C++ runtime.
15long_description        ${description} \
16                        Because objects cannot be passed between different versions of the C++ runtime, this port must \
17                        replace the host version in order to be used.  On Snow Leopard and earlier, this is done \
18                        automatically because there is no existing host version of this library.  On Lion and later, \
19                        users must build the port with +replacemnt_libcxx and install the root manually if they wish \
20                        to replace the existing host implementation.
21
22homepage                http://libcxxabi.llvm.org/
23
24master_sites            http://www.llvm.org/releases/${version}/
25dist_subdir             llvm
26 
27use_xz                  yes
28distname                ${name}-${version}.src
29
30checksums               rmd160  d06ebae3fc873f47588c544e5e516b695c8c0809 \
31                        sha256  48b074fd334958b2d8bab893c897a0c8258328782cdec2d229c7bce432b49beb
32
33set roots_path ${prefix}/var/system_roots/
34set root_name  ${name}-${version}-${revision}
35
36patch.pre_args          -p1
37patchfiles \
38    0001-Update-buildit-script-to-read-EXTRA_LDFLAGS-from-the.patch \
39    0002-Revert-Make-libc-abi-use-the-implementation-of-__num.patch
40
41variant universal {}
42default_variants +universal
43use_configure no
44
45platform darwin {
46    if {${os.major} < 9} {
47        pre-fetch {
48            ui_error "${name} is not supported on Tiger or earlier."
49            error "unsupported platform"
50        }
51    }
52
53    if {${os.major} < 11} {
54        post-activate {
55            system "cd / && tar xzf ${roots_path}/${root_name}.tgz"
56        }
57    }
58}
59
60variant replacemnt_libcxx description {EXPERTS ONLY: Build a replacement libcxxabi and libcxx even if it is already part of the base OS.} {}
61
62if {${os.major} < 11 || [variant_isset replacemnt_libcxx]} {
63    compiler.blacklist *gcc* {clang < 300}
64
65    # clang 3.5 and newer are blacklisted to prevent dependency cycles
66    foreach ver {3.5 3.6 3.7 3.8 3.9 devel} {
67        if {![file exists ${prefix}/bin/clang-mp-${ver}]} {
68            compiler.blacklist-append macports-clang-${ver}
69        }
70    }
71
72    supported_archs i386 x86_64 ppc
73
74    if {[variant_isset universal] && [lsearch ${universal_archs} ppc] != -1} {
75        # http://trac.macports.org/wiki/LibcxxOnOlderSystems#Leopardppc
76        compiler.whitelist macports-clang-3.6
77    }
78
79    if {${os.major} < 10} {
80        depends_build-append \
81            port:libunwind \
82            port:libmacho
83
84        pre-build {
85            system "nm -g ${prefix}/lib/libmacho.a 2> /dev/null | grep ' \[DST\] ' | awk '{print \$3}' > ${worksrcpath}/unexported_symbols_macho"
86            system "nm -g ${prefix}/lib/libunwind.a 2> /dev/null | grep ' \[DST\] ' | awk '{print \$3}' | grep -v '^__Unwind' > ${worksrcpath}/unexported_symbols_unwind"
87            system "cat ${worksrcpath}/unexported_symbols_macho ${worksrcpath}/unexported_symbols_unwind > ${worksrcpath}/unexported_symbols"
88        }
89
90        build.env-append \
91            EXTRA_LDFLAGS="${prefix}/lib/libmacho.a ${prefix}/lib/libunwind.a -unexported_symbols_list ${worksrcpath}/unexported_symbols"
92    }
93
94    build.dir ${worksrcpath}/lib
95    build.cmd ./buildit
96    build.env-append \
97        CC="${configure.cc} ${configure.cppflags}" \
98        CXX="${configure.cxx} ${configure.cppflags}" \
99        RC_XBS=1 \
100        RC_CFLAGS="[get_canonical_archflags]" \
101        RC_ProjectSourceVersion="${version}" \
102        TRIPLE="-apple-darwin${os.major}"
103
104    # We want to use the host's libc++abi everywhere because we want to ensure
105    # that only *ONE* copy of this library is in any process's address space.
106    # On Snow Leopard, this port provides this library in /usr for binary
107    # compatibility with Lion and later.
108    #
109    # On newer OS version, this port does not install the content to /usr and
110    # just leaves it to expert users who may want to replace their system
111    # runtime.
112
113    destroot {
114        xinstall -m 755 -d ${destroot}${roots_path}/${root_name}/usr/lib
115        xinstall -m 755 ${worksrcpath}/lib/libc++abi.dylib ${destroot}${roots_path}/${root_name}/usr/lib
116
117        xinstall -m 755 -d ${destroot}${roots_path}/${root_name}/usr/include
118        xinstall -m 644 ${worksrcpath}/include/__cxxabi_config.h ${destroot}${roots_path}/${root_name}/usr/include
119        xinstall -m 644 ${worksrcpath}/include/cxxabi.h ${destroot}${roots_path}/${root_name}/usr/include
120
121        system "cd ${destroot}${roots_path}/${root_name} && tar czf ../${root_name}.tgz ."
122        file delete -force ${destroot}${roots_path}/${root_name}
123    }
124} else {
125    distfiles
126    patchfiles
127    fetch {}
128    build {}
129    destroot {
130        xinstall -d ${destroot}${prefix}/share/doc/${name}
131        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"
132    }
133}
134
135livecheck.type none
Note: See TracBrowser for help on using the repository browser.