# -*- 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           active_variants 1.1
PortGroup           app 1.0
PortGroup           github 1.0
PortGroup           legacysupport 1.1
PortGroup           meson 1.0

# strndup
legacysupport.newest_darwin_requires_legacy 10

github.setup        BestImageViewer geeqie 2.5 v
revision            0
github.tarball_from releases
checksums           rmd160  9eea18861617224088327873e0baa4d730210a06 \
                    sha256  cc991c9d4c78c58668105a15f7ece953bfc21b6b78cedc26ccbaaee6a12b8952 \
                    size    2224492

categories          graphics x11
maintainers         nomaintainer
license             GPL-2+
# only used at build
license_noconflict  graphviz openssl11

description         Image viewer and organiser

long_description    Geeqie is a lightweight Gtk+-based image viewer and browser. \
                    Provides slideshow function and supports MANY image formats.

homepage            https://www.geeqie.org

use_xz              yes

depends_build       path:bin/pkg-config:pkgconfig

depends_lib         port:desktop-file-utils \
                    port:djvulibre \
                    port:exiv2 \
                    port:ffmpegthumbnailer \
                    path:lib/pkgconfig/gtk+-3.0.pc:gtk3 \
                    port:gspell \
                    port:lcms \
                    port:libarchive \
                    port:libheif \
                    path:include/turbojpeg.h:libjpeg-turbo \
                    port:libjxl \
                    port:libraw \
                    port:openjpeg \
                    path:lib/pkgconfig/poppler.pc:poppler \
                    port:tiff \
                    port:webp

depends_run         port:adwaita-icon-theme

# dependencies needed by plugins (not checked by configure) -
depends_run-append  port:ImageMagick \
                    port:exiftool \
                    port:exiftran \
                    port:gphoto2 \
                    port:zenity

# geeqie(23119,0x26fc408) malloc: *** error for object 0x246f700: Non-aligned pointer being freed (2)
legacysupport.redirect_bins geeqie

# ERROR: C++ Compiler does not support -std=c++14
compiler.cxx_standard   2014

configure.args      -Ddoxygen=disabled \
                    -Devince=disabled \
                    -Dlua=disabled \
                    -Dpandoc=disabled \
                    -Dyelp-build=disabled

variant print_preview description {Print preview support with evince} {
# appears non-functional but adds many dependencies
     depends_run-append     port:evince
     configure.args-replace -Devince=disabled -Devince=enabled
}

variant docs description {Build documentation} {
# avoid depending on pandoc which needs ghc by default
     depends_build-append   path:bin/doxygen:doxygen \
                            port:pandoc
     configure.args-replace -Ddoxygen=disabled -Ddoxygen=enabled \
                            -Dpandoc=disabled -Dpandoc=enabled
}

variant help_files description {Enable help browswer} {
# TODO - log window currently says "Unable to detect an installed browser."
     depends_build-append   port:pandoc \
                            port:yelp-tools
     configure.args-replace -Dyelp-build=disabled -Dyelp-build=enabled
}

variant x11 conflicts quartz {
    require_active_variants path:lib/pkgconfig/gtk+-3.0.pc:gtk3 x11 quartz
    depends_lib-append      port:clutter-gtk port:libchamplain
}

variant quartz conflicts x11 {
    require_active_variants path:lib/pkgconfig/gtk+-3.0.pc:gtk3 quartz x11

    # meson.build looks for clutter-gtk and libchamplain unless gps-map is disabled
    # if clutter-gtk and libchamplain are found, the quartz version of the port builds
    # against them but crashes on launch with "unsupported backend"
    configure.args-append   -Dgps-map=disabled
}

if {![variant_isset quartz]} {
    default_variants-append +x11
}

post-activate {
    system "${prefix}/bin/update-desktop-database ${prefix}/share/applications"
}

app.name            Geeqie
app.icon            src/icons/svg/geeqie.svg
app.hide_dock_icon  yes
# app.retina          yes
app.privacy_photo   "Geeqie can display photos in your photo library"
