diff --git a/lang/libcxx/Portfile b/lang/libcxx/Portfile
index ab52872..0fd720f 100644
a
|
b
|
PortGroup compiler_blacklist_versions 1.0 |
3 | 3 | |
4 | 4 | name libcxx |
5 | 5 | epoch 1 |
6 | | version 5.0.1 |
| 6 | version 5.0.1 ; revision 1 |
7 | 7 | categories lang |
8 | 8 | platforms darwin |
9 | 9 | license MIT NCSA |
… |
… |
long_description ${description} \ |
14 | 14 | replace the host version in order to be used. On Snow Leopard and earlier, this is done \ |
15 | 15 | automatically because there is no existing host version of this library. On Lion and later, \ |
16 | 16 | 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. |
18 | 20 | |
19 | 21 | homepage http://libcxx.llvm.org/ |
20 | 22 | |
… |
… |
platform darwin { |
68 | 70 | } |
69 | 71 | |
70 | 72 | variant replacemnt_libcxx description {EXPERTS ONLY: Build a replacement libcxxabi and libcxx even if it is already part of the base OS.} {} |
| 73 | variant 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 | |
71 | 80 | |
72 | | if {${os.major} < 11 || [variant_isset replacemnt_libcxx]} { |
| 81 | if {${os.major} < 11 || [variant_isset replacemnt_libcxx] || [variant_isset runtime]} { |
73 | 82 | compiler.blacklist *gcc* {clang < 500} |
74 | 83 | |
75 | 84 | # clang 3.5 and newer are conditionally blacklisted to prevent dependency cycles |
… |
… |
if {${os.major} < 11 || [variant_isset replacemnt_libcxx]} { |
129 | 138 | CXX="${configure.cxx}" \ |
130 | 139 | RC_XBS=1 \ |
131 | 140 | 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" \ |
133 | 142 | TRIPLE="-apple-darwin${os.major}" |
134 | 143 | build.args-append \ |
135 | 144 | LIBCXXABI_PATH=${libcxxabi_worksrcpath} \ |
… |
… |
if {${os.major} < 11 || [variant_isset replacemnt_libcxx]} { |
146 | 155 | # runtime. |
147 | 156 | |
148 | 157 | 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 |
150 | 160 | |
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 |
152 | 162 | |
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 |
155 | 165 | |
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 | } |
158 | 179 | } |
159 | 180 | } else { |
160 | 181 | distfiles |
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 | |
| 3 | if [ "${DYLD_INSERT_LIBRARIES}" != "" ] ;then |
| 4 | DYLD_INSERT_LIBRARIES="${DYLD_INSERT_LIBRARIES}:@PREFIX@/lib/libc++.1.dylib" |
| 5 | else |
| 6 | DYLD_INSERT_LIBRARIES="@PREFIX@/lib/libc++.1.dylib" |
| 7 | fi |
| 8 | export DYLD_INSERT_LIBRARIES |
| 9 | |
| 10 | exec "$@" |