# -*- 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                fakeroot
version             1.37
revision            0
checksums           rmd160  a8061b050398be469619d4bba9eaca0eae830fb8 \
                    sha256  9831cc912bc1da6dadac15699c5a07a82c00d6f0dd5c15ec02e20908dd527d3a \
                    size    587210

categories          sysutils
license             GPL-3+
maintainers         {ryandesign @ryandesign} openmaintainer

description         Tool for simulating superuser privileges
long_description    fakeroot runs a command in an environment where it \
                    appears to have root privileges for file manipulation. \
                    It does this by means \
                    of LD_PRELOAD and SYSV IPC (or TCP) trickery.

homepage            https://wiki.debian.org/FakeRoot/

master_sites        debian:f/${name}
distname            ${name}_${version}.orig
worksrcdir          ${name}-${version}

patchfiles          patch-message.h.diff

# https://trac.macports.org/wiki/WimplicitFunctionDeclaration#strchr
configure.checks.implicit_function_declaration.whitelist-append strchr

configure.args      --disable-static

platform darwin {
    if {${os.major} == 18 || ${os.major} == 19} {
        universal_variant                       no
    } else {
        default_variants                        +universal
        variant_set                             universal

        configure.universal_archs               x86_64

        if {${os.major} <= 9} {
            configure.universal_archs-append    ppc64
        }

        if {${os.major} <= 10} {
            configure.universal_archs-append    ppc
        }

        if {${os.major} <= 17} {
            configure.universal_archs-append    i386
        }

        if {${os.major} >= 20} {
            configure.universal_archs-append    arm64
        }

        if {${os.major} == 8} {
            configure.cflags-append             -mmacosx-version-min=10.4
        }

        if {${os.major} >= 9 && ${os.major} <= 10} {
            configure.ldflags-append            -Wl,-force_cpusubtype_ALL
        }
    }

    if {${os.major} >= 10} {
        configure.cflags-append                 -Wno-deprecated-declarations
    }

    if {${os.major} >= 11} {
        configure.cflags-append                 -Wno-extra-tokens
    }
}

test.run            yes
test.target         check

livecheck.type      regex
livecheck.url       https://packages.debian.org/unstable/fakeroot
livecheck.regex     {fakeroot \(([\d.]+)}