# -*- 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           yelp 1.0

name                gnome-calendar
version             3.24.3
revision            3
license             GPL-3+
set branch          [join [lrange [split ${version} .] 0 1] .]
description         Calendar is a calendar application for GNOME.
long_description    ${description}
maintainers         {devans @dbevans} openmaintainer
categories          gnome
platforms           darwin
homepage            https://wiki.gnome.org/Design/Apps/Calendar
master_sites        gnome:sources/${name}/${branch}/

use_xz              yes

checksums           rmd160  3f44e9f196bd7eca0a41bd1aa704c5b5f9bfd395 \
                    sha256  3ecb4074f44cb6c883f81f93ebde2fa3890107f8e06740495be9f942190ff3ec

depends_build       port:pkgconfig \
                    port:intltool \
                    port:appstream-glib \
                    port:gnome-common \
                    port:autoconf \
                    port:automake \
                    port:libtool

depends_lib         port:desktop-file-utils \
                    path:lib/pkgconfig/gdk-pixbuf-2.0.pc:gdk-pixbuf2 \
                    path:lib/pkgconfig/gtk+-3.0.pc:gtk3 \
                    port:evolution-data-server \
                    port:gnome-online-accounts \
                    port:libical

depends_run         port:adwaita-icon-theme

patchfiles          patch-src-Makefile.am.diff \
                    patch-separate-weeks-events-overlaps.diff \
                    patch-utils-libical-3.0.diff

# reconfigure using upstream autogen.sh for intltool 0.51 compatibility

post-patch {
    xinstall -m 755 ${filespath}/autogen.sh ${worksrcpath}
# fixup gsettings schema for glib2 >= 1.45.1
    reinplace "s|_summary|summary|g" ${worksrcpath}/data/org.gnome.calendar.gschema.xml.in
    reinplace "s|_description|description|g" ${worksrcpath}/data/org.gnome.calendar.gschema.xml.in
}

configure.cmd       ./autogen.sh

configure.args      --disable-maintainer-mode \
                    --disable-schemas-compile \
                    --disable-silent-rules

# evolution-data-server->nss is not universal
universal_variant   no

post-activate {
   system "${prefix}/bin/gtk-update-icon-cache -f -t ${prefix}/share/icons/hicolor"
   system "${prefix}/bin/update-desktop-database ${prefix}/share/applications"
   system "${prefix}/bin/glib-compile-schemas ${prefix}/share/glib-2.0/schemas"
}

livecheck.type      gnome
