1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
6 PYTHON_COMPAT=( python2_7 )
8 inherit eutils toolchain-funcs python-single-r1
12 DESCRIPTION="Automated astrometric calibration programs and service"
13 HOMEPAGE="http://astrometry.net/"
14 SRC_URI="https://github.com/dstndstn/astrometry.net/releases/download/${PV}/${MYP}.tar.gz"
16 LICENSE="BSD GPL-2 GPL-3"
18 KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
20 REQUIRED_USE="${PYTHON_REQUIRED_USE}"
23 dev-python/astropy[${PYTHON_USEDEP}]
24 dev-python/numpy[${PYTHON_USEDEP}]
27 sci-astronomy/wcslib:0=
41 "${FILESDIR}"/${P}-soname.patch
42 "${FILESDIR}"/${P}-dynlink.patch
43 "${FILESDIR}"/${P}-qsortr.patch
49 python_fix_shebang "${S}"
50 sed -e "s|python setup-util.py|${EPYTHON} setup-util.py|" -i util/Makefile || die
51 sed -e "s|python setup.py|${EPYTHON} setup.py|" -i {libkd,sdss,blind}/Makefile || die
52 sed -e "s|python -c|${EPYTHON} -c|" -i blind/Makefile || die
53 sed -e "s|python <<EOF|${EPYTHON} <<EOF|" -i util/simplexy.c || die
54 sed -e "s|python -V|${EPYTHON} -V|" -i Makefile || die
55 # respect use compilation flags
56 sed -e '/-O3/d' -e '/-fomit-frame-pointer/d' -i util/makefile.common || die
58 sed -e "s|-lm|-lm $($(tc-getPKG_CONFIG) --libs wcslib gsl)|" -i util/Makefile || die
63 tc-export CC RANLIB AR
64 # fragile makefiles, build targets sequentially
74 for d in util blind libkd; do
75 pushd ${d} > /dev/null
76 ./test || die "failed tests in ${d}"
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" \
99 ap_make -C util install
100 ap_make -C blind install-extra
102 # remove duplicates and non installable libraries
103 rm "${ED}"/usr/bin/{fitscopy,imcopy,listhead} || die
104 rm "${ED}"/usr/$(get_libdir)/lib*.a || die
105 rm "${ED}"/usr/share/doc/${PF}/LICENSE || die
107 use examples || rm -r "${ED}"/usr/share/doc/${PF}/examples