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

name                    alglib
version                 4.08.0
revision                0
categories              math
license                 GPL-2+
maintainers             {mcalhoun @MarcusCalhoun-Lopez} openmaintainer
description             a cross-platform numerical analysis and data processing library
long_description        ALGLIB is ${description}.

homepage                http://www.alglib.net
master_sites            ${homepage}/translator/re/

extract.suffix          .cpp.gpl.tgz

checksums               rmd160  909ec840b059b35e4ed016815896fdd43d4ce8b6 \
                        sha256  98a3ed084fb02c56a0bc154389d6bca100b23bb3749255a4c87163922a776a86 \
                        size    4276550

worksrcdir              ${name}-cpp

post-extract {
    # CMakeLists.txt is taken from https://src.fedoraproject.org/rpms/alglib/raw/rawhide/f/CMakeLists.txt
    copy ${filespath}/CMakeLists.txt ${worksrcpath}/
}

patch.pre_args-replace  -p0 -p1

# http://bugs.alglib.net/view.php?id=1025
patchfiles-append       alglib-1byte-bool.patch
# Fix constants in tests:
patchfiles-append       test_c_uint64_literals.patch

configure.args-append   -DALGLIB_VERSION=${version} \
                        -DALGLIB_VERSION_MAJOR=[lindex [split ${version} .] 0]

test.run                yes
test.args-append        DYLD_LIBRARY_PATH=${cmake.build_dir}
