# -*- 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.10.3 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  ee1dfc50ed1ee099ed6d40c4724dec5694c2f0e6 \
                    sha256  8ffdbd5d09d15c8717ae55497e90d6fa46f085b45ac1056f2727076da180c33e \
                    size    2504233

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:json-glib

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

build.cmd           ${prefix}/bin/scons
build.args          --prefix=${prefix} 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/
}
