1PORTNAME=	openmpi
2DISTVERSION=	5.0.6
3CATEGORIES=	net parallel
4MASTER_SITES=	https://download.open-mpi.org/release/open-mpi/v${PORTVERSION:R}/
5
6MAINTAINER=	ports@MidnightBSD.org
7COMMENT=	High Performance Message Passing Library
8WWW=		https://www.open-mpi.org/
9
10LICENSE=	bsd3
11LICENSE_FILE=	${WRKSRC}/LICENSE
12
13NOT_FOR_ARCHS=		armv6 armv7 i386 powerpc
14NOT_FOR_ARCHS_REASON=	Not supported on 32-bits - see net/openmpi4
15
16LIB_DEPENDS=	libhwloc.so:devel/hwloc2 \
17		libevent.so:devel/libevent \
18		libmunge.so:security/munge
19
20CONFIGURE_TARGET=     ${ARCH}-portbld-freebsd13.4
21
22# :keepla because port uses lt_dlopen
23USES=		compiler:c11 fortran gmake libtool:keepla localbase perl5 \
24		pkgconfig python:build shebangfix tar:bzip2
25USE_LDCONFIG=	${PREFIX}/${MPIDIR}/lib
26USE_PERL5=	build
27SHEBANG_FILES=	ompi/mca/common/monitoring/profile2mat.pl \
28		ompi/mca/common/monitoring/aggregate_profile.pl
29
30MPIBASE?=	mpi
31MPIDIR?=	${MPIBASE}/${PKGBASE}
32
33GNU_CONFIGURE=	yes
34GNU_CONFIGURE_PREFIX=	${PREFIX}/${MPIDIR}
35GNU_CONFIGURE_MANPREFIX=${PREFIX}/${MPIDIR}/share
36CONFIGURE_ARGS+=	--program-prefix= \
37			--with-hwloc=external \
38			--without-ofi \
39			--enable-mpi-fortran=usempif08 \
40			--with-libevent=external \
41			--enable-mca-no-build=verbs,btl_openib,oob_ud \
42			--with-wrapper-ldflags=-Wl,-rpath=-Wl,-rpath=${LOCALBASE}/lib/gcc${_GCC_VER}
43TEST_TARGET=		check
44CFLAGS+=		${CFLAGS_F2018}
45LDFLAGS+=		-lpthread
46CONFLICTS_INSTALL=	openmpi4-4*
47
48DOCSDIR=	${PREFIX}/${MPIDIR}/share/doc
49MANDIRS=	${PREFIX}/${MPIDIR}/share/man
50BINARY_ALIAS=	python3=${PYTHON_CMD}
51PLIST_SUB+=	MPIDIR=${MPIDIR}
52PORTDOCS=	*
53PIE_UNSAFE=	yes
54
55OPTIONS_DEFINE=			AVX DEBUG DOCS IPV6 ROMIO SLURM
56OPTIONS_DEFAULT=		ROMIO
57OPTIONS_EXCLUDE_aarch64=	AVX
58OPTIONS_EXCLUDE_armv6=		AVX SLURM
59OPTIONS_EXCLUDE_armv7=		AVX SLURM
60OPTIONS_EXCLUDE_i386=		SLURM
61OPTIONS_EXCLUDE_mips=		AVX SLURM
62OPTIONS_EXCLUDE_mips64=		AVX
63OPTIONS_EXCLUDE_powerpc=	AVX SLURM
64OPTIONS_EXCLUDE_powerpc64=	AVX
65OPTIONS_EXCLUDE_powerpc64le=	AVX
66OPTIONS_EXCLUDE_riscv64=	AVX
67OPTIONS_SUB=			yes
68
69AVX_DESC=	Enable AVX instructions
70ROMIO_DESC=	Enable romio mpi-io support
71SLURM_DESC=	Enable SLURM support
72
73AVX_CONFIGURE_OFF=	--enable-mca-no-build=op-avx
74
75DEBUG_CONFIGURE_ENABLE=		debug
76DEBUG_INSTALL_TARGET_OFF=	install-strip
77
78DOCS_BUILD_DEPENDS=	${PYTHON_PKGNAMEPREFIX}sphinx>0:textproc/py-sphinx@${PY_FLAVOR}	\
79			${PYTHON_PKGNAMEPREFIX}recommonmark>0:textproc/py-recommonmark@${PY_FLAVOR} \
80			${PYTHON_PKGNAMEPREFIX}sphinx_rtd_theme>0:textproc/py-sphinx_rtd_theme@${PY_FLAVOR}
81
82IPV6_CONFIGURE_ENABLE=	ipv6
83
84ROMIO_CONFIGURE_OFF=	--disable-io-romio
85
86SLURM_LIB_DEPENDS=	libslurm.so:sysutils/slurm-wlm
87SLURM_CONFIGURE_WITH=	slurm
88
89.include <bsd.port.pre.mk>
90
91.if ${FORTRAN_DEFAULT} == gfortran
92FCFLAGS+=	-fallow-argument-mismatch
93.endif
94
95# Both clang and gcc support half precision on these platforms
96# Note: RISC-V can support half precision with Zhf extension
97.if ${ARCH:Maarch64} || ${ARCH:Mamd64}
98PLIST_SUB+=	SHORTFLOAT=""
99.else
100PLIST_SUB+=	SHORTFLOAT="@comment "
101.endif
102
103LIBDIR2FIX=	oshmem/tools/wrappers opal/tools/wrappers \
104		3rd-party/openpmix ompi/tools/wrappers
105
106pre-configure:
107.for d in ${LIBDIR2FIX}
108	${REINPLACE_CMD} -e 's|$$(libdir)/pkgconfig|${LOCALBASE}/libdata/pkgconfig|g' \
109		${WRKSRC}/${d}/Makefile.in
110.endfor
111
112.include <bsd.port.post.mk>
113