# -*- 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               github 1.0
PortGroup               python 1.0
PortGroup               app 1.1

github.setup            gramps-project gramps 6.0.5 v
revision                0
github.tarball_from     archive

supported_archs         noarch
platforms               {darwin any}
categories              genealogy python
license                 GPL-2
maintainers             {devans @dbevans} {mascguy @mascguy} openmaintainer
           
description             Gramps is a genealogy program
long_description        Gramps is a genealogy program to store, edit, \
                        and research genealogical data.  It provides \
                        advanced capabilities for research, analysis, and \
                        correlation to potentially fill relationship gaps.
homepage                https://www.gramps-project.org/

checksums               rmd160  25ec6b2e58167476f68832063119c165405d4ef1 \
                        sha256  1295fe352669cdf419d762445db1d26ba5492da30c0a78fef278856eda9cc680 \
                        size    22663322

depends_build-append \
                        port:intltool

depends_lib-append \
                        port:desktop-file-utils \
                        port:geocode-glib \
                        port:gexiv2 \
                        port:ghostscript \
                        path:bin/dot:graphviz \
                        port:gspell \
                        path:lib/pkgconfig/gtk+-3.0.pc:gtk3 \
                        path:lib/pkgconfig/librsvg-2.0.pc:librsvg \
                        port:osm-gps-map \
                        port:shared-mime-info \
                        port:sqlite3

depends_run-append \
                        port:adwaita-icon-theme

#patchfiles-append       patch-gramps-gen-utils-resourcepath.py.diff

proc py_setup {py_ver} {
    python.default_version \
                        ${py_ver}

    depends_lib-append \
                        port:py${py_ver}-berkeleydb \
                        port:py${py_ver}-gobject3 \
                        port:py${py_ver}-orjson \
                        port:py${py_ver}-Pillow \
                        port:py${py_ver}-pyicu

    depends_test-append \
                        port:py${py_ver}-jsonschema \
                        port:py${py_ver}-lxml

    test.run            yes
}

variant python39 conflicts python310 python311 python312 python313 description {Use Python 3.9} {
    py_setup 39
}

variant python310 conflicts python39 python311 python312 python313 description {Use Python 3.10} {
    py_setup 310
}

variant python311 conflicts python39 python310 python312 python313 description {Use Python 3.11} {
    py_setup 311
}

variant python312 conflicts python39 python310 python311 python313 description {Use Python 3.12} {
    py_setup 312
}

variant python313 conflicts python39 python310 python311 python312 description {Use Python 3.13} {
    py_setup 313
}

if {![variant_isset python39] && \
    ![variant_isset python310] && \
    ![variant_isset python311] && \
    ![variant_isset python312] && \
    ![variant_isset python313]} {
    default_variants    +python313
}

# Dummy variants, to ensure user's choice cascades to dependencies
variant quartz conflicts x11 {}
variant x11 conflicts quartz {}

if {![variant_isset quartz]} {
    default_variants +x11
}
if {![variant_isset x11]} {
    default_variants +quartz
}
if {![variant_isset quartz] && ![variant_isset x11]} {
    error "Either +x11 or +quartz is required"
}

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

app.icon   ${worksrcpath}/images/hicolor/scalable/apps/org.gramps_project.Gramps.svg
app.retina yes

notes {
* When using Gramps, be sure to backup your data regularly! Gramps backups are in XML format, which is\
  machine and human-readable. It is also completely self-sufficient, as well as compact.
* The following are good backup practices:
  - Backup from time to time, especially after large edits.
  - Backup before making big changes, such as importing new data into an existing database,\
    merging records, running tools that may heavily modify the data, etc.
  - Backup before upgrading Gramps to a newer version. Backup with the old version before you install the new one!
  - Backup before upgrading your OS.
* Also, use XML format for any data migration. Moving to another machine, sending data to a family member,\
  copying to another user on the same machine -- all of these cases should use XML.
* For detailed backup instructions, see the online Gramps documentation at:
  - https://www.gramps-project.org/wiki/index.php?title=How_to_make_a_backup
}

# Ignore non-numeric dev/rc releases
github.livecheck.regex  {([0-9.]+)}
