summaryrefslogtreecommitdiff
blob: ae1a1ad6a7463712b2df6988ed361f4061100af4 (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
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
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=6

inherit fortran-2 toolchain-funcs

# TODO:
# testing: emake examples?
# better doc instalation and building
# pypastix (separate package?)
# multilib with eselect?
# static libs building without pic
# metis?

# package id: change every version, see the link on inriaforge
PID=35070
# commit id: change every version
#CID=351ef60
# leave empty if this is not a post release bug fix
#PPV=bugfix9_
#MYPN=pastix_release
#SRC_URI="https://gforge.inria.fr/frs/download.php/${PID}/${MYPN}_${PPV}${CID}.tar.bz2"

DESCRIPTION="Parallel solver for very large sparse linear systems"
HOMEPAGE="http://pastix.gforge.inria.fr"
SRC_URI="https://gforge.inria.fr/frs/download.php/${PID}/${PN}_${PV}.tar.bz2"

LICENSE="CeCILL-C"
SLOT="0"
KEYWORDS="~alpha amd64 ~arm ~ia64 ~ppc64 ~x86 ~amd64-linux ~x86-linux"
IUSE="doc int64 mpi +smp starpu static-libs"

RDEPEND="
	sci-libs/scotch:0=[int64?,mpi?]
	sys-apps/hwloc:0=
	virtual/blas
	mpi? ( virtual/mpi )
	starpu? ( dev-libs/starpu:0= )"
DEPEND="${RDEPEND}
	virtual/pkgconfig"

PATCHES=(
	"${FILESDIR}/${P}-nosmp-undefined-variable.patch"
	"${FILESDIR}/${P}-isnan-floating-point-cast.patch"
)
S="${WORKDIR}/${PN}_${PV}/src"

src_prepare() {
	default
	sed -e 's/^\(HOSTARCH\s*=\).*/\1 ${HOST}/' \
		-e "s:^\(CCPROG\s*=\).*:\1 $(tc-getCC):" \
		-e "s:^\(CFPROG\s*=\).*:\1 $(tc-getFC):" \
		-e "s:^\(CF90PROG\s*=\).*:\1 $(tc-getFC):" \
		-e "s:^\(ARPROG\s*=\).*:\1 $(tc-getAR):" \
		-e "s:^\(CCFOPT\s*=\).*:\1 ${FFLAGS}:" \
		-e "s:^\(CCFDEB\s*=\).*:\1 ${FFLAGS}:" \
		-e 's:^\(EXTRALIB\s*=\).*:\1 -lm -lrt:' \
		-e "s:^#\s*\(ROOT\s*=\).*:\1 \$(DESTDIR)${EPREFIX%/}/usr:" \
		-e 's:^#\s*\(INCLUDEDIR\s*=\).*:\1 $(ROOT)/include:' \
		-e 's:^#\s*\(BINDIR\s*=\).*:\1 $(ROOT)/bin:' \
		-e "s:^#\s*\(LIBDIR\s*=\).*:\1 \$(ROOT)/$(get_libdir):" \
		-e 's:^#\s*\(SHARED\s*=\).*:\1 1:' \
		-e 's:^#\s*\(SOEXT\s*=\).*:\1 .so:' \
		-e '/fPIC/s/^#//g' \
		-e "s:^#\s*\(SHARED_FLAGS\s*=.*\):\1 ${LDFLAGS}:" \
		-e "s:pkg-config:$(tc-getPKG_CONFIG):g" \
		-e "s:^\(BLASLIB\s*=\).*:\1 $($(tc-getPKG_CONFIG) --libs blas):" \
		-e "s:^\s*\(HWLOC_HOME\s*?=\).*:\1 ${EPREFIX}/usr:" \
		-e "s:-I\$(HWLOC_INC):$($(tc-getPKG_CONFIG) --cflags hwloc):" \
		-e "s:-L\$(HWLOC_LIB) -lhwloc:$($(tc-getPKG_CONFIG) --libs hwloc):" \
		-e "s:^\s*\(SCOTCH_HOME\s*?=\).*:\1 ${EPREFIX}/usr:" \
		-e "s:^\s*\(SCOTCH_INC\s*?=.*\):\1/scotch:" \
		-e "s:^\s*\(SCOTCH_LIB\s*?=.*\)lib:\1$(get_libdir):" \
		config/LINUX-GNU.in > config.in || die
	sed -e 's/__SO_NAME__,$@/__SO_NAME__,$(notdir $@)/g' -i Makefile || die
}

src_configure() {
	if use amd64; then
		sed -e 's/^\(VERSIONBIT\s*=\).*/\1 _64bit/' \
			-i config.in || die
	fi

	if use int64; then
		sed -e '/VERSIONINT.*_int64/s/#//' \
			-e '/CCTYPES.*INTSSIZE64/s/#//' \
			-i config.in || die
	fi

	if ! use mpi; then
		sed -e '/VERSIONMPI.*_nompi/s/#//' \
			-e '/CCTYPES.*NOMPI/s/#//' \
			-e '/MPCCPROG\s*= $(CCPROG)/s/#//' \
			-e '/MCFPROG\s*= $(CFPROG)/s/#//' \
			-e 's/-DDISTRIBUTED//' \
			-e 's/-lptscotch/-lscotch/g' \
			-i config.in || die
	fi

	if ! use smp; then
		sed -e '/VERSIONSMP.*_nosmp/s/#//' \
			-e '/CCTYPES.*NOSMP/s/#//' \
			-i config.in || die
	fi

	if use starpu; then
		sed -e '/libstarpu/s/#//g' -i config.in || die
	fi
}

src_compile() {
	emake all drivers
}

src_test() {
	# both test and tests targets are defined and do not work
	echo
}

src_install() {
	default
	sed -e "s:${D}::g" -i "${ED}"/usr/bin/pastix-conf || die
	# quick and dirty (static libs should really be built without pic)
	cd .. || die
	dodoc README.txt doc/refcard/refcard.pdf
}