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

name                nettle
version             3.10.2
revision            0
checksums           rmd160  115b1d7d585c9c15e8ee8a2e2aa5aab8673c54f1 \
                    sha256  fe9ff51cb1f2abb5e65a6b8c10a92da0ab5ab6eaf26e7fc2b675c45f1fb519b5 \
                    size    2644644

categories          devel crypto
maintainers         {ryandesign @ryandesign} openmaintainer
license             LGPL-2.1+

description         low-level cryptographic library

long_description    Nettle is a cryptographic library that is designed to fit \
                    easily in more or less any context: In crypto toolkits \
                    for object-oriented languages (C++, Python, Pike, ...), \
                    in applications like LSH or GNUPG, or even in kernel \
                    space. It tries to solve a problem of providing a common \
                    set of cryptographic algorithms for higher-level \
                    applications by implementing a context-independent set of \
                    cryptographic algorithms. In that light, Nettle doesn't \
                    do any memory allocation or I/O, it simply provides the \
                    cryptographic algorithms for the application to use in \
                    any environment and in any way it needs.

homepage            https://www.lysator.liu.se/~nisse/nettle/
master_sites        gnu

depends_build-append \
                    port:m4

depends_lib         port:gmp

patchfiles          no-fink.patch

# We patch configure.ac.
use_autoreconf      yes
autoreconf.args     -fvi

# error: invalid instruction mnemonic 'sha1rnds4'
compiler.blacklist  *gcc-4.* {clang < 500}
# This works around base not adding macports-gcc to the fallback list
# automatically on ppc (nettle doesn't use C++ anyway)
# <https://trac.macports.org/ticket/59195>
compiler.cxx_standard

configure.args      --disable-openssl \
                    --enable-fat \
                    --enable-shared \
                    ac_cv_path_M4=${prefix}/bin/gm4

# aes-decrypt-internal.s:73:2: error: unrecognized instruction mnemonic
# aes-decrypt-internal.s:76:8: error: vector register expected
# aes-decrypt-internal.s:77:6: error: invalid operand for instruction
# etc.
set merger_configure_args(arm64) --build=aarch64-apple-darwin${os.major}

if {(!${universal_possible} || ![variant_isset universal]) && [info exists merger_configure_args(${build_arch})]} {
    configure.args-append $merger_configure_args(${build_arch})
}

test.run            yes
test.target         check
test.env            DYLD_LIBRARY_PATH=../.lib
