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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.7 - (show annotations) (download)
Fri Sep 18 18:03:25 2009 UTC (10 years, 10 months ago) by betelgeuse
Branch: MAIN
CVS Tags: HEAD
Changes since 1.6: +1 -1 lines
FILE REMOVED
Remove old versions using built_with_use.
(Portage version: 2.2_rc40/cvs/Linux i686)

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

  ViewVC Help
Powered by ViewVC 1.1.20