# -*- 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               app 1.0
PortGroup               perl5 1.0
PortGroup               gitlab 1.0

gitlab.setup            GCstar GCstar 1.8.0 v
name                    gcstar

perl5.branches          5.30 5.32 5.34
perl5.default_branch    5.34
perl5.create_variants   ${perl5.branches}

revision                0
categories              databases
license                 GPL-2+
maintainers             nomaintainer

description             Manage your collections of movies, games, books, music and more

long_description        GCstar is an application for managing your collections. It supports \
                        many types of collections, including movies, books, games, comics, \
                        stamps, coins, and many more. You can even create your own \
                        collection type for whatever unique thing it is that you collect! \
                        Detailed information on each item can be automatically retrieved \
                        from the internet and you can store additional data, such as the \
                        location or who you've lent it to. You may also search and filter \
                        your collections by many criteria.

distname                ${gitlab.project}-v${gitlab.version}
use_bzip2               yes

checksums               rmd160  2810534d62815bcf09cf154e724b84bb3a153580 \
                        sha256  99a381277fa119db1541fed5a214ae28d879b449d44af607892ff4cac177ac66 \
                        size    8627901

platforms               {darwin any}
supported_archs         noarch

patchfiles              patch-gcstar-no-update-mime.diff
post-patch {
    foreach f {gcstar/install gcstar/bin/gcstar gcstar/share/applications/gcstar-thumbnailer} {
        reinplace -locale C "s|/usr/bin/perl|${perl5.bin}|g" ${f}
    }
}

foreach perldep {
    archive-tar
    archive-zip
    compress-raw-zlib
    date-calc
    datetime-format-strptime
    digest-md5
    gd
    gdgraph
    gdtextutil
    gtk3
    gtk3-simplelist
    image-exiftool
    json
    locale-codes
    lwp-protocol-https
    mime-base64
    mp3-info
    mp3-tag
    ogg-vorbis-header-pureperl
    time-piece
    xml-simple
} {
    depends_run-append port:p${perl5.major}-${perldep}
}

depends_run-append  port:adwaita-icon-theme \
                    port:xdg-utils \
                    port:desktop-file-utils \
                    port:shared-mime-info

use_configure       no
build               {}

destroot {
  system -W ${worksrcpath} "gcstar/install --prefix=${destroot}${prefix}"
}

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

app.icon                gcstar/share/gcstar/icons/GCstar.ico
app.name                GCstar
app.executable          gcstar
app.use_launch_script   yes
