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 | |
---|
3 | PortSystem 1.0 |
---|
4 | PortGroup compiler_blacklist_versions 1.0 |
---|
5 | PortGroup compilers 1.0 |
---|
6 | PortGroup mpiutil 1.0 |
---|
7 | |
---|
8 | #=============================================================================== |
---|
9 | # |
---|
10 | # *** IMPORTANT NOTE *** |
---|
11 | # |
---|
12 | # When making logic changes to this port, PLEASE review port 'mpich' to see |
---|
13 | # if the same changes should be applied. While the subports and variants aren't |
---|
14 | # exactly the same between the two - and things like configure arguments |
---|
15 | # certainly differ, as they're different code bases - much of the core logic |
---|
16 | # is very similar. (And often identical.) |
---|
17 | # |
---|
18 | # Please help us avoid divergent MPI ports, which cause serious migraines. |
---|
19 | # |
---|
20 | #=============================================================================== |
---|
21 | |
---|
22 | name openmpi |
---|
23 | version 4.1.6 |
---|
24 | revision 0 |
---|
25 | |
---|
26 | license BSD |
---|
27 | categories science parallel net |
---|
28 | platforms darwin |
---|
29 | maintainers {mascguy @mascguy} |
---|
30 | |
---|
31 | description Message Passing Interface (MPI) Library |
---|
32 | |
---|
33 | long_description Open MPI is a project combining technologies and resources \ |
---|
34 | from several other projects (FT-MPI, LA-MPI, LAM/MPI, and \ |
---|
35 | PACX-MPI) in order to build the best MPI library available. A \ |
---|
36 | completely new MPI-2 compliant implementation, Open MPI offers \ |
---|
37 | advantages for system and software vendors, application developers \ |
---|
38 | and computer science researchers. |
---|
39 | |
---|
40 | homepage https://www.open-mpi.org/ |
---|
41 | set branch [join [lrange [split ${version} .] 0 1] .] |
---|
42 | set subdir ompi/v${branch}/downloads/ |
---|
43 | master_sites https://www.open-mpi.org/software/${subdir} |
---|
44 | |
---|
45 | checksums rmd160 5857d47842ba5136807d359a94e3e3226624c06b \ |
---|
46 | sha256 f740994485516deb63b5311af122c265179f5328a0d857a567b85db00b11e415 \ |
---|
47 | size 10017002 |
---|
48 | |
---|
49 | use_bzip2 yes |
---|
50 | |
---|
51 | # Disable livecheck for all subports; only enabled for main port, at end of portfile |
---|
52 | livecheck.type none |
---|
53 | |
---|
54 | #------------------------------------------------------------------------------- |
---|
55 | # Target Compiler Logic |
---|
56 | #------------------------------------------------------------------------------- |
---|
57 | |
---|
58 | # As OpenMPI creates compiler wrappers, there are lots of |
---|
59 | # variants for what compiler the user would like to wrap. |
---|
60 | |
---|
61 | # Please update the mpi portgroup whenever clist is changed. |
---|
62 | |
---|
63 | # Subport names and corresponding configure.compiler value |
---|
64 | set clist [dict create] |
---|
65 | set clist_unsupported [list] |
---|
66 | set clist_obsolete [list] |
---|
67 | |
---|
68 | # Compilers supported across-the-board |
---|
69 | dict set clist default {} |
---|
70 | dict set clist gcc7 {macports-gcc-7} |
---|
71 | dict set clist gcc10 {macports-gcc-10} |
---|
72 | dict set clist gcc11 {macports-gcc-11} |
---|
73 | dict set clist gcc12 {macports-gcc-12} |
---|
74 | dict set clist clang11 {macports-clang-11} |
---|
75 | dict set clist clang12 {macports-clang-12} |
---|
76 | dict set clist clang13 {macports-clang-13} |
---|
77 | dict set clist clang14 {macports-clang-14} |
---|
78 | |
---|
79 | # Only enable Xcode clang builds for MacOS 10.7 and later |
---|
80 | if { ${os.major} >= 11 } { |
---|
81 | dict set clist clang {clang} |
---|
82 | } else { |
---|
83 | lappend clist_unsupported \ |
---|
84 | clang |
---|
85 | } |
---|
86 | |
---|
87 | # Clang 9 and 10 not supported on ARM |
---|
88 | if { ${os.arch} eq "arm" } { |
---|
89 | lappend clist_unsupported \ |
---|
90 | clang90 clang10 |
---|
91 | } else { |
---|
92 | dict set clist clang90 {macports-clang-9.0} |
---|
93 | dict set clist clang10 {macports-clang-10} |
---|
94 | } |
---|
95 | |
---|
96 | # GCC 9 only supported for macOS 10.6 through 10.10 |
---|
97 | if { ${os.major} >= 10 && ${os.major} <= 14 } { |
---|
98 | dict set clist gcc9 {macports-gcc-9} |
---|
99 | } else { |
---|
100 | lappend clist_unsupported \ |
---|
101 | gcc9 |
---|
102 | } |
---|
103 | |
---|
104 | # Clang 15 and 16 only available on 10.7 and later |
---|
105 | if {${os.major} >= 11} { |
---|
106 | dict set clist clang15 {macports-clang-15} |
---|
107 | dict set clist clang16 {macports-clang-16} |
---|
108 | } else { |
---|
109 | lappend clist_unsupported \ |
---|
110 | clang15 clang16 |
---|
111 | } |
---|
112 | |
---|
113 | #------------------------------------------------------------------------------- |
---|
114 | # Subport Creation/Validation |
---|
115 | #------------------------------------------------------------------------------- |
---|
116 | |
---|
117 | set cname \ |
---|
118 | [lindex [split ${subport} -] end] |
---|
119 | |
---|
120 | mpiutil_add_subports \ |
---|
121 | ${name} ${subport} \ |
---|
122 | ${clist} ${clist_unsupported} ${clist_obsolete} |
---|
123 | |
---|
124 | set subport_enabled \ |
---|
125 | [mpiutil_validate_subport \ |
---|
126 | ${name} ${subport} ${cname} \ |
---|
127 | ${clist} ${clist_unsupported} ${clist_obsolete} \ |
---|
128 | ] |
---|
129 | |
---|
130 | #------------------------------------------------------------------------------- |
---|
131 | # General Subport Logic |
---|
132 | #------------------------------------------------------------------------------- |
---|
133 | |
---|
134 | if {${subport_enabled}} { |
---|
135 | PortGroup select 1.0 |
---|
136 | PortGroup muniversal 1.0 |
---|
137 | PortGroup legacysupport 1.0 |
---|
138 | |
---|
139 | if {${cname} == "default"} { |
---|
140 | set cname "mp" |
---|
141 | } |
---|
142 | |
---|
143 | # Add various dependencies: build, lib, and run |
---|
144 | mpiutil_add_depends \ |
---|
145 | ${subport} ${cname} |
---|
146 | |
---|
147 | # Determine whether buildbot binaries should be used, and disable if necessary |
---|
148 | mpiutil_set_binary_eligibility \ |
---|
149 | ${subport} ${cname} |
---|
150 | |
---|
151 | depends_build-append port:pkgconfig |
---|
152 | depends_lib-append port:libevent \ |
---|
153 | port:zlib |
---|
154 | |
---|
155 | pre-extract { |
---|
156 | file mkdir ${workpath}/build |
---|
157 | } |
---|
158 | |
---|
159 | # https://trac.macports.org/ticket/39089 |
---|
160 | compiler.blacklist-append \ |
---|
161 | gcc-4.0 \ |
---|
162 | llvm-gcc-4.2 \ |
---|
163 | macports-llvm-gcc-4.2 |
---|
164 | |
---|
165 | # For reasons that are not entirely clear, -I${worksrcpath} is added to the CPPFLAGS by the configure script. |
---|
166 | # In ${worksrcpath}, there is a file called VERSION. |
---|
167 | # C++ has a standard library header version (https://en.cppreference.com/w/cpp/header/version). |
---|
168 | # Starting with Clang 8.0, version was included in other standard header files (https://reviews.llvm.org/D51955). |
---|
169 | # With a case-insensitive file system, VERSION is used instead of version. |
---|
170 | # This is an ugly workaround. |
---|
171 | patchfiles-append patch-configure.diff |
---|
172 | |
---|
173 | configure.dir ${workpath}/build |
---|
174 | configure.cmd ${worksrcpath}/configure |
---|
175 | configure.args --disable-mpi-fortran \ |
---|
176 | --enable-mpi-cxx \ |
---|
177 | "FFLAGS='' F77=''" |
---|
178 | |
---|
179 | # remove -arch from ldflags, ticket #22833 |
---|
180 | configure.ld_archflags |
---|
181 | configure.ccache no |
---|
182 | |
---|
183 | # We're making compiler wrappers here... don't default to -O2 for wrappers. |
---|
184 | # Actual library code is compiled with -O2 via --enable-fast=O2 configure arg |
---|
185 | configure.optflags-delete -O2 -Os |
---|
186 | configure.cppflags-delete -I${prefix}/include |
---|
187 | configure.ldflags-delete -L${prefix}/lib |
---|
188 | |
---|
189 | build.dir ${configure.dir} |
---|
190 | destroot.dir ${build.dir} |
---|
191 | |
---|
192 | select.group mpi |
---|
193 | select.file ${filespath}/portselect/${name}-${cname} |
---|
194 | |
---|
195 | if {${cname} ne "mp"} { |
---|
196 | set compiler [dict get ${clist} ${cname}] |
---|
197 | configure.compiler [lindex ${compiler} 0] |
---|
198 | unset compiler |
---|
199 | |
---|
200 | long_description-append \ |
---|
201 | "\n\nTHIS SUBPORT WRAPS ${cname}'s C/C++" |
---|
202 | } else { |
---|
203 | long_description-append \ |
---|
204 | "\n\nTHIS SUBPORT WRAPS MACPORTS' DEFAULT COMPILER FOR C/C++" |
---|
205 | } |
---|
206 | |
---|
207 | configure.args-append \ |
---|
208 | --bindir=${prefix}/libexec/${name}-${cname} \ |
---|
209 | --libdir=${prefix}/lib/${name}-${cname} \ |
---|
210 | --sysconfdir=${prefix}/etc/${name}-${cname} \ |
---|
211 | --includedir=${prefix}/include/${name}-${cname} \ |
---|
212 | --datadir=${prefix}/share/${name}-${cname} \ |
---|
213 | --docdir=${prefix}/share/docdelete \ |
---|
214 | --mandir=${prefix}/share/mandelete \ |
---|
215 | --with-hwloc=${prefix} \ |
---|
216 | --with-libevent=${prefix} \ |
---|
217 | --with-zlib=${prefix} |
---|
218 | |
---|
219 | post-destroot { |
---|
220 | # This version doesn't supply manpages |
---|
221 | if {[file isdirectory ${destroot}${prefix}/share/mandelete]} { |
---|
222 | delete ${destroot}${prefix}/share/mandelete |
---|
223 | } |
---|
224 | if {[file isdirectory ${destroot}${prefix}/share/docdelete]} { |
---|
225 | delete ${destroot}${prefix}/share/docdelete |
---|
226 | } |
---|
227 | |
---|
228 | set vampirlog ${destroot}${prefix}/share/${name}-${cname}/vampirtrace/config.log |
---|
229 | if { [ file exists $vampirlog ] } { |
---|
230 | delete $vampirlog |
---|
231 | } |
---|
232 | |
---|
233 | foreach bin {mpirun mpiexec mpicc mpicxx mpif77 mpif90 mpifort} { |
---|
234 | system -W ${destroot}${prefix}/share/$name-$cname/openmpi \ |
---|
235 | "ln -sf $bin-wrapper-data.txt $bin-$name-$cname-wrapper-data.txt" |
---|
236 | system -W ${destroot}${prefix}/bin \ |
---|
237 | "ln -sf ${prefix}/libexec/$name-$cname/$bin $bin-$name-$cname" |
---|
238 | } |
---|
239 | } |
---|
240 | |
---|
241 | #--------------------------------------------------------------------------- |
---|
242 | # Fortran Support |
---|
243 | #--------------------------------------------------------------------------- |
---|
244 | |
---|
245 | set fortran_enabled no |
---|
246 | |
---|
247 | if { [string first gcc $cname] == 0 } { |
---|
248 | set fortran_enabled yes |
---|
249 | |
---|
250 | long_description-append "AND FORTRAN COMPILERS" |
---|
251 | |
---|
252 | variant fortran description {Stub : fortran always enabled for gcc-based version} {} |
---|
253 | default_variants-append +fortran |
---|
254 | |
---|
255 | # GCC C++ always uses libstdc++ |
---|
256 | # see https://trac.macports.org/ticket/59185 |
---|
257 | configure.cxx_stdlib libstdc++ |
---|
258 | } else { |
---|
259 | long_description-append "(AND THE FORTRAN COMPILER SELECTED BY THE VARIANT, IF ANY)" |
---|
260 | |
---|
261 | compilers.choose fc |
---|
262 | compilers.setup default_fortran |
---|
263 | |
---|
264 | if {[fortran_variant_isset]} { |
---|
265 | set fortran_enabled yes |
---|
266 | |
---|
267 | # Get the dependent port for the active fortran variant |
---|
268 | depends_lib-append [fortran_variant_depends] |
---|
269 | } |
---|
270 | } |
---|
271 | |
---|
272 | if {${fortran_enabled}} { |
---|
273 | configure.args-replace --disable-mpi-fortran \ |
---|
274 | --enable-mpi-fortran |
---|
275 | |
---|
276 | select.file ${filespath}/portselect/${name}-${cname}-fortran |
---|
277 | } |
---|
278 | |
---|
279 | unset fortran_enabled |
---|
280 | |
---|
281 | #--------------------------------------------------------------------------- |
---|
282 | # Universal Build Support |
---|
283 | #--------------------------------------------------------------------------- |
---|
284 | |
---|
285 | if {![info exists universal_possible]} { |
---|
286 | set universal_possible [expr {${os.universal_supported} && [llength ${configure.universal_archs}] >= 2}] |
---|
287 | } |
---|
288 | if {${universal_possible} && [variant_isset universal]} { |
---|
289 | # use open-mpi's multilib support to build universal |
---|
290 | # see https://github.com/open-mpi/ompi/wiki/MultiLib |
---|
291 | # Fortran is the only non-trivial case |
---|
292 | |
---|
293 | merger-post-destroot { |
---|
294 | # Fortran headers do not understand preprocessors commands like __LP64__ |
---|
295 | # Fortran mod files can not be merged for different architectures |
---|
296 | # create a architecture specific folder for the non-build_arch architecture |
---|
297 | foreach arch ${configure.universal_archs} { |
---|
298 | if {${arch} ne ${build_arch}} { |
---|
299 | set mod_dir ${destroot}-${arch}${prefix}/lib/${name}-${cname} |
---|
300 | xinstall -d -m 0755 ${mod_dir}/${arch} |
---|
301 | foreach f [glob -nocomplain -directory ${mod_dir} *.mod] { |
---|
302 | move ${f} ${mod_dir}/${arch} |
---|
303 | } |
---|
304 | |
---|
305 | set inc_dir ${destroot}-${arch}${prefix}/include/${name}-${cname} |
---|
306 | xinstall -d -m 0755 ${inc_dir}/${arch} |
---|
307 | foreach f [glob -nocomplain -directory ${inc_dir} mpif-config.h] { |
---|
308 | move ${f} ${inc_dir}/${arch} |
---|
309 | } |
---|
310 | |
---|
311 | # include the new directories in the search paths for header and mod files |
---|
312 | set data_dir ${destroot}-${arch}${prefix}/share/${name}-${cname}/openmpi |
---|
313 | if {[file exists ${data_dir}/mpifort-wrapper-data.txt]} { |
---|
314 | reinplace \ |
---|
315 | "s|-I\${libdir}|-I\${libdir}/${arch} -I\${libdir}|g" \ |
---|
316 | ${data_dir}/mpifort-wrapper-data.txt |
---|
317 | |
---|
318 | reinplace \ |
---|
319 | "s|preprocessor_flags=|preprocessor_flags=-I\${includedir}/i386|g" \ |
---|
320 | ${data_dir}/mpifort-wrapper-data.txt |
---|
321 | } |
---|
322 | } |
---|
323 | } |
---|
324 | foreach arch ${configure.universal_archs} { |
---|
325 | set data_dir ${destroot}-${arch}${prefix}/share/${name}-${cname}/openmpi |
---|
326 | if {[file exists ${data_dir}/mpifort-wrapper-data.txt]} { |
---|
327 | # muniversal PortGroup will not merge this file properly |
---|
328 | # merge file in destroot phase |
---|
329 | move \ |
---|
330 | ${data_dir}/mpifort-wrapper-data.txt \ |
---|
331 | ${data_dir}/mpifort-wrapper-data-${arch}.txt |
---|
332 | } |
---|
333 | } |
---|
334 | } |
---|
335 | |
---|
336 | post-destroot { |
---|
337 | # merge mpifort data file |
---|
338 | # see https://github.com/open-mpi/ompi/wiki/compilerwrapper3264 |
---|
339 | set data_dir ${destroot}${prefix}/share/${name}-${cname}/openmpi |
---|
340 | if {[file exists ${data_dir}/mpifort-wrapper-data-${build_arch}.txt]} { |
---|
341 | system -W ${data_dir} "cat mpifort-wrapper-data-${build_arch}.txt >> mpifort-wrapper-data.txt" |
---|
342 | } |
---|
343 | foreach arch ${configure.universal_archs} { |
---|
344 | if {[file exists ${data_dir}/mpifort-wrapper-data-${arch}.txt]} { |
---|
345 | if {${arch} ne ${build_arch}} { |
---|
346 | if {${arch} eq "ppc" || ${arch} eq "i386"} { |
---|
347 | set bitval 32 |
---|
348 | } else { |
---|
349 | set bitval 64 |
---|
350 | } |
---|
351 | system -W ${data_dir} "echo \"\">> mpifort-wrapper-data.txt" |
---|
352 | system -W ${data_dir} "echo \"compiler_args=${arch};-m${bitval}\" >> mpifort-wrapper-data.txt" |
---|
353 | system -W ${data_dir} "cat mpifort-wrapper-data-${arch}.txt >> mpifort-wrapper-data.txt" |
---|
354 | } |
---|
355 | } |
---|
356 | } |
---|
357 | foreach arch ${configure.universal_archs} { |
---|
358 | delete ${data_dir}/mpifort-wrapper-data-${arch}.txt |
---|
359 | } |
---|
360 | } |
---|
361 | } |
---|
362 | |
---|
363 | #--------------------------------------------------------------------------- |
---|
364 | # Variants |
---|
365 | #--------------------------------------------------------------------------- |
---|
366 | |
---|
367 | variant valgrind description {Enable valgrind support} { |
---|
368 | depends_lib-append path:${prefix}/lib/pkgconfig/valgrind.pc:valgrind |
---|
369 | configure.args-append --enable-debug --enable-memchecker --with-valgrind=${prefix} |
---|
370 | } |
---|
371 | |
---|
372 | variant heterogeneous description {Enable heterogeneous cluster support} { |
---|
373 | configure.args-append --enable-heterogeneous |
---|
374 | } |
---|
375 | |
---|
376 | variant mpi1 description {Enable legacy mpi1 compatibility} { |
---|
377 | configure.args-append --enable-mpi1-compatibility |
---|
378 | } |
---|
379 | |
---|
380 | #--------------------------------------------------------------------------- |
---|
381 | # Notes |
---|
382 | #--------------------------------------------------------------------------- |
---|
383 | |
---|
384 | mpiutil_add_notes \ |
---|
385 | ${name} ${subport} ${cname} ${select.file} |
---|
386 | |
---|
387 | } elseif {${subport} eq ${name}} { |
---|
388 | PortGroup stub 1.0 |
---|
389 | |
---|
390 | depends_lib-append port:${name}-default |
---|
391 | |
---|
392 | livecheck.type regex |
---|
393 | livecheck.url https://www.open-mpi.org/ |
---|
394 | livecheck.regex Open MPI v(\[0-9\.\]+) released |
---|
395 | } |
---|