# -*- 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                gom
version             0.5.3
revision            0
license             LGPL-2.1+
set branch          [join [lrange [split ${version} .] 0 1] .]
description         Gom provides an object mapper from GObjects to SQLite.
long_description    ${description}

maintainers         {devans @dbevans} openmaintainer
categories          gnome
homepage            https://wiki.gnome.org/Gom
master_sites        gnome:sources/${name}/${branch}/

use_xz              yes

checksums           rmd160  3450554cb61003f779afbe2bf18750246dc2a3ea \
                    sha256  069d0909fbdc6b4d27edf7a879366194e3ab508b03548bf5b89ff63546d20177 \
                    size    106204

set python_version  313
set python_branch   [string index ${python_version} 0].[string range ${python_version} 1 end]
set python_prefix   ${frameworks_dir}/Python.framework/Versions/${python_branch}
set python_pkgd     ${python_prefix}/lib/python${python_branch}/site-packages
configure.python    ${python_prefix}/bin/python${python_branch}

depends_build       path:bin/pkg-config:pkgconfig \
                    port:python${python_version}

# depends_build       port:gi-docgen \
#                     port:gtk-doc

depends_lib-append  path:lib/pkgconfig/gdk-pixbuf-2.0.pc:gdk-pixbuf2 \
                    path:lib/pkgconfig/glib-2.0.pc:glib2 \
                    path:lib/pkgconfig/gobject-introspection-1.0.pc:gobject-introspection \
                    port:py${python_version}-gobject3 \
                    port:sqlite3

# This is broken:
# ERROR: Could not find GIR dependency in the search paths: GObject-2.0
# And docs require introspection enabled:
# doc/meson.build:26:24: ERROR: Unknown variable "gom_gir".
configure.args      -Denable-gtk-doc=false \
                    -Denable-introspection=false \
                    -Dpygobject-override-dir="${python_pkgd}/gi/overrides"

# gom-resource-group.c: error: ‘for’ loop initial declaration used outside C99 mode
# But -std=c99 not sufficient:
# gom-resource-group.c: error: ‘ItemData’ has no member named ‘resource’, etc.
compiler.blacklist-append \
                    *gcc-4.0 *gcc-4.2

destroot.cmd        ${build.cmd}

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

livecheck.type      gnome-with-unstable
