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

# No release since v0.98.1 in 2015; master carries seven years of fixes.
github.setup        imneme pcg-cpp 428802d1a5634f96bcd0705fab379ff0113bcf13
version             0.98.1-20220408
revision            1
categories          devel

# This is NOT a noarch port: while header-only, headers are patched to fix BE.
# Using any_any.noarch will allow installing broken version from upstream MacPorts.

license             {Apache-2 MIT}
maintainers         @jrjsmrtn openmaintainer

description         PCG family of random number generators for C++

long_description    PCG is a family of simple, fast, statistically good \
                    random number generators. This header-only C++ library \
                    provides them with an interface compatible with \
                    the C++11 <random> engines.

checksums           rmd160  0fc8fb3d330df69d754c53594069dbfbd22e2073 \
                    sha256  79f23706ed0cbc1bb57ea35d50d0abed66898b8f7b0bcf2aaecdfd234863b060 \
                    size    78224
github.tarball_from archive

# https://github.com/imneme/pcg-cpp/issues/93
patch.pre_args-replace  -p0 -p1
patchfiles          pcg-cpp-ppc-big-endian.patch

use_configure       no

compiler.cxx_standard   2011

build               { }

destroot {
    xinstall -d ${destroot}${prefix}/include
    xinstall -m 0644 {*}[glob ${worksrcpath}/include/*.hpp] ${destroot}${prefix}/include
}

test.run            yes
test {
    system -W ${worksrcpath}/test-high "${build.cmd} test CXX=${configure.cxx} 2>&1 | tee test.log \
        && ! grep -q '^ERROR:' test.log && grep -q '^All tests' test.log"
}
