# -*- 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 3.17.0
name                py-tlsh
revision            0

platforms           darwin
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  90f6cb3e093bac0e3070d7032a48aaf9632463b6 \
                    sha256  5a732a90d9e80ff42706eb1b02c4d4bff71db86d6449ea7da03e7c1bfa81804b \
                    size    2829369

dist_subdir         tlsh
worksrcdir          ${distname}/py_ext

python.versions     37 38

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 {
        test.env    PYTHONPATH=[glob -nocomplain ${worksrcpath}/build/lib*]
        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}
    test.target

    livecheck.type  none
}
