source: trunk/dports/devel/boost/Portfile

Last change on this file was 141182, checked in by jeremyhu@…, 2 years ago

misc: Remove references to older versions of macports-clang that are no longer used

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