# -*- 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.12.0
github.tarball_from archive
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  e6359c891e42704676b9767ed5835d2e85a2f388 \
                    sha256  93d206e999d51b25bc800f01c1a88dd632849b1555ca8680264486738f39f3c2 \
                    size    10243473

dist_subdir         tlsh
worksrcdir          ${distname}/py_ext

python.versions     310 311 312 313

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}
}
