net-vpn/networkmanager-vpnc: remove old
[gentoo.git] / sci-libs / hdf5 / hdf5-1.10.5.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 FORTRAN_NEEDED=fortran
7
8 inherit autotools eutils fortran-2 flag-o-matic toolchain-funcs multilib prefix
9
10 MY_P=${PN}-${PV/_p/-patch}
11 MAJOR_P=${PN}-$(ver_cut 1-2)
12
13 DESCRIPTION="General purpose library and file format for storing scientific data"
14 HOMEPAGE="http://www.hdfgroup.org/HDF5/"
15 SRC_URI="http://www.hdfgroup.org/ftp/HDF5/releases/${MAJOR_P}/${MY_P}/src/${MY_P}.tar.bz2"
16
17 LICENSE="NCSA-HDF"
18 SLOT="0/${PV%%_p*}"
19 KEYWORDS="~alpha amd64 ~arm arm64 ~ia64 ppc ppc64 sparc x86 ~amd64-linux ~x86-linux"
20 IUSE="cxx debug examples fortran +hl mpi szip threads zlib"
21
22 REQUIRED_USE="
23         cxx? ( !mpi ) mpi? ( !cxx )
24         threads? ( !cxx !mpi !fortran !hl )"
25
26 RDEPEND="
27         mpi? ( virtual/mpi[romio] )
28         szip? ( virtual/szip )
29         zlib? ( sys-libs/zlib:0= )"
30
31 DEPEND="${RDEPEND}
32         sys-devel/libtool:2
33         >=sys-devel/autoconf-2.69"
34
35 S="${WORKDIR}/${MY_P}"
36
37 PATCHES=(
38         "${FILESDIR}"/${PN}-1.8.9-static_libgfortran.patch
39         "${FILESDIR}"/${PN}-1.8.9-mpicxx.patch
40         "${FILESDIR}"/${PN}-1.8.13-no-messing-ldpath.patch
41 )
42
43 pkg_setup() {
44         tc-export CXX CC AR # workaround for bug 285148
45         use fortran && fortran-2_pkg_setup
46
47         if use mpi; then
48                 if has_version 'sci-libs/hdf5[-mpi]'; then
49                         ewarn "Installing hdf5 with mpi enabled with a previous hdf5 with mpi disabled may fail."
50                         ewarn "Try to uninstall the current hdf5 prior to enabling mpi support."
51                 fi
52                 export CC=mpicc
53                 use fortran && export FC=mpif90
54         elif has_version 'sci-libs/hdf5[mpi]'; then
55                 ewarn "Installing hdf5 with mpi disabled while having hdf5 installed with mpi enabled may fail."
56                 ewarn "Try to uninstall the current hdf5 prior to disabling mpi support."
57         fi
58 }
59
60 src_prepare() {
61         # respect gentoo examples directory
62         sed \
63                 -e "s:hdf5_examples:doc/${PF}/examples:g" \
64                 -i $(find . -name Makefile.am) $(find . -name "run*.sh.in") || die
65         sed \
66                 -e '/docdir/d' \
67                 -i config/commence.am || die
68         if ! use examples; then
69                 sed -e '/^install:/ s/install-examples//' \
70                         -i Makefile.am || die #409091
71         fi
72         # enable shared libs by default for h5cc config utility
73         sed -i -e "s/SHLIB:-no/SHLIB:-yes/g" tools/src/misc/h5cc.in || die
74         hprefixify m4/libtool.m4
75
76         default
77         eautomake
78 }
79
80 src_configure() {
81         econf \
82                 --disable-static \
83                 --enable-deprecated-symbols \
84                 --enable-build-mode=$(usex debug debug production) \
85                 $(use_enable cxx) \
86                 $(use_enable debug codestack) \
87                 $(use_enable fortran) \
88                 $(use_enable hl) \
89                 $(use_enable mpi parallel) \
90                 $(use_enable threads threadsafe) \
91                 $(use_with szip szlib) \
92                 $(use_with threads pthread) \
93                 $(use_with zlib)
94 }
95
96 src_install() {
97         default
98
99         # no static archives
100         find "${D}" -name '*.la' -delete || die
101 }