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

github.setup        libtom libtomcrypt 1.18.2 v
revision            1
categories          security
maintainers         nomaintainer
license             public-domain

description         Cryptographic toolkit
long_description    LibTomCrypt is a fairly comprehensive, modular and portable \
                    cryptographic toolkit that provides developers with a vast \
                    array of well known published block ciphers, one-way hash \
                    functions, chaining modes, pseudo-random number generators, \
                    public key cryptography and a plethora of other routines.
homepage            https://www.libtom.net/LibTomCrypt

distname            crypt-${version}
github.tarball_from releases
use_xz              yes

checksums           rmd160  484fa6695e84448270d45851123249276d8add8d \
                    sha256  96ad4c3b8336050993c5bc2cf6c057484f2b0f9f763448151567fbab5e767b84 \
                    size    2638064

depends_build       port:libtommath

# https://github.com/libtom/libtomcrypt/issues/614
patchfiles          patch-unbreak-10.6.diff

worksrcdir          ${name}-${version}

use_configure       no

build.args-append   CPPFLAGS="-DUSE_LTM -DLTM_DESC -I${prefix}/include/libtommath/" \
                    CFLAGS="${configure.cc_archflags}" \
                    V=1
build.target
build.env           CC=${configure.cc}

destroot.args       LIBPATH=${prefix}/lib INCPATH=${prefix}/include \
                    USER=`id -u` GROUP=`id -g` NODOCS=1

post-destroot {
    # the makefile wants to rebuild this if you tell it to install it
    xinstall -d ${destroot}${prefix}/share/doc/${name}
    xinstall -m 444 ${worksrcpath}/doc/crypt.pdf ${destroot}${prefix}/share/doc/${name}
}