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

name                surf
version             2.1
license             MIT

categories          www
maintainers         nomaintainer
description         simple webkit2-gtk-based browser
long_description    surf is a simple Web browser based on WebKit2/GTK+. It is able to display \
    websites and follow links. It supports the  XEmbed protocol which makes it possible to embed \
    it in another application. Furthermore, one can point surf to another URI by setting its XProperties.


homepage            https://surf.suckless.org/

master_sites        https://dl.suckless.org/${name}/

checksums           rmd160  76d6a7090c276c946ce50c73a70bb986ffdda3bc \
                    sha256  72e582920ba25a646203e93c2d2331d87f03037a28894d6c7e99af00ee043257 \
                    size    22555
                    
depends_build-append \
                    port:pkgconfig

depends_lib-append  port:gcr \
                    path:lib/pkgconfig/webkit2gtk-4.1.pc:webkit2-gtk \
                    path:lib/pkgconfig/gtk+-3.0.pc:gtk3 \
                    port:dmenu

depends_run-append  port:xprop

# uses X11 specific code in UI
require_active_variants \
                    path:lib/pkgconfig/gtk+-3.0.pc:gtk3 x11

use_configure       no

patchfiles-append   patch-config-mk.diff \
                    patch-surf-Style-namecollision.diff \
                    patch-downloader.diff

post-patch {
    reinplace "s|@@MACPORTS_PREFIX@@|${prefix}|g" ${worksrcpath}/config.mk
    reinplace "s|-Wl,-soname,\$@|-install_name ${prefix}/lib/surf/\$@|" ${worksrcpath}/Makefile
}

configure.cc-append -DBUILDING_GTK__

build.args          CC="${configure.cc}"
destroot.args       CC="${configure.cc}"
                    
livecheck.type      regex
livecheck.url       ${master_sites}
livecheck.regex     ${name}-(\\d+(?:\\.\\d+)*)
