summaryrefslogtreecommitdiff
blob: 1b282881a56edff12f36f088af17f27f5be32c2b (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
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sci-visualization/qtiplot/qtiplot-0.9.2.ebuild,v 1.1 2007/12/03 11:20:14 bicatali Exp $

inherit eutils multilib qt4 python

DESCRIPTION="Qt based clone of the Origin plotting package"
HOMEPAGE="http://soft.proindependent.com/qtiplot.html"
SRC_URI="http://soft.proindependent.com/src/${P}.tar.bz2
	doc? ( http://soft.proindependent.com/doc/manual-en.tar.bz2
		linguas_es? ( http://soft.proindependent.com/doc/manual-es.zip ) )"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="python doc"

LANGUAGES="de es fr ja ru sv"
for l in ${LANGUAGES}; do
	IUSE="${IUSE} linguas_${l}"
done

CDEPEND=">=x11-libs/qwt-5.0.2
	>=x11-libs/qwtplot3d-0.2.7
	>=dev-cpp/muParser-1.28
	>=sci-libs/liborigin-20071119
	>=sci-libs/gsl-1.10"

DEPEND="${RDEPEND}
	python? ( >=dev-python/sip-4.5.2 )
	doc? ( linguas_es? ( app-arch/unzip ) )"

RDEPEND="${CDEPEND}
	python? ( >=dev-lang/python-2.5
		dev-python/PyQt4
		dev-python/pygsl
		sci-libs/scipy )"

# manual-en.html never changes version
# could also uses docbook2html, but the dep is quite heavy
RESTRICT=" doc? ( mirror )"

QT4_BUILT_WITH_USE_CHECK="qt3support"

src_unpack() {
	unpack ${A}
	cd "${S}"
	epatch "${FILESDIR}"/${P}-systemlibs.patch

	for l in ${LANGUAGES}; do
		use linguas_${l} || \
			sed -i -e "s:translations/qtiplot_${l}.ts::" ${PN}/${PN}.pro
	done
	use python || sed -i -e 's/^\(SCRIPTING_LANGS += Python\)/#\1/' ${PN}.pro

	# the lib$$suff did not work in the fitRational*.pro files
	sed -i \
		-e "s|/usr/lib\$\${libsuff}|$(get_libdir)|g" \
		fitPlugins/fit*/fitRational*.pro \
		|| die "sed fitRational* failed"
}

src_compile() {
	eqmake4 ${PN}.pro || die "eqmake4 failed"
	emake || die "emake failed"
}

src_install() {
	emake INSTALL_ROOT="${D}" install || die 'emake install failed'

	newicon qtiplot_logo.png qtiplot.png
	make_desktop_entry qtiplot QtiPlot qtiplot Science
	doman qtiplot.1

	if use doc; then
		insinto "/usr/share/doc/${PF}"
		doins -r "${WORKDIR}"/manual-en
		use linguas_es && doins -r "${WORKDIR}"/manual-es
	fi

	for l in ${LANGUAGES}; do
		if use linguas_${l}; then
			insinto /usr/share/${PN}/translations
			doins ${PN}/translations/*${l}*.qm
		fi
	done

	if use python; then
		cd "${S}"/${PN}
		insinto /etc
		doins qtiplotrc.py
		python_version
		insinto /usr/$(get_libdir)/python${PYVER}/site-packages/
		doins qtiUtil.py
	fi
}

pkg_postinst() {
	use python && python_mod_optimize \
		"${ROOT}"/usr/$(get_libdir)/python${PYVER}/site-packages/qtiUtil
}

pkg_postrm() {
	use python && python_mod_cleanup \
		"${ROOT}"/usr/$(get_libdir)/python${PYVER}/site-packages/qtiUtil
}