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

name                libhttpseverywhere
version             0.8.3
revision            4
license             LGPL-3+
set branch          [join [lrange [split ${version} .] 0 1] .]
categories          www
maintainers         nomaintainer

description         This library enables you to leverage the power \
                    of HTTPSEverywhere to any desktop-application.

long_description    ${description}. HTTPSEverywhere is a browser plugin \
                    that comes with a set of rules that you can use \
                    to ensure that you use HTTP instead of HTTPS only \
                    when this is absolutely not circumventable. \
                    With libhttpseverywhere you get a C-bindable, \
                    GLib-based library you can link/bind against \
                    in almost all languages

use_xz              yes

set main_distfile   ${distfiles}
set rules_distfile  default.rulesets-2019.1.7
set rules_commit    9c43785fe5ce13c70b8a1abfece834d12fc9d0fb

extract.only        ${main_distfile}

distfiles           ${main_distfile}:main \
                    ${rules_distfile}:rules

homepage            https://git.gnome.org/browse/${name}
master_sites        gnome:sources/${name}/${branch}/:main \
                    https://gitlab.gnome.org/GNOME/libhttpseverywhere/-/raw/${rules_commit}/data/default.rulesets?inline=false&dummy=:rules

checksums           ${main_distfile} \
                    rmd160  67ecbcfbfe5eba4eba47b38099ddc4ebae847403 \
                    sha256  1c006f5633842a2b131c1cf644ab929556fc27968a60da55c00955bd4934b6ca \
                    size    1139192 \
                    ${rules_distfile} \
                    rmd160  7b444fe306b26c11856ca9ecb28b092f3359151c \
                    sha256  e4c78743cd11eb718c4d218273c61a1f597610a6c3177b2a5576078c95a01564 \
                    size    6992700

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

depends_lib         path:lib/pkgconfig/glib-2.0.pc:glib2 \
                    port:json-glib \
                    path:lib/pkgconfig/gobject-introspection-1.0.pc:gobject-introspection \
                    port:libarchive \
                    port:libgee \
                    port:libsoup-2.4 \
                    port:libxml2

patchfiles          patch-vala-0.42.diff \
                    meson.patch \
                    patch-fix-typelib-generation.diff

post-patch {
    # update rulesets to 2019.1.7
    xinstall -m 644 ${distpath}/${rules_distfile} ${worksrcpath}/data/default.rulesets
    reinplace "s|@@LIB_DIR@@|${prefix}/lib|" ${worksrcpath}/src/meson.build
}

test.run            yes
test.cmd            test/httpseverywhere_test
test.target

livecheck.type      gnome
