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

github.setup                        xroche httrack 3.50.2
github.tarball_from                 releases
revision                            0
categories                          net
maintainers                         {mathiesen.info:macintosh @BjarneDMat} openmaintainer
license                             GPL-2+

description                         Website Copier/Offline Browser
long_description \
    HTTrack is an offline browser utility that allows you to \
    download a website from the Internet to a local directory.

homepage                            https://www.httrack.com/

checksums                           rmd160  890f457340997c1251ca13e79973ce7eafdb7e66 \
                                    sha256  bde231415a42adf793e5272ce436a5c22377dab94b0b2e395e3cee7c298343f0 \
                                    size    5415612

depends_build-append                path:bin/pkg-config:pkgconfig

depends_lib-append                  port:libiconv \
                                    port:zlib

patchfiles                          patch-src-htsweb.c.diff \
                                    patch-src-webhttrack.diff \
                                    patch-u_int.diff

post-patch {
    reinplace "s|@PREFIX@|${prefix}|" ${worksrcpath}/src/htsweb.c
}

configure.args-append               --with-sysroot=${prefix} \
                                    --with-zlib=${prefix} \
                                    --disable-origin-rpath \
                                    --disable-ipv6

variant ipv6 description {Enable IPv6 support} {
    configure.args-replace          --disable-ipv6  --enable-ipv6
}

default_variants                    +ipv6

post-destroot {
    # Remove metadata files not used by darwin or OS X
    file delete -force ${destroot}${prefix}/share/pixmaps/
    file delete -force ${destroot}${prefix}/share/applications/
}

test.run                            yes
test.target                         check
