dev-lang/julia: drop old version 0.6.2
[gentoo.git] / sci-astronomy / astrometry / astrometry-0.72.ebuild
1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 # this could be a multiple python package
7 # but the way it is packaged makes it very time consuming.
8
9 PYTHON_COMPAT=( python2_7 )
10
11 inherit eutils toolchain-funcs python-single-r1
12
13 MYP=${PN}.net-${PV}
14
15 DESCRIPTION="Automated astrometric calibration programs and service"
16 HOMEPAGE="http://astrometry.net/"
17 SRC_URI="https://github.com/dstndstn/astrometry.net/releases/download/${PV}/${MYP}.tar.gz"
18
19 LICENSE="BSD GPL-2 GPL-3"
20 SLOT="0"
21 KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
22 IUSE="examples"
23 REQUIRED_USE="${PYTHON_REQUIRED_USE}"
24
25 RDEPEND="
26         dev-python/astropy[${PYTHON_USEDEP}]
27         dev-python/fitsio[${PYTHON_USEDEP}]
28         dev-python/numpy[${PYTHON_USEDEP}]
29         media-libs/libpng:0
30         media-libs/netpbm
31         sci-astronomy/wcslib:0=
32         sci-libs/cfitsio:0=
33         sci-libs/gsl:0=
34         sys-libs/zlib:0=
35         virtual/jpeg:0
36         x11-libs/cairo
37         ${PYTHON_DEPS}"
38 DEPEND="${RDEPEND}
39         dev-lang/swig:0
40         virtual/pkgconfig"
41
42 S="${WORKDIR}/${MYP}"
43
44 PATCHES=(
45         "${FILESDIR}"/${PN}-0.67-soname.patch
46         "${FILESDIR}"/${PN}-0.67-qsortr.patch
47 )
48 #       "${FILESDIR}"/${PN}-0.72-dynlink.patch
49
50 src_prepare() {
51         default
52         # respect user compilation flags
53         sed -e '/-O3/d' \
54                 -e '/-fomit-frame-pointer/d' \
55                 -i util/makefile.common || die
56         # fix underlinking
57         sed -e "s|-lm|-lm $($(tc-getPKG_CONFIG) --libs wcslib gsl)|" \
58                 -i util/Makefile || die
59         export SYSTEM_GSL=yes
60 }
61
62 src_compile() {
63         tc-export CC RANLIB AR
64         # fragile makefiles, build targets sequentially
65         emake
66         emake py
67         emake extra
68         emake report.txt
69 }
70
71 src_test() {
72         emake test
73         local d
74         for d in util blind libkd; do
75                 pushd ${d} > /dev/null
76                 ./test || die "failed tests in ${d}"
77                 popd ${d} > /dev/null
78         done
79 }
80
81 ap_make() {
82         emake \
83                 INSTALL_DIR="${ED%/}/usr" \
84                 DATA_INSTALL_DIR="${ED%/}/usr/share/astrometry" \
85                 LIB_INSTALL_DIR="${ED%/}/usr/$(get_libdir)" \
86                 ETC_INSTALL_DIR="${ED%/}/etc" \
87                 MAN1_INSTALL_DIR="${ED%/}/usr/share/man/man1" \
88                 DOC_INSTALL_DIR="${ED%/}/usr/share/doc/${PF}" \
89                 EXAMPLE_INSTALL_DIR="${ED%/}/usr/share/doc/${PF}/examples" \
90                 PY_BASE_INSTALL_DIR="${ED%/}$(python_get_sitedir)/astrometry" \
91                 PY_BASE_LINK_DIR="../$(python_get_sitedir | sed -e 's|/usr/||')/astrometry" \
92                 FINAL_DIR="${EPREFIX%/}/usr" \
93                 DATA_FINAL_DIR="${EPREFIX%/}/usr/share/astrometry" \
94                 $@
95 }
96
97 src_install() {
98         ap_make install-core
99         ap_make -C util install
100         ap_make -C blind install-extra
101
102         # remove duplicates and non installable libraries
103         # cfitsio
104         rm "${ED}"/usr/bin/{fitscopy,imcopy,listhead} || die
105         # cfitsio utilities
106         rm "${ED}"/usr/bin/{fitsverify,imarith,imstat,liststruc,modhead,tablist,tabmerge} || die
107         rm "${ED}"/usr/$(get_libdir)/lib*.a || die
108         rm "${ED}"/usr/share/doc/${PF}/LICENSE || die
109
110         if use examples; then
111                 docompress -x /usr/share/doc/${PF}/examples
112         else
113                 rm -r "${ED}"/usr/share/doc/${PF}/examples || die
114         fi
115 }