# -*- 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           cmake 1.1
PortGroup           compilers 1.0
PortGroup           linear_algebra 1.1

name                pastix
version             6.4.0
revision            2
categories          science math
license             LGPL-3
maintainers         {mps @Schamschula} openmaintainer
description         PaStiX: sparse direct solver
long_description    {*}${description} PaStiX (Parallel Sparse matriX package) is \
                    a scientific library that provides a high performance parallel solver \
                    for very large sparse linear systems based on direct methods. \
                    Numerical algorithms are implemented in single or double precision \
                    (real or complex) using LLt, LDLt and LU with static pivoting (for \
                    non symmetric matrices having a symmetric pattern). This solver \
                    also provides some low-rank compression methods to reduce the memory \
                    footprint and/or the time-to-solution.
homepage            https://solverstack.gitlabpages.inria.fr/pastix
master_sites        https://files.inria.fr/pastix/releases/v6/

checksums           rmd160  6e66f689d2f43f4bd310650953840ee4906a047e \
                    sha256  891d426188eed56c1075fb34d2d80132593a1536ffc05cf333567f68a4811e55 \
                    size    2096924

# Code in atomic-ppc.h uses invalid syntax.
patchfiles          patch-unbreak-asm.diff

# https://github.com/OpenCMISS-Dependencies/pastix/issues/5
patchfiles-append   patch-fix-BUILDNAME.diff

post-patch {
    reinplace "s|@ARCH@|${configure.build_arch}|" ${worksrcpath}/CTestConfig.cmake
}

compilers.setup     require_fortran
compiler.blacklist-append \
                    *gcc-4.* {clang < 500}

set py_ver          314

depends_build-append \
                    path:bin/pkg-config:pkgconfig \
                    port:python${py_ver}

depends_lib-append  port:hwloc \
                    port:metis \
                    port:scotch

# Use OpenBLAS specifically here, Accelerate is not accepted.
default_variants    +openblas

pre-configure {
    configure.args-append \
                    ${cmake_linalglib}
}

# TODO: optionally support MPI.
configure.args-append \
                    -DCMAKE_Fortran_COMPILER=${configure.fc} \
                    -DPASTIX_INT64=OFF \
                    -DPASTIX_ORDERING_METIS=ON \
                    -DPASTIX_WITH_MPI=OFF

livecheck.type      regex
livecheck.url       https://files.inria.fr/pastix/releases/
livecheck.regex     ${name}-(\[0-9.\]+)${extract.suffix}
