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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Mon Jun 11 17:41:45 2007 UTC (13 years, 2 months ago) by betelgeuse
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +1 -1 lines
FILE REMOVED
Remove old version.
(Portage version: 2.1.2.9)

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

  ViewVC Help
Powered by ViewVC 1.1.20