summaryrefslogtreecommitdiff
blob: 699887c1dcc4a415e1084b4d7ecd755fbe5b715c (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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sci-visualization/qtiplot/qtiplot-0.9.7.11-r1.ebuild,v 1.1 2010/01/10 07:46:14 pva Exp $

EAPI=2
inherit eutils qt4 fdo-mime python

DESCRIPTION="Qt based clone of the Origin plotting package"
HOMEPAGE="http://soft.proindependent.com/qtiplot.html"
SRC_URI="mirror://berlios/${PN}/${P}.tar.bz2"

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

LANGS="cn cz de es fr ro ru ja sv"
for l in ${LANGS}; do
	lu=${l/cz/cs}
	lu=${lu/cn/zh_CN}
	IUSE="${IUSE} linguas_${lu}"
done

# qwtplot3d much modified from original upstream
# >=x11-libs/qwt-5.3 they are using trunk checkouts
CDEPEND="
	x11-libs/qt-opengl:4
	x11-libs/qt-qt3support:4
	x11-libs/qt-assistant:4
	x11-libs/qt-svg:4
	>=x11-libs/gl2ps-1.3.5
	>=dev-cpp/muParser-1.30
	>=dev-libs/boost-1.35.0
	>=sci-libs/liborigin-20090406:2
	sci-libs/gsl
	dev-libs/boost
	dev-tex/qtexengine
	xls? ( dev-libs/libxls )
	ods? ( dev-libs/quazip )"
# Still unable to build
#	emf? ( media-libs/libemf
#		media-libs/emfengine )

# TODO: check GL2PS_HAVE_ZLIB
# CONFIG          += BrowserPlugin

DEPEND="${CDEPEND}
	dev-util/pkgconfig
	python? ( >=dev-python/sip-4.9 )
	doc? ( app-text/docbook-sgml-utils
		   >=app-text/docbook-xml-dtd-4.4-r2:4.4 )"

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

PATCHES=(
	"${FILESDIR}/${P}-system-QTeXEngine.patch"
	"${FILESDIR}/${P}-system-liborigin.patch"
	"${FILESDIR}/${P}-system-gl2ps.patch"
	"${FILESDIR}/${PN}-0.9.7.10-dont-install-qwt.patch"
	)

src_prepare() {
	qt4_src_prepare

	rm -rf 3rdparty/{liborigin,QTeXEngine,/qwtplot3d/3rdparty/gl2ps/}

	# Check build.conf for changes on bump.
	cat >build.conf <<-EOF
	# Automatically generated by Gentoo ebuild
	isEmpty( QTI_ROOT ) {
	  message( "each file including this config needs to set QTI_ROOT to the dir containing this file!" )
	}

	MUPARSER_LIBS = \$\$system(pkg-config --libs muparser)
	GSL_LIBS = \$\$system(pkg-config --libs gsl)
	BOOST_INCLUDEPATH = /usr/include/boost
	BOOST_LIBS = -lboost_date_time-mt -lboost_thread-mt
	QWT_INCLUDEPATH = \$\$QTI_ROOT/3rdparty/qwt/src
	QWT_LIBS = \$\$QTI_ROOT/3rdparty/qwt/lib/libqwt.a
	LIB_ORIGIN_INCLUDEPATH = /usr/include/liborigin2
	LIB_ORIGIN_LIBS = -lorigin2
	SYS_LIBS = -lQTeXEngine -lgl2ps

	PYTHON = python
	LUPDATE = lupdate
	LRELEASE = lrelease

	SCRIPTING_LANGS += muParser

	CONFIG          += release
	CONFIG          += CustomInstall

	EOF

	use python && echo "SCRIPTING_LANGS += Python" >> build.conf
	use xls && echo "XLS_LIBS = -lxlsreader" >> build.conf
	if use ods; then
		echo "QUAZIP_INCLUDEPATH = /usr/include/quazip" >> build.conf
		echo "QUAZIP_LIBS = -lquazip" >> build.conf
	fi

	# Fails to build... 
	#if use emf; then
	#	echo "EMF_ENGINE_INCLUDEPATH = /usr/include/libEMF" >> build.conf
	#	echo "EMF_ENGINE_LIBS = -lEMF" >> build.conf
	#fi

	python_version

	sed -e "s:doc/${PN}/manual:doc/${PF}/html:" \
		-e "s:local/${PN}:$(get_libdir)/python${PYVER}/site-packages:" \
			-i qtiplot/qtiplot.pro || die

	sed -e '/INSTALLS.*documentation/d' \
		-e '/INSTALLS.*manual/d' \
		-e 's:\(^RESOURCES.*manual/html/icons.*\):#\1:' \
			-i qtiplot/qtiplot.pro || die
	sed -e '/manual/d' -i qtiplot.pro || die

	# Drop langs only if LINGUAS is not empty
	if [[ -n ${LINGUAS} ]]; then
		for l in ${LANGS}; do
			lu=${l/cz/cs}
			lu=${lu/cn/zh_CN}
			use linguas_${lu} || \
				sed -e "s:translations/qtiplot_${l}.[tq][sm]::" \
						-i qtiplot/qtiplot.pro || die
		done
	fi
	chmod -x qtiplot/qti_wordlist.txt

	# sed out debian paths
	sed -e 's:\(/usr/share/sgml/\)docbook/stylesheet/dsssl/modular\(/html/docbook.dsl\):\1stylesheets/dsssl/docbook\2:' \
		-i manual/qtiplot.dsl || die
	sed -e 's:\(/usr/share/\)xml/docbook/stylesheet/nwalsh\(/html/chunk.xsl\):\1sgml/docbook/xsl-stylesheets\2:' \
		-i manual/qtiplot_html.xsl || die
}

src_configure() {
	eqmake4
}

src_compile() {
	emake || die "emake failed"
	lrelease qtiplot/qtiplot.pro || die
	if use doc; then
		cd manual
		emake web || die "html docbook building failed"
	fi
}

src_install() {
	emake INSTALL_ROOT="${D}" install || die 'emake install failed'
	newicon qtiplot_logo.png qtiplot.png
	make_desktop_entry qtiplot "QtiPlot Scientific Plotting" qtiplot
	if use doc; then
		insinto /usr/share/doc/${PF}/html
		doins -r manual/html/* || die "install manual failed"
	fi

	if [[ -n ${LINGUAS} ]]; then
		insinto /usr/share/${PN}/translations
		for l in ${LANGS}; do
			lu=${l/cz/cs}
			lu=${lu/cn/zh_CN}
			use linguas_${lu} && \
				doins qtiplot/translations/qtiplot_${l}.qm
		done
	fi
}

pkg_postinst() {
	fdo-mime_desktop_database_update
}

pkg_postrm() {
	fdo-mime_desktop_database_update
}