# -*- 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             42.5
license             GPL-3+
set branch          [lindex [split ${version} .] 0]
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  79db5bd36a8835273f0828f735ffa5f2b1a96ded \
                    sha256  4691a9ead4bfb6bd41a31e593749237960d81863a0985452cc133b507d249656 \
                    size    6101272

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

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:json-glib \
                    port:libarchive \
                    port:libdazzle \
                    port:libhandy \
                    path:lib/pkgconfig/libsoup-3.0.pc:libsoup \
                    port:libsecret \
                    port:libnotify \
                    port:nettle \
                    port:sqlite3 \
                    path:lib/pkgconfig/libxml-2.0.pc:libxml2 \
                    path:lib/pkgconfig/webkit2gtk-4.1.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__

# use libsoup 3 / webkit2gtk-4.1 instead of libsoup 2 / webkit2gtk-4.0
configure.args      -Dsoup2=disabled \
                    -Dlibportal=disabled

# specify a python3 version
# revert use of getrandom() not supported by macOS
patchfiles          patch-post-install-python.diff \
                    revert-getrandom-929f8f4d.patch

post-patch {
    reinplace "s|@@PYTHON3@@|${prefix}/bin/python3.14|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
