-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
Portfile
425 lines (356 loc) · 15.3 KB
/
Portfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
# -*- 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
PortSystem 1.0
PortGroup compilers 1.0
PortGroup mpiutil 1.0
#===============================================================================
#
# *** IMPORTANT NOTE ***
#
# When making logic changes to this port, PLEASE review port 'openmpi' to see
# if the same changes should be applied. While the subports and variants aren't
# exactly the same between the two - and things like configure arguments
# certainly differ, as they're different code bases - much of the core logic
# is very similar. (And often identical.)
#
# Please help us avoid divergent MPI ports, which cause serious migraines.
#
#===============================================================================
# make sure to keep in sync with mpi-doc
name mpich
version 4.1.1
revision 0
license BSD
categories science parallel net
platforms darwin
maintainers {eborisch @eborisch} \
{mascguy @mascguy}
description Message Passing Interface (MPI) Library
long_description MPICH is a high-performance and widely portable\
implementation of the Message Passing Interface (MPI) \
standard (MPI-1, MPI-2 and MPI-3). The goals of MPICH are:\
(1) to provide an MPI implementation that efficiently\
supports different computation and communication platforms\
including commodity clusters (desktop systems,\
shared-memory systems, multicore architectures), high-speed\
networks (10 Gigabit Ethernet, InfiniBand, Myrinet,\
Quadrics) and proprietary high-end computing systems (Blue\
Gene, Cray) and (2) to enable cutting-edge research in MPI\
through an easy-to-extend modular framework for other\
derived implementations.
homepage https://www.mpich.org/
master_sites ${homepage}static/downloads/${version}
checksums rmd160 87cab1d40759846cb7ca3d008522c66965c7aae8 \
sha256 ee30471b35ef87f4c88f871a5e2ad3811cd9c4df32fd4f138443072ff4284ca2 \
size 38537070
livecheck.type regex
livecheck.regex {href=.([0-9.p]+)/}
livecheck.url ${homepage}/static/downloads/
#-------------------------------------------------------------------------------
# Target Compiler Logic
#-------------------------------------------------------------------------------
# As MPICH creates compiler wrappers, there are lots of
# variants for what compiler the user would like to wrap.
# Please update the mpi portgroup whenever clist is changed.
# Subport names and corresponding configure.compiler value
set clist [dict create]
set clist_unsupported [list]
set clist_obsolete [list]
# Compilers supported across-the-board
dict set clist gcc7 {macports-gcc-7}
dict set clist gcc10 {macports-gcc-10}
dict set clist gcc11 {macports-gcc-11}
dict set clist gcc12 {macports-gcc-12}
dict set clist clang11 {macports-clang-11}
dict set clist clang12 {macports-clang-12}
dict set clist clang13 {macports-clang-13}
dict set clist clang14 {macports-clang-14}
# Only enable default (gcc), and Xcode clang, for MacOS 10.7 and later
if { ${os.major} >= 11 } {
dict set clist default {}
dict set clist clang {clang}
} else {
lappend clist_unsupported \
default clang
}
# Clang 9 and 10 not supported on ARM
if { ${os.arch} eq "arm" } {
lappend clist_unsupported \
clang90 clang10
} else {
dict set clist clang90 {macports-clang-9.0}
dict set clist clang10 {macports-clang-10}
}
# GCC 9 only supported for macOS 10.6 through 10.10
if { ${os.major} >= 10 && ${os.major} <= 14 } {
dict set clist gcc9 {macports-gcc-9}
} else {
lappend clist_unsupported \
gcc9
}
# Clang 15 and 16 only available on 10.7 and later
if {${os.major} >= 11} {
dict set clist clang15 {macports-clang-15}
dict set clist clang16 {macports-clang-16}
} else {
lappend clist_unsupported \
clang15 clang16
}
#-------------------------------------------------------------------------------
# Subport Creation/Validation
#-------------------------------------------------------------------------------
set cname \
[lindex [split ${subport} -] end]
mpiutil_add_subports \
${name} ${subport} \
${clist} ${clist_unsupported} ${clist_obsolete}
set subport_enabled \
[mpiutil_validate_subport \
${name} ${subport} ${cname} \
${clist} ${clist_unsupported} ${clist_obsolete} \
]
#-------------------------------------------------------------------------------
# General Subport Logic
#-------------------------------------------------------------------------------
if {${subport_enabled}} {
PortGroup select 1.0
PortGroup muniversal 1.0
PortGroup legacysupport 1.1
if {${cname} eq "default"} {
set cname "mp"
}
# Add various dependencies: build, lib, and run
mpiutil_add_depends \
${subport} ${cname}
# Determine whether buildbot binaries should be used, and disable if necessary
mpiutil_set_binary_eligibility \
${subport} ${cname}
depends_build-append port:pkgconfig
depends_lib-append port:libxml2
if {${cname} eq "mp"} {
if {${os.major} == 10} {
# Make every attempt to avoid MacPorts compilers on 10.6
configure.cxx_stdlib libstdc++
}
}
configure.args --disable-dependency-tracking \
--disable-fortran \
--disable-silent-rules \
--enable-base-cache \
--enable-cache \
--enable-cxx \
--enable-fast=O2 \
--enable-shared \
--enable-versioning \
--enable-timer-type=mach_absolute_time \
--with-pm=hydra \
--with-thread-package=posix \
--with-hwloc-prefix=${prefix} \
--disable-collalgo-tests \
--disable-f08 \
"F90FLAGS='' F90=''"
if {${os.major} < 12} {
# MPICH requires OpenCL version 1.2, which was not introduced until OS X Mountain Lion
configure.args-append \
--enable-opencl=no
}
patchfiles-append \
patch-no_qmkshrobj.diff \
patch-ch4-ipv6.diff \
patch-mpich-darwin-powerpc.diff \
patch-pingpong.diff \
patch-spinlocks.diff
platform darwin powerpc {
# libfabric calls for atomicops, on PPC at least
configure.ldflags-append \
-latomic
}
# We're making compiler wrappers here... don't default to -O2 for wrappers.
# Actual library code is compiled with -O2 via --enable-fast=O2 configure arg
configure.optflags-delete -O2 -Os
configure.cppflags-delete -I${prefix}/include
configure.ldflags-delete -L${prefix}/lib
select.group mpi
select.file ${filespath}/portselect/${name}-${cname}
# Prevent "ccache" and "distcc" from being baked into the wrapper scripts.
configure.ccache no
configure.distcc no
# don't need to livecheck all the subports, just the port
livecheck.type none
if {${cname} ne "mp"} {
set compiler [dict get ${clist} ${cname}]
configure.compiler [lindex ${compiler} 0]
unset compiler
long_description-append \
"\n\nTHIS SUBPORT WRAPS ${cname}'s C/C++"
} else {
long_description-append \
"\n\nTHIS SUBPORT WRAPS MACPORTS' DEFAULT COMPILER FOR C/C++"
}
configure.args-append \
--libdir=${prefix}/lib/${name}-${cname} \
--sysconfdir=${prefix}/etc/${name}-${cname} \
--program-suffix=-${name}-${cname} \
--includedir=${prefix}/include/${name}-${cname}
# avoid dependency on port:bash
configure.env-append \
BASH_SHELL=/bin/bash
# setting xFLAGS resulting in mpicc, etc. always using these flags
# setting MPICHLIB_xFLAGS only uses them for building the library
foreach env_var {CFLAGS CPPFLAGS CXXFLAGS FFLAGS FCFLAGS} {
configure.args-append \
MPICHLIB_${env_var}=\"\$${env_var}\" \
${env_var}=""
}
# remove LDFLAGS mpicc, etc. and pkgconfig files
post-build {
foreach arch [get_canonical_archs] {
if {[variant_exists universal] && [variant_isset universal]} {
set dir ${worksrcpath}-${arch}
} else {
set dir ${worksrcpath}
}
foreach f [glob \
${dir}/src/env/*.bash \
${dir}/src/env/*.sh \
${dir}/src/packaging/pkgconfig/*.pc] {
reinplace \
"s| ${configure.ldflags}||g" \
${f}
reinplace \
"s| -arch ${arch}||g" \
${f}
}
}
}
post-destroot {
# This version doesn't supply doc/manpages
if {[file isdirectory ${destroot}${prefix}/share/man]} {
delete ${destroot}${prefix}/share/man
}
if {[file isdirectory ${destroot}${prefix}/share/doc]} {
delete ${destroot}${prefix}/share/doc
}
}
#---------------------------------------------------------------------------
# Fortran Support
#---------------------------------------------------------------------------
set fortran_enabled no
if { [string first gcc $cname] == 0 } {
set fortran_enabled yes
long_description-append "AND FORTRAN COMPILERS"
variant fortran description {Stub : fortran always enabled for gcc-based version} {}
default_variants-append +fortran
if {${cname} eq "gcc10" ||
${cname} eq "gcc11" ||
${cname} eq "gcc12"} {
# see https://lists.mpich.org/pipermail/discuss/2020-January/005862.html
# see https://github.com/pmodels/mpich/issues/4300
# see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91556
configure.fflags-append -fallow-argument-mismatch
configure.fcflags-append -fallow-argument-mismatch
}
# GCC C++ always uses libstdc++
# see https://trac.macports.org/ticket/59185
configure.cxx_stdlib libstdc++
} else {
long_description-append "(AND THE FORTRAN COMPILER SELECTED BY THE VARIANT, IF ANY)"
compilers.allow_arguments_mismatch yes
compilers.choose fc f77 f90
compilers.setup default_fortran
if {[fortran_variant_isset]} {
set fortran_enabled yes
# Ask the portgroup for the correct dependency - the Fortran
# variants gccX and g95 match the name of the ports but
# gccdevel does not.
depends_lib-append [fortran_variant_depends]
if {[variant_isset g95]} {
configure.args-append lt_cv_ld_force_load=no
}
}
}
if {${fortran_enabled}} {
configure.args-replace --disable-fortran \
--enable-fortran
# avoid
# Python 3 is required to generate F90 bindings but not found!
set python_branch 3.11
set python_version [string map {. {}} ${python_branch}]
depends_build-append port:python${python_version}
depends_skip_archcheck-append port:python${python_version}
configure.python ${prefix}/bin/python${python_branch}
select.file ${filespath}/portselect/${name}-${cname}-fortran
}
unset fortran_enabled
#---------------------------------------------------------------------------
# Universal Build Support
#---------------------------------------------------------------------------
if {![info exists universal_possible]} {
set universal_possible [expr {${os.universal_supported} && [llength ${configure.universal_archs}] >= 2}]
}
# Fortran headers do not understand preprocessors commands like __LP64__
# Fortran mod files can not be merged for different architectures
# create a architecture specific folder for the non-build_arch architecture
if {${universal_possible} && [variant_isset universal]} {
patchfiles-append patch-universal_fortran.diff
post-patch {
if {${build_arch} eq "ppc" || ${build_arch} eq "ppc64"} {
set arch32 "ppc"
set arch64 "ppc64"
} else {
set arch32 "i386"
set arch64 "x86_64"
}
reinplace \
"s|__MACPORTS_32_BIT_ARCH__|${arch32}|g" \
${worksrcpath}/src/env/mpifort.bash.in
reinplace \
"s|__MACPORTS_64_BIT_ARCH__|${arch64}|g" \
${worksrcpath}/src/env/mpifort.bash.in
reinplace \
"s|__MACPORTS_BUILD_ARCH__|${build_arch}|g" \
${worksrcpath}/src/env/mpifort.bash.in
}
merger-post-destroot {
foreach arch ${configure.universal_archs} {
set incdir ${destroot}-${arch}${prefix}/include/${name}-${cname}
if {${arch} ne ${build_arch}} {
set archinc ${incdir}/${arch}
xinstall -d -m 0755 ${archinc}
foreach f [glob -nocomplain -directory ${incdir} *.mod mpif.h] {
move ${f} ${archinc}
}
}
}
}
}
#---------------------------------------------------------------------------
# Variants
#---------------------------------------------------------------------------
variant threads description {Build with full thread support} {
configure.args-append --enable-threads=multiple
}
variant gforker description {Use gforker process manager instead of the default hydra} {
configure.args-replace --with-pm=hydra \
--with-pm=gforker
}
variant native description {Build for local machine} {
configure.args-replace --enable-fast=O2 \
--enable-fast=all
# Note these need to be above the following foreach
if {${build_arch} in [list ppc ppc64]} {
configure.cflags-append -mtune=native
configure.cxxflags-append -mtune=native
} else {
configure.cflags-append -march=native
configure.cxxflags-append -march=native
}
}
#---------------------------------------------------------------------------
# Notes
#---------------------------------------------------------------------------
mpiutil_add_notes \
${name} ${subport} ${cname} ${select.file}
} elseif {${subport} eq ${name}} {
PortGroup stub 1.0
depends_lib-append port:${name}-default
}