# -*- 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           compilers 1.0

name                ape
version             2.3.1
revision            1
categories          science
platforms           darwin
license             GPL-2+
maintainers         {dstrubbe @dstrubbe}

description         A tool for generating atomic pseudopotentials within a Density-Functional Theory framework.
long_description    APE (Atomic Pseudopotentials Engine) is a computer package designed to generate \
                    and test norm-conserving pseudo-potentials within Density Functional Theory. \
                    The generated pseudo-potentials can be either non-relativistic, scalar \
                    relativistic or fully relativistic and can explicitly include \
                    semi-core states. A wide range of exchange-correlation functionals is included. \
                    APE can generate pseudopotential files for use with SIESTA, Abinit, Octopus, \
                    and Quantum Espresso.
homepage            http://www.tddft.org/programs/APE
master_sites        https://www.tddft.org/programs/APE/download/${version}

checksums           rmd160  c7b047ef4319086aac02439f6aa75d6ba8793c62 \
                    sha256  b0f30fba1098deef92715f5b77a095acf79d4996fc1a47f8691ccd211431e5ed \
                    size    641243

depends_lib         port:libxc4 port:gsl

configure.args      --with-libxc-prefix=${prefix}
configure.optflags-append  -ffree-line-length-none

compilers.choose    fc cc cpp
compilers.setup     require_fortran -g95 -clang

# g95 is disabled because of constructs regarded as illegal by this compiler.
# :info:build In file mesh_ape.f90:58
# :info:build
# :info:build     integer, private :: type !mesh type
# :info:build                     1
# :info:build Error: PRIVATE attribute at (1) is not allowed in a TYPE definition

compilers.enforce_fortran libxc4
# libxc does not have universal variant, so APE cannot either
universal_variant   no

post-destroot {
    # avoid conflict with octopus
    delete ${destroot}${prefix}/include/liboct_parser.h
}

# Note: a few tests may fail.
test.run            yes
test.target         check

livecheck.type      regex
livecheck.url       https://gitlab.com/ape/ape/tags
livecheck.regex     Release (\[0-9.\]+)
