Ticket #19111: Portfile

File Portfile, 5.9 KB (added by tgamblin@…, 16 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 48149 2009-03-15 10:00:31Z takeshi@macports.org $
3
4PortSystem 1.0
5
6name        vtk5
7version     5.2.1
8revision    1
9set branch  [join [lrange [split ${version} .] 0 1] .]
10categories  graphics devel
11maintainers nomaintainer
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}/
22checksums vtk-${version}.tar.gz md5 d59520d5f6c49c8b4e3b9227e341b19f \
23          vtk-${version}.tar.gz sha1 e08ee5c9d738c2fe774fdb3111818b9899a7b751 \
24          vtk-${version}.tar.gz rmd160 c6cdee0c76e243d21d802690f138faab1c6eb863\
25      vtkdata-${version}.tar.gz md5 3cd99917ab1ec3ef369dd40db74b93b1 \
26      vtkdata-${version}.tar.gz sha1 a625f4934d0fbaad2242ae2bc920084775438933 \
27      vtkdata-${version}.tar.gz rmd160 5628fec27673d99426922dcd32b8d66a0d86c9ec
28
29depends_build   bin:cmake:cmake \
30        port:readline
31distfiles   vtk-${version}.tar.gz \
32        vtkdata-${version}.tar.gz
33distname    VTK
34
35use_parallel_build yes
36
37post-extract {
38    delete ${worksrcpath}/Utilities/vtktiff/tif_fax3sm.c
39}
40
41configure   { system "cd ${worksrcpath} && ${configure.env} cmake ${configure.args} ${worksrcpath}" }
42configure.args  \
43        -DBUILD_SHARED_LIBS:BOOL=ON \
44        -DVTK_USE_RPATH:BOOL=ON \
45        -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=ON \
46        -DCMAKE_INSTALL_RPATH:STRING=${prefix}/lib/vtk-5.2 \
47        -DCMAKE_INSTALL_NAME_DIR:STRING=${prefix}/lib/vtk-5.2 \
48        -DCMAKE_INSTALL_RPATH_USE_LINK_PATH:BOOL=ON \
49        -DCMAKE_LIBRARY_PATH:PATH=${prefix}/lib \
50        -DCMAKE_INCLUDE_PATH:PATH=${prefix}/include \
51        -DCMAKE_INSTALL_PREFIX:PATH=${prefix} \
52        -DVTK_INSTALL_PREFIX:PATH=${prefix} \
53        -DVTK_USE_HYBRID:BOOL=ON \
54        -DVTK_USE_TK:BOOL=OFF \
55        -DVTK_WRAP_TCL:BOOL=OFF \
56        -DTK_INCLUDE_PATH=${prefix}/include \
57        -DTK_LIBRARY=${prefix}/lib/libtk.dylib \
58        -DVTK_USE_CARBON:BOOL=OFF \
59        -DVTK_USE_COCOA:BOOL=ON \
60        -DVTK_DATA_ROOT:PATH=${prefix}/share/VTKData \
61        -DVTK_USE_GL2PS:BOOL=ON \
62        -DVTK_WRAP_PYTHON:BOOL=OFF
63
64configure.env   \
65        LDFLAGS="-L${prefix}/lib" \
66        CPPFLAGS="-I${prefix}/include"
67
68post-configure {
69    reinplace "s|c++|c++ -L${prefix}/lib |" \
70    ${worksrcpath}/Infovis/Testing/Cxx/CMakeFiles/InfovisCxxTests.dir/link.txt \
71    ${worksrcpath}/IO/Testing/Cxx/CMakeFiles/IOCxxTests.dir/link.txt \
72    ${worksrcpath}/Views/Testing/Cxx/CMakeFiles/ViewsCxxTests.dir/link.txt
73
74    if {[variant_isset tcltk]} {
75      reinplace "s|c++|c++ -L${prefix}/lib |" \
76      ${worksrcpath}/Wrapping/Tcl/CMakeFiles/vtk.dir/link.txt
77    }
78}
79
80build.env-append DYLD_LIBRARY_PATH=${worksrcpath}/bin
81
82platform darwin 8 {
83    configure.env-append    CC=/usr/bin/gcc-4.0 CPP=/usr/bin/cpp-4.0 MACOSX_DEPLOYMENT_TARGET=10.4
84}
85
86platform darwin 9 {
87    configure.env-append    MACOSX_DEPLOYMENT_TARGET=10.5
88}
89
90default_variants +carbon +python
91
92variant x11 description {use X11} {
93    depends_build-append    port:xorg-libs
94    configure.args-delete   -DVTK_USE_COCOA:BOOL=ON
95    configure.args-append   \
96        -DVTK_USE_COCOA:BOOL=OFF \
97        -DVTK_USE_X:BOOL=ON \
98        -DOPENGL_gl_LIBRARY:FILEPATH=${x11prefix}/lib/libGL.dylib \
99        -DOPENGL_glu_LIBRARY:FILEPATH=${x11prefix}/lib/libGLU.dylib
100}
101
102variant tcltk description {build with Tcl wrappers and Tk support} {
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 description {use Carbon.  Allows embedding VTK within Qt4.} {
114    configure.args-delete \
115        -DVTK_USE_COCOA:BOOL=ON \
116        -DVTK_USE_CARBON:BOOL=OFF
117    configure.args-append \
118        -DVTK_USE_COCOA:BOOL=OFF \
119        -DVTK_USE_CARBON:BOOL=ON
120}
121
122variant python description {builds python wrappers} {
123    depends_build-append    port:python25
124    configure.args-delete   \
125        -DVTK_WRAP_PYTHON:BOOL=OFF
126    configure.args-append   \
127        -DPYTHON_DEBUG_LIBRARY:FILEPATH=${prefix}/lib/libpython2.5.dylib \
128        -DPYTHON_EXECUTABLE:FILEPATH=${prefix}/bin/python2.5 \
129        -DPYTHON_INCLUDE_PATH:FILEPATH=${prefix}/include/python2.5 \
130        -DPYTHON_LIBRARY:FILEPATH=${prefix}/lib/libpython2.5.dylib \
131        -DVTK_WRAP_PYTHON:BOOL=ON \
132        -DVTK_INSTALL_NO_PYTHON:BOOL=ON
133}
134
135set vtkdest ${destroot}${prefix}/share/doc/${name}
136
137post-destroot {
138    if {[variant_isset python]} {
139        file mkdir ${destroot}${prefix}/lib/python2.5/site-packages
140        system "cd ${worksrcpath}/Wrapping/Python; ${prefix}/bin/python2.5 setup.py install --prefix=${prefix} --root=${destroot}"
141    }
142
143    xinstall -d -m 0755 ${vtkdest}
144    file copy ${worksrcpath}/README.html ${vtkdest}
145    file copy ${worksrcpath}/Copyright.txt ${vtkdest}
146    file copy ${worksrcpath}/Testing.txt ${vtkdest}
147
148    # Provide some examples
149    file copy ${worksrcpath}/Examples ${vtkdest}
150    foreach x {CommonCxxTests FilteringCxxTests GenericFilteringCxxTests GraphicsCxxTests IOCxxTests} { file copy ${worksrcpath}/bin/$x ${vtkdest}/Examples }
151    foreach x {ImagingCxxTests RenderingCxxTests TestCxxFeatures TestInstantiator VTKBenchMark VolumeRenderingCxxTests WidgetsCxxTests} { file copy ${worksrcpath}/bin/$x ${vtkdest}/Examples }
152
153    # Provide data files
154    system "tar -C ${destroot}${prefix}/share -xzvf ${distpath}/vtkdata-${version}.tar.gz"
155}