PortSystem 1.0

name            proxytunnel
version         1.9.0
revision        2
categories      net
license         GPL-2+
platforms       darwin
maintainers     nomaintainer
installs_libs   no

description \
    ProxyTunnel is a program that connects stdin and stdout \
    to a server somewhere on the network, through a standard \
    HTTPS proxy. This will allow you for example to access \
    SSH servers when you normally only have http(s) access.

long_description ${description}

homepage        http://proxytunnel.sourceforge.net/
master_sites    sourceforge:proxytunnel

extract.suffix  .tgz
checksums       rmd160  5444861031fa256a5e0d2d83be297afc70137e8b \
                sha256  2ef5bbf8d81ddf291d71f865c5dab89affcc07c4cb4b3c3f23e1e9462721a6b9 \
                size    46556

depends_build   port:pkgconfig
depends_lib     path:lib/libssl.dylib:openssl

# patch-ssl-change.diff is contributed by juliangilbey (Julian Gilbey)
# https://trac.macports.org/ticket/59020
patchfiles      patch-Makefile.diff \
                patch-ssl-change.diff

post-patch {
    reinplace -W ${worksrcpath} s|strlcat|strlcat2|g \
        proxytunnel.h \
        setproctitle.c \
        strlcat.c \
        strzcat.c
    reinplace -W ${worksrcpath} s|strlcpy|strlcpy2|g \
        proxytunnel.h \
        setproctitle.c \
        strlcpy.c
}

use_configure       no

variant universal {}

configure.cflags-append -Wall

platform darwin {
    configure.cflags-append -DDARWIN
}

build.args-append CC=${configure.cc} CFLAGS="${configure.cflags} [get_canonical_archflags cc]"
build.target

destroot.args PREFIX=${prefix}

livecheck.type regex
livecheck.url http://sourceforge.net/projects/proxytunnel/files/proxytunnel%20source%20tarballs/
livecheck.regex "${name} (\\d+(?:\\.\\d+)+)"