Ticket #26466: Portfile

File Portfile, 7.6 KB (added by manphiz@…, 14 years ago)

New Portfile to enable multithreading/shared/release by default with other options through variants

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 70711 2010-08-18 14:53:56Z adfernandes@macports.org $
3
4PortSystem      1.0
5
6name            boost
7version         1.44.0
8license         Boost-1.0
9categories      devel
10platforms       darwin
11maintainers     adfernandes
12description     Collection of portable C++ source libraries
13
14long_description \
15    Boost provides free portable peer-reviewed C++ \
16    libraries. The emphasis is on portable libraries \
17    which work well with the C++ Standard Library.
18
19homepage        http://www.boost.org
20master_sites    sourceforge
21set distver     [join [split ${version} .] _]
22distname        ${name}_${distver}
23use_bzip2       yes
24
25checksums       md5     f02578f5218f217a9f20e9c30e119c6a \
26                sha1    0dfeaad7a316ddfdcdb8a7e42443ef048ad18c01 \
27                rmd160  1fe1bf83ce5699dc43cbfc3d5a6997722c34c938
28
29depends_build   path:bin/bjam:boost-jam
30
31depends_lib     port:zlib \
32                port:expat \
33                port:bzip2
34
35configure {
36    reinplace -E "s|-install_name \"|&${prefix}/lib/|" \
37        ${worksrcpath}/tools/build/v2/tools/darwin.jam
38    write_jam "using darwin : : ${configure.cxx} ;"
39}
40
41build.cmd       bjam
42build.target
43build.args      -d2 \
44                --layout=tagged \
45                --debug-configuration \
46                --ignore-site-config \
47                --user-config=user-config.jam \
48                --without-python \
49                --without-mpi \
50                -sBZIP2_INCLUDE=${prefix}/include \
51                -sBZIP2_LIBPATH=${prefix}/lib \
52                -sEXPAT_INCLUDE=${prefix}/include \
53                -sEXPAT_LIBPATH=${prefix}/lib \
54                -sZLIB_INCLUDE=${prefix}/include \
55                -sZLIB_LIBPATH=${prefix}/lib \
56                threading=multi \
57                link=shared \
58                runtime-link=shared \
59                variant=release
60
61use_parallel_build  no
62
63destroot.cmd        bjam
64destroot.destdir    --prefix=${destroot}${prefix}
65
66pre-destroot {
67    eval destroot.args  ${build.args}
68}
69
70post-destroot {
71    set docdir ${prefix}/share/doc/${name}
72    xinstall -d ${destroot}${docdir}
73    set l [expr [string length ${worksrcpath}] + 1]
74    fs-traverse f [glob -directory ${worksrcpath} *] {
75        set dest ${destroot}${docdir}/[string range ${f} ${l} end]
76        if {[file isdirectory ${f}]} {
77            if {[file tail ${f}] eq "example"} {
78                copy ${f} ${dest}
79                continue
80            }
81            xinstall -d ${dest}
82        } elseif {[lsearch -exact {css htm html png svg} [string range [file extension ${f}] 1 end]] != -1} {
83            xinstall -m 644 ${f} ${dest}
84        }
85    }
86}
87
88set pythons_suffixes {24 25 26 27 31}
89
90set pythons_ports {}
91foreach s ${pythons_suffixes} {
92    lappend pythons_ports python${s}
93}
94
95proc python_dir {} {
96    global pythons_suffixes
97    foreach s ${pythons_suffixes} {
98        if {[variant_isset python${s}]} {
99            set p python[string index ${s} 0].[string index ${s} 1]
100            return [file normalize [exec ${p} -c "import sys; print sys.prefix"]/lib/${p}/site-packages]
101        }
102    }
103    error "Python support not enabled."
104}
105
106proc write_jam s {
107    global worksrcpath
108    set config [open ${worksrcpath}/user-config.jam a]
109    puts ${config} ${s}
110    close ${config}
111}
112
113foreach s ${pythons_suffixes} {
114    set p python${s}
115    set v [string index ${s} 0].[string index ${s} 1]
116    set i [lsearch -exact ${pythons_ports} ${p}]
117    set c [lreplace ${pythons_ports} ${i} ${i}]
118    eval [subst {
119        variant ${p} description "Build Boost.Python for Python ${v}" conflicts ${c} debug {
120            # Cannot build debug variants with openmpi and python variants as per the following:
121            # <http://trac.macports.org/ticket/23667> and <https://svn.boost.org/trac/boost/ticket/4461>
122            patchfiles-append   patch-tools-build-v2-tools-python.jam.diff
123
124            post-patch {
125                reinplace s|@PREFIX@|${prefix}| ${worksrcpath}/tools/build/v2/tools/python.jam
126            }
127
128            depends_lib-append  port:${p}
129            build.args-delete   --without-python
130
131            post-configure {
132                write_jam "using python : : ${prefix}/bin/python${v} : : ${prefix}/lib ;"
133            }
134        }
135    }]
136}
137
138variant debug description {Builds debug versions of the libraries as well} conflicts openmpi {
139    build.args-delete   variant=release
140    build.args-append   variant=debug,release
141}
142
143variant icu description {Enable Unicode support in Boost.Regex through ICU} {
144    depends_lib-append  port:icu
145    build.args-append   -sICU_PATH=${prefix}
146}
147
148variant openmpi description {Build Boost.MPI} conflicts debug {
149    # Cannot build debug variants with openmpi and python variants as per the following:
150    # <http://trac.macports.org/ticket/23667> and <https://svn.boost.org/trac/boost/ticket/4461>
151    depends_lib-append  port:openmpi
152    build.args-delete   --without-mpi
153
154    post-configure {
155        write_jam "using mpi : ${prefix}/bin/openmpic++ : : ${prefix}/bin/openmpirun ;"
156    }
157
158    if {![catch python_dir]} {
159        patchfiles-append patch-libs-mpi-build-Jamfile.v2.diff
160
161        post-destroot {
162            set site_packages [python_dir]
163            xinstall -d ${destroot}${site_packages}/boost
164            xinstall -m 644 ${worksrcpath}/libs/mpi/build/__init__.py \
165                ${destroot}${site_packages}/boost
166
167            set l ${site_packages}/boost/mpi.so
168            move ${destroot}${prefix}/lib/mpi.so ${destroot}${l}
169            system "install_name_tool -id ${l} ${destroot}${l}"
170        }
171    }
172}
173
174variant regex_match_extra description \
175        "Enable access to extended capture information of submatches in Boost.Regex" {
176    notes \
177        You enabled +regex_match_extra variant, see the following page for an \
178        exhaustive list of the consequences of this feature:\n\t \
179        http://www.boost.org/doc/libs/${distver}/libs/regex/doc/html/boost_regex/ref/sub_match.html
180
181    post-patch {
182        reinplace {/#define BOOST_REGEX_MATCH_EXTRA/s:^// ::} \
183            ${worksrcpath}/boost/regex/user.hpp
184    }
185}
186
187variant single description \
188        "build single-threading flavor in addition of multi-threading flavor" {
189    build.args-delete   threading=multi
190    build.args-append   threading=single,multi
191}
192
193variant static description \
194        "build static flavor in addition of shared flavor" {
195    build.args-delete   link=shared \
196                        runtime-link=shared
197    build.args-append   link=shared,static \
198                        runtime-link=shared,static
199}
200
201variant universal {
202    build.args-append   pch=off
203
204    if {[lsearch ${universal_archs} ppc*] != -1} {
205        if {[lsearch ${universal_archs} *86*] != -1} {
206            build.args-append   architecture=combined
207        } else {
208            build.args-append   architecture=power
209        }
210
211        if {${os.arch} != "powerpc"} {
212            build.args-append   --disable-long-double
213        }
214    } else {
215        build.args-append   architecture=x86
216    }
217
218    if {[lsearch ${universal_archs} *64] != -1} {
219        if {[lsearch ${universal_archs} i386] != -1 || [lsearch ${universal_archs} ppc] != -1} {
220            build.args-append   address-model=32_64
221        } else {
222            build.args-append   address-model=64
223        }
224    } else {
225        build.args-append   address-model=32
226    }
227}
228
229platform powerpc {
230    build.args-append   --disable-long-double
231}
232
233platform darwin 8 powerpc {
234    if {[variant_isset universal]} {
235        build.args-append   macosx-version=10.4
236    }
237}
238
239livecheck.type  regex
240livecheck.url   ${homepage}
241livecheck.regex "Version (\\d+\\.\\d+\\.\\d+)"