Ticket #46297: Portfile

File Portfile, 5.3 KB (added by bgschaid@…, 10 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$
3
4# Used the VTK5-Portfile as a basis
5
6PortSystem 1.0
7
8PortGroup qt4 1.0
9PortGroup mpi 1.0
10PortGroup   cmake 1.0
11PortGroup select 1.0
12
13name        paraview42
14version     4.2.0
15revision    1
16set branch  [join [lrange [split ${version} .] 0 1] .]
17#
18# There was a stealth-update of vtkdata-5.10.1 that invalidated the checksums of that file.
19# (see https://trac.macports.org/wiki/PortfileRecipes#stealth-updates) Remove the 'dist_subdir'
20# line when the next proper version of vtk5 is released...
21#
22dist_subdir   ${name}/${version}_1
23#
24categories  science graphics
25maintainers nomaintainer
26description 3D data analysis and visualization application
27long_description    ParaView is an open-source, multi-platform data \
28    analysis and visualization application. ParaView users can quickly \
29    build visualizations to analyze their data using qualitative and \
30    quantitative techniques. The data exploration can be done \
31    interactively in 3D or programmatically using ParaViews batch \
32    processing capabilities.
33
34license     BSD
35
36homepage    http://www.paraview.org/
37platforms   darwin
38master_sites    http://www.paraview.org/files/v${branch}/
39
40distfiles           ParaView-v${version}-source${extract.suffix}
41checksums           ParaView-v${version}-source${extract.suffix} \
42                    sha256 ac26cc5fe5ce82d27531727a01242353d40984826eaa580edea0791887a07b6b \
43                    rmd160 c326c70e15c2555ddf0700020b8f62c5f69b7a92
44
45depends_build-append    port:readline \
46    port:gmake \
47    port:netcdf \
48    port:qt4-mac-sqlite3-plugin
49
50depends_run             port:paraview_select
51
52distname    ${name}-${version}-src
53
54patchfiles patch-vtkProcessModuleInitializePython.h.diff
55patch.dir ${workpath}/ParaView-v${version}-source
56
57default_variants +python27 +llvm +openmpi +ffmpeg
58# +gcc49 causes a segmentation fault
59
60# patchfiles
61
62use_parallel_build yes
63# use_parallel_build no
64
65compilers.choose cxx cc
66mpi.choose
67mpi.setup
68compilers.setup
69
70configure.args-append  \
71        -DBUILD_SHARED_LIBS:BOOL=ON \
72        -DPARAVIEW_DO_UNIX_STYLE_INSTALLS:BOOL=ON
73
74configure.cxxflags-append \
75        -DUSE_INTERP_ERRORLINE
76configure.cppflags-replace -I${prefix}/include -isystem${prefix}/include
77
78build.env-append DYLD_LIBRARY_PATH=${worksrcpath}/bin
79
80variant ffmpeg description {Add support for FFMPEG} {
81    depends_lib-append port:ffmpeg
82    configure.args-append -DPARAVIEW_ENABLE_FFMPEG:BOOL=ON
83}
84
85set pythons_suffixes {27}
86
87set pythons_ports {}
88foreach s ${pythons_suffixes} {
89    lappend pythons_ports python${s}
90}
91
92foreach s ${pythons_suffixes} {
93    set p python${s}
94    set v [string index ${s} 0].[string index ${s} 1]
95    set i [lsearch -exact ${pythons_ports} ${p}]
96    set c [lreplace ${pythons_ports} ${i} ${i}]
97    eval [subst {
98        variant ${p} description "Use Python" conflicts ${c} {
99           depends_lib-append port:${p}
100
101           configure.args-append   \
102                -DPARAVIEW_ENABLE_PYTHON:BOOL=ON \
103                -DPYTHON_DEBUG_LIBRARY:FILEPATH=${prefix}/lib/libpython${v}.dylib \
104                -DPYTHON_EXECUTABLE:FILEPATH=${prefix}/bin/python${v} \
105                -DPYTHON_INCLUDE_PATH:FILEPATH=${frameworks_dir}/Python.framework/Versions/${v}/Headers \
106                -DPYTHON_LIBRARY:FILEPATH=${prefix}/lib/libpython${v}.dylib
107           depends_lib-append port:py${s}-numpy port:py${s}-matplotlib
108        }
109    }]
110}
111
112select.group            paraview
113select.file             ${filespath}/paraview[string map {. {}} ${branch}]
114set confdir config-${branch}m
115
116notes "
117To make paraview ${branch} the default (i.e. the version you get when you run\
118'paraview'), please run:
119
120sudo port select --set ${select.group} [file tail ${select.file}]
121"
122
123pre-configure {
124    configure.args-delete -DCMAKE_OSX_SYSROOT="/"
125
126    configure.args-append  \
127        -DBUILD_TESTING:BOOL=OFF \
128        -DPARAVIEW_INSTALL_DEVELOPMENT_FILES:BOOL=ON \
129        -DCMAKE_CXX_COMPILER=${configure.cxx} \
130        -DCMAKE_C_COMPILER=${configure.cc}
131
132    if {[mpi_variant_isset]} {
133        configure.args-append  \
134            -DPARAVIEW_USE_MPI:BOOL=ON \
135            -DMPI_C_COMPILER=${mpi.cc} \
136            -DMPI_CXX_COMPILER=${mpi.cxx} \
137            -DMPIEXEC=${mpi.exec} \
138            -DMPI_EXEC=${mpi.exec}
139    }
140
141    configure.args-append  ${workpath}/ParaView-v${version}-source
142}
143
144post-configure {
145    system "cd ${worksrcpath}/lib && ln -s . paraview-${branch}"
146}
147
148post-build {
149#    copy ${worksrcpath}/bin/paraview.app/Contents/MacOS/paraview ${worksrcpath}/bin/
150}
151
152post-destroot {
153    #    copy ${worksrcpath}/bin/paraview ${destroot}${prefix}/bin
154    copy ${worksrcpath}/bin/paraview.app/Contents/MacOS/paraview ${destroot}${prefix}/bin
155    system "rm -r ${destroot}${prefix}/var/macports"
156    system "rm -r ${destroot}${prefix}/share/man/man3"
157    system "/usr/bin/install_name_tool -change ${worksrcpath}/lib/libprotobuf.dylib @executable_path/../lib/paraview-${branch}/libprotobuf.dylib ${destroot}${prefix}/bin/paraview"
158    foreach f  [glob ${destroot}${prefix}/bin/*] {
159        if {![string match {*-pv*} ${f}]} {
160            if {![string match {*.app} ${f}]} {
161                move ${f} ${f}-${branch}
162            }
163        }
164    }
165    foreach f  [glob ${destroot}${prefix}/lib/cmake/*.cmake] {
166        move ${f} ${f}-${branch}
167    }
168}