app-editors/kakoune: drop old 0_pre20160620
[gentoo.git] / sci-libs / p4est / p4est-1.1.ebuild
1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 # The build system currently fails with everything newer than 1.11.
7 WANT_AUTOMAKE=1.11
8
9 inherit autotools eutils
10
11 DESCRIPTION="Scalable Algorithms for Parallel Adaptive Mesh Refinement on Forests of Octrees"
12 HOMEPAGE="http://www.p4est.org/"
13 SRC_URI="
14         https://github.com/cburstedde/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz
15         https://github.com/cburstedde/libsc/archive/v${PV}.tar.gz -> libsc-${PV}.tar.gz"
16
17 KEYWORDS="~amd64 ~x86"
18
19 LICENSE="GPL-2+"
20 SLOT="0"
21
22 IUSE="debug doc examples mpi romio static-libs +vtk-binary"
23 REQUIRED_USE="romio? ( mpi )"
24
25 RDEPEND="
26         ~sci-libs/libsc-${PV}[mpi=,romio=,static-libs=]
27         dev-lang/lua:*
28         sys-apps/util-linux
29         virtual/blas
30         virtual/lapack
31         mpi? ( virtual/mpi[romio=] )"
32
33 DEPEND="
34         ${RDEPEND}
35         sys-devel/automake:1.11
36         virtual/pkgconfig"
37
38 DOCS=( AUTHORS NEWS README )
39
40 src_prepare() {
41         default
42
43         # Inject libsc to get  all parts of the build system...
44         rmdir "${S}/sc" || die "rmdir failed"
45         mv "${WORKDIR}/libsc-${PV}" "${S}/sc" || die "mv failed"
46
47         # Inject a version number into the build system
48         echo "${PV}" > ${S}/.tarball-version
49
50         AT_M4DIR="${WORKDIR}/${P}/config ${WORKDIR}/${P}/sc/config"
51         eautoreconf
52
53         sed -i \
54                 "s/P4EST_SC_DIR\/etc/P4EST_SC_DIR\/share\/libsc/" \
55                 "${S}"/configure || die "sed failed"
56
57         sed -i \
58                 "s/libsc\.la/libsc\.so/" \
59                 "${S}"/configure || die "sed failed"
60 }
61
62 src_configure() {
63         # avoid underlinkage
64         LDFLAGS="${LDFLAGS} -lsc"
65
66         local myeconfargs=(
67                 $(use_enable debug)
68                 $(use_enable mpi)
69                 $(use_enable romio mpiio)
70                 $(use_enable static-libs static)
71                 $(use_enable vtk-binary)
72                 --with-blas="$($(tc-getPKG_CONFIG) --libs blas)"
73                 --with-lapack="$($(tc-getPKG_CONFIG) --libs lapack)"
74                 --with-sc="${EPREFIX}/usr"
75         )
76         econf "${myeconfargs[@]}"
77 }
78
79 src_install() {
80         default
81
82         use doc && dodoc -r doc/*
83
84         if use examples
85         then
86                 docinto examples
87                 dodoc -r example/*
88                 docompress -x /usr/share/doc/${PF}/examples
89         else
90                 # Remove compiled example binaries in case of -examples:
91                 rm -r "${ED}"/usr/bin || die "rm failed"
92         fi
93
94         # Fix wrong installation paths:
95         dodir /usr/share/p4est
96         mv "${ED}"/usr/share/data "${ED}"/usr/share/p4est/data || die "mv failed"
97         mv "${ED}"/etc/* "${ED}"/usr/share/p4est || die "mv failed"
98         rmdir "${ED}"/etc/ || die "rmdir failed"
99 }