Fetching contributors…
Cannot retrieve contributors at this time
136 lines (111 sloc) 5.9 KB
# -*- 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
PortSystem 1.0
PortGroup compiler_blacklist_versions 1.0
PortGroup cmake 1.0
PortGroup mpi 1.0
PortGroup github 1.0
cmake.out_of_source yes
name apbs
categories science
license BSD
maintainers { @jwhowarth} openmaintainer
description Adaptive Poisson-Boltzmann Solver
long_description APBS is a software package for the numerical \
solution of the Poisson-Boltzmann equation, \
a popular continuum model for describing \
electrostatic interactions between molecular \
solutes over a wide range of length scales.
platforms darwin
github.setup Electrostatics apbs-pdb2pqr d4e78c62e6a07f92c26924318d83a159fa6af063
version 1.4.1
worksrcdir ${worksrcdir}/apbs
revision 4
checksums rmd160 5c4d583e12deb3fbc2b5a8031882311cbfd22c7e \
sha256 f98ce6a51d8f813e1b4fa626c054ddbf7a985403ca30f890733cb1abf2bd6e05
depends_lib port:maloc \
# dependencies are not managed correctly within this code, so errors such as from -lapbs_geoflow might occur
# how to solve: first 'make apbs_geoflow', then 'make all'
use_parallel_build no
configure.optflags -O3 -ffast-math
configure.args-append -DENABLE_OPENMP:BOOL=OFF \
-DCMAKE_C_COMPILER_ARG1:STRING="-I${worksrcpath}/include ${configure.cflags}" \
-DCMAKE_CXX_COMPILER_ARG1:STRING="-I${worksrcpath}/include ${configure.cxxflags} -stdlib=libc++"
# otherwise obsolete subport installation will fail on patch phase and not get to pre-configure error about replacement
if {${subport} eq ${name}} {
patchfiles patch-CMakeLists.txt.diff patch-Eigen-include-path.diff patch-contrib-tabipb-CMakeLists.txt.diff patch-pbsolvercz.cpp.diff
if {[mpi_variant_isset]} {
} yes
test {
ln ${worksrcpath}/tools/manip/ ${worksrcpath}/tests/
ln ${worksrcpath}/tools/manip/ ${worksrcpath}/tests/
if {[mpi_variant_isset]} {
if {![catch {sysctl hw.ncpu} result]} {
set njobs $result
} else {
set njobs 1
reinplace "s|mpiexec|\"${mpi.exec}\", \"-n\", \"${njobs}\"|" ${worksrcpath}/tests/
ui_msg "Running testsuite with $njobs jobs in parallel"
system -W ${worksrcpath}/tests "python"
system -W ${worksrcpath}/tests "cat test.log"
system -W ${worksrcpath}/tests "if grep FAILED test.log; then echo \"FAIL\"; exit 1; fi"
# Some cmake tests will fail with "error: unrecognized option '-arch'" from gcc 4.6 and earlier. Same with dragonegg based on it.
# llvm-gcc-4.2 will fail to build with: error: unrecognized command line option "-std=c++0x"
# It comes with clang for OSX 10.6 so we need to blacklist clang to prevent it being used.
compiler.blacklist macports-gcc-4.4 macports-gcc-4.5 macports-gcc-4.6 \
macports-dragonegg-3.4 gcc-4.2 llvm-gcc-4.2 apple-gcc-4.2 macports-llvm-gcc-4.2 {clang < 425} \
macports-clang-3.4 macports-clang-3.5
# g++ will just fail to link apbs_geoflow. probably about -lstdc++ stuff. So, just use Fortran.
compilers.choose fc
configure.args-append -DENABLE_MPI:BOOL=OFF
post-destroot {
set tools ${destroot}${prefix}/share/${subport}/tools
move ${tools}/manip/ ${destroot}${prefix}/bin/
file attributes ${destroot}${prefix}/bin/ \
-permissions 0755
foreach {bin} [glob -tails -dir ${tools}/bin *] {
move ${tools}/bin/${bin} ${destroot}${prefix}/bin/apbs-${bin}
file attributes ${destroot}${prefix}/bin/apbs-${bin} \
-permissions 0755
pre-configure {
if {[mpi_variant_isset]} {
configure.args-delete -DENABLE_MPI:BOOL=OFF
configure.args-append -DENABLE_MPI:BOOL=ON \
variant bem description {Build with support for Boundary Element Method} {
configure.args-delete -DENABLE_BEM=OFF
configure.args-append -DENABLE_BEM=ON
if {![fortran_variant_isset]} {
ui_error "+bem requires a Fortran variant, e.g. +gccX or +g95."
return -code error "+bem requires a Fortran variant."
# BEM looks for 'gfortran', hard-coded, and configure fails without it if BEM is enabled, with a syntax error
#CMake Error at CMakeLists.txt:217 (get_filename_component):
# get_filename_component called with incorrect number of arguments
post-patch {
# -lstdc++ does not seem necessary and may cause trouble; specifying full paths avoid possible use of -ltabip from an earlier installation in ${prefix}
reinplace "s|-L\${LIBGFORTRAN_PATH} -lgfortran -ltabipb -lstdc\+\+|${compilers.libfortran} ${worksrcpath}/lib/libtabipb.a|" ${worksrcpath}/CMakeLists.txt
# provide this information to subsidiary cmake command run in tabipb directory during build phase
reinplace "s|CMAKE_ARGS|CMAKE_ARGS -DCMAKE_Fortran_COMPILER:STRING=${configure.fc}|" ${worksrcpath}/CMakeLists.txt
reinplace "s|FCFLAGS|${configure.fcflags}|g" ${worksrcpath}/contrib/tabipb/CMakeLists.txt
# check for real releases, not github commits
livecheck.type regex
livecheck.version ${version}
livecheck.regex APBS (\[0-9.\]+)