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

name                devhelp
version             3.38.1
revision            1
license             GPL-2+
description         Devhelp is an API documentation browser for GTK+ and GNOME.
long_description    Devhelp is an API documentation browser for GTK+ and GNOME. It works \
                    natively with gtk-doc (the API reference framework developed for GTK+ \
                    and used throughout GNOME for API documentation). If you use gtk-doc \
                    with your project, you can use Devhelp to browse the documentation.

maintainers         {devans @dbevans} openmaintainer
categories          gnome
homepage            https://wiki.gnome.org/Apps/Devhelp
set branch          [join [lrange [split ${version} .] 0 1] .]

master_sites        gnome:sources/${name}/${branch}/

use_xz              yes

checksums           rmd160  4d890c43114992c69c93e356576ba8255f7be31f \
                    sha256  4da8f5951b3a5920df73d057beab3ebe1855a75eae41208a9d89305a6b114a8f \
                    size    313948

depends_build       port:gettext \
                    port:gtk-doc \
                    port:itstool \
                    path:bin/pkg-config:pkgconfig

depends_lib         port:amtk \
                    port:desktop-file-utils \
                    port:gettext-runtime \
                    path:lib/pkgconfig/glib-2.0.pc:glib2 \
                    path:lib/pkgconfig/gobject-introspection-1.0.pc:gobject-introspection \
                    port:gsettings-desktop-schemas \
                    path:lib/pkgconfig/gtk+-3.0.pc:gtk3 \
                    path:lib/pkgconfig/webkit2gtk-4.0.pc:webkit2-gtk

depends_run         port:adwaita-icon-theme

patchfiles          dont-use-version-script.patch \
                    meson-0.61.patch

configure.args      -Dgtk_doc=true

# gobject-introspection uses g-ir-scanner, which uses $CC from env
if {${universal_possible} && [variant_isset universal]} {
    foreach arch ${configure.universal_archs} {
        lappend merger_build_env(${arch})  "CC=${configure.cc} -arch ${arch}"
        lappend merger_destroot_env(${arch})  "CC=${configure.cc} -arch ${arch}"
    }
} else {
    build.env-append       "CC=${configure.cc} ${configure.cc_archflags}"
    destroot.env-append    "CC=${configure.cc} ${configure.cc_archflags}"
}

post-activate {
    system "${prefix}/bin/gtk-update-icon-cache -f -t ${prefix}/share/icons/hicolor"
    system "${prefix}/bin/update-desktop-database ${prefix}/share/applications"
    system "${prefix}/bin/glib-compile-schemas ${prefix}/share/glib-2.0/schemas"
}

livecheck.type      gnome
