Ticket #19000: Portfile

File Portfile, 11.2 KB (added by dweber@…, 16 years ago)

Portfile for vtk54

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 31356 2007-11-21 03:46:08Z ryandesign@macports.org $
3
4PortSystem 1.0
5
6name        vtk54
7version     5.4.0
8revision    0
9
10set branch      [join [lrange [split ${version} .] 0 1] .]
11
12categories  graphics devel science
13
14maintainers dweber openmaintainer
15
16description 3D visualization toolkit (www.vtk.org)
17
18long_description    \
19An open source, freely available software system for computer graphics,\
20\nimage processing, and visualization used by thousands of researchers\
21\nand developers around the world.\
22\n\nVTK consists of a C++ class library, and several interpreted interface\
23\nlayers including Tcl/Tk, Java, and Python.\
24\n\ndefault_variants: +examples +testing +tclSys
25
26homepage \
27    http://www.vtk.org/
28master_sites \
29    http://www.vtk.org/files/release/${branch}
30
31distname    vtk-${branch}
32distfiles \
33    vtk-${version}.tar.gz \
34    vtkdata-${version}.tar.gz
35
36checksums \
37    vtk-${version}.tar.gz \
38        md5  3e7c6d5c37602c935674d580a8dd43c0 \
39        sha1 a227caf932315d944cf72008d75df90dd4c554e7 \
40        rmd160 e2140fc35ed974f5fde6b418089554904e197c21 \
41    vtkdata-${version}.tar.gz \
42        md5  283d40f3e499b3a6102d86855d2ca20b \
43        sha1 a710227e7f7f25f481a36d2fa14bda49756bd39d \
44        ripemd160 160129a0580bd7b70b40d3f7fa61bbd78b586ad8
45
46platforms       darwin
47depends_build   bin:cmake:cmake
48depends_lib     port:readline
49
50post-extract {
51    system "cd ${workpath}; mv VTK ${distname}; mv VTKData ${distname}-data"
52}
53
54configure {
55    system "cd ${worksrcpath} && ${configure.env} && cmake ${configure.args} ${worksrcpath}"
56}
57
58configure.args \
59    -DVTK_USE_RPATH:BOOL=OFF \
60    -DBUILD_SHARED_LIBS:BOOL=OFF \
61    -DBUILD_EXAMPLES:BOOL=OFF \
62    -DBUILD_TESTING:BOOL=OFF \
63    -DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo \
64    -DCMAKE_INCLUDE_PATH:PATH=${prefix}/include \
65    -DCMAKE_LIBRARY_PATH:PATH=${prefix}/lib \
66    -DCMAKE_INSTALL_PREFIX:PATH=${prefix} \
67    -DCMAKE_INSTALL_NAME_DIR:STRING=${prefix}/lib \
68    -DVTK_INSTALL_PREFIX:PATH=${prefix} \
69    -DVTK_DATA_ROOT:PATH=${prefix}/share/${distname}-data \
70    -DVTK_USE_HYBRID:BOOL=ON \
71    -DVTK_USE_CARBON:BOOL=OFF \
72    -DVTK_USE_COCOA:BOOL=ON \
73    -DVTK_USE_X:BOOL=OFF \
74    -DVTK_USE_INFOVIS:BOOL=ON \
75    -DVTK_USE_PARALLEL:BOOL=ON \
76    -DVTK_USE_RENDERING:BOOL=ON \
77    -DVTK_USE_VIEWS:BOOL=ON \
78    -DVTK_WRAP_TCL:BOOL=OFF \
79    -DVTK_WRAP_JAVA:BOOL=OFF \
80    -DVTK_WRAP_PYTHON:BOOL=OFF \
81    -DPYTHON_EXECUTABLE:FILEPATH=${prefix}/bin/python2.6
82
83   
84    #-DCMAKE_EXE_LINKER_FLAGS:STRING=-rpath ${prefix}/lib \
85    #-DVTK_REQUIRED_EXE_LINKER_FLAGS:STRING=-rpath ${prefix}/lib \
86
87
88# ------------------------------------------------------------------
89# ENVIRONMENT VARIABLES
90
91#configure.env \
92#   LDFLAGS=-L${prefix}/lib \
93#   CXXFLAGS=-I${prefix}/include
94
95
96# PLATFORMS: platform darwin <version>
97# Can be used to handle different tasks depending
98# on the version of Mac OS X.  The version can be:
99# 6 for 10.2 Jaguar,
100# 7 for 10.3 Panther,
101# 8 for 10.4 Tiger, or
102# 9 for 10.5 Leopard.
103
104platform darwin 8 {
105    # I have not tested this [dweber]
106    depends_build-append \
107        port:gcc40
108    configure.env-append \
109        CC=/usr/bin/gcc-4.0 \
110        CXX=/usr/bin/cpp-4.0 \
111        MACOSX_DEPLOYMENT_TARGET=10.4
112}
113
114#VTK_REQUIRED_OBJCXX_FLAGS "-fobjc-gc"
115# When building VTK with Cocoa, in 10.5, Cocoa supports two memory models:
116# reference counting and garbage collection. This compiler flag lets it work with both.
117platform darwin 9 {
118    depends_build-append \
119        port:gcc42
120    configure.env-append \
121        CC=/usr/bin/gcc-4.2 \
122        CXX=/usr/bin/g++-4.2 \
123        MACOSX_DEPLOYMENT_TARGET=10.5
124    configure.args-append \
125        VTK_REQUIRED_OBJCXX_FLAGS="-fobjc-gc"
126}
127
128
129# ------------------------------------------------------------------
130# VARIANTS
131#
132# variant name [requires variant] [conflicts variant] [description description]
133
134default_variants \
135    +examples \
136    +testing \
137    +tclSys
138
139
140variant examples description {Build examples} {
141    configure.args-delete \
142        -DBUILD_EXAMPLES:BOOL=OFF
143    configure.args-append \
144        -DBUILD_EXAMPLES:BOOL=ON
145}
146
147
148variant testing description {Build testing} {
149    configure.args-delete \
150        -DBUILD_TESTING:BOOL=OFF
151    configure.args-append \
152        -DBUILD_TESTING:BOOL=ON
153}
154
155
156variant tclSys description conflicts tclMacPorts {Tcl Wrapper (System Tcl/Tk)} {
157    configure.args-delete \
158        -DVTK_WRAP_TCL:BOOL=OFF
159    configure.args-append \
160        -DVTK_WRAP_TCL:BOOL=ON \
161        -DTCL_TCLSH:FILEPATH=/usr/bin/tclsh \
162        -DTCL_INCLUDE_PATH:PATH=/System/Library/Frameworks/Tcl.framework/Headers \
163        -DTCL_LIBRARY:FILEPATH=/System/Library/Frameworks/tcl.framework \
164        -DTK_INCLUDE_PATH:PATH=/System/Library/Frameworks/Tk.framework/Headers \
165        -DTK_LIBRARY:FILEPATH=/System/Library/Frameworks/tk.framework
166}
167
168# This provides a tcl variant that uses the macports tcl installation. (It seems
169# vtk 5.2 does not work with tcl8.5 - macports has 8.5, as of Sep 2008).
170variant tclMacPorts conflicts tclSys description {Tcl Wrapper (MacPorts Tcl/Tk)} {
171    depends_lib-append \
172        port:tcl \
173        port:tk
174    configure.args-delete \
175        -DVTK_WRAP_TCL:BOOL=OFF
176    configure.args-append \
177        -DVTK_WRAP_TCL:BOOL=ON \
178        -DTCL_TCLSH:FILEPATH=${prefix}/bin/tclsh \
179        -DTCL_INCLUDE_PATH:PATH=${prefix}/include \
180        -DTCL_LIBRARY:FILEPATH=${prefix}/lib \
181        -DTK_INCLUDE_PATH:PATH=${prefix}/include \
182        -DTK_LIBRARY:FILEPATH=${prefix}/lib
183}
184# /opt/local/lib/tclConfig.sh
185# /opt/local/lib/tkConfig.sh
186
187
188
189variant python requires shared description {Python Wrapping for VTK} {
190   depends_build-append    port:python26
191   configure.args-delete \
192       -DVTK_WRAP_PYTHON:BOOL=OFF \
193   configure.args-append \
194       -DVTK_WRAP_PYTHON:BOOL=ON \
195       -DPYTHON_INCLUDE_PATH:FILEPATH=${prefix}/include/python2.6 \
196       -DPYTHON_LIBRARY:FILEPATH=${prefix}/lib/libpython2.6.dylib \
197       -DPYTHON_DEBUG_LIBRARY:FILEPATH=${prefix}/lib/libpython2.6.dylib \
198       -DPYTHON_EXECUTABLE:FILEPATH=${prefix}/bin/python2.6 \
199       -DVTK_PYTHON_SETUP_ARGS:STRING="--prefix=${prefix} --root=${destdir}"
200}
201
202# ---------------------------------------------------------
203# There is a problem with RPATH config for the shared libs.
204# Until this is fixed, it will not be a default variant.
205
206variant shared description {Build shared libraries} {
207    configure.args-delete \
208        -DBUILD_SHARED_LIBS:BOOL=OFF \
209        -DVTK_USE_RPATH:BOOL=OFF
210    configure.args-append \
211        -DBUILD_SHARED_LIBS:BOOL=ON \
212        -DCMAKE_INSTALL_NAME_DIR:STRING=${prefix}/lib/${distname} \
213        -DCMAKE_INSTALL_RPATH:STRING=${prefix}/lib/${distname}
214        #-DVTK_USE_RPATH:BOOL=ON
215}
216
217#-DVTK_INSTALL_LIB_DIR:STRING=${prefix}/lib/vtk-5.2
218
219#  -DBUILD_SHARED_LIBS:BOOL=ON \
220#  -DVTK_INSTALL_LIB_DIR:STRING="/lib/vtk52" \
221#  -DCMAKE_INSTALL_PREFIX:PATH=%p \
222#  -DCMAKE_INSTALL_NAME_DIR:STRING=%p/lib/vtk52 \
223#  -DVTK_USE_RPATH=ON \
224#  -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF \
225#  -DCMAKE_INSTALL_RPATH:STRING="${CMAKE_INSTALL_NAME_DIR}" \
226
227#
228#--->  Staging vtk5 into destroot
229#Warning: violation by /opt/local/opt
230#Warning: vtk5 violates the layout of the ports-filesystems!
231#Warning: Please fix or indicate this misbehavior (if it is intended), it will be an error in future releases!
232#--->  Installing vtk5 5.2.0_0+darwin_9+examples+shared+tclSys+testing
233#
234
235
236# -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=ON \
237# Cannot use this RPATH setting because the build tree is
238# used to bootstrap the build process, eg:
239#
240#[  4%] Generating vtkGLSLShaderLibrary.h
241#dyld: Library not loaded: "/opt/local/lib/vtk-5.2"/libvtksys.5.2.dylib
242#  Referenced from: /opt/local/var/macports/build/_Users_dweber_ports_graphics_vtk5/work/VTK/Utilities/MaterialLibrary/../../bin/ProcessShader
243#  Reason: image not found
244
245# Might need variants for carbon vs. cocoa.  When doing a shared library
246# build, must use carbon, not cocoa.
247
248
249
250
251#
252#It might be useful to use $x11prefix in this variant.
253#
254#variant x11 {
255#   depends_build-append    lib:libX11:XFree86
256#   configure.args-delete   -DVTK_USE_COCOA:BOOL=ON
257#   configure.args-append   -DVTK_USE_COCOA:BOOL=OFF \
258#               -DVTK_USE_X:BOOL=ON \
259#               -DOPENGL_gl_LIBRARY:FILEPATH=/usr/X11R6/lib/libGL.dylib \
260#               -DOPENGL_glu_LIBRARY:FILEPATH=/usr/X11R6/lib/libGLU.dylib
261#}
262
263
264
265# ------------------------------------------------------------------
266# POST DESTROOT
267
268set vtkDocPath  ${destroot}${prefix}/share/doc/${distname}
269set vtkDataPath ${destroot}${prefix}/share/${distname}-data
270
271# Define variables used by install_name_tool for
272# the shared libary installation RPATH
273set libdestStr ${destroot}${prefix}/bin/libvtk
274set libinstStr ${prefix}/lib/${distname}/libvtk
275
276post-destroot {
277
278    # Provide data files
279    xinstall -d -m 0755 ${vtkDataPath}
280    system "tar -C ${vtkDataPath} -zxvf ${distpath}/vtkdata-${version}.tar.gz"
281    system "mv ${vtkDataPath}/VTKData/* ${vtkDataPath}/"
282    system "rm -rf ${vtkDataPath}/VTKData"
283
284    # Add basic documentation
285    xinstall -d -m 0755 ${vtkDocPath}
286    file copy ${worksrcpath}/README.html   ${vtkDocPath}
287    file copy ${worksrcpath}/Copyright.txt ${vtkDocPath}
288    file copy ${worksrcpath}/Testing.txt   ${vtkDocPath}
289
290    # Copy examples to the documentation path
291    if {[variant_isset examples]} {
292        file copy ${worksrcpath}/Examples ${vtkDocPath}
293    }
294
295    # Provide some tests in the documentation path
296    if {[variant_isset testing]} {
297        foreach x { \
298            CommonCxxTests \
299            FilteringCxxTests \
300            GenericFilteringCxxTests \
301            GraphicsCxxTests \
302            IOCxxTests \
303            ImagingCxxTests \
304            RenderingCxxTests \
305            TestCxxFeatures \
306            TestInstantiator \
307            VTKBenchMark \
308            VolumeRenderingCxxTests \
309            WidgetsCxxTests } \
310        {
311            file copy ${worksrcpath}/bin/$x ${vtkDocPath}/Examples
312        }
313    }
314   
315    #if {[variant_isset shared]} {
316        # Must set RPATH on all .dylib for shared variant; the RPATH settings
317        # in the build are hi-jacked by the DESTDIR set by macports during
318        # 'make install'.  Add some system code here to correct the RPATH
319        # settings for shared libs?  Perhaps add the system code to the shared
320        # variant only.
321       
322        # Use install_name_tool to change the
323        # RPATH settings for each .dylib file.
324
325        # This doesn't work!
326        #system "cd ${destroot}${prefix}/bin; install_name_tool -change $libdestStr $libinstStr $*{version}.dylib"
327        # See
328        # http://qin.laya.com/tech_coding_help/dylib_linking.html
329
330        #for f in `otool -L libvtkRendering.5.2.0.dylib`; do
331        #    echo $f | grep $libdestStr;
332        #done
333   
334        # otool -L ${dylib} | grep ${libdestStr} | sed s/.dylib.*/.dylib/
335
336        # http://guide.macports.org/chunked/reference.phases.html
337        # During the destroot phase, macports issues:
338        # make install DESTDIR=${destroot}
339        # in ${worksrcpath}.
340    #}
341}
342
343# This may be useful to uninstall the port:
344# for f in `cat install_manifest.txt`; do echo $f; sudo rm $f; done
345#
346# The installation is going into:
347# /opt/local/include/vtk-5.2/
348# /opt/local/lib/vtk-5.2/
349# /opt/local/bin/vtk*
350