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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.12 - (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.11: +1 -1 lines
FILE REMOVED
Version bump and removed old versions.
(Portage version: 2.1.2.4)

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

  ViewVC Help
Powered by ViewVC 1.1.20