b0ca93d985160d2f77cbd1256202e42098a2c6be
[gentoo.git] / sci-astronomy / wcslib / wcslib-5.16.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 FORTRAN_NEEDED=fortran
7
8 inherit fortran-2
9
10 DESCRIPTION="Astronomical World Coordinate System transformations library"
11 HOMEPAGE="http://www.atnf.csiro.au/people/mcalabre/WCS/"
12 SRC_URI="ftp://ftp.atnf.csiro.au/pub/software/${PN}/${P}.tar.bz2"
13
14 SLOT="0/5"
15 LICENSE="LGPL-3"
16 KEYWORDS="amd64 x86 ~amd64-linux ~x86-linux"
17 IUSE="doc fortran fits pgplot static-libs +tools"
18
19 RDEPEND="
20         fits? ( sci-libs/cfitsio:0= )
21         pgplot? ( sci-libs/pgplot:0= )"
22 DEPEND="${RDEPEND}
23         sys-devel/flex
24         virtual/pkgconfig"
25
26 src_configure() {
27         local myconf=(
28                 --docdir="${EPREFIX}"/usr/share/doc/${PF}
29                 --htmldir="${EPREFIX}"/usr/share/doc/${PF}
30                 $(use_enable fortran)
31                 $(use_enable tools utils)
32         )
33         # hacks because cfitsio and pgplot directories are hard-coded
34         if use fits; then
35                 myconf+=(
36                         --with-cfitsioinc="${EPREFIX}/usr/include"
37                         --with-cfitsiolib="${EPREFIX}/usr/$(get_libdir)"
38                 )
39         else
40                 myconf+=( --without-cfitsio )
41         fi
42         if use pgplot; then
43                 myconf+=(
44                         --with-pgplotinc="${EPREFIX}/usr/include"
45                         --with-pgplotlib="${EPREFIX}/usr/$(get_libdir)"
46                 )
47         else
48                 myconf+=( --without-pgplot )
49         fi
50         econf ${myconf[@]}
51         sed -i -e 's/COPYING\*//' GNUmakefile || die
52 }
53
54 src_compile() {
55         # nasty makefile, debugging means probably full rewrite
56         emake -j1
57 }
58
59 src_test() {
60         emake -j1 check
61 }
62
63 src_install() {
64         default
65         # static libs share the same symbols as shared (i.e. compiled with PIC)
66         # so they are not compiled twice
67         use static-libs || rm "${ED}"/usr/$(get_libdir)/lib*.a
68         use doc || rm -r \
69                 "${ED}"/usr/share/doc/${PF}/html \
70                 "${ED}"/usr/share/doc/${PF}/*.pdf
71 }