/[gentoo-x86]/sci-libs/vtk/vtk-5.0.3.ebuild
Gentoo

Contents of /sci-libs/vtk/vtk-5.0.3.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.14 - (show annotations) (download)
Sat Jul 18 03:33:23 2009 UTC (10 years, 11 months ago) by markusle
Branch: MAIN
CVS Tags: HEAD
Changes since 1.13: +1 -1 lines
FILE REMOVED
Version bump (fixes bug #269040). Also removed old version.
(Portage version: 2.2_rc33/cvs/Linux x86_64)

1 # Copyright 1999-2008 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/sci-libs/vtk/vtk-5.0.3.ebuild,v 1.13 2008/07/28 21:16:46 carlo Exp $
4
5 EAPI="1"
6
7 inherit distutils eutils flag-o-matic toolchain-funcs versionator java-pkg-opt-2 python qt3 qt4
8
9 # Short package version
10 SPV="$(get_version_component_range 1-2)"
11
12 DESCRIPTION="The Visualization Toolkit"
13 HOMEPAGE="http://www.vtk.org"
14 SRC_URI="http://www.${PN}.org/files/release/${SPV}/${P}.tar.gz
15 examples? ( http://www.${PN}.org/files/release/${SPV}/${PN}data-${PV}.tar.gz )"
16
17 LICENSE="BSD LGPL-2"
18 KEYWORDS="~amd64 ~x86"
19 SLOT="0"
20 IUSE="doc examples mpi patented python tcl tk threads qt3 qt4"
21 RDEPEND="mpi? ( || (
22 sys-cluster/openmpi
23 sys-cluster/lam-mpi
24 sys-cluster/mpich2 ) )
25 python? ( >=dev-lang/python-2.0 )
26 tcl? ( >=dev-lang/tcl-8.2.3 )
27 tk? ( >=dev-lang/tk-8.2.3 )
28 java? ( >=virtual/jre-1.5 )
29 qt3? ( x11-libs/qt:3 )
30 qt4? ( =x11-libs/qt-4.3*:4 )
31 dev-libs/expat
32 media-libs/freetype
33 media-libs/jpeg
34 media-libs/libpng
35 media-libs/tiff
36 virtual/opengl
37 x11-libs/libXmu"
38
39 DEPEND="${RDEPEND}
40 java? ( >=virtual/jdk-1.5 )
41 >=dev-util/cmake-2.2.3"
42
43 S="${WORKDIR}"/VTK
44
45 pkg_setup() {
46 java-pkg-opt-2_pkg_setup
47 if use qt3 && use qt4; then
48 echo
49 ewarn "qt3 and qt4 support for vtk are mutually exclusive and"
50 ewarn "qt4 support has therefore been enabled by default."
51 echo
52 fi
53
54 use qt4 && use examples && \
55 if ! built_with_use =x11-libs/qt-4* qt3support; then
56 echo
57 eerror 'Please emerge qt4 with USE="qt3support" to'
58 eerror 'build the examples under qt4!'
59 die "qt4 setup error"
60 fi
61
62 if use mpi && has_version sys-cluster/mpich2; then
63 append-flags -DMPICH_IGNORE_CXX_SEEK
64 if ! built_with_use sys-cluster/mpich2 cxx; then
65 die "Please re-emerge sys-cluster/mpich2 with USE=\"cxx\""
66 fi
67 fi
68
69 use qt4 && qt4_pkg_setup
70 }
71
72 src_unpack() {
73 unpack ${A}
74 cd "${S}"
75 epatch "${FILESDIR}"/${P}-mpi.patch
76 }
77
78 src_compile() {
79 # gcc versions 3.2.x seem to have sse-related bugs that are
80 # triggered by VTK when compiling for pentium3/4
81 if [ "$(gcc-major-version)" -eq 3 -a "$(gcc-minor-version)" -eq 2 -a \
82 "$(get-flag -march)" == "-march=pentium4" ]; then
83 filter-mfpmath sse
84 filter-flags "-msse -msse2"
85 echo "$(get-flag -march)"
86 fi
87
88 # Fix Examples cmake file
89 sed -e "s/MAKEPROGRAM/CMAKE_MAKE_PROGRAM/g" \
90 -i "${S}"/Examples/CMakeLists.txt || \
91 die "Failed to fix examples CMakeList.txt"
92
93 # build list of config variable define's to pass to cmake
94 local CMAKE_VARIABLES=""
95 CMAKE_VARIABLES="${CMAKE_VARIABLES} -DCMAKE_SKIP_RPATH:BOOL=YES"
96 CMAKE_VARIABLES="${CMAKE_VARIABLES} -DVTK_DIR:PATH=${S}"
97 CMAKE_VARIABLES="${CMAKE_VARIABLES} -DVTK_INSTALL_LIB_DIR:PATH=/$(get_libdir)/"
98 CMAKE_VARIABLES="${CMAKE_VARIABLES} -DCMAKE_INSTALL_PREFIX:PATH=/usr"
99 CMAKE_VARIABLES="${CMAKE_VARIABLES} -DBUILD_SHARED_LIBS:BOOL=ON"
100 CMAKE_VARIABLES="${CMAKE_VARIABLES} -DVTK_USE_FREETYPE:BOOL=ON"
101 CMAKE_VARIABLES="${CMAKE_VARIABLES} -DVTK_USE_SYSTEM_JPEG:BOOL=ON"
102 CMAKE_VARIABLES="${CMAKE_VARIABLES} -DVTK_USE_SYSTEM_PNG:BOOL=ON"
103 CMAKE_VARIABLES="${CMAKE_VARIABLES} -DVTK_USE_SYSTEM_TIFF:BOOL=ON"
104 CMAKE_VARIABLES="${CMAKE_VARIABLES} -DVTK_USE_SYSTEM_ZLIB:BOOL=ON"
105 CMAKE_VARIABLES="${CMAKE_VARIABLES} -DVTK_USE_SYSTEM_EXPAT:BOOL=ON"
106 CMAKE_VARIABLES="${CMAKE_VARIABLES} -DBUILD_TESTING:BOOL=OFF"
107 CMAKE_VARIABLES="${CMAKE_VARIABLES} -DVTK_USE_HYBRID:BOOL=ON"
108 CMAKE_VARIABLES="${CMAKE_VARIABLES} -DVTK_USE_GL2PS:BOOL=ON"
109 CMAKE_VARIABLES="${CMAKE_VARIABLES} -DVTK_USE_RENDERING:BOOL=ON"
110
111 use examples && CMAKE_VARIABLES="${CMAKE_VARIABLES} -DVTK_DATA_ROOT:PATH=/usr/share/${PN}/data -DBUILD_EXAMPLES:BOOL=ON"
112 if use java; then
113 CMAKE_VARIABLES="${CMAKE_VARIABLES} -DVTK_WRAP_JAVA:BOOL=ON"
114 CMAKE_VARIABLES="${CMAKE_VARIABLES} -DJAVA_AWT_INCLUDE_PATH:PATH=`java-config -O`/include"
115 CMAKE_VARIABLES="${CMAKE_VARIABLES} -DJAVA_INCLUDE_PATH:PATH=`java-config -O`/include"
116 CMAKE_VARIABLES="${CMAKE_VARIABLES} -DJAVA_INCLUDE_PATH2:PATH=`java-config -O`/include/linux"
117 if [ "${ARCH}" == "amd64" ]; then
118 CMAKE_VARIABLES="${CMAKE_VARIABLES} -DJAVA_AWT_LIBRARY:PATH=`java-config -O`/jre/lib/${ARCH}/libjawt.so"
119 else
120 CMAKE_VARIABLES="${CMAKE_VARIABLES} -DJAVA_AWT_LIBRARY:PATH=`java-config -O`/jre/lib/i386/libjawt.so"
121 fi
122 fi
123
124 if use mpi; then
125 CMAKE_VARIABLES="${CMAKE_VARIABLES} -DVTK_USE_MPI:BOOL=ON"
126 use !threads && CMAKE_VARIABLES="${CMAKE_VARIABLES} -DVTK_USE_PARALLEL:BOOL=ON"
127 fi
128
129 if use python; then
130 python_version
131 CMAKE_VARIABLES="${CMAKE_VARIABLES} -DVTK_WRAP_PYTHON:BOOL=ON"
132 CMAKE_VARIABLES="${CMAKE_VARIABLES} -DPYTHON_INCLUDE_PATH:PATH=/usr/include/python${PYVER}"
133 CMAKE_VARIABLES="${CMAKE_VARIABLES} -DPYTHON_LIBRARY:PATH=/usr/$(get_libdir)/libpython${PYVER}.so"
134 fi
135
136 if use qt3 || use qt4 ; then
137 CMAKE_VARIABLES="${CMAKE_VARIABLES} -DVTK_USE_GUISUPPORT:BOOL=ON"
138 CMAKE_VARIABLES="${CMAKE_VARIABLES} -DVTK_USE_QVTK:BOOL=ON"
139 CMAKE_VARIABLES="${CMAKE_VARIABLES} -DQT_WRAP_CPP:BOOL=ON"
140 CMAKE_VARIABLES="${CMAKE_VARIABLES} -DQT_WRAP_UI:BOOL=ON"
141 fi
142
143 if use qt3; then
144 CMAKE_VARIABLES="${CMAKE_VARIABLES} -DVTK_INSTALL_QT_DIR:PATH=/qt/3/plugins/${PN}"
145 CMAKE_VARIABLES="${CMAKE_VARIABLES} -DDESIRED_QT_VERSION:STRING=3"
146 CMAKE_VARIABLES="${CMAKE_VARIABLES} -DQT_MOC_EXECUTABLE:FILEPATH=/usr/qt/3/bin/moc"
147 CMAKE_VARIABLES="${CMAKE_VARIABLES} -DQT_UIC_EXECUTABLE:FILEPATH=/usr/qt/3/bin/uic"
148 CMAKE_VARIABLES="${CMAKE_VARIABLES} -DQT_INCLUDE_DIR:PATH=/usr/qt/3/include"
149 CMAKE_VARIABLES="${CMAKE_VARIABLES} -DQT_QMAKE_EXECUTABLE:PATH=/usr/qt/3/bin/qmake"
150 fi
151
152 if use qt4; then
153 CMAKE_VARIABLES="${CMAKE_VARIABLES} -DVTK_INSTALL_QT_DIR:PATH=/$(get_libdir)/qt4/plugins/${PN}"
154 CMAKE_VARIABLES="${CMAKE_VARIABLES} -DDESIRED_QT_VERSION:STRING=4"
155 CMAKE_VARIABLES="${CMAKE_VARIABLES} -DQT_MOC_EXECUTABLE:FILEPATH=/usr/bin/moc"
156 CMAKE_VARIABLES="${CMAKE_VARIABLES} -DQT_UIC_EXECUTABLE:FILEPATH=/usr/bin/uic"
157 CMAKE_VARIABLES="${CMAKE_VARIABLES} -DQT_INCLUDE_DIR:PATH=/usr/include/qt4"
158 CMAKE_VARIABLES="${CMAKE_VARIABLES} -DQT_QMAKE_EXECUTABLE:PATH=/usr/bin/qmake"
159 fi
160
161 if use tcl; then
162 CMAKE_VARIABLES="${CMAKE_VARIABLES} -DVTK_WRAP_TCL:BOOL=ON"
163 else
164 CMAKE_VARIABLES="${CMAKE_VARIABLES} -DVTK_WRAP_TCL:BOOL=OFF"
165 fi
166
167 if use tk; then
168 CMAKE_VARIABLES="${CMAKE_VARIABLES} -DVTK_USE_TK:BOOL=ON"
169 else
170 CMAKE_VARIABLES="${CMAKE_VARIABLES} -DVTK_USE_TK:BOOL=OFF"
171 fi
172
173 use threads && CMAKE_VARIABLES="${CMAKE_VARIABLES} -DVTK_USE_PARALLEL:BOOL=ON"
174 use patented && CMAKE_VARIABLES="${CMAKE_VARIABLES} -DVTK_USE_PATENTED:BOOL=ON"
175 use doc && CMAKE_VARIABLES="${CMAKE_VARIABLES} -DDOCUMENTATION_HTML_HELP:BOOL=ON -DBUILD_DOCUMENTATION:BOOL=ON"
176
177 # run cmake twice to achieve proper
178 # configuration with cmake 2.2.x
179 cmake ${CMAKE_VARIABLES} . && cmake ${CMAKE_VARIABLES} . \
180 || die "cmake configuration failed"
181
182 # fix java.lang.OutOfMemoryError on amd64 (see bug #123178)
183 if use java && [ "${ARCH}" == "amd64" ]; then
184 sed -e "s/javac/javac -J-Xmx256m/" \
185 -i "${S}"/Wrapping/Java/CMakeFiles/VTKBuildAll.dir/build.make \
186 || die "Failed to patch javac"
187 fi
188
189 emake -j1 || die "emake failed"
190 }
191
192 src_install() {
193 # remove portage paths from dynamically created Type
194 # headers
195 sed -e "s:${S}/Common/::" \
196 -e "s:${S}/Rendering/::" \
197 -i "${S}"/Utilities/InstallOnly/*.cmake || \
198 die "Failed to fix cmake files"
199
200 make DESTDIR="${D}" install || die "make install failed"
201
202 # install docs
203 dohtml "${S}"/README.html || die "Failed to install docs"
204
205 # install python modules
206 if use python; then
207 cd "${S}"/Wrapping/Python
208 docinto vtk_python
209 distutils_src_install
210 fi
211
212 # install jar
213 use java && java-pkg_dojar "${S}"/bin/vtk.jar
214
215 # install Tcl docs
216 docinto vtk_tcl
217 dodoc "${S}"/Wrapping/Tcl/README || \
218 die "Failed to install Tcl docs"
219
220 # install examples
221 if use examples; then
222 dodir /usr/share/${PN} || \
223 die "Failed to create examples directory"
224 cp -pPR "${S}"/Examples "${D}"/usr/share/${PN}/examples || \
225 die "Failed to copy example files"
226
227 # fix example's permissions
228 find "${D}"/usr/share/${PN}/examples -type d -exec \
229 chmod 0755 {} \; || \
230 die "Failed to fix example directories permissions"
231 find "${D}"/usr/share/${PN}/examples -type f -exec \
232 chmod 0644 {} \; || \
233 die "Failed to fix example files permissions"
234
235 cp -pPR "${WORKDIR}"/VTKData "${D}"/usr/share/${PN}/data || \
236 die "Failed to copy data files"
237
238 # fix data's permissions
239 find "${D}"/usr/share/${PN}/data -type d -exec \
240 chmod 0755 {} \; || \
241 die "Failed to fix data directories permissions"
242 find "${D}"/usr/share/${PN}/data -type f -exec \
243 chmod 0644 {} \; || \
244 die "Failed to fix data files permissions"
245 fi
246
247 # environment
248 echo "VTK_DATA_ROOT=/usr/share/${PN}/data" >> "${T}"/40${PN}
249 echo "VTK_DIR=/usr/lib/${PN}-${SPV}" >> "${T}"/40${PN}
250 echo "VTKHOME=/usr" >> "${T}"/40${PN}
251 doenvd "${T}"/40${PN}
252 }
253
254 pkg_postinst() {
255 if use patented; then
256 ewarn "Using patented code in VTK may require a license."
257 ewarn "For more information, please read:"
258 ewarn "http://public.kitware.com/cgi-bin/vtkfaq?req=show&file=faq07.005.htp"
259 fi
260 }

  ViewVC Help
Powered by ViewVC 1.1.20