aboutsummaryrefslogtreecommitdiff
blob: 2c58b618deb6b7ee65bcbd6d11931036fe804b4a (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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sci-visualization/paraview/paraview-3.6.1-r1.ebuild,v 1.4 2009/11/24 04:05:41 markusle Exp $

EAPI="2"

inherit distutils eutils flag-o-matic cmake-utils toolchain-funcs versionator python qt4

MAIN_PV=$(get_major_version)
MAJOR_PV=$(get_version_component_range 1-2)

DESCRIPTION="ParaView is a powerful scientific data visualization application"
HOMEPAGE="http://www.paraview.org"
SRC_URI="mirror://gentoo/${P}.tar.gz
	mirror://gentoo/${P}-openfoam-gpl-r120.patch.bz2
	mirror://gentoo/${P}-openfoam-r120.patch.bz2"

LICENSE="paraview GPL-2"
KEYWORDS="~x86 ~amd64"
SLOT="0"
IUSE="mpi python doc examples qt4 plugins overview streaming gl2ps mysql postgres odbc cg"
# the database backends are exposed in some of the plugins.
# wether gl2ps and cg are exposed in paraview is a good question.
RDEPEND="sci-libs/hdf5
	mpi? ( || (
				sys-cluster/openmpi
				sys-cluster/mpich2[cxx] ) )
	python? ( >=dev-lang/python-2.0 )
	qt4? ( x11-libs/qt-gui:4
			x11-libs/qt-qt3support:4
			x11-libs/qt-assistant:4
			x11-libs/qt-opengl:4 )
	gl2ps? ( x11-libs/gl2ps )
	mysql? ( virtual/mysql )
	postgres? ( virtual/postgresql-base )
	odbc? ( dev-db/unixODBC )
	cg? ( media-gfx/nvidia-cg-toolkit )
	dev-libs/libxml2
	media-libs/libpng
	media-libs/jpeg
	media-libs/tiff
	media-video/ffmpeg
	dev-libs/expat
	sys-libs/zlib
	media-libs/freetype
	>=app-admin/eselect-opengl-1.0.6-r1
	virtual/opengl
	sci-libs/netcdf
	x11-libs/libXmu"

DEPEND="${RDEPEND}
		doc? ( app-doc/doxygen )
		overview? ( >=dev-libs/boost-1.37 )
		>=dev-util/cmake-2.6.4"

PVLIBDIR="$(get_libdir)/${PN}-${MAJOR_PV}"
S="${WORKDIR}"/ParaView${MAIN_PV}

pkg_setup() {
	# overview needs qt4 so if overview is enabled and qt4 isn't we abort
	if( ( use overview ) && ! (use qt4) ); then
		einfo "overview requires qt4 to build"
		einfo "you currently have qt4 disabled please enable it"
		einfo "if you really want overview"
		die
	fi
}

src_prepare() {
	epatch "${FILESDIR}/${P}-qt.patch"
	epatch "${FILESDIR}/${P}-pointsprite-disable.patch"
	epatch "${FILESDIR}/${P}-assistant.patch"
	epatch "${DISTDIR}/${P}-openfoam-r120.patch.bz2"
	epatch "${DISTDIR}/${P}-openfoam-gpl-r120.patch.bz2"
	epatch "${FILESDIR}/${P}-no-doc-finder.patch"

	has_version '>=sci-libs/hdf5-1.8.0' epatch "${FILESDIR}"/${P}-hdf-1.8.3.patch

	# fix GL issues
	sed -e "s:DEPTH_STENCIL_EXT:DEPTH_COMPONENT24:" \
		-i VTK/Rendering/vtkOpenGLRenderWindow.cxx \
		|| die "Failed to fix GL issues."

	# fix plugin install directory
	sed -e "s:\${PV_INSTALL_BIN_DIR}/plugins:/usr/${PVLIBDIR}/plugins:" \
		-i CMake/ParaViewPlugins.cmake \
		|| die "Failed to fix plugin install directories"
}

src_configure(){
	# we do not depend on an external sci-libs/proj - doing so is incompatible
	# with building shared libraries. But we can use gsl or pthreads.
	# Building vtk with the boost library is only required if you want to build OverView and its plugins.
	mycmakeargs="${mycmakeargs}
		-DPV_INSTALL_LIB_DIR:PATH=${PVLIBDIR}
		-DPARAVIEW_USE_SYSTEM_HDF5:BOOL=ON
		-DBUILD_SHARED_LIBS:BOOL=ON
		-DBUILD_TESTING:BOOL=OFF
		-DCMAKE_SKIP_RPATH:BOOL=YES
		-DCMAKE_INSTALL_PREFIX:PATH=/usr
		-DCMAKE_VERBOSE_MAKEFILE:BOOL=OFF
		-DCMAKE_USE_PTHREADS:BOOL=ON
		-DCMAKE_COLOR_MAKEFILE:BOOL=TRUE
		-DEXPAT_INCLUDE_DIR:PATH=/usr/include
		-DEXPAT_LIBRARY=/usr/$(get_libdir)/libexpat.so
		-DOPENGL_gl_LIBRARY=/usr/$(get_libdir)/libGL.so
		-DOPENGL_glu_LIBRARY=/usr/$(get_libdir)/libGLU.so
		-DVTK_USE_SYSTEM_FREETYPE:BOOL=ON
		-DVTK_USE_SYSTEM_JPEG:BOOL=ON
		-DVTK_USE_SYSTEM_PNG:BOOL=ON
		-DVTK_USE_SYSTEM_TIFF:BOOL=ON
		-DVTK_USE_SYSTEM_ZLIB:BOOL=ON
		-DVTK_USE_SYSTEM_EXPAT:BOOL=ON
		-DVTK_USE_RPATH:BOOL=OFF
		-DVTK_USE_SYSTEM_LIBXML2:BOOL=ON
		-DVTK_USE_OFFSCREEN=TRUE
		-DVTK_USE_GEOVIS:BOOL=ON
		-DVTK_USE_GLSL_SHADERS:BOOL=ON
		-DVTK_USE_GUISUPPORT:BOOL=ON
		-DVTK_USE_INFOVIS:BOOL=ON
		-DVTK_USE_METAIO:BOOL=ON
		-DVTK_USE_VIEWS:BOOL=ON
		$(cmake-utils_use cg VTK_USE_CG_SHADERS)
		$(cmake-utils_use odbc VTK_USE_ODBC)
		$(cmake-utils_use mysql VTK_USE_MYSQL)
		$(cmake-utils_use mysql XDMF_USE_MYSQL)
		$(cmake-utils_use postgres VTK_USE_POSTGRES)
		$(cmake-utils_use streaming PARAVIEW_BUILD_StreamingParaView)
		$(cmake-utils_use mpi PARAVIEW_USE_MPI)
		$(cmake-utils_use gl2ps VTK_USE_GL2PS)
		$(cmake-utils_use python PARAVIEW_ENABLE_PYTHON)
		$(cmake-utils_use_build doc DOCUMENTATION)
		$(cmake-utils_use_build examples EXAMPLES)"

	# Building OverView requires boost and some plugins
	# VTK_USE_N_WAY_ARRAYS is needed for the Array and TableToSparseArrayPanel plugins,
	# it also probably enables some functionality in the Infovis plugin.
	# Plugins in the first list are both required and enabled by OverView
	if use overview; then
		mycmakeargs="${mycmakeargs}
			-DVTK_USE_BOOST:BOOL=ON
			-DVTK_USE_N_WAY_ARRAYS:BOOL=ON
			-DPARAVIEW_BUILD_OverView:BOOL=ON
			-DPARAVIEW_BUILD_PLUGIN_ClientGraphView:BOOL=ON
			-DPARAVIEW_BUILD_PLUGIN_ClientGraphViewFrame:BOOL=ON
			-DPARAVIEW_BUILD_PLUGIN_ClientRecordView:BOOL=ON
			-DPARAVIEW_BUILD_PLUGIN_ClientTableView:BOOL=ON
			-DPARAVIEW_BUILD_PLUGIN_ClientTreeView:BOOL=ON
			-DPARAVIEW_BUILD_PLUGIN_Infovis:BOOL=ON
			-DPARAVIEW_BUILD_PLUGIN_SQLDatabaseGraphSourcePanel:BOOL=ON
			-DPARAVIEW_BUILD_PLUGIN_SQLDatabaseTableSourcePanel:BOOL=ON
			-DPARAVIEW_BUILD_PLUGIN_TableToGraphPanel:BOOL=ON"
		# The following plugins needs overview to build but are not needed to build OverView.
		use plugins && mycmakeargs="${mycmakeargs}
			-DPARAVIEW_BUILD_PLUGIN_Array:BOOL=ON
			-DPARAVIEW_BUILD_PLUGIN_ClientGeoView2D:BOOL=ON
			-DPARAVIEW_BUILD_PLUGIN_ClientGeoView:BOOL=ON
			-DPARAVIEW_BUILD_PLUGIN_SplitTableFieldPanel:BOOL=ON
			-DPARAVIEW_BUILD_PLUGIN_ThresholdTablePanel:BOOL=ON
			-DPARAVIEW_BUILD_PLUGIN_StatisticsToolbar:BOOL=ON
			-DPARAVIEW_BUILD_PLUGIN_ClientHierarchyView:BOOL=ON
			-DPARAVIEW_BUILD_PLUGIN_CommonToolbar:BOOL=ON
			-DPARAVIEW_BUILD_PLUGIN_TableToSparseArrayPanel:BOOL=ON
			-DPARAVIEW_BUILD_PLUGIN_GraphLayoutFilterPanel:BOOL=ON"
	fi

	# FIXME: compiling against ffmpeg is currently broken
	mycmakeargs="${mycmakeargs}
		-DVTK_USE_FFMPEG_ENCODER:BOOL=OFF"

	# May be if someone is interested we should test this
	# source include a stub of visit but it tries to find an installed copy of visit.
	# It may just need to be pointed there manually
	mycmakeargs="${mycmakeargs}
		-DPARAVIEW_BUILD_PLUGIN_VisItReaderPlugin:BOOL=OFF"

	# PointSprite: Does it require mpi (seems to build without)? say it really should need cmake>2.7 .
	if use plugins; then
		mycmakeargs="${mycmakeargs}
			-DPARAVIEW_BUILD_PLUGIN_CosmoFilters:BOOL=ON
			-DPARAVIEW_BUILD_PLUGIN_Moments,:BOOL=ON
			-DPARAVIEW_BUILD_PLUGIN_PointSprite:BOOL=ON
			-DPARAVIEW_BUILD_PLUGIN_Prism:BOOL=ON
			-DPARAVIEW_BUILD_PLUGIN_SLACTools:BOOL=ON
			-DPARAVIEW_BUILD_PLUGIN_netCDFReaders:BOOL=ON
			$(cmake-utils_use examples PointSpritePlugin_BUILD_EXAMPLES)
			$(cmake-utils_use python PARAVIEW_BUILD_PLUGIN_pvblot)"

		# note about -DPARAVIEW_BUILD_PLUGIN_Streaming 
		# it is enabled if the streaming application is built - off otherwise.
	fi

	if use qt4; then
		mycmakeargs="${mycmakeargs}
			-DPARAVIEW_BUILD_QT_GUI:BOOL=ON
			-DVTK_INSTALL_QT_DIR=/${PVLIBDIR}/plugins/designer
			-DVTK_USE_QT:BOOL=ON
			-DVTK_USE_QVTK_QTOPENGL:BOOL=ON"
	else
		mycmakeargs="${mycmakeargs}
			-DPARAVIEW_BUILD_QT_GUI:BOOL=OFF"
	fi

	# we also need to append -DH5Tget_array_dims_vers=1 to our CFLAGS
	append-flags -DH5_USE_16_API

	cmake-utils_src_configure
	# if we want to built overview configure has to be called twice 
	# otherwise some variables are not propagated properly
	use overview && cmake-utils_src_configure
}

src_compile() {
	cmake-utils_src_compile
}

src_install() {
	cmake-utils_src_install
	# rename the assistant wrapper
	if use qt4; then
		mv "${D}"/usr/bin/assistant "${D}"/usr/bin/paraview-assistant \
			|| die "Failed to rename assistant wrapper"
		chmod 0755 "${D}/usr/${PVLIBDIR}/assistant-real" \
			|| die "Failed to change permissions on assistant wrapper"
		newicon Applications/Client/pvIcon.svg "${PN}".svg
		make_desktop_entry paraview Paraview "${PN}".svg
	fi

	# There is no install target for OverView, so we have a manual install
	if use overview; then
		exeinto /usr/"${PVLIBDIR}"
		newexe "${CMAKE_BUILD_DIR}"/bin/OverView OverView-real
		dolib.so "${CMAKE_BUILD_DIR}"/bin/libOverViewCore.so
		mkdir "${D}/usr/${PVLIBDIR}"/OverView-startup
		cd "${CMAKE_BUILD_DIR}"/bin/OverView-startup
		for i in ./* ;
			do dosym /usr/"${PVLIBDIR}"/"$i" "/usr/${PVLIBDIR}"/OverView-startup/"$i" ;
		done
		dosym /usr/"${PVLIBDIR}"/OverView-real /usr/bin/OverView
		newicon "${S}"/Applications/OverView/Icon.png overview.png
		make_desktop_entry OverView "OverView" overview.png
	fi

	# set up the environment
	echo "LDPATH=/usr/${PVLIBDIR}" >> "${T}"/40${PN}
	doenvd "${T}"/40${PN}

	# move and remove some of the files that should not be
	# in /usr/bin
	dohtml "${D}/usr/bin/about.html" && rm -f "${D}/usr/bin/about.html" \
		|| die "Failed to move about.html into doc dir"

	# this binary does not work and probably should not be installed
	rm -f "${D}/usr/bin/vtkSMExtractDocumentation" \
		|| die "Failed to remove vtkSMExtractDocumentation"

	# rename /usr/bin/lproj to /usr/bin/lproj_paraview to avoid
	# a file collision with vtk which installs the same file
	mv "${D}/usr/bin/lproj" "${D}/usr/bin/lproj_paraview"  \
		|| die "Failed to rename /usr/bin/lproj"
}

pkg_postinst() {
	# with Qt4.5 there seem to be issues reading data files
	# under certain locales. Setting LC_ALL=C should fix these.
	echo
	elog "If you experience data corruption during parsing of"
	elog "data files with paraview please try setting your"
	elog "locale to LC_ALL=C."
	elog "The binary /usr/bin/lproj has been renamed to"
	elog "/usr/bin/lproj_paraview to avoid a file collision"
	elog "with vtk."
	echo
}