# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4

PortSystem          1.0
PortGroup           meson 1.0
PortGroup           active_variants 1.1

name                epiphany
version             3.36.4
revision            6
license             GPL-2+
set branch          [join [lrange [split ${version} .] 0 1] .]
description         A GNOME Web browser.
long_description    A web browser is more than an application, it is a \
                    way of thinking, it is a way of seeing the world. \
                    Epiphany's principles are simplicity and standards \
                    compliance.
maintainers         {devans @dbevans} openmaintainer
categories          gnome www
homepage            https://wiki.gnome.org/Apps/Web
master_sites        gnome:sources/${name}/${branch}/

use_xz              yes

checksums           rmd160  a18c01eb4221258a213b141fa4d413f61235ca97 \
                    sha256  588a75b1588f5a509c33cf0be6a38a0f4fc1748eeb499a51d991ddef485242bf \
                    size    5824436

depends_build-append \
                    port:pkgconfig \
                    port:appstream-glib \
                    port:gettext \
                    port:itstool \
                    port:python310

depends_lib-append  port:desktop-file-utils \
                    port:gcr \
                    port:gettext-runtime \
                    port:gsettings-desktop-schemas \
                    path:lib/pkgconfig/gtk+-3.0.pc:gtk3 \
                    path:lib/pkgconfig/glib-2.0.pc:glib2 \
                    path:lib/pkgconfig/icu-uc.pc:icu \
                    port:iso-codes \
                    port:libdazzle \
                    port:libhandy-0.0 \
                    port:libsoup-2.4 \
                    port:libsecret \
                    port:libnotify \
                    port:nettle \
                    port:sqlite3 \
                    path:lib/pkgconfig/webkit2gtk-4.0.pc:webkit2-gtk

depends_run         port:adwaita-icon-theme \
                    port:gnome-keyring

# lib/ephy-web-app-utils.h:23:10: fatal error: 'gio/gdesktopappinfo.h' file not found
require_active_variants path:lib/pkgconfig/glib-2.0.pc:glib2 x11

compiler.c_standard 2011

# fix the way the JSC_API_AVAILABLE macro works in WebKitAvailablity.h
# fixes JSValueRef.h:54:18: error: missing ',' between enumerators
#    kJSTypeSymbol JSC_API_AVAILABLE(macosx(JSC_MAC_TBA), ios(JSC_IOS_TBA))
configure.cppflags-append -DBUILDING_GTK__

# specify a python3 version
# revert use of getrandom() not supported by macOS
# see https://gitlab.gnome.org/GNOME/epiphany/-/commit/929f8f4d9e89c7751e6a6f15c1915349a2851c97

patchfiles          patch-post-install-python.diff \
                    revert-getrandom-929f8f4d.patch \
                    fix-i18n-issue-meson-0.60.patch

post-patch {
    reinplace "s|@@PYTHON3@@|${prefix}/bin/python3.10|g" post_install.py
}

post-activate {
    system "${prefix}/bin/update-desktop-database -q ${prefix}/share/applications"
    system "${prefix}/bin/glib-compile-schemas ${prefix}/share/glib-2.0/schemas"
}

livecheck.type      gnome
