Ticket #37792: Portfile

File Portfile, 8.4 KB (added by adfernandes (Andrew Fernandes), 11 years ago)
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: Portfile 100791 2012-12-24 18:47:09Z adfernandes@macports.org $
3
4PortSystem 1.0
5PortGroup   cmake 1.0
6
7name        vtk5
8version     5.10.1
9set branch  [join [lrange [split ${version} .] 0 1] .]
10#
11# There was a stealth-update of vtkdata-5.10.1 that invalidated the checksums of that file.
12# (see https://trac.macports.org/wiki/PortfileRecipes#stealth-updates) Remove the 'dist_subdir'
13# line when the next proper version of vtk5 is released...
14#
15dist_subdir   ${name}/${version}_1
16#
17categories  graphics devel
18maintainers adfernandes openmaintainer
19description 3D visualization toolkit
20long_description    an open source, freely available software system  \
21    for 3D computer graphics, image processing, and visualization     \
22    used by thousands of researchers and developers around the world. \
23    VTK consists of a C++ class library, and several interpreted      \
24    interface layers including Tcl/Tk, Java, and Python.
25license     BSD
26
27homepage    http://www.vtk.org/
28platforms   darwin freebsd
29master_sites    http://www.vtk.org/files/release/${branch}/
30
31distfiles           [suffix vtk-${version}]
32checksums           [suffix vtk-${version}] \
33                    md5     264b0052e65bd6571a84727113508789 \
34                    sha1    deb834f46b3f7fc3e122ddff45e2354d69d2adc3 \
35                    rmd160  3b0b138bf45743e925a905fb2eccb6b3ab3dada4
36
37depends_build-append    port:readline
38distname    VTK${version}
39
40use_parallel_build yes
41
42configure.args-append  \
43        -DBUILD_SHARED_LIBS:BOOL=ON \
44        -DVTK_USE_RPATH:BOOL=ON \
45        -DCMAKE_INSTALL_RPATH:STRING=${prefix}/lib/vtk-${branch} \
46        -DCMAKE_INSTALL_NAME_DIR:STRING=${prefix}/lib/vtk-${branch} \
47        -DCMAKE_INSTALL_RPATH_USE_LINK_PATH:BOOL=ON \
48        -DVTK_INSTALL_PREFIX:PATH=${prefix} \
49        -DVTK_USE_HYBRID:BOOL=ON \
50        -DVTK_USE_TK:BOOL=OFF \
51        -DVTK_WRAP_TCL:BOOL=OFF \
52        -DTK_INCLUDE_PATH=${prefix}/include \
53        -DTK_LIBRARY=${prefix}/lib/libtk.dylib \
54        -DVTK_USE_CARBON:BOOL=OFF \
55        -DVTK_USE_COCOA:BOOL=ON \
56        -DVTK_DATA_ROOT:PATH=${prefix}/share/VTKData \
57        -DVTK_USE_GL2PS:BOOL=ON \
58        -DVTK_WRAP_PYTHON:BOOL=OFF
59configure.cxxflags-append \
60        -DUSE_INTERP_ERRORLINE
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 {${os.major} <= 10} {
77    configure.args-append  \
78        -DIOKit:FILEPATH=/System/Library/Frameworks/IOKit.framework
79}
80
81if {![variant_isset carbon] && ![variant_isset qt4_mac]} {
82    default_variants +x11 +tcltk
83}
84
85post-destroot {
86    set vtkdest ${destroot}${prefix}/share/doc/${name}
87    xinstall -d ${vtkdest}
88    xinstall -m 644 -W ${worksrcpath} Copyright.txt README.html Testing.txt ${vtkdest}
89}
90
91variant x11 conflicts carbon qt4_mac {
92    depends_lib-append port:mesa port:Xft2 port:xorg-libXScrnSaver port:xorg-libXt
93    configure.args-delete   -DVTK_USE_COCOA:BOOL=ON
94    configure.args-append   \
95        -DVTK_USE_COCOA:BOOL=OFF \
96        -DVTK_USE_X:BOOL=ON \
97        -DOPENGL_gl_LIBRARY:FILEPATH=${prefix}/lib/libGL.dylib \
98        -DOPENGL_glu_LIBRARY:FILEPATH=${prefix}/lib/libGLU.dylib
99}
100
101variant tcltk conflicts carbon description {Build with Tcl wrappers and Tk support} {
102    depends_lib-append port:tcl port:tk
103    configure.args-delete \
104        -DVTK_USE_TK:BOOL=OFF \
105        -DVTK_WRAP_TCL:BOOL=OFF
106    configure.args-append \
107        -DVTK_USE_TK:BOOL=ON \
108        -DVTK_WRAP_TCL:BOOL=ON \
109        -DTCL_INCLUDE_PATH=${prefix}/include \
110        -DTCL_LIBRARY=${prefix}/lib/libtcl.dylib
111}
112
113variant carbon conflicts x11 tcltk description {Use Carbon.  Allows embedding VTK within qt4-mac (and py*-pyqt4 when used with Python)} {
114    supported_archs i386 ppc
115    if {${os.platform} == "darwin" && ${os.major} >= 12} {
116        ui_error "${name}: 'carbon' is not supported on OS X 10.8 or greater"
117        return -code error "incompatible OS X version"
118    }
119    configure.args-delete \
120        -DVTK_USE_COCOA:BOOL=ON \
121        -DVTK_USE_CARBON:BOOL=OFF
122    configure.args-append \
123        -DVTK_USE_COCOA:BOOL=OFF \
124        -DVTK_USE_CARBON:BOOL=ON
125}
126
127set pythons_suffixes {25 26 27}
128
129set pythons_ports {}
130foreach s ${pythons_suffixes} {
131    lappend pythons_ports python${s}
132}
133
134foreach s ${pythons_suffixes} {
135    set p python${s}
136    set v [string index ${s} 0].[string index ${s} 1]
137    set i [lsearch -exact ${pythons_ports} ${p}]
138    set c [lreplace ${pythons_ports} ${i} ${i}]
139    eval [subst {
140        variant ${p} description "Build Python ${v} wrappers" conflicts ${c} {
141
142            configure.args-delete   \
143                -DVTK_WRAP_PYTHON:BOOL=OFF
144            configure.args-append   \
145                -DPYTHON_DEBUG_LIBRARY:FILEPATH=${prefix}/lib/libpython${v}.dylib \
146                -DPYTHON_EXECUTABLE:FILEPATH=${prefix}/bin/python${v} \
147                -DPYTHON_INCLUDE_PATH:FILEPATH=${frameworks_dir}/Python.framework/Versions/${v}/Headers \
148                -DPYTHON_LIBRARY:FILEPATH=${prefix}/lib/libpython${v}.dylib \
149                -DVTK_WRAP_PYTHON:BOOL=ON \
150                -DVTK_INSTALL_NO_PYTHON:BOOL=ON
151
152            post-configure {
153                system -W ${worksrcpath}/Wrapping/Python/CMakeFiles/vtkpython.dir "echo `cat link.txt` -L../../bin > link.txt"
154                system -W ${worksrcpath}/Wrapping/Python/CMakeFiles/vtkPythonCore.dir "echo `cat link.txt` -L../../bin > link.txt"
155            }
156
157            post-destroot {
158                file mkdir ${destroot}${prefix}/lib/python${v}/site-packages
159                system "cd ${worksrcpath}/Wrapping/Python && ${prefix}/bin/python${v} setup.py install --prefix=${frameworks_dir}/Python.framework/Versions/${v} --root=${destroot}"
160            }
161
162        }
163    }]
164}
165
166if {[variant_isset qt4_mac]} {
167    PortGroup qt4 1.0
168}
169
170variant qt4_mac conflicts x11 description {Build GUI support with Qt4 (Mac)} {
171    configure.args-append   -DVTK_USE_QT:BOOL=ON \
172                            -DVTK_USE_GUISUPPORT:BOOL=ON \
173                            -DQT_PHONON_INCLUDE_DIR=${prefix}/include/phonon \
174                            ${qt_cmake_defines}
175    post-destroot {
176        xinstall -m 755 -d ${destroot}${qt_plugins_dir}/designer
177        move ${destroot}${prefix}/plugins/designer/libQVTKWidgetPlugin.dylib \
178            ${destroot}${qt_plugins_dir}/designer/
179        set fixfile ${qt_plugins_dir}/designer/libQVTKWidgetPlugin.dylib
180        system "install_name_tool -id ${fixfile} ${destroot}${fixfile}"
181    }
182}
183
184variant mysql description {Build the MySQL driver for vtkSQLDatabase} {
185    depends_build-append    port:zlib \
186                            port:mysql5
187    configure.args-append   -DVTK_USE_MYSQL:BOOL=ON \
188                            -DMYSQL_LIBRARY:FILEPATH=${prefix}/lib/mysql5/mysql/libmysqlclient.dylib \
189                            -DMYSQL_INCLUDE_DIRECTORIES:FILEPATH=${prefix}/include/mysql5/mysql/ \
190                            -DMYSQL_EXTRA_LIBRARIES:FILEPATH=${prefix}/lib/libz.dylib
191}
192
193variant data description {Install data and examples} {
194    distfiles-append    [suffix vtkdata-${version}]
195    checksums-append    [suffix vtkdata-${version}] \
196                        md5     b6355063264cd56bcd1396c92f6ca59a \
197                        sha1    9fb9b3324dc5960813fbffd4111562f7b717a483 \
198                        rmd160  950f4dcc52ae077fb3b0d385fdd33d4dc18fdb1a
199
200    post-destroot {
201        set vtkdest ${destroot}${prefix}/share/doc/${name}
202        # Provide some examples
203        file copy ${worksrcpath}/Examples ${vtkdest}
204        xinstall -W ${worksrcpath}/bin \
205            CommonCxxTests \
206            FilteringCxxTests \
207            GenericFilteringCxxTests \
208            GraphicsCxxTests \
209            IOCxxTests \
210            ImagingCxxTests \
211            RenderingCxxTests \
212            TestCxxFeatures \
213            TestInstantiator \
214            VTKBenchMark \
215            VolumeRenderingCxxTests \
216            WidgetsCxxTests \
217            ${vtkdest}/Examples
218
219        # Provide data files
220        system "tar -C ${destroot}${prefix}/share -xzvf ${distpath}/[suffix vtkdata-${version}]"
221    }
222}