# -*- 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                totem-pl-parser
version             3.26.6
revision            1
set branch          [join [lrange [split ${version} .] 0 1] .]
categories          gnome
license             LGPL-2+
maintainers         {devans @dbevans} openmaintainer
description         Gnome Playlist parser
long_description    totem-pl-parser is a simple GObject-based library to parse \
                    a host of playlist formats, as well as save those

homepage            https://gitlab.gnome.org/GNOME/${name}
master_sites        gnome:sources/${name}/${branch}/

use_xz              yes

checksums           rmd160  2aa57b399c39a85000cbaa6290d5a979c0984fd5 \
                    sha256  c0df0f68d5cf9d7da43c81c7f13f11158358368f98c22d47722f3bd04bd3ac1c \
                    size    1503888

depends_build-append \
                    port:pkgconfig \
                    port:gtk-doc

depends_lib         path:lib/pkgconfig/gobject-introspection-1.0.pc:gobject-introspection \
                    port:libarchive \
                    port:libgcrypt \
                    port:libxml2 \
                    port:uchardet

patchfiles          no-version-scripts.patch

configure.args      -Denable-libarchive=yes \
                    -Denable-libgcrypt=yes \
                    -Denable-uchardet=yes \
                    -Denable-gtk-doc=true

# /usr/include/unistd.h: error: redundant redeclaration of ‘_Exit’ etc.
compiler.blacklist-append \
                    *gcc-4.0 *gcc-4.2

# error: 'ret' may be used uninitialized [-Werror=maybe-uninitialized]
if {[string match *gcc* ${configure.compiler}]} {
    patchfiles-append \
                    patch-fix-gcc-build.diff
}

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

test.run            yes

livecheck.type      gnome
