# -*- 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           active_variants 1.1
PortGroup           gitlab 1.0
PortGroup           legacysupport 1.1
PortGroup           meson 1.0
PortGroup           muniversal 1.0

set real_name       gnome-desktop
name                ${real_name}-gtk4

gitlab.instance     https://gitlab.gnome.org
gitlab.setup        GNOME ${real_name} 44.5
revision            0
maintainers         nomaintainer
categories          gnome
license             LGPL-2+
description         ${name} contains the libgnome-desktop library as well as a data \
                    file that exports the GNOME version to the Settings Details panel

long_description    {*}${description}. The libgnome-desktop library provides API shared \
                    by several applications on the desktop, but that cannot live \
                    in the platform for various reasons. Documentation for the API \
                    is available with gtk-doc.

homepage            https://www.gnome.org
use_bzip2           yes

checksums           rmd160  18d83829f4ba17fc4ccdcaa181cfe78c66f4d8ef \
                    sha256  7bda9d5998ee99fa11ef4defabed19a78ca2b71dd9a61876039f39a62d75dc8d \
                    size    944631

conflicts           gnome-desktop

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

depends_lib-append  path:lib/pkgconfig/cairo.pc:cairo \
                    path:lib/pkgconfig/fontconfig.pc:fontconfig \
                    path:lib/pkgconfig/gdk-pixbuf-2.0.pc:gdk-pixbuf2 \
                    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/gtk4.pc:gtk4 \
                    port:iso-codes \
                    port:libxkbcommon-x11 \
                    port:xkeyboard-config \
                    port:xorg-libX11 \
                    port:xorg-libXext \
                    port:xorg-libXrandr

#  Portions of this port are strictly X11 specific,
#  so a +quartz build is not possible (fails in configure if X11 is absent)
require_active_variants \
                    path:lib/pkgconfig/gtk4.pc:gtk4 x11

# Avoid unconditional linuxisms:
patchfiles-append   patch-unbreak.diff

# error: passing argument 3 of 'scandir' from incompatible pointer type
legacysupport.newest_darwin_requires_legacy 12
# https://trac.macports.org/ticket/71261
if {${os.platform} eq "darwin" && ${os.major} <= 12} {
    configure.cppflags-append \
                    -D_MACPORTS_LEGACY_COMPATIBLE_SCANDIR=1
}

# error: redefinition of typedef ‘GnomeRRScreen’
compiler.c_standard 2011

configure.args-append \
                    -Ddesktop_docs=true \
                    -Dgtk_doc=true \
                    -Dsystemd=disabled \
                    -Dudev=disabled

# 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}"
}

livecheck.type      gnome
