# -*- 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           boost 1.0
PortGroup           gitlab 1.0
PortGroup           gobject_introspection 1.0
PortGroup           legacysupport 1.1

# CLOCK_REALTIME
legacysupport.newest_darwin_requires_legacy 15

name                abiword-x11
set dname           abiword
gitlab.instance     https://gitlab.gnome.org
gitlab.setup        World AbiWord 3.0.6 release-
revision            0

license             GPL-2+
description         A word processor with Gnome support.
long_description    ${description}
maintainers         {@barracuda156 gmail.com:vital.had} openmaintainer
categories          editors textproc gnome

checksums           rmd160  f95a8c71503ae04ff13225e6c7d8a5d5c6a0d425 \
                    sha256  f29bfe269abe65ea8c43c07ba1e900d436163382a191c32d5e056d21c69c87cc \
                    size    7914872

patchfiles          patch-configure.diff \
                    patch-abs.diff \
                    c++11.patch

# https://gitlab.com/inkscape/inbox/-/issues/9885
patchfiles-append   patch-new-libxml2.diff

configure.cmd      ./autogen.sh

depends_build-append \
                    port:autoconf \
                    port:autoconf-archive \
                    port:automake \
                    port:libtool \
                    path:bin/pkg-config:pkgconfig

depends_lib-append  port:desktop-file-utils \
                    port:enchant \
                    port:goffice \
                    port:fribidi \
                    port:atk \
                    path:lib/pkgconfig/gtk+-3.0.pc:gtk3 \
                    path:lib/pkgconfig/glib-2.0.pc:glib2 \
                    path:lib/pkgconfig/pango.pc:pango \
                    path:lib/pkgconfig/cairo.pc:cairo \
                    path:lib/pkgconfig/harfbuzz.pc:harfbuzz \
                    path:lib/pkgconfig/gdk-pixbuf-2.0.pc:gdk-pixbuf2 \
                    port:fontconfig \
                    port:freetype \
                    port:libgcrypt \
                    port:libgsf \
                    port:libical \
                    path:include/turbojpeg.h:libjpeg-turbo \
                    port:libpng \
                    path:lib/pkgconfig/librsvg-2.0.pc:librsvg \
                    port:libwmf \
                    port:libxslt \
                    port:libxml2 \
                    port:psiconv \
                    port:rasqal \
                    port:raptor2 \
                    port:redland \
                    port:wv \
                    port:xorg-libX11 \
                    port:zlib

depends_run         port:adwaita-icon-theme

# uses nullptr
compiler.cxx_standard   2011

gobject_introspection   yes

# champlain seems to cause crashes on startup
configure.args      --disable-default-plugins \
                    --disable-silent-rules \
                    --enable-clipart=yes \
                    --enable-templates=yes \
                    --with-boost=[boost::install_area] \
                    --with-champlain=no \
                    --without-evolution-data-server

variant evolution description "Enable Evolution data server" {
    depends_lib-append \
                    port:evolution-data-server
    configure.args-replace \
                    --without-evolution-data-server \
                    --with-evolution-data-server
}

# Do not make it the default, until it is fixed.
# https://trac.macports.org/ticket/69798
# if {(${os.platform} eq "darwin" && ${os.major} > 12) \
#     || ${os.platform} ne "darwin"} {
#     default_variants-append \
#                     +evolution
# }

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