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

github.setup        radareorg iaito 6.2.0
github.tarball_from archive
revision            0

categories          devel aqua
license             GPL-3
maintainers         {i0ntempest @i0ntempest} openmaintainer

description         Fork of Cutter from the last working commit with radare2
long_description    iaito (formerly Cutter) is a free and open-source reverse engineering framework\
                    powered by radare2. Its goal is making an advanced, customizable\
                    and FOSS reverse-engineering platform while keeping the user\
                    experience at mind. Cutter is created by reverse engineers for\
                    reverse engineers.

homepage            https://www.radare.org/n/iaito.html

checksums           rmd160  1a78d9239b8c03187ceb07f0ea9b09d1ecd927ba \
                    sha256  a4c9763f47106b9bdc5a42bc48afaf4054e0496eb7192b95790079bfd0e2de43 \
                    size    2545939

# Port prone to stelth updates even after releasing
# Consider waiting for a few days before updating to a new version
depends_build-append \
                    path:bin/pkg-config:pkgconfig
depends_lib-append  port:radare2 \
                    port:capstone
depends_run-append  path:bin/dot:graphviz

qt6.depends_build   qttools
qt6.depends_lib     qtsvg

compiler.cxx_standard \
                    2020

post-patch {
    system -W ${worksrcpath}/src "sed -i '' '1i\\\nQMAKE_MACOSX_DEPLOYMENT_TARGET = ${macosx_deployment_target}\\\n' Iaito.pro"
    reinplace -E "s|-mmacosx-version-min=\[0-9\]+\\.\[0-9\]+|-mmacosx-version-min=${macosx_deployment_target}|g" src/Iaito.pro
}

configure.args-append \
                    ${worksrcpath}/src/Iaito.pro \
                    -config release

destroot {
    file copy ${worksrcpath}/${name}.app ${destroot}${applications_dir}
    ln -s ${applications_dir}/${name}.app/Contents/MacOS/${name} ${destroot}${prefix}/bin/
    xinstall -m 644 ${worksrcpath}/src/${name}.1 ${destroot}${prefix}/share/man/man1/
}
