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

github.setup        wolfcw libfaketime 0.9.10 v
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
revision            2
categories          sysutils
maintainers         nomaintainer
license             GPL-2

description         libfaketime modifies the system time for a single application

long_description    libfaketime intercepts various system calls that applications use to \
                    retrieve the current date and time. It can then report user-specified \
                    faked dates and times to these applications. This allows us to modify \
                    the system time an application sees without having to change the time \
                    system-wide. The faketime wrapper can be used from command line. \
                    Check the documentation on how to integrate into installed applications.

checksums           rmd160  a1f4403d48c3c61fc797b5b376830408989cc5de \
                    sha256  36ffb44ff94d208b52733d2653447b51853915c4d4b8e09a626709244ffdf691 \
                    size    88929

depends_run-append  path:libexec/coreutils/libstdbuf.so:coreutils

# timespec_get() and others
legacysupport.newest_darwin_requires_legacy 18

post-patch {
    # FAKE_SETTIME requires `clock_settime` which doesn't support by legacysupport yet
    if {${os.platform} eq "darwin" && ${os.major} <= 15} {
        reinplace "s|-DFAKE_SETTIME||g" ${worksrcpath}/src/Makefile.OSX
    }
}

compiler.thread_local_storage yes
compiler.blacklist  *cc* *dragonegg*

test.run            yes

notes {
    With System Integrity Protection (SIP) enabled on macOS 10.11 El Capitan\
    or later, it is not possible to override date and time for system\
    binaries in /bin or /usr/bin as DYLD_INSERT_LIBRARIES will be ignored.\
    This also applies to shell scripts invoked through #!/bin/sh or similar.
}
