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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.6 - (show annotations) (download)
Tue Apr 24 14:12:10 2007 UTC (13 years, 3 months ago) by markusle
Branch: MAIN
CVS Tags: HEAD
Changes since 1.5: +1 -1 lines
FILE REMOVED
Version bump and removed old versions.
(Portage version: 2.1.2.4)

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

  ViewVC Help
Powered by ViewVC 1.1.20