# -*- 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} 43.2
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  b3d279158eb16ad2e8e7bcd3dfbc2d1bd62a3a60 \
                    sha256  e6a439427138d6f162ee38c2a14e7b34e81c6b37464a7078beeffc2c03031da2 \
                    size    948523

conflicts           gnome-desktop

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

depends_lib-append  port:fontconfig \
                    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/gtk+-4.0.pc:gtk4 \
                    port:iso-codes \
                    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/gtk+-4.0.pc:gtk4 x11

# 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.blacklist-append \
                    *gcc-4.0 *gcc-4.2

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
