summaryrefslogtreecommitdiff
path: root/sci-astronomy/funtools/funtools-1.4.8-r1.ebuild
blob: ae1f275205f084a6fa1ce0dfd52e721729155463 (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
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit toolchain-funcs autotools

DESCRIPTION="FITS library and utlities for astronomical images"
HOMEPAGE="https://github.com/ericmandel/funtools"
SRC_URI="https://github.com/ericmandel/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"

LICENSE="GPL-2"
SLOT="0/1"
KEYWORDS="~amd64 ~ppc ~x86 ~amd64-linux ~x86-linux"
IUSE="doc static-libs"

RDEPEND="
	dev-lang/tcl:0=
	sci-astronomy/wcstools
	sci-visualization/gnuplot
	sys-libs/zlib:0=
"
DEPEND="${RDEPEND}"
BDEPEND="virtual/pkgconfig"

src_prepare() {
	default
	# respect libdir, dont build wcs, respect toolchain
	sed -e "/INSTALL/s|/lib|/$(get_libdir)|g" \
		-e 's|${OBJS}|$(OBJS)|g' \
		-e '/^SUBLIBS/s|wcs||g' \
		-e 's/mkdir/mkdir -p/g' \
		-e '/mklib/s|-o $(PACKAGE)|-o $(PACKAGE) $(LIBS)|g' \
		-e 's|./mklib|& -linker "$(CC)" -ldflags "$(LDFLAGS)"|' \
		-e "s| ar| $(tc-getAR)|g" \
		-e "s|ar cruv|$(tc-getAR) cruv|g" \
		-e "s|WCS_INC.*=.*|WCS_INC = $($(tc-getPKG_CONFIG) --cflags wcstools)|g" \
		-i Makefile.in */Makefile.in || die
	# fix race condition (when ccache is on)
	sed -e 's|$(LIB):|$(LIB): FORCE|g' \
		-e '$aFORCE:' \
		-i */Makefile.in || die
	eautoreconf
}

src_configure() {
	local myeconfargs=(
		--exec-prefix="${EPREFIX}/usr"
		--enable-shared
		--enable-dl
		--with-wcslib="$($(tc-getPKG_CONFIG) --libs wcstools)"
		--with-zlib="$($(tc-getPKG_CONFIG) --libs zlib)"
		--with-tcl="${EPREFIX}/usr/$(get_libdir)"
	)
	econf "${myeconfargs[@]}"
}

src_compile() {
	emake
	emake shtclfun
}

src_install() {
	default
	# install missing includes
	insinto /usr/include/funtools/fitsy
	doins fitsy/*.h

	# fix bug #536630
	mv "${ED}"/usr/share/man/man3/funopen.3 \
	   "${ED}"/usr/share/man/man7/funopen.7 \
		|| die

	if use doc; then
		dodoc doc/*.pdf doc/*html doc/*c
		docompress -x /usr/share/doc/${PF}/*.c
	fi

	if ! use static-libs; then
		find "${ED}" -name "*.a" -type f -delete || die
	fi
}