source: trunk/dports/science/apbs/Portfile

Last change on this file was 149935, checked in by ryandesign@…, 13 months ago

apbs: use eq instead of == for string comparison

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 6.0 KB
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 149935 2016-07-06 01:02:51Z ryandesign@macports.org $
3
4PortSystem              1.0
5PortGroup               compiler_blacklist_versions 1.0
6PortGroup               cmake 1.0
7PortGroup               mpi 1.0
8PortGroup               github 1.0
9
10cmake.out_of_source     yes
11name                    apbs
12
13# For example, now "apbs +mpich" would be equivalent to the old "apbs-mpi +mpich"
14subport apbs-mpi {
15    replaced_by         apbs
16    PortGroup           obsolete 1.0
17    revision            2
18}
19
20categories              science
21license                 BSD
22maintainers             gmail.com:howarth.at.macports openmaintainer
23
24description             Adaptive Poisson-Boltzmann Solver
25long_description        APBS is a software package for the numerical \
26                        solution of the Poisson-Boltzmann equation, \
27                        a popular continuum model for describing \
28                        electrostatic interactions between molecular \
29                        solutes over a wide range of length scales.
30
31platforms               darwin
32
33github.setup            Electrostatics apbs-pdb2pqr d4e78c62e6a07f92c26924318d83a159fa6af063
34version                 1.4.1
35homepage                http://www.poissonboltzmann.org
36worksrcdir              ${worksrcdir}/apbs
37revision                2
38
39checksums               rmd160  5c4d583e12deb3fbc2b5a8031882311cbfd22c7e \
40                        sha256  f98ce6a51d8f813e1b4fa626c054ddbf7a985403ca30f890733cb1abf2bd6e05
41
42depends_lib             port:maloc \
43                        port:readline
44
45# dependencies are not managed correctly within this code, so errors such as from -lapbs_geoflow might occur
46# how to solve: first 'make apbs_geoflow', then 'make all'
47use_parallel_build no
48
49configure.optflags      -O3 -ffast-math
50configure.args-append   -DENABLE_OPENMP:BOOL=OFF \
51                        -DENABLE_BEM=OFF \
52                        -DCMAKE_C_COMPILER_ARG1:STRING="-I${worksrcpath}/include ${configure.cflags}" \
53                        -DCMAKE_CXX_COMPILER_ARG1:STRING="-I${worksrcpath}/include ${configure.cxxflags} -stdlib=libc++"
54
55# otherwise obsolete subport installation will fail on patch phase and not get to pre-configure error about replacement
56if {${subport} eq ${name}} {
57    patchfiles              patch-CMakeLists.txt.diff patch-Eigen-include-path.diff patch-contrib-tabipb-CMakeLists.txt.diff
58    if {[mpi_variant_isset]} {
59        patchfiles-append   patch-tests-apbs_tester.py.diff
60    }
61}
62
63test.run  yes
64test {
65    ln ${worksrcpath}/tools/manip/inputgen.py ${worksrcpath}/tests/
66    ln ${worksrcpath}/tools/manip/psize.py    ${worksrcpath}/tests/
67
68    if {[mpi_variant_isset]} {
69        if {![catch {sysctl hw.ncpu} result]} {
70            set njobs $result
71        } else {
72            set njobs 1
73        }
74        reinplace "s|mpiexec|\"${mpi.exec}\", \"-n\", \"${njobs}\"|" ${worksrcpath}/tests/apbs_tester.py
75        ui_msg "Running testsuite with $njobs jobs in parallel"
76    }
77   
78    system -W ${worksrcpath}/tests "python apbs_tester.py"
79    system -W ${worksrcpath}/tests "cat test.log"
80    system -W ${worksrcpath}/tests "if grep FAILED test.log; then echo \"FAIL\"; exit 1; fi"
81}
82
83# Some cmake tests will fail with "error: unrecognized option '-arch'" from gcc 4.6 and earlier. Same with dragonegg based on it.
84# llvm-gcc-4.2 will fail to build with: error: unrecognized command line option "-std=c++0x"
85# It comes with clang for OSX 10.6 so we need to blacklist clang to prevent it being used.
86compiler.blacklist      macports-gcc-4.4 macports-gcc-4.5 macports-gcc-4.6 \
87    macports-dragonegg-3.3 macports-dragonegg-3.4 gcc-4.2 llvm-gcc-4.2 apple-gcc-4.2 macports-llvm-gcc-4.2 {clang < 425} \
88    macports-clang-3.4 macports-clang-3.5
89# g++ will just fail to link apbs_geoflow. probably about -lstdc++ stuff. So, just use Fortran.
90compilers.choose        fc
91mpi.setup
92
93configure.args-append   -DENABLE_MPI:BOOL=OFF
94
95post-destroot {
96    set tools ${destroot}${prefix}/share/${subport}/tools
97   
98    move ${tools}/manip/psize.py ${destroot}${prefix}/bin/apbs-psize.py
99    file attributes ${destroot}${prefix}/bin/apbs-psize.py \
100        -permissions 0755
101
102    foreach {bin} [glob -tails -dir ${tools}/bin *] {
103        move ${tools}/bin/${bin} ${destroot}${prefix}/bin/apbs-${bin}
104        file attributes ${destroot}${prefix}/bin/apbs-${bin} \
105            -permissions 0755
106    }
107}
108
109pre-configure {
110    if {[mpi_variant_isset]} {
111        configure.args-delete   -DENABLE_MPI:BOOL=OFF
112        configure.args-append   -DENABLE_MPI:BOOL=ON \
113            -DMPI_C_COMPILER=${mpi.cc} \
114            -DMPI_CXX_COMPILER=${mpi.cxx}
115    }
116}
117
118variant bem description {Build with support for Boundary Element Method} {
119    configure.args-delete  -DENABLE_BEM=OFF
120    configure.args-append  -DENABLE_BEM=ON
121
122    if {![fortran_variant_isset]} {
123        ui_error "+bem requires a Fortran variant, e.g. +gccX or +g95."
124        return -code error "+bem requires a Fortran variant."
125    }
126
127    # BEM looks for 'gfortran', hard-coded, and configure fails without it if BEM is enabled, with a syntax error
128    #CMake Error at CMakeLists.txt:217 (get_filename_component):
129    #  get_filename_component called with incorrect number of arguments
130    post-patch {
131        # -lstdc++ does not seem necessary and may cause trouble; specifying full paths avoid possible use of -ltabip from an earlier installation in ${prefix}
132        reinplace "s|-L\${LIBGFORTRAN_PATH} -lgfortran -ltabipb -lstdc\+\+|${compilers.libfortran} ${worksrcpath}/lib/libtabipb.a|" ${worksrcpath}/CMakeLists.txt
133        # provide this information to subsidiary cmake command run in tabipb directory during build phase
134        reinplace "s|CMAKE_ARGS|CMAKE_ARGS -DCMAKE_Fortran_COMPILER:STRING=${configure.fc}|" ${worksrcpath}/CMakeLists.txt
135        reinplace "s|FCFLAGS|${configure.fcflags}|g" ${worksrcpath}/contrib/tabipb/CMakeLists.txt
136    }
137}
138
139# check for real releases, not github commits
140livecheck.type   regex
141livecheck.url    http://www.poissonboltzmann.org/news/
142livecheck.regex  APBS (\[0-9.\]+)
Note: See TracBrowser for help on using the repository browser.