Ticket #33465: Portfile

File Portfile, 8.9 KB (added by v.favrenicolin@…, 13 years ago)

Working portfile with a workaround kludge

Line 
1# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
2# $Id$
3
4PortSystem 1.0
5PortGroup   cmake 1.0
6
7name        vtk5
8version     5.8.0
9set branch  [join [lrange [split ${version} .] 0 1] .]
10categories  graphics devel
11maintainers adfernandes openmaintainer
12description 3D visualization toolkit
13long_description    an open source, freely available software system  \
14    for 3D computer graphics, image processing, and visualization     \
15    used by thousands of researchers and developers around the world. \
16    VTK consists of a C++ class library, and several interpreted      \
17    interface layers including Tcl/Tk, Java, and Python.
18
19homepage    http://www.vtk.org/
20platforms   darwin freebsd
21master_sites    http://www.vtk.org/files/release/${branch}/
22
23distfiles           [suffix vtk-${version}]
24checksums           [suffix vtk-${version}] \
25                    md5     37b7297d02d647cc6ca95b38174cb41f \
26                    sha1    ece52f4fa92811fe927581e60ecb39a8a5f68cd9 \
27                    rmd160  f100af93c4a4fc6a601aef563d3dd846d7aee914
28
29depends_build-append    port:readline
30distname    VTK
31
32use_parallel_build yes
33
34build.asroot yes
35pre-build {
36        system "rm -Rf /opt/local/lib/vtk-5.8"
37        system "ln -sf /opt/local/var/macports/build/_Users_vincent/vtk5/work/VTK/bin/ /opt/local/lib/vtk-5.8"
38}
39
40post-build {
41        system "rm -f /opt/local/lib/vtk-5.8"
42}
43
44configure.args-append  \
45        -DBUILD_SHARED_LIBS:BOOL=ON \
46        -DVTK_USE_RPATH:BOOL=ON \
47        -DCMAKE_INSTALL_RPATH:STRING=${prefix}/lib/vtk-${branch} \
48        -DCMAKE_INSTALL_NAME_DIR:STRING=${prefix}/lib/vtk-${branch} \
49        -DCMAKE_INSTALL_RPATH_USE_LINK_PATH:BOOL=ON \
50        -DVTK_INSTALL_PREFIX:PATH=${prefix} \
51        -DVTK_USE_HYBRID:BOOL=ON \
52        -DVTK_USE_TK:BOOL=OFF \
53        -DVTK_WRAP_TCL:BOOL=OFF \
54        -DTK_INCLUDE_PATH=${prefix}/include \
55        -DTK_LIBRARY=${prefix}/lib/libtk.dylib \
56        -DVTK_USE_CARBON:BOOL=OFF \
57        -DVTK_USE_COCOA:BOOL=ON \
58        -DVTK_DATA_ROOT:PATH=${prefix}/share/VTKData \
59        -DVTK_USE_GL2PS:BOOL=ON \
60        -DVTK_WRAP_PYTHON:BOOL=OFF
61
62post-configure {
63    reinplace "s|c++|c++ -L${prefix}/lib |" \
64    ${worksrcpath}/Infovis/Testing/Cxx/CMakeFiles/InfovisCxxTests.dir/link.txt \
65    ${worksrcpath}/IO/Testing/Cxx/CMakeFiles/IOCxxTests.dir/link.txt \
66    ${worksrcpath}/Views/Testing/Cxx/CMakeFiles/ViewsCxxTests.dir/link.txt
67
68    if {[variant_isset tcltk]} {
69      reinplace "s|c++|c++ -L${prefix}/lib |" \
70      ${worksrcpath}/Wrapping/Tcl/CMakeFiles/vtk.dir/link.txt
71    }
72}
73
74build.env-append DYLD_LIBRARY_PATH=${worksrcpath}/bin
75
76if {![variant_isset carbon] && ![variant_isset qt4_mac]} {
77    default_variants +x11 +tcltk
78}
79
80if {![variant_isset python25] && ![variant_isset python26]} {
81    default_variants +python27
82}
83
84post-destroot {
85    set vtkdest ${destroot}${prefix}/share/doc/${name}
86    xinstall -d ${vtkdest}
87    xinstall -m 644 -W ${worksrcpath} Copyright.txt README.html Testing.txt ${vtkdest}
88}
89
90variant x11 conflicts carbon qt4_mac {
91    depends_lib-append port:mesa port:Xft2 port:xorg-libXScrnSaver port:xorg-libXt
92    configure.args-delete   -DVTK_USE_COCOA:BOOL=ON
93    configure.args-append   \
94        -DVTK_USE_COCOA:BOOL=OFF \
95        -DVTK_USE_X:BOOL=ON \
96        -DOPENGL_gl_LIBRARY:FILEPATH=${prefix}/lib/libGL.dylib \
97        -DOPENGL_glu_LIBRARY:FILEPATH=${prefix}/lib/libGLU.dylib
98}
99
100variant tcltk conflicts carbon description {Build with Tcl wrappers and Tk support} {
101    depends_lib-append port:tcl port:tk
102    configure.args-delete \
103        -DVTK_USE_TK:BOOL=OFF \
104        -DVTK_WRAP_TCL:BOOL=OFF
105    configure.args-append \
106        -DVTK_USE_TK:BOOL=ON \
107        -DVTK_WRAP_TCL:BOOL=ON \
108        -DTCL_INCLUDE_PATH=${prefix}/include \
109        -DTCL_LIBRARY=${prefix}/lib/libtcl.dylib
110}
111
112variant carbon conflicts x11 tcltk description {Use Carbon.  Allows embedding VTK within qt4-mac (and py*-pyqt4 when used with Python)} {
113    configure.args-delete \
114        -DVTK_USE_COCOA:BOOL=ON \
115        -DVTK_USE_CARBON:BOOL=OFF
116    configure.args-append \
117        -DVTK_USE_COCOA:BOOL=OFF \
118        -DVTK_USE_CARBON:BOOL=ON
119}
120
121variant python requires python25 description {Compatibility variant, requires +python25} {}
122
123variant python25 description {Build Python 2.5 wrappers} conflicts python26 python27 {
124    depends_build-append    port:python25
125    configure.args-delete   \
126        -DVTK_WRAP_PYTHON:BOOL=OFF
127    configure.args-append   \
128        -DPYTHON_DEBUG_LIBRARY:FILEPATH=${prefix}/lib/libpython2.5.dylib \
129        -DPYTHON_EXECUTABLE:FILEPATH=${prefix}/bin/python2.5 \
130        -DPYTHON_INCLUDE_PATH:FILEPATH=${prefix}/include/python2.5 \
131        -DPYTHON_LIBRARY:FILEPATH=${prefix}/lib/libpython2.5.dylib \
132        -DVTK_WRAP_PYTHON:BOOL=ON \
133        -DVTK_INSTALL_NO_PYTHON:BOOL=ON
134    post-destroot {
135        file mkdir ${destroot}${prefix}/lib/python2.5/site-packages
136        system "cd ${worksrcpath}/Wrapping/Python && ${prefix}/bin/python2.5 setup.py install --prefix=${prefix} --root=${destroot}"
137    }
138}
139
140variant python26 description {Build Python 2.6 wrappers} conflicts python25 python27 {
141    depends_build-append    port:python26
142    configure.args-delete   \
143        -DVTK_WRAP_PYTHON:BOOL=OFF
144    configure.args-append   \
145        -DPYTHON_DEBUG_LIBRARY:FILEPATH=${prefix}/lib/libpython2.6.dylib \
146        -DPYTHON_EXECUTABLE:FILEPATH=${prefix}/bin/python2.6 \
147        -DPYTHON_INCLUDE_PATH:FILEPATH=${frameworks_dir}/Python.framework/Versions/2.6/include/python2.6 \
148        -DPYTHON_LIBRARY:FILEPATH=${prefix}/lib/libpython2.6.dylib \
149        -DVTK_WRAP_PYTHON:BOOL=ON \
150        -DVTK_INSTALL_NO_PYTHON:BOOL=ON
151    post-destroot {
152        system "cd ${worksrcpath}/Wrapping/Python && ${prefix}/bin/python2.6 setup.py install --prefix=${frameworks_dir}/Python.framework/Versions/2.6/ --root=${destroot}"
153    }
154}
155
156variant python27 description {Build Python 2.7 wrappers} conflicts python25 python26 {
157    depends_build-append    port:python27
158    configure.args-delete   \
159        -DVTK_WRAP_PYTHON:BOOL=OFF
160    configure.args-append   \
161        -DPYTHON_DEBUG_LIBRARY:FILEPATH=${prefix}/lib/libpython2.7.dylib \
162        -DPYTHON_EXECUTABLE:FILEPATH=${prefix}/bin/python2.7 \
163        -DPYTHON_INCLUDE_PATH:FILEPATH=${frameworks_dir}/Python.framework/Versions/2.7/include/python2.7 \
164        -DPYTHON_LIBRARY:FILEPATH=${prefix}/lib/libpython2.7.dylib \
165        -DVTK_WRAP_PYTHON:BOOL=ON \
166        -DVTK_INSTALL_NO_PYTHON:BOOL=ON
167    post-destroot {
168        system "cd ${worksrcpath}/Wrapping/Python && ${prefix}/bin/python2.7 setup.py install --prefix=${frameworks_dir}/Python.framework/Versions/2.7/ --root=${destroot}"
169    }
170}
171
172if {[variant_isset qt4_mac]} {
173    PortGroup qt4 1.0
174}
175
176variant qt4_mac conflicts x11 description {Build GUI support with Qt4 (Mac)} {
177    configure.args-append   -DVTK_USE_QT:BOOL=ON \
178                            -DVTK_USE_GUISUPPORT:BOOL=ON \
179                            -DQT_PHONON_INCLUDE_DIR=${prefix}/include/phonon \
180                            ${qt_cmake_defines}
181    post-destroot {
182        xinstall -m 755 -d ${destroot}${qt_plugins_dir}/designer
183        move ${destroot}${prefix}/plugins/designer/libQVTKWidgetPlugin.dylib \
184            ${destroot}${qt_plugins_dir}/designer/
185        set fixfile ${qt_plugins_dir}/designer/libQVTKWidgetPlugin.dylib
186        system "install_name_tool -id ${fixfile} ${destroot}${fixfile}"
187    }
188}
189
190variant mysql description {Build the MySQL driver for vtkSQLDatabase} {
191    depends_build-append    port:zlib \
192                            port:mysql5
193    configure.args-append   -DVTK_USE_MYSQL:BOOL=ON \
194                            -DMYSQL_LIBRARY:FILEPATH=${prefix}/lib/mysql5/mysql/libmysqlclient.dylib \
195                            -DMYSQL_INCLUDE_DIRECTORIES:FILEPATH=${prefix}/include/mysql5/mysql/ \
196                            -DMYSQL_EXTRA_LIBRARIES:FILEPATH=${prefix}/lib/libz.dylib
197}
198
199variant data description {Install data and examples} {
200    distfiles-append    [suffix vtkdata-${version}]
201    checksums-append    [suffix vtkdata-${version}] \
202                        md5     67263bd972f923d39a60f01104368779 \
203                        sha1    7350863d6351a961c4813ad6e73f74428307cd35 \
204                        rmd160  b77b5f6919beae406712b93cd333dd4fad5ff3d1
205
206    post-destroot {
207        set vtkdest ${destroot}${prefix}/share/doc/${name}
208        # Provide some examples
209        file copy ${worksrcpath}/Examples ${vtkdest}
210        xinstall -W ${worksrcpath}/bin \
211            CommonCxxTests \
212            FilteringCxxTests \
213            GenericFilteringCxxTests \
214            GraphicsCxxTests \
215            IOCxxTests \
216            ImagingCxxTests \
217            RenderingCxxTests \
218            TestCxxFeatures \
219            TestInstantiator \
220            VTKBenchMark \
221            VolumeRenderingCxxTests \
222            WidgetsCxxTests \
223            ${vtkdest}/Examples
224       
225        # Provide data files
226        system "tar -C ${destroot}${prefix}/share -xzvf ${distpath}/[suffix vtkdata-${version}]"
227    }
228}