summaryrefslogtreecommitdiff
blob: 094766fd3738c739112f9a227fd0ad82bf95eec0 (plain)
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
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-cluster/mpich2/mpich2-1.0.2_p1.ebuild,v 1.1 2006/01/11 14:51:09 kanaka Exp $

inherit eutils

# Set the MPICH_CONFIGURE_OPTS environment variable to change the signal
# mpich listens on or any other custom options (#38207).
# The default USR1 conflicts with pthreads. Options include SIGUSR2 and SIGBUS.
# For example: MPICH_CONFIGURE_OPTS="--with-device=ch_p4:-listener_sig=SIGBUS"

DESCRIPTION="MPICH2 - A portable MPI implementation"
HOMEPAGE="http://www-unix.mcs.anl.gov/mpi/mpich2"
MY_P=${P/_/}
SRC_URI="ftp://ftp.mcs.anl.gov/pub/mpi/${MY_P}.tar.gz"

LICENSE="as-is"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="doc fast cxx mpe"

PROVIDE="virtual/mpi"
DEPEND="virtual/libc
	sys-devel/libtool"
RDEPEND="${DEPEND}
	!virtual/mpi"

pkg_setup() {
	if [ -n "${MPICH_CONFIGURE_OPTS}" ]; then
		einfo "Custom configure options are ${MPICH_CONFIGURE_OPTS}."
	fi
}

src_unpack() {
	unpack ${A}
	mv ${WORKDIR}/${MY_P} ${S}
	cd ${S}
}

src_compile() {
	local myconf="${myconf} ${MPICH_CONFIGURE_OPTS}"

	./configure \
		${myconf} \
		$(use_enable fast) \
		$(use_enable cxx) \
		$(use_enable mpe) \
		--mandir=/usr/share/man \
		--with-docdir=/usr/share/doc/${PF} \
		--with-htmldir=/usr/share/doc/${PF}/html \
		--sysconfdir=/etc/mpich2 \
		--prefix=/usr \
		--datadir=/usr/share/mpich2 || die
	make || die
}

src_install() {
	make DESTDIR=${D} \
		mandir=${D}/usr/share/man \
		docdir=${D}/usr/share/doc/${PF} \
		htmldir=${D}/usr/share/doc/${PF}/html \
		sysconfdir=${D}/etc/mpich2 \
		prefix=${D}/usr \
		install || die

	# Dont let users deinstall without portage
	rm ${D}/usr/sbin/mpeuninstall

	# Fix broken install scripts
	mv ${D}/usr/doc/jumpshot-4 ${D}/usr/share/doc/${PF}
	mv ${D}/usr/examples/cpi ${D}/usr/share/${PN}/cpi

	# Decide whether to install documentation
	if use doc; then
		dodoc COPYRIGHT README README.romio README.testing CHANGES
	else
		rm -rf ${D}/usr/share/doc/
		rm -rf ${D}/usr/share/man/
	fi

	# Fix up the example code Makefiles
	for DIR in examples_graphics examples_logging; do
		sed -i -e "s:^srcdir *=.*$:srcdir=/usr/share/mpich2/${DIR}:" \
			${D}/usr/share/mpich2/${DIR}/Makefile
	done
}