# -*- 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           legacysupport 1.1

# arc4random_buf, clock_gettime, renameat etc.
legacysupport.newest_darwin_requires_legacy 15

github.setup        kristapsdz openrsync 1878c030a784de38903afe422119ac0a84e0c4f1
version             20260706
revision            0
categories          net
license             ISC
maintainers         nomaintainer

description         Re-implementation of rsync from OpenBSD developers
long_description    rsync has specific running modes for the super-user. \
                    It also pumps arbitrary data from the network onto \
                    your file-system. ${name} is about 10 000 lines of C \
                    code: do you trust me not to make mistakes?

homepage            https://openrsync.org

checksums           rmd160  e459229666dbe54fafa7098ed8667254ccd78807 \
                    sha256  c4c89098c492a0d6c221b843af9ad2050e8437a0dfe3ab7b1d02b4433a3d4f1e \
                    size    276080
github.tarball_from archive

# https://github.com/kristapsdz/openrsync/issues/45
# https://github.com/kristapsdz/openrsync/issues/46
depends_build-append \
                    port:bmake \
                    path:bin/gmktemp:coreutils
# https://github.com/kristapsdz/openrsync/issues/47
patchfiles-append   patch-sbuf.diff
# https://github.com/kristapsdz/openrsync/issues/48
patchfiles-append   patch-fix-linking.diff

configure.env-append \
                    PATH=${prefix}/libexec/gnubin:${prefix}/bin:${prefix}/sbin:/usr/bin:/usr/sbin:/bin:/sbin

configure.pre_args  PREFIX=${prefix} \
                    MANDIR=${prefix}/share/man

# rules.c:223: error: ‘for’ loop initial declaration used outside C99 mode
# -std=c99 breaks build:
# copy.c:432: error: ‘const struct flist’ has no member named ‘dstat’
compiler.c_standard 1999
configure.cflags-append \
                    -std=gnu99

build.cmd           ${prefix}/bin/bmake
build.pre_args      MANDIR=${prefix}/share/man
