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

github.setup        sahib rmlint 2.11.0 v
github.tarball_from archive
revision            0

homepage            https://rmlint.rtfd.org

description         Extremely fast tool to remove duplicates and other \
                    lint from your filesystem

long_description    {*}${description}. rmlint finds space waste and other \
                    broken things on your filesystem and offers to remove \
                    it.

checksums           rmd160  f8d15ecc72fc8a2e69d3eb016b4ab27d6ca93ae6 \
                    sha256  e7a20caf7f0162791f947a89931de76750daadd72be7719477278f3e949f00df \
                    size    2702392

categories          sysutils
license             GPL-3
maintainers         {gmail.com:herby.gillot @herbygillot} \
                    openmaintainer

depends_build-append \
                    port:pkgconfig   \
                    port:py311-sphinx \
                    port:scons

depends_lib-append  path:lib/pkgconfig/glib-2.0.pc:glib2 \
                    port:gettext-runtime \
                    port:json-glib

platform darwin {
    if {${os.major} < 11} {
        patchfiles-append   patch-darwin-old.diff
    }
}

build.cmd           ${prefix}/bin/scons
build.args          --without-gui VERBOSE=1
build.target

# gcc-4.2 and Xcode clang of 10.6 fail to build it
compiler.blacklist-append   *gcc-4* {clang < 421}

if {[variant_isset universal]  && [info exists universal_archs_supported]} {
    # Without this SCons builds a fake universal with a single arch
    patchfiles-append   patch-universal.diff
    post-configure {
        foreach arch ${universal_archs_supported} {
            if {[file isfile ${worksrcpath}-${arch}/SConstruct]} {
                reinplace "s|@ARCH@|${arch}|" ${worksrcpath}-${arch}/SConstruct
            }
        }
    }
}

use_configure       no

destroot {
    xinstall -m 0755 ${worksrcpath}/${name} ${destroot}${prefix}/bin/
    xinstall -m 0644 ${worksrcpath}/docs/_build/man/${name}.1 \
        ${destroot}${prefix}/share/man/man1/
}
