# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4

PortSystem          1.0
PortGroup           meson 1.0
PortGroup           github 1.0
PortGroup           muniversal 1.0

github.setup        hughsie appstream-glib 0_8_3 appstream_glib_
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
version             [string map {_ .} ${version}]
revision            1
epoch               1

categories          devel
license             LGPL-2.1+
maintainers         {devans @dbevans} {mascguy @mascguy} openmaintainer

description         This library provides objects and helper methods to help \
                    reading and writing AppStream metadata.
long_description    {*}${description}
homepage            https://github.com/hughsie/${name}

checksums           rmd160  79f1000cc42ac91bab7187c9a71bfba5a3ca3852 \
                    sha256  59f816dffd87821872e54b84e583472d2450952e7d761587c3d9e76b1443607a \
                    size    2597232

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

depends_lib-append \
                    port:curl \
                    port:docbook-xml \
                    port:docbook-xsl-nons \
                    port:fontconfig \
                    port:freetype \
                    port:gettext-runtime \
                    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:gperf \
                    path:lib/pkgconfig/gtk+-3.0.pc:gtk3 \
                    port:json-glib \
                    port:libarchive \
                    port:libxslt \
                    port:libyaml \
                    port:ossp-uuid

patchfiles-append   use-system-uuid.patch

post-patch {
    reinplace -W ${worksrcpath} \
                    "s|__SDK_PATH__|${configure.sdkroot}|g" \
                    meson.build
}

compiler.c_standard 1999
# https://trac.macports.org/ticket/66257
compiler.blacklist-append *gcc-4.*

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

configure.args-append \
                    -Drpm=false \
                    -Dgtk-doc=true
