aboutsummaryrefslogtreecommitdiff
blob: ec2dcf6deda123a247a73972fdca97050d356c52 (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
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

inherit fortran autotools

DESCRIPTION="C and Fortran library for manipulating FITS files"
HOMEPAGE="http://heasarc.gsfc.nasa.gov/docs/software/fitsio/fitsio.html"
SRC_URI="ftp://heasarc.gsfc.nasa.gov/software/fitsio/c/${PN}${PV//.}.tar.gz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="doc fortran"

DEPEND="fortran? ( dev-lang/cfortran )"
FORTRAN="gfortran g77 ifc"
S=${WORKDIR}/${PN}

pkg_setup() {
	use fortran && fortran_pkg_setup
}

src_unpack() {
	if use fortran; then
		fortran_src_unpack ${A}
		export FC="${FORTRANC}"
		sed -i \
			-e 's:"cfortran.h":<cfortran.h>:' \
			"${S}"/f77_wrap.h || die "sed failed"
	else
		unpack ${A}
	fi
	cd "${S}"
	cp "${FILESDIR}"/${P}-Makefile.am Makefile.am
	cp "${FILESDIR}"/${P}-configure.ac configure.ac
	eautoreconf
}

src_test() {
	make testprog
	./testprog > testprog.lis
	diff testprog.lis testprog.out || die "test failed"
	cmp testprog.fit testprog.std  || die "failed"
}

src_install () {
	emake DESTDIR="${D}" install || die "emake install failed"
	dodoc changes.txt README License.txt
	insinto /usr/share/doc/${PF}
	doins cookbook.{f,c}
	use doc && dodoc *.ps
}