summaryrefslogtreecommitdiff
blob: fd7656a80cd999864a4543c1176131d7da7f8f33 (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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sci-visualization/hippodraw/hippodraw-1.21.3-r1.ebuild,v 1.7 2009/09/30 16:57:04 ayoy Exp $

EAPI=1

inherit eutils autotools multilib qt3 qt4

MY_PN=HippoDraw

DESCRIPTION="Highly interactive data analysis Qt environment for C++ and python"
HOMEPAGE="http://www.slac.stanford.edu/grp/ek/hippodraw/"
SRC_URI="ftp://ftp.slac.stanford.edu/users/pfkeb/${PN}/${MY_PN}-${PV}.tar.gz"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86"

IUSE="doc examples +fits +numpy qt4 root wcs"

CDEPEND="dev-libs/boost
	virtual/latex-base
	media-libs/netpbm
	fits? ( sci-libs/cfitsio )
	numpy? ( dev-python/numpy )
	qt4? (
		x11-libs/qt-gui:4
		x11-libs/qt-qt3support:4
		x11-libs/qt-assistant:4
	)
	!qt4? ( x11-libs/qt:3 )
	root? ( >=sci-physics/root-5 )
	!root? ( sci-libs/minuit )
	wcs? ( sci-astronomy/wcslib )"

DEPEND="${CDEPEND}
	doc? ( app-doc/doxygen )"

RDEPEND="${CDEPEND}
	numpy? ( fits? ( dev-python/pyfits ) )"

S="${WORKDIR}/${MY_PN}-${PV}"

pkg_setup() {
	# need python threads (see bug #224269)
	if ! built_with_use dev-lang/python threads; then
		die "hippodraw needs dev-lang/python with USE=\"threads\""
	fi
	use qt4 && qt4_pkg_setup
}

src_unpack() {
	unpack ${A}
	cd "${S}"
	epatch "${FILESDIR}"/${P}-gcc4.3.patch
	epatch "${FILESDIR}"/${P}-numarray.patch
	epatch "${FILESDIR}"/${P}-test-fix.patch
	epatch "${FILESDIR}"/${P}-minuit2.patch
	epatch "${FILESDIR}"/${P}-wcslib.patch
	epatch "${FILESDIR}"/${P}-qt4.patch

	# fix the install doc directory to gentoo's one
	local docdir=/usr/share/doc/${PF}
	sed -i \
		-e "s:\(docdir\).*=.*:\1= ${docdir}:" \
		-e "s:\(INSTALLDIR\).*=.*:\1= \$(DESTDIR)${docdir}/html:" \
		-e "/^DOCS_STR/s:\(DOCS_STR\).*=.*:\1 = \\\\\"${docdir}/html\\\\\":" \
		-e "s:\$(pkgdatadir)/examples:${docdir}/examples:" \
		-e 's:LICENSE:README:' \
		{.,doc,examples,qt}/Makefile.am || die "sed for docdir failed"

	AT_M4DIR=config/m4 eautoreconf
}

src_compile() {
	local myconf="
		--disable-numarraybuild
		$(use_enable numpy numpybuild)
		$(use_enable doc help)"
	# All these longuish conf options are necessary
	# or else a huge patch
	if use qt4; then
		myconf="${myconf} --with-Qt-include-dir=no"
		myconf="${myconf} --with-Qt-lib-dir=no"
		myconf="${myconf} --with-Qt-bin-dir=no"
		myconf="${myconf} --with-qt4-include=/usr/include/qt4"
		myconf="${myconf} --with-qt4-lib=/usr/$(get_libdir)/qt4"
		myconf="${myconf} --with-qt4-dir=/usr"
	else
		myconf="${myconf} --with-Qt-include-dir=/usr/qt/3/include"
		myconf="${myconf} --with-Qt-lib-dir=/usr/qt/3/$(get_libdir)"
		myconf="${myconf} --with-Qt-bin-dir=/usr/qt/3/bin"
		myconf="${myconf} --with-qt4-include=no"
		myconf="${myconf} --with-qt4-lib=no"
		myconf="${myconf} --with-qt4-dir=no"
	fi

	if use root; then
		myconf="${myconf} --with-root-include=$(root-config --incdir)"
		myconf="${myconf} --with-root-lib=$(root-config --libdir)"
		myconf="${myconf} --with-minuit2-lib=no"
	else
		myconf="${myconf} --with-minuit2-include=/usr/include"
		myconf="${myconf} --with-minuit2-lib=/usr/$(get_libdir)"
		myconf="${myconf} --with-root-lib=no"
	fi

	if use fits; then
		myconf="${myconf} --with-cfitsio-include=/usr/include"
		myconf="${myconf} --with-cfitsio-lib=/usr/$(get_libdir)"
	else
		myconf="${myconf} --with-cfitsio-lib=no"
	fi

	if use wcs; then
		myconf="${myconf} --with-wcslib-include=/usr/include"
		myconf="${myconf} --with-wcslib-lib=/usr/$(get_libdir)"
	else
		myconf="${myconf} --with-wcslib-include=no"
		myconf="${myconf} --with-wcslib-lib=no"
	fi

	econf ${myconf} || die "econf failed"

	emake || die "emake failed"
	if use doc; then
		emake docs || die "emake docs failed"
	fi
}

src_install() {
	emake DESTDIR="${D}" install || die "emake install failed"
	dosym ../${MY_PN}/hippoApp.png /usr/share/pixmaps/hippoApp.png
	make_desktop_entry hippodraw HippoDraw hippoApp
	if use examples; then
		insinto /usr/share/doc/${PF}/testsuite
		doins testsuite/*.py || die "examples install failed"
		insinto /usr/share/doc/${PF}/examples
		doins examples/*.{fits,tnt,data,baddata}*
	else
		# these are automatically installed
		rm -rf "${D}"usr/share/doc/${PF}/examples || die
	fi
}