# -*- 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
PortGroup           python 1.0

github.setup        trendmicro tlsh 4.11.2
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
name                py-tlsh
revision            0

license             Apache-2 BSD
maintainers         nomaintainer

description         Trend Micro Locality Sensitive Hash
long_description    TLSH is a fuzzy matching library. Given a byte stream with \
                    a minimum length of 50 bytes TLSH generates a hash value \
                    which can be used for similarity comparisons.

checksums           rmd160  168f70d22eac9601444b193379b6f296d0a823e8 \
                    sha256  b29531bc182061c4ae950f6f6ec5413d1653c07d197e033a1a085fc0ca3f9033 \
                    size    10244131

dist_subdir         tlsh
worksrcdir          ${distname}/py_ext

python.versions     39 310 311

if {${name} ne ${subport}} {
    depends_build-append \
                        path:bin/cmake:cmake

    pre-build {
        xinstall -d ${workpath}/${distname}/build
        system -W ${workpath}/${distname}/build "cmake -DCMAKE_C_COMPILER=${configure.cc} -DCMAKE_CXX_COMPILER=${configure.cxx} .."
    }

    pre-test {
        reinplace "s|\$file\.tlsh_EXP|\$file\.128.1.tlsh_EXP|g" ${workpath}/${distname}/Testing/python_test.sh
    }

    test.run        yes
    test.dir        ${workpath}/${distname}/Testing
    test.cmd        ./python_test.sh ${python.bin}
}
