Ticket #48711: Portfile

File Portfile, 12.2 KB (added by crmoore (Chris Moore), 9 years ago)

Updated Portfile to apply patch and bump revision

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 139551 2015-08-20 07:23:27Z ryandesign@macports.org $
3
4PortSystem      1.0
5PortGroup       compiler_blacklist_versions 1.0
6PortGroup       mpi 1.0
7
8name            boost
9version         1.59.0
10license         Boost-1
11categories      devel
12platforms       darwin
13maintainers     ryandesign openmaintainer
14revision        1
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-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
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
163# TODO: Remove after 2016-05-26.
164variant python25 description {Legacy variant} requires python27 {}
165variant python31 description {Legacy variant} requires python34 {}
166variant python32 description {Legacy variant} requires python34 {}
167
168set pythons_suffixes {26 27 33 34}
169
170set pythons_ports {}
171foreach s ${pythons_suffixes} {
172    lappend pythons_ports python${s}
173}
174
175proc 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
186foreach 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
215if {![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
225default_variants +no_single +no_static
226
227variant 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
232variant no_static description {Disable building static libraries} {
233    build.args-delete   link=static,shared
234    build.args-append   link=shared
235}
236
237variant no_single description {Disable building single-threaded libraries} {
238    build.args-delete   threading=single,multi
239    build.args-append   threading=multi
240}
241
242variant regex_match_extra description \
243        "Enable access to extended capture information of submatches in Boost.Regex" {
244    notes-append "
245You enabled the +regex_match_extra variant\; see the following page for an\
246exhaustive list of the consequences of this feature:
247
248http://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
257if {[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
290if {![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
313variant 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
346platform powerpc {
347    build.args-append   --disable-long-double
348}
349
350platform darwin 8 powerpc {
351    if {[variant_isset universal]} {
352        build.args-append   macosx-version=10.4
353    }
354}
355
356livecheck.type  regex
357livecheck.url   ${homepage}
358livecheck.regex ${name}/(\\d+\\.\\d+\\.\\d+)/