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

github.setup            BLAKE3-team BLAKE3 1.8.7
github.tarball_from     archive
name                    libblake3
revision                0
categories              security devel
license                 {public-domain Apache-2}
maintainers             {@commitmaniac} openmaintainer

description             ${github.project} crytographic hash function
long_description        ${name} is the C implementation of the {*}${description}. It is \
                        much faster than MD5, SHA-1, SHA-2, SHA-3, and BLAKE2\; secure, \
                        unlike MD5 and SHA-1\; secure against length extensions, unlike \
                        SHA-2\; highly parallelizable, and capable of verified streaming \
                        and incremental updates.

checksums               rmd160  6afc0d73f9616bcc486bfd316bf53fd1fdf7e2e2 \
                        sha256  c6782a28842b1c0478524ac06a4f2ede784038ee298d6e2162c0b089c4306a3c \
                        size    268353

patchfiles              cxx_std_20_on_tbb_only.patch

cmake.source_dir        ${worksrcpath}/c
compiler.c_standard     1999

# error: invalid instruction mnemonic 'jc', 'jnc', 'jnz'
# error: invalid operand for instruction 'jne', 'je', 'jz'
# error: unknown use of instruction mnemonic without a size suffix 'jmp'
compiler.blacklist-append \
                        {clang < 1100}

configure.args-append   -DBUILD_SHARED_LIBS=ON

# Force portable C SIMD support on legacy platforms
# See: https://trac.macports.org/ticket/63885#comment:24
if {${configure.build_arch} in [list i386 ppc ppc64]} {
    patchfiles-append   support_legacy_platforms.patch
    configure.args-append \
                        -DBLAKE3_SIMD_TYPE=none
}
