Ticket #46296: Portfile

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