aboutsummaryrefslogtreecommitdiff
blob: 96a3035204164a90ec6f5d5dbeabc812245c1736 (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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI=5

inherit eutils toolchain-funcs

MYP=${PN}.net-${PV}

DESCRIPTION="Automated astrometric calibration programs and service"
HOMEPAGE="http://astrometry.net/"
SRC_URI="${HOMEPAGE}/downloads/${MYP}.tar.bz2"

LICENSE="GPL-2"
SLOT="0"

KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
IUSE="examples extra python"

RDEPEND="
	dev-python/numpy
	sci-astronomy/wcslib
	sci-libs/cfitsio
	sci-libs/gsl
	sys-libs/zlib
	virtual/pyfits
	extra? (
		media-libs/libpng
		media-libs/netpbm
		virtual/jpeg
		x11-libs/cairo )"
DEPEND="${RDEPEND}
	dev-lang/swig
	virtual/pkgconfig"

S="${WORKDIR}/${MYP}"

src_prepare() {
	epatch \
		"${FILESDIR}"/0.43-as-needed.patch \
		"${FILESDIR}"/0.43-respect-user-flags.patch \
		"${FILESDIR}"/0.43-system-libs.patch
}

src_compile() {
	emake \
		CC=$(tc-getCC) \
		RANLIB=$(tc-getRANLIB) \
		AR=$(tc-getAR) \
		all report.txt
	if use extra; then
		emake \
			CC=$(tc-getCC) \
			RANLIB=$(tc-getRANLIB) \
			AR=$(tc-getAR) \
			extra
	fi
	# TODO: work it out for multiple python abi
	if use python; then
		emake \
			CC=$(tc-getCC) \
			RANLIB=$(tc-getRANLIB) \
			AR=$(tc-getAR) \
			py
	fi
}

src_install() {
	# TODO: install in standard directories to respect FHS
	export INSTALL_DIR="${ED}"/usr/astrometry
	emake install-core
	use extra && emake -C blind install-extras

	# remove cfitsio duplicates
	rm ${INSTALL_DIR}/bin/{fitscopy,imcopy,listhead} || die

	# remove license file
	rm ${INSTALL_DIR}/doc/LICENSE || die
	dodoc ${INSTALL_DIR}/doc/*
	rm -r ${INSTALL_DIR}/doc || die
	if use examples; then
		mv ${INSTALL_DIR}/examples "${ED}"/usr/share/doc/${PF} || die
	else
		rm -r ${INSTALL_DIR}/examples || die
	fi
}