source: trunk/dports/science/mpich/Portfile

Last change on this file was 152178, checked in by eborisch@…, 15 months ago

mpich-devel: Update to 3.3a1.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 11.6 KB
Line 
1# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
2# $Id: Portfile 152178 2016-08-31 16:32:45Z ryandesign@macports.org $
3
4PortSystem          1.0
5PortGroup           compiler_blacklist_versions 1.0
6PortGroup           select 1.0
7PortGroup           compilers 1.0
8
9name                mpich
10version             3.2
11# Note multiple revisions in Portfile (for various sub-ports to reduce builds)
12revision            1
13
14license             BSD
15categories          science parallel net
16platforms           darwin
17maintainers         eborisch \
18                    sean \
19                    openmaintainer
20
21description         Message Passing Interface (MPI) Library
22
23long_description    MPICH is a high-performance and widely portable\
24                    implementation of the Message Passing Interface (MPI) \
25                    standard (MPI-1, MPI-2 and MPI-3). The goals of MPICH are:\
26                    (1) to provide an MPI implementation that efficiently\
27                    supports different computation and communication platforms\
28                    including commodity clusters (desktop systems,\
29                    shared-memory systems, multicore architectures), high-speed\
30                    networks (10 Gigabit Ethernet, InfiniBand, Myrinet,\
31                    Quadrics) and proprietary high-end computing systems (Blue\
32                    Gene, Cray) and (2) to enable cutting-edge research in MPI\
33                    through an easy-to-extend modular framework for other\
34                    derived implementations.
35
36homepage            http://www.mpich.org/
37master_sites        ${homepage}static/downloads/${version}
38
39# Since mpi is just a compiler wrapper, compiling it as universal needs to be
40# supported upstream since it'd be a constantly moving target, for reference
41# see, https://trac.macports.org/ticket/20240
42universal_variant   no
43
44checksums \
45    rmd160  d7180d5129fe313830504e1d59c3b37831554bee \
46    sha256  0778679a6b693d7b7caff37ff9d2856dc2bfc51318bf8373859bfa74253da3dc
47
48livecheck.type      regex
49livecheck.regex     {href=.([0-9.p]+)/}
50livecheck.url       ${homepage}/static/downloads/
51
52if {[string first "-devel" $subport] > 0} {
53    name                mpich-devel
54    version             3.3a1
55    revision            0
56    # To see 3.2 as newer than 3.2rcX
57    epoch               2
58
59    ## Nightly versions. Disabled when alpha / beta / rc versions available.
60    #set tag             g658ff0d9
61    #distname            mpich-master-v${version}-${tag}
62    #master_sites        ${homepage}static/downloads/nightly/master/mpich
63    #livecheck.regex \
64        mpich-master-v(\[0-9.\]+-\[0-9\]+)-\[0-9a-z\]+${extract.suffix}
65    #livecheck.url       ${master_sites}
66
67    ## Alpha / rc versions (When available)
68    distname            mpich-${version}
69    master_sites        ${homepage}static/downloads/${version}
70    # nightly snapshots have not been updated for a while so let's manually
71    # check them for now
72    livecheck.type      none
73    # livecheck.regex     {href=.([0-9.abrcp]+)/}
74    checksums \
75        rmd160  760abc5bcfaa4c7b57435b8c6382482875598abe \
76        sha256  0bb1c70e7b7d110fdb781e753b8995e48d3ff8667ee8f65738c375f3516bdcbf
77} else {
78    patchfiles-append       alignment.patch
79}
80
81# As MPICH creates compiler wrappers, there are lots of
82# variants for what compiler the user would like to wrap.
83
84# Sup-ports names and corresponding configure.compiler value
85array set clist {
86    clang   {clang}
87    clang33 {macports-clang-3.3}
88    clang34 {macports-clang-3.4}
89    clang35 {macports-clang-3.5}
90    clang36 {macports-clang-3.6}
91    clang37 {macports-clang-3.7}
92    clang38 {macports-clang-3.8}
93    clang39 {macports-clang-3.9}
94    gcc43   {macports-gcc-4.3}
95    gcc44   {macports-gcc-4.4}
96    gcc45   {macports-gcc-4.5}
97    gcc46   {macports-gcc-4.6}
98    gcc47   {macports-gcc-4.7}
99    gcc48   {macports-gcc-4.8}
100    gcc49   {macports-gcc-4.9}
101    gcc5    {macports-gcc-5}
102    gcc6    {macports-gcc-6}
103    gcc7    {macports-gcc-7}
104    llvm    {llvm-gcc-4.2}
105}
106
107foreach key [array name clist] {
108    subport ${name}-${key} {}
109    subport ${name}-devel-${key} {}
110}
111subport ${name}-default {}
112subport ${name}-devel {}
113subport ${name}-devel-default {}
114
115# Linker for Apple clang version 421.11.66 segfaults
116# See https://trac.macports.org/ticket/36654#comment:9
117compiler.blacklist-append   {clang >= 421.11.66 < 425.0.24}
118
119configure.args      --disable-dependency-tracking \
120                    --disable-f77 \
121                    --disable-fc \
122                    --disable-silent-rules \
123                    --enable-base-cache \
124                    --enable-cache \
125                    --enable-cxx \
126                    --enable-fast=O2 \
127                    --enable-shared \
128                    --enable-smpcoll \
129                    --with-device=ch3:nemesis \
130                    --with-pm=hydra \
131                    --with-thread-package=posix \
132                    --enable-versioning \
133                    "F90FLAGS='' F90=''"
134
135variant threads description {Build with full thread support} {
136    configure.args-append   --enable-threads=multiple
137}
138
139platform darwin {
140    configure.args-append   --enable-timer-type=mach_absolute_time
141}
142
143# We're making compiler wrappers here... don't default to -O2 for wrappers.
144# Actual library code is compiled with -O2 via --enable-fast=O2 configure arg
145configure.optflags-delete   -O2 -Os
146configure.cppflags-delete   -I${prefix}/include
147configure.ldflags-delete    -L${prefix}/lib
148
149if {${subport} != ${name}} {
150    set cname                   [lindex [split ${subport} -] end]
151    if {${cname} == "default"} {
152        set cname                   mp
153    }
154
155    # As we are making wrappers, we depend on the compilers to exist. The
156    # compilers group already does this for gcc, but not clangXX.  This adds
157    # clang-X.X to the depends_lib (not just depends_build)
158    if {[regexp {clang\d} ${cname}] == 1} {
159        set cport_name          [regsub {(\d)(\d)} ${cname} {-\1.\2}]
160        depends_lib-append      port:${cport_name}
161    }
162
163    if {[lsearch -exact {mp llvm clang} ${cname}] != -1} {
164        # Force local builds with Xcode-provided compilers (avoid issues with
165        # different Xcode versions on buildbot and user machines)
166        archive_sites
167    }
168
169    depends_lib-append          port:libxml2
170    depends_run-append          port:mpi_select port:mpi-doc
171    select.group                mpi
172    select.file                 ${filespath}/${name}-${cname}
173
174    # Prevent "ccache" and "distcc" from being baked into the wrapper scripts.
175    configure.ccache            no
176    configure.distcc            no
177
178    # don't need to livecheck all the subports, just the port
179    livecheck.type              none
180
181    if {[string first "-default" $subport] < 0} {
182        configure.compiler      [lindex $clist($cname) 0]
183        append long_description "\\n\\nTHIS SUBPORT WRAPS ${cname}'s C/C++"
184    } else {
185        append long_description \
186"\\n\\nTHIS SUBPORT WRAPS MACPORTS' DEFAULT COMPILER FOR C/C++"
187    }
188
189    configure.args-append   \
190        --libdir=${prefix}/lib/${name}-${cname} \
191        --sysconfdir=${prefix}/etc/${name}-${cname} \
192        --program-suffix=-${name}-${cname} \
193        --includedir=${prefix}/include/${name}-${cname}
194
195    post-destroot {
196        if {[string first "-devel" $subport] > 0} {
197            # Supply our own -devel manpages (might be materially different /
198            # new)
199            move ${destroot}${prefix}/share/man \
200                ${destroot}${prefix}/share/doc/mpich/
201            move ${destroot}${prefix}/share/doc/mpich \
202                ${destroot}${prefix}/share/doc/${name}-${cname}
203            system -W ${destroot}${prefix}/share/doc/${name}-${cname}/man \
204                "/usr/bin/find . -type f -print0 | /usr/bin/xargs -0 -P ${build.jobs} /usr/bin/gzip -v"
205        } else {
206            # This version doesn't supply doc/manpages
207            if {[file isdirectory ${destroot}${prefix}/share/man]} {
208                delete ${destroot}${prefix}/share/man
209            }
210            if {[file isdirectory ${destroot}${prefix}/share/doc]} {
211                delete ${destroot}${prefix}/share/doc
212            }
213        }
214    }
215
216    if { [string first gcc $cname] == 0 } {
217        append long_description " AND FORTRAN COMPILERS"
218        revision                4
219        configure.args-delete   --disable-f77 --disable-fc
220        configure.args-append   --enable-f77 --enable-fc
221        select.file             ${filespath}/${name}-${cname}-fortran
222        variant fortran description {
223            Stub : fortran always enabled for gcc-based version
224        } {}
225        default_variants-append     +fortran
226
227       
228        if {[ variant_isset tuned ] && ${os.major} >= 14} {
229            if {![ file exists ${prefix}/bin/clang ]} {
230                pre-configure {
231                    error "
232
233    **********************************************
234    A MacPorts-provided clang must be installed
235    and 'select'-ed to compile mpich-*gcc* +tuned!
236    (Such that ${prefix}/bin/clang exists.)
237    **********************************************       
238"
239                }
240
241            }
242            # Use clang assembler
243            configure.cflags-append     -Wa,-q
244            configure.cxxflags-append   -Wa,-q
245        }
246    } else {
247        append long_description " (AND THE FORTRAN COMPILER SELECTED BY THE VARIANT, IF ANY)"
248
249        compilers.choose   fc f77 f90
250        compilers.setup    -dragonegg default_fortran
251
252        if {[fortran_variant_isset]} {
253            configure.args-delete   --disable-f77 --disable-fc
254            configure.args-append   --enable-f77  --enable-fc
255            select.file             ${filespath}/${name}-${cname}-fortran
256
257            # at least currently, the Fortran variants gccX and g95 match the name of the ports
258            depends_lib-append      port:[fortran_variant_name]
259
260            if {[variant_isset g95]} {
261                configure.args-append lt_cv_ld_force_load=no
262            }
263        }
264    }
265
266    set devnotes ""
267
268    if {[string first "-devel" $subport] > 0} {
269        set devnotes "
270|
271| To see the -devel MAN pages, add:
272|   ${prefix}/share/doc/${name}-${cname}/man
273| to the start of your MANPATH environment variable."
274    }
275
276notes "
277
278+--- MPICH Usage note ----
279| The mpicc wrapper (and friends) are installed as:
280|
281|   ${prefix}/bin/mpicc-${name}-${cname} (likewise mpicxx, ...)
282|
283| To make ${subport}'s wrappers the default (what you get when
284| you execute 'mpicc' etc.) please run:
285|
286|   sudo port select --set mpi [file tail ${select.file}]${devnotes}
287+-------------------------
288
289"
290
291    if {[variant_isset gcc5]} {
292        set DEFAULT_MSG "
293NOTE: Default fortran changed to +gcc6; consider switching variants to enable
294pre-built packages for ${subport} by running:
295  \"sudo port clean ${subport} && sudo port upgrade ${subport} +gcc6-gcc5\"
296"
297        notes-append    ${DEFAULT_MSG}
298
299        pre-fetch {
300            ui_msg ${DEFAULT_MSG}
301            system "sleep 3"
302            ui_msg "Continuing with local +gcc5 build."
303        }
304    }
305
306    variant gforker description {
307        Use gforker process manager instead of the default hydra
308    } {
309        configure.args-append   --with-pm=gforker
310        configure.args-delete   --with-pm=hydra
311    }
312
313    variant tuned description {Build with more optimizations} {
314        configure.args-delete   --enable-fast=O2
315        configure.args-append   --enable-fast=all \
316                                MPICHLIB_CFLAGS='-fomit-frame-pointer -O2'
317    }
318} else {
319    depends_lib-append      port:$name-default
320    distfiles
321    supported_archs         noarch
322    use_configure           no
323    patch {}
324    build {}
325    destroot {
326        set docdir          ${destroot}${prefix}/share/doc/${name}
327        xinstall -d ${docdir}
328        system "echo $name is a stub port > ${docdir}/README"
329    }
330}
Note: See TracBrowser for help on using the repository browser.