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

EAPI=5

AUTOTOOLS_AUTORECONF=1
AUTOTOOLS_IN_SOURCE_BUILD=1

inherit eutils autotools-utils multilib

DESCRIPTION="World Coordinate System library for astronomical FITS images"
HOMEPAGE="http://tdc-www.harvard.edu/software/wcstools"
SRC_URI="${HOMEPAGE}/${P}.tar.gz"

LICENSE="GPL-2 LGPL-2.1"
SLOT="0"
KEYWORDS="~amd64 ~ppc ~x86 ~amd64-linux ~x86-linux"
IUSE=""

DOCS=( Readme Programs NEWS )

PATCHES=(
	"${FILESDIR}"/wcstools-3.9.2-compiler_warnings.patch
	"${FILESDIR}"/wcstools-3.9.2-mayhem.patch
	"${FILESDIR}"/wcstools-3.9.2-RASortStars.patch
	"${FILESDIR}"/wcstools-3.9.2-spelling.patch
	"${FILESDIR}"/wcstools-3.9.2-sprintf.patch
	"${FILESDIR}"/wcstools-3.9.2-use_abort.patch
	"${FILESDIR}"/wcstools-3.9.2-wcsinit_crash.patch
)

src_prepare() {
	einfo "Copying gentoo autotools files"
	local f
	for f in "${FILESDIR}"/{configure.ac,wcstools.pc.in,Makefile.am}; do
		cp ${f} "${S}"/ || die
	done
	cp "${FILESDIR}"/Makefile.libwcs.am "${S}"/libwcs/Makefile.am || die
	# avoid colliding with fixdos, getdate and remap from other packages
	sed -i \
		-e 's/getdate/wcsgetdate/' \
		-e 's/crlf/wcscrlf/' \
		-e 's/remap/wcsremap/' \
		-e "s/3.... Programs/${PV} Programs/" \
		wcstools || die
	autotools-utils_src_prepare
}

src_test() {
	einfo "Testing various wcstools programs"
	./newfits -a 10 -j 248 41 -p 0.15 test.fits || die "test newfits failed"
	./sethead test.fits A=1 B=1 ||  die "test sethead failed"
	[[ "$(./gethead test.fits RA)" == "16:32:00.0000" ]] \
		|| die "test gethead failed"
	rm test.fits
}

src_install() {
	autotools-utils_src_install
	doman man/man1/*
	newdoc libwcs/NEWS NEWS.libwcs
	newdoc libwcs/Readme Readme.libwcs

}

pkg_postinst() {
	elog "The following execs have been renamed to avoid colliding"
	elog "with other packages:"
	elog " getdate -> wcsgetdate"
	elog " crlf    -> wcscrlf"
	elog " remap   -> wcsremap"
}