1 | # -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4 |
---|
2 | # $Id: Portfile 139551 2015-08-20 07:23:27Z ryandesign@macports.org $ |
---|
3 | |
---|
4 | PortSystem 1.0 |
---|
5 | PortGroup compiler_blacklist_versions 1.0 |
---|
6 | PortGroup mpi 1.0 |
---|
7 | |
---|
8 | name boost |
---|
9 | version 1.59.0 |
---|
10 | license Boost-1 |
---|
11 | categories devel |
---|
12 | platforms darwin |
---|
13 | maintainers ryandesign openmaintainer |
---|
14 | revision 1 |
---|
15 | |
---|
16 | description Collection of portable C++ source libraries |
---|
17 | |
---|
18 | long_description \ |
---|
19 | Boost provides free portable peer-reviewed C++ \ |
---|
20 | libraries. The emphasis is on portable libraries \ |
---|
21 | which work well with the C++ Standard Library. |
---|
22 | |
---|
23 | homepage http://www.boost.org |
---|
24 | master_sites sourceforge:project/boost/boost/${version} |
---|
25 | set distver [join [split ${version} .] _] |
---|
26 | distname ${name}_${distver} |
---|
27 | use_bzip2 yes |
---|
28 | |
---|
29 | checksums rmd160 a106b3cd1dbda2323e5e84c7106cedee327db03c \ |
---|
30 | sha256 727a932322d94287b62abb1bd2d41723eec4356a7728909e38adb65ca25241ca |
---|
31 | |
---|
32 | depends_lib port:zlib \ |
---|
33 | port:expat \ |
---|
34 | port:bzip2 \ |
---|
35 | port:libiconv \ |
---|
36 | port:icu |
---|
37 | |
---|
38 | post-extract { |
---|
39 | fs-traverse dir ${workpath} { |
---|
40 | if [file isdirectory ${dir}] { |
---|
41 | file attributes ${dir} -permissions a+rx |
---|
42 | } |
---|
43 | } |
---|
44 | } |
---|
45 | |
---|
46 | patchfiles patch-tools-build-src-engine-build.sh.diff \ |
---|
47 | patch-tools-build-src-engine-build.jam.diff \ |
---|
48 | patch-apple-clang-no-libcxx.diff \ |
---|
49 | patch-log-setup-link.diff |
---|
50 | # patch-apple-clang-no-libcxx.diff fixes a clang configuration |
---|
51 | # error that occurs on OS X 10.7 and 10.8 due to the assumption |
---|
52 | # that if clang is the compiler in use it must be using libc++. |
---|
53 | # Apple Clang uses libstdc++ by default on these OS versions. |
---|
54 | # The patch adds an additional BOOST_* configuration flag |
---|
55 | # that is set if Apple clang is being used but libc++ |
---|
56 | # is not. This flag is then used to prevent boost or a |
---|
57 | # dependent package from using functions such as std::forward that |
---|
58 | # are only available in libc++. Fixes build of libcdr on these |
---|
59 | # OS versions without affecting build on 10.6 and less (where clang is not |
---|
60 | # the default compiler) or 10.9 and up (where libc++ is the default). |
---|
61 | |
---|
62 | post-patch { |
---|
63 | reinplace "s|%%CONFIGURE.CC%%|${configure.cc}|g" ${worksrcpath}/tools/build/src/engine/build.jam \ |
---|
64 | ${worksrcpath}/tools/build/src/engine/build.sh |
---|
65 | } |
---|
66 | |
---|
67 | proc write_jam s { |
---|
68 | global worksrcpath |
---|
69 | set config [open ${worksrcpath}/user-config.jam a] |
---|
70 | puts ${config} ${s} |
---|
71 | close ${config} |
---|
72 | } |
---|
73 | |
---|
74 | # clang++ produces broken boost libraries (https://trac.macports.org/ticket/31525) |
---|
75 | # If Apple's clang is used on 32-bit systems, it seems to silently ignore the '-march=i386' flag. |
---|
76 | # (https://trac.macports.org/ticket/38157) |
---|
77 | compiler.blacklist {clang < 421} macports-clang-2.9 macports-clang-3.0 *llvm-gcc-4.2 *gcc-4.0 gcc-3.3 |
---|
78 | |
---|
79 | compilers.choose cc cxx |
---|
80 | mpi.setup -gcc -dragonegg |
---|
81 | |
---|
82 | # It turns out that ccache and distcc can produce boost libraries that, although they |
---|
83 | # compile without warning, have all sorts of runtime errors especially with pointer corruption. |
---|
84 | # Since most people will now use MacPorts' pre-compiled boost, this should not be a problem. |
---|
85 | configure.ccache no |
---|
86 | configure.distcc no |
---|
87 | |
---|
88 | configure.cmd ./bootstrap.sh |
---|
89 | configure.args --without-libraries=python \ |
---|
90 | --without-libraries=mpi \ |
---|
91 | --with-icu=${prefix} |
---|
92 | |
---|
93 | if {${os.platform} eq "darwin" && ${os.major} <= 10} { |
---|
94 | configure.args-append --without-libraries=context \ |
---|
95 | --without-libraries=coroutine |
---|
96 | } |
---|
97 | |
---|
98 | configure.universal_args |
---|
99 | |
---|
100 | post-configure { |
---|
101 | |
---|
102 | reinplace -E "s|-install_name \"|&${prefix}/lib/|" \ |
---|
103 | ${worksrcpath}/tools/build/src/tools/darwin.jam |
---|
104 | |
---|
105 | set compileflags "" |
---|
106 | if {[string length ${configure.sdkroot}] != 0} { |
---|
107 | set compileflags "<compileflags>\"-isysroot ${configure.sdkroot}\"" |
---|
108 | } |
---|
109 | |
---|
110 | set cxx_stdlibflags {} |
---|
111 | if {[string match *clang* ${configure.cxx}]} { |
---|
112 | set cxx_stdlibflags -stdlib=${configure.cxx_stdlib} |
---|
113 | } |
---|
114 | |
---|
115 | write_jam "using darwin : : ${configure.cxx} : <cxxflags>\"${configure.cxxflags} ${cxx_stdlibflags}\" ${compileflags} <linkflags>\"${configure.ldflags} ${cxx_stdlibflags}\" : ;" |
---|
116 | |
---|
117 | } |
---|
118 | |
---|
119 | build.cmd ${worksrcpath}/b2 |
---|
120 | build.target |
---|
121 | build.args -d2 \ |
---|
122 | --layout=tagged \ |
---|
123 | --debug-configuration \ |
---|
124 | --user-config=user-config.jam \ |
---|
125 | -sBZIP2_INCLUDE=${prefix}/include \ |
---|
126 | -sBZIP2_LIBPATH=${prefix}/lib \ |
---|
127 | -sEXPAT_INCLUDE=${prefix}/include \ |
---|
128 | -sEXPAT_LIBPATH=${prefix}/lib \ |
---|
129 | -sZLIB_INCLUDE=${prefix}/include \ |
---|
130 | -sZLIB_LIBPATH=${prefix}/lib \ |
---|
131 | -sICU_PATH=${prefix} \ |
---|
132 | variant=release \ |
---|
133 | threading=single,multi \ |
---|
134 | link=static,shared \ |
---|
135 | -j${build.jobs} |
---|
136 | |
---|
137 | destroot.cmd ${worksrcpath}/bjam |
---|
138 | destroot.post_args |
---|
139 | |
---|
140 | pre-destroot { |
---|
141 | destroot.args {*}${build.args} --prefix=${destroot}${prefix} |
---|
142 | system "find ${worksrcpath} -type f -name '*.gch' -exec rm {} \\;" |
---|
143 | } |
---|
144 | |
---|
145 | post-destroot { |
---|
146 | set docdir ${prefix}/share/doc/${name} |
---|
147 | xinstall -d ${destroot}${docdir} |
---|
148 | set l [expr [string length ${worksrcpath}] + 1] |
---|
149 | fs-traverse f [glob -directory ${worksrcpath} *] { |
---|
150 | set dest ${destroot}${docdir}/[string range ${f} ${l} end] |
---|
151 | if {[file isdirectory ${f}]} { |
---|
152 | if {[file tail ${f}] eq "example"} { |
---|
153 | copy ${f} ${dest} |
---|
154 | continue |
---|
155 | } |
---|
156 | xinstall -d ${dest} |
---|
157 | } elseif {[lsearch -exact {css htm html png svg} [string range [file extension ${f}] 1 end]] != -1} { |
---|
158 | xinstall -m 644 ${f} ${dest} |
---|
159 | } |
---|
160 | } |
---|
161 | } |
---|
162 | |
---|
163 | # TODO: Remove after 2016-05-26. |
---|
164 | variant python25 description {Legacy variant} requires python27 {} |
---|
165 | variant python31 description {Legacy variant} requires python34 {} |
---|
166 | variant python32 description {Legacy variant} requires python34 {} |
---|
167 | |
---|
168 | set pythons_suffixes {26 27 33 34} |
---|
169 | |
---|
170 | set pythons_ports {} |
---|
171 | foreach s ${pythons_suffixes} { |
---|
172 | lappend pythons_ports python${s} |
---|
173 | } |
---|
174 | |
---|
175 | proc python_dir {} { |
---|
176 | global pythons_suffixes |
---|
177 | foreach s ${pythons_suffixes} { |
---|
178 | if {[variant_isset python${s}]} { |
---|
179 | set p python[string index ${s} 0].[string index ${s} 1] |
---|
180 | return [file normalize [exec ${p} -c "import sys; print(sys.prefix)"]/lib/${p}/site-packages] |
---|
181 | } |
---|
182 | } |
---|
183 | error "Python support not enabled." |
---|
184 | } |
---|
185 | |
---|
186 | foreach s ${pythons_suffixes} { |
---|
187 | set p python${s} |
---|
188 | set v [string index ${s} 0].[string index ${s} 1] |
---|
189 | set i [lsearch -exact ${pythons_ports} ${p}] |
---|
190 | set c [lreplace ${pythons_ports} ${i} ${i}] |
---|
191 | if { ${s} > 30 } { set bppatch "patch-boost-python3.diff" } else { set bppatch "" } |
---|
192 | eval [subst { |
---|
193 | variant ${p} description "Build Boost.Python for Python ${v}" conflicts ${c} debug { |
---|
194 | |
---|
195 | # There is a conflict with python and debug support, so we should really change the 'variant' line above |
---|
196 | # to end with "conflicts ${c} debug" above. However, we leave it enabled for those who want to try it. |
---|
197 | # The issue has been reported to both the MacPorts team and the boost team, as per: |
---|
198 | # <http://trac.macports.org/ticket/23667> and <https://svn.boost.org/trac/boost/ticket/4461> |
---|
199 | |
---|
200 | depends_lib-append port:${p} |
---|
201 | configure.args-delete --without-libraries=python |
---|
202 | configure.args-append --with-python=${prefix}/bin/python${v} --with-python-root=${prefix}/bin/python${v} |
---|
203 | |
---|
204 | patchfiles-append ${bppatch} patch-tools-build-src-tools-python.jam.diff \ |
---|
205 | patch-tools-build-src-tools-python-2.jam.diff |
---|
206 | |
---|
207 | post-patch { |
---|
208 | reinplace s|@FRAMEWORKS_DIR@|${frameworks_dir}| ${worksrcpath}/tools/build/src/tools/python.jam |
---|
209 | } |
---|
210 | |
---|
211 | } |
---|
212 | }] |
---|
213 | } |
---|
214 | |
---|
215 | if {![variant_isset debug]} { |
---|
216 | set selected_python python27 |
---|
217 | foreach s ${pythons_suffixes} { |
---|
218 | if {[variant_isset python${s}]} { |
---|
219 | set selected_python python${s} |
---|
220 | } |
---|
221 | } |
---|
222 | default_variants +${selected_python} |
---|
223 | } |
---|
224 | |
---|
225 | default_variants +no_single +no_static |
---|
226 | |
---|
227 | variant debug description {Builds debug versions of the libraries as well} { |
---|
228 | build.args-delete variant=release |
---|
229 | build.args-append variant=debug,release |
---|
230 | } |
---|
231 | |
---|
232 | variant no_static description {Disable building static libraries} { |
---|
233 | build.args-delete link=static,shared |
---|
234 | build.args-append link=shared |
---|
235 | } |
---|
236 | |
---|
237 | variant no_single description {Disable building single-threaded libraries} { |
---|
238 | build.args-delete threading=single,multi |
---|
239 | build.args-append threading=multi |
---|
240 | } |
---|
241 | |
---|
242 | variant regex_match_extra description \ |
---|
243 | "Enable access to extended capture information of submatches in Boost.Regex" { |
---|
244 | notes-append " |
---|
245 | You enabled the +regex_match_extra variant\; see the following page for an\ |
---|
246 | exhaustive list of the consequences of this feature: |
---|
247 | |
---|
248 | http://www.boost.org/doc/libs/${distver}/libs/regex/doc/html/boost_regex/ref/sub_match.html |
---|
249 | " |
---|
250 | |
---|
251 | post-patch { |
---|
252 | reinplace {/#define BOOST_REGEX_MATCH_EXTRA/s:^// ::} \ |
---|
253 | ${worksrcpath}/boost/regex/user.hpp |
---|
254 | } |
---|
255 | } |
---|
256 | |
---|
257 | if {[mpi_variant_isset]} { |
---|
258 | |
---|
259 | # There is a conflict with debug support. |
---|
260 | # The issue has been reported to both the MacPorts team and the boost team, as per: |
---|
261 | # <http://trac.macports.org/ticket/23667> and <https://svn.boost.org/trac/boost/ticket/4461> |
---|
262 | if {[variant_isset debug]} { |
---|
263 | return -code error "+debug variant conflicts with mpi" |
---|
264 | } |
---|
265 | |
---|
266 | configure.args-delete --without-libraries=mpi |
---|
267 | |
---|
268 | post-configure { |
---|
269 | write_jam "using mpi : ${mpi.cxx} : : ${mpi.exec} ;" |
---|
270 | } |
---|
271 | |
---|
272 | if {![catch python_dir]} { |
---|
273 | |
---|
274 | patchfiles-append patch-libs-mpi-build-Jamfile.v2.diff |
---|
275 | |
---|
276 | post-destroot { |
---|
277 | set site_packages [python_dir] |
---|
278 | xinstall -d ${destroot}${site_packages}/boost |
---|
279 | xinstall -m 644 ${worksrcpath}/libs/mpi/build/__init__.py \ |
---|
280 | ${destroot}${site_packages}/boost |
---|
281 | |
---|
282 | set l ${site_packages}/boost/mpi.so |
---|
283 | move ${destroot}${prefix}/lib/mpi.so ${destroot}${l} |
---|
284 | system "install_name_tool -id ${l} ${destroot}${l}" |
---|
285 | } |
---|
286 | |
---|
287 | } |
---|
288 | } |
---|
289 | |
---|
290 | if {![variant_isset universal]} { |
---|
291 | # Honour 'build_arch', if not universal as per #28327 |
---|
292 | if {[lsearch ${build_arch} ppc*] != -1} { |
---|
293 | build.args-append architecture=power |
---|
294 | if {${os.arch} ne "powerpc"} { |
---|
295 | build.args-append --disable-long-double |
---|
296 | } |
---|
297 | } else { |
---|
298 | if {[lsearch ${build_arch} *86*] != -1} { |
---|
299 | build.args-append architecture=x86 |
---|
300 | } else { |
---|
301 | pre-fetch { |
---|
302 | error "Current value of 'build_arch' is not supported." |
---|
303 | } |
---|
304 | } |
---|
305 | } |
---|
306 | if {[lsearch ${build_arch} *64] != -1} { |
---|
307 | build.args-append address-model=64 |
---|
308 | } else { |
---|
309 | build.args-append address-model=32 |
---|
310 | } |
---|
311 | } |
---|
312 | |
---|
313 | variant universal { |
---|
314 | build.args-append pch=off |
---|
315 | |
---|
316 | if {[lsearch ${universal_archs} ppc*] != -1} { |
---|
317 | if {[lsearch ${universal_archs} *86*] != -1} { |
---|
318 | build.args-append architecture=combined |
---|
319 | } else { |
---|
320 | build.args-append architecture=power |
---|
321 | } |
---|
322 | |
---|
323 | if {${os.arch} ne "powerpc"} { |
---|
324 | build.args-append --disable-long-double |
---|
325 | } |
---|
326 | } else { |
---|
327 | build.args-append architecture=x86 |
---|
328 | } |
---|
329 | |
---|
330 | if {[lsearch ${universal_archs} *64] != -1} { |
---|
331 | if {[lsearch ${universal_archs} i386] != -1 || [lsearch ${universal_archs} ppc] != -1} { |
---|
332 | build.args-append address-model=32_64 |
---|
333 | if {[lsearch ${universal_archs} ppc64] == -1} { |
---|
334 | post-patch { |
---|
335 | reinplace "/local support-ppc64 =/s/= 1/= /" ${worksrcpath}/tools/build/src/tools/darwin.jam |
---|
336 | } |
---|
337 | } |
---|
338 | } else { |
---|
339 | build.args-append address-model=64 |
---|
340 | } |
---|
341 | } else { |
---|
342 | build.args-append address-model=32 |
---|
343 | } |
---|
344 | } |
---|
345 | |
---|
346 | platform powerpc { |
---|
347 | build.args-append --disable-long-double |
---|
348 | } |
---|
349 | |
---|
350 | platform darwin 8 powerpc { |
---|
351 | if {[variant_isset universal]} { |
---|
352 | build.args-append macosx-version=10.4 |
---|
353 | } |
---|
354 | } |
---|
355 | |
---|
356 | livecheck.type regex |
---|
357 | livecheck.url ${homepage} |
---|
358 | livecheck.regex ${name}/(\\d+\\.\\d+\\.\\d+)/ |
---|