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

epoch               1
github.setup        uzbl uzbl 0.9.1 v
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
checksums           rmd160  6d2bbbf966112921af8d7fa4e79f57fa5f0bf70e \
                    sha256  471f171c6534c9984b714707ccd0df983278e1884d603537a5f24e79cd4b7d5a \
                    size    257551

categories          www
license             GPL-3
maintainers         {ryandesign @ryandesign} openmaintainer

description         Uzbl Web Browser

long_description    ${name} is a web browser that adheres to the UNIX philosophy.

homepage            https://www.uzbl.org

depends_build       port:pkgconfig

depends_lib         path:lib/pkgconfig/gtk+-2.0.pc:gtk2 \
                    port:libsoup-2.4 \
                    port:python27 \
                    path:lib/pkgconfig/webkit-1.0.pc:webkit-gtk

depends_run         port:py27-configparser \
                    port:py27-pygtk \
                    port:py27-six

configure.python    ${prefix}/bin/python2.7

post-patch {
    foreach f [concat [glob ${worksrcpath}/bin/*] [glob ${worksrcpath}/examples/data/scripts/*]] {
        if {[file isfile ${f}]} {
            reinplace -E -q "s|#!/usr/bin/env python2?|#!${configure.python}|g" ${f}
        }
    }
}

use_configure       no

variant universal {}

build.args          CC="${configure.cc} [get_canonical_archflags cc]" \
                    ENABLE_GTK3=no \
                    PREFIX=${prefix} \
                    PYTHON=${configure.python}

destroot.args       {*}${build.args}

post-destroot {
    xinstall -d ${destroot}${frameworks_dir}/Python.framework/Versions/2.7/lib/python2.7
    move ${destroot}${prefix}/lib/python2.7/site-packages ${destroot}${frameworks_dir}/Python.framework/Versions/2.7/lib/python2.7/
}

platform darwin {
    if {${configure.cxx_stdlib} eq "libstdc++"} {
        depends_lib-replace \
                    path:lib/pkgconfig/webkit-1.0.pc:webkit-gtk \
                    path:lib/pkgconfig/webkit-1.0.pc:webkit-gtk-2.0
    }
}
