source: trunk/dports/devel/boost/Portfile @ 135232

Last change on this file since 135232 was 135232, checked in by ryandesign@…, 5 years ago

icu: update to 55.1

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 12.0 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 135232 2015-04-20 00:15:39Z ryandesign@macports.org $
3
4PortSystem      1.0
5PortGroup       compiler_blacklist_versions 1.0
6PortGroup       mpi 1.0
7
8name            boost
9version         1.58.0
10revision        1
11license         Boost-1
12categories      devel
13platforms       darwin
14maintainers     ryandesign 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  efc78b2b1a5d33ed72fcfa6688564c2fcd56772a \
30                sha256  fdfc204fc33ec79c99b9a74944c3e54bd78be4f7f15e260c0e2700a36dc7d3e5
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-bootstrap.sh.diff \
49                patch-apple-clang-no-libcxx.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
62post-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
67proc 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)
77compiler.blacklist {clang < 421} macports-clang-2.9 macports-clang-3.0 *llvm-gcc-4.2 *gcc-4.0 gcc-3.3
78
79compilers.choose   cc cxx
80mpi.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.
85configure.ccache    no
86configure.distcc    no
87
88configure.cmd       ./bootstrap.sh
89configure.args      --without-libraries=python \
90                    --without-libraries=mpi \
91                    --with-icu=${prefix}
92
93if {${os.platform} eq "darwin" && ${os.major} <= 10} {
94    configure.args-append   --without-libraries=context \
95                            --without-libraries=coroutine
96}
97
98configure.universal_args
99
100post-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
119build.cmd       ${worksrcpath}/b2
120build.target
121build.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
137destroot.cmd            ${worksrcpath}/bjam
138destroot.post_args
139
140pre-destroot {
141    destroot.args {*}${build.args} --prefix=${destroot}${prefix}
142    system "find ${worksrcpath} -type f -name '*.gch' -exec rm {} \\;"
143}
144
145post-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
163set pythons_suffixes {25 26 27 31 32 33 34}
164
165set pythons_ports {}
166foreach s ${pythons_suffixes} {
167    lappend pythons_ports python${s}
168}
169
170proc python_dir {} {
171    global pythons_suffixes
172    foreach s ${pythons_suffixes} {
173        if {[variant_isset python${s}]} {
174            set p python[string index ${s} 0].[string index ${s} 1]
175            return [file normalize [exec ${p} -c "import sys; print(sys.prefix)"]/lib/${p}/site-packages]
176        }
177    }
178    error "Python support not enabled."
179}
180
181foreach s ${pythons_suffixes} {
182    set p python${s}
183    set v [string index ${s} 0].[string index ${s} 1]
184    set i [lsearch -exact ${pythons_ports} ${p}]
185    set c [lreplace ${pythons_ports} ${i} ${i}]
186    if { ${s} > 30 } { set bppatch "patch-boost-python3.diff" } else { set bppatch "" }
187    eval [subst {
188        variant ${p} description "Build Boost.Python for Python ${v}" conflicts ${c} debug {
189
190            # There is a conflict with python and debug support, so we should really change the 'variant' line above
191            # to end with "conflicts ${c} debug" above. However, we leave it enabled for those who want to try it.
192            # The issue has been reported to both the MacPorts team and the boost team, as per:
193            # <http://trac.macports.org/ticket/23667> and <https://svn.boost.org/trac/boost/ticket/4461>
194
195            depends_lib-append      port:${p}
196            configure.args-delete   --without-libraries=python
197            configure.args-append   --with-python=${prefix}/bin/python${v} --with-python-root=${prefix}/bin/python${v}
198
199            patchfiles-append   ${bppatch} patch-tools-build-src-tools-python.jam.diff \
200                                patch-tools-build-src-tools-python-2.jam.diff
201
202            post-patch {
203                reinplace s|@FRAMEWORKS_DIR@|${frameworks_dir}| ${worksrcpath}/tools/build/src/tools/python.jam
204            }
205
206        }
207    }]
208}
209
210if {![variant_isset debug]} {
211    set selected_python python27
212    foreach s ${pythons_suffixes} {
213        if {[variant_isset python${s}]} {
214            set selected_python python${s}
215        }
216    }
217    default_variants +${selected_python}
218}
219
220default_variants +no_single +no_static
221
222variant debug description {Builds debug versions of the libraries as well} {
223    build.args-delete   variant=release
224    build.args-append   variant=debug,release
225}
226
227variant no_static description {Disable building static libraries} {
228    build.args-delete   link=shared,static
229    build.args-append   link=shared
230}
231
232variant no_single description {Disable building single-threaded libraries} {
233    build.args-delete   threading=single,multi
234    build.args-append   threading=multi
235}
236
237variant regex_match_extra description \
238        "Enable access to extended capture information of submatches in Boost.Regex" {
239    notes-append "
240You enabled the +regex_match_extra variant\; see the following page for an\
241exhaustive list of the consequences of this feature:
242
243http://www.boost.org/doc/libs/${distver}/libs/regex/doc/html/boost_regex/ref/sub_match.html
244"
245
246    post-patch {
247        reinplace {/#define BOOST_REGEX_MATCH_EXTRA/s:^// ::} \
248            ${worksrcpath}/boost/regex/user.hpp
249    }
250}
251
252if {[mpi_variant_isset]} {
253
254    # There is a conflict with debug support.
255    # The issue has been reported to both the MacPorts team and the boost team, as per:
256    # <http://trac.macports.org/ticket/23667> and <https://svn.boost.org/trac/boost/ticket/4461>
257    if {[variant_isset debug]} {
258        return -code error "+debug variant conflicts with mpi"
259    }
260
261    configure.args-delete   --without-libraries=mpi
262
263    post-configure {
264        write_jam "using mpi : ${mpi.cxx} : : ${mpi.exec} ;"
265    }
266
267    if {![catch python_dir]} {
268
269        patchfiles-append patch-libs-mpi-build-Jamfile.v2.diff
270
271        post-destroot {
272            set site_packages [python_dir]
273            xinstall -d ${destroot}${site_packages}/boost
274            xinstall -m 644 ${worksrcpath}/libs/mpi/build/__init__.py \
275                ${destroot}${site_packages}/boost
276
277            set l ${site_packages}/boost/mpi.so
278            move ${destroot}${prefix}/lib/mpi.so ${destroot}${l}
279            system "install_name_tool -id ${l} ${destroot}${l}"
280        }
281
282    }
283}
284
285if {![variant_isset universal]} {
286    # Honour 'build_arch', if not universal as per #28327
287    if {[lsearch ${build_arch} ppc*] != -1} {
288        build.args-append   architecture=power
289        if {${os.arch} ne "powerpc"} {
290            build.args-append   --disable-long-double
291        }
292    } else {
293        if {[lsearch ${build_arch} *86*] != -1} {
294            build.args-append   architecture=x86
295        } else {
296            pre-fetch {
297                error "Current value of 'build_arch' is not supported."
298            }
299        }
300    }
301    if {[lsearch ${build_arch} *64] != -1} {
302        build.args-append   address-model=64
303    } else {
304        build.args-append   address-model=32
305    }
306}
307
308variant universal {
309    build.args-append   pch=off
310
311    if {[lsearch ${universal_archs} ppc*] != -1} {
312        if {[lsearch ${universal_archs} *86*] != -1} {
313            build.args-append   architecture=combined
314        } else {
315            build.args-append   architecture=power
316        }
317
318        if {${os.arch} ne "powerpc"} {
319            build.args-append   --disable-long-double
320        }
321    } else {
322        build.args-append   architecture=x86
323    }
324
325    if {[lsearch ${universal_archs} *64] != -1} {
326        if {[lsearch ${universal_archs} i386] != -1 || [lsearch ${universal_archs} ppc] != -1} {
327            build.args-append   address-model=32_64
328            if {[lsearch ${universal_archs} ppc64] == -1} {
329                post-patch {
330                    reinplace "/local support-ppc64 =/s/= 1/= /" ${worksrcpath}/tools/build/src/tools/darwin.jam
331                }
332            }
333        } else {
334            build.args-append   address-model=64
335        }
336    } else {
337        build.args-append   address-model=32
338    }
339}
340
341platform powerpc {
342    build.args-append   --disable-long-double
343}
344
345platform darwin 8 powerpc {
346    if {[variant_isset universal]} {
347        build.args-append   macosx-version=10.4
348    }
349}
350
351livecheck.type  regex
352livecheck.url   ${homepage}
353livecheck.regex ${name}/(\\d+\\.\\d+\\.\\d+)/
Note: See TracBrowser for help on using the repository browser.