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

name                flawfinder
version             2.0.19
revision            1
categories          devel
license             GPL-2+
maintainers         {khindenburg @kurthindenburg} openmaintainer

description         Examines C/C++ source code for security flaw
long_description \
    Program that examines source code and reports possible  \
    security weaknesses (``flaws'') sorted by risk level.   \
    It's very useful for quickly finding and removing at    \
    least some potential security problems before a program \
    is widely released to the public.

homepage            https://dwheeler.com/flawfinder/
platforms           any
supported_archs     noarch
master_sites        ${homepage}

checksums           rmd160  df7d640994ae690eed26d68cfd001e95f8016be9 \
                    sha256  fe550981d370abfa0a29671346cc0b038229a9bd90b239eab0f01f12212df618 \
                    size    260817

set python_branch   3.10
set python_version  [string map {. ""} ${python_branch}]

depends_lib         port:python${python_version}

use_configure       no
build.target

destroot {
    reinplace       "s|#!/usr/bin/env python|#!${prefix}/bin/python${python_branch}|" ${worksrcpath}/${name}.py
    xinstall -m 755 ${worksrcpath}/${name}.py ${destroot}${prefix}/bin
        xinstall -m 644 ${worksrcpath}/${name}.1 \
        ${destroot}${prefix}/share/man/man1
}

depends_test-append port:py${python_version}-setuptools
test.run            yes
test.target         check
test.env-append     PYTHON3=${prefix}/bin/python${python_branch}

notes "The executable name has changed to ${name}.py"