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

github.setup        hrs-allbsd spegla 1.1p5 v
revision            0
categories          net ftp
license             BSD
maintainers         nomaintainer

description         Spegla is a mirror program for FTP sites
long_description    {*}${description}

checksums           rmd160  a7b7a3933d08c7753634a2a5f0d5907b92d755ef \
                    sha256  9cecdb5ddeb25012f5bd02f27f0feb340fa36526eff122e862d42be004d7722f \
                    size    101505
github.tarball_from archive

patchfiles-append   0001-Fix-build-with-Apple-clang.patch \
                    0002-Add-MacOS-makefile.patch \
                    0003-Handle-strlcpy.h-coherently.patch

# This is done in post-patch, because we first create the makefile.
# The generic one is broken: https://github.com/hrs-allbsd/spegla/issues/1
post-patch {
    delete ${worksrcpath}/Makefile
    move ${worksrcpath}/Makefile.macosx ${worksrcpath}/Makefile
}

build.target        ${name}

destroot {
    copy ${worksrcpath}/${name} ${destroot}${prefix}/bin
    set docdir ${prefix}/share/${name}/docs
    set exadir ${prefix}/share/${name}/examples
    xinstall -d ${destroot}${docdir}
    xinstall -d ${destroot}${exadir}
    xinstall -m 0644 -W ${worksrcpath} freebsd.org netbsd.org spegla.conf spegla.sh ${destroot}${exadir}
    xinstall -m 0644 -W ${worksrcpath} CHANGELOG header.txt README TODO ${destroot}${docdir}
}
