/[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.1 - (show annotations) (download)
Mon Jul 10 12:41:27 2006 UTC (14 years, 1 month ago) by markusle
Branch: MAIN
Version bump. Also, split tcltk USE flag into tcl and tk and moved to new style virtual/jdk.
(Portage version: 2.1.1_pre2-r6)

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.0.ebuild,v 1.7 2006/06/23 01:13: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 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 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 if use qt3 && use qt4; then
43 echo
44 ewarn "qt3 and qt4 support for vtk are mutually exclusive and"
45 ewarn "qt4 support has therefore been enabled by default."
46 echo
47 fi
48 }
49
50 src_unpack() {
51 unpack ${A}
52 cd "${S}"
53
54 epatch "${FILESDIR}"/vtk-qt3-qt4-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 tcl; then
137 CMAKE_VARIABLES="${CMAKE_VARIABLES} -DVTK_WRAP_TCL:BOOL=ON"
138 else
139 CMAKE_VARIABLES="${CMAKE_VARIABLES} -DVTK_WRAP_TCL:BOOL=OFF"
140 fi
141
142 if use tk; then
143 CMAKE_VARIABLES="${CMAKE_VARIABLES} -DVTK_USE_TK:BOOL=ON"
144 else
145 CMAKE_VARIABLES="${CMAKE_VARIABLES} -DVTK_USE_TK:BOOL=OFF"
146 fi
147
148 use threads && CMAKE_VARIABLES="${CMAKE_VARIABLES} -DVTK_USE_PARALLEL:BOOL=ON"
149 use patented && CMAKE_VARIABLES="${CMAKE_VARIABLES} -DVTK_USE_PATENTED:BOOL=ON"
150 use doc && CMAKE_VARIABLES="${CMAKE_VARIABLES} -DDOCUMENTATION_HTML_HELP:BOOL=ON -DBUILD_DOCUMENTATION:BOOL=ON"
151
152 # run cmake twice to achieve proper
153 # configuration with cmake 2.2.x
154 cmake ${CMAKE_VARIABLES} . && cmake ${CMAKE_VARIABLES} . \
155 || die "cmake configuration failed"
156
157 # fix java.lang.OutOfMemoryError on amd64 (see bug #123178)
158 if use java && [ "${ARCH}" == "amd64" ]; then
159 sed -e "s/javac/javac -J-Xmx256m/" \
160 -i "${S}"/Wrapping/Java/CMakeFiles/VTKBuildAll.dir/build.make \
161 || die "Failed to patch javac"
162 fi
163
164 emake -j1 || die "emake failed"
165 }
166
167 src_install() {
168 # remove portage paths from dynamically created Type
169 # headers
170 sed -e "s:${S}/Common/::" \
171 -e "s:${S}/Rendering/::" \
172 -i "${S}"/Utilities/InstallOnly/*.cmake || \
173 die "Failed to fix cmake files"
174
175 make DESTDIR=${D} install || die "make install failed"
176
177 # install docs
178 dohtml "${S}"/README.html || die "Failed to install docs"
179
180 # install python modules
181 if use python; then
182 cd "${S}"/Wrapping/Python
183 docinto vtk_python
184 distutils_src_install
185 fi
186
187 # install jar
188 use java && java-pkg_dojar "${S}"/bin/vtk.jar
189
190 # install Tcl docs
191 docinto vtk_tcl
192 dodoc "${S}"/Wrapping/Tcl/README || \
193 die "Failed to install Tcl docs"
194
195 # install examples
196 if use examples; then
197 dodir /usr/share/${PN} || \
198 die "Failed to create examples directory"
199 cp -pPR ${S}/Examples ${D}/usr/share/${PN}/examples || \
200 die "Failed to copy example files"
201
202 # fix example's permissions
203 find ${D}/usr/share/${PN}/examples -type d -exec \
204 chmod 0755 {} \; || \
205 die "Failed to fix example directories permissions"
206 find ${D}/usr/share/${PN}/examples -type f -exec \
207 chmod 0644 {} \; || \
208 die "Failed to fix example files permissions"
209
210 cp -pPR ${WORKDIR}/VTKData ${D}/usr/share/${PN}/data || \
211 die "Failed to copy data files"
212
213 # fix data's permissions
214 find ${D}/usr/share/${PN}/data -type d -exec \
215 chmod 0755 {} \; || \
216 die "Failed to fix data directories permissions"
217 find ${D}/usr/share/${PN}/data -type f -exec \
218 chmod 0644 {} \; || \
219 die "Failed to fix data files permissions"
220 fi
221
222 # environment
223 echo "VTK_DATA_ROOT=/usr/share/${PN}/data" >> ${T}/40${PN}
224 echo "VTK_DIR=/usr/lib/${PN}-${SPV}" >> ${T}/40${PN}
225 if use java; then
226 echo "CLASSPATH=/usr/share/${PN}/lib/${PN}.jar" >> ${T}/40${PN}
227 fi
228 doenvd ${T}/40${PN}
229 }
230
231 pkg_postinst() {
232 if use patented; then
233 ewarn "Using patented code in VTK may require a license."
234 ewarn "For more information, please read:"
235 ewarn "http://public.kitware.com/cgi-bin/vtkfaq?req=show&file=faq07.005.htp"
236 fi
237 }

  ViewVC Help
Powered by ViewVC 1.1.20