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

name                mate-icons
categories          kde kf5 gnome
github.setup        mate-desktop mate-icon-theme 1.12.0 v
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball

maintainers         {gmail.com:rjvbertin @RJVB} openmaintainer

installs_libs       no
supported_archs     noarch
platforms           any

description         the official icon themes from the Mate desktop
long_description    {*}${description}, Mate and Menta.
license             {LGPL-3 CC-BY-SA-3}
checksums           rmd160  464ac2c5134baebfcc45bd03445adb8df42cd3e0 \
                    sha256  da22c97da2d7ff5fdf819ed5f19284de287919fe7bc3e0085eeaf75e8f46cfd0

variant rebuild description {rebuild the theme from source rather than using the provided pre-compiled files} {
    # this will probably need to be done when a new version of the theme is published.
    depends_extract \
                    port:intltool

    post-extract {
        system -W ${worksrcpath} "intltoolize"
    }

    use_autoreconf  yes
    configure.args  --disable-dependency-tracking
}

if {![variant_isset rebuild]} {
    use_configure   no

    build           {}
    # do the destroot by hand instead of going through the heavy-handed configure/build/install procedure
    # that would ideally require installing a mate-common component, only to provide translations in index.theme .
    destroot {
        xinstall -m 755 -d ${destroot}${prefix}/share/icons/
        file copy ${worksrcpath}/mate ${destroot}${prefix}/share/icons/
        file copy ${worksrcpath}/menta ${destroot}${prefix}/share/icons/
        file delete ${destroot}${prefix}/share/icons/mate/Makefile.am
        file delete ${destroot}${prefix}/share/icons/mate/scalable/Makefile.am
        file delete ${destroot}${prefix}/share/icons/mate/scalable-up-to-32/Makefile.am
        file copy ${filespath}/index.theme.mate ${destroot}${prefix}/share/icons/mate/index.theme
        file copy -force ${filespath}/text-x-preview.icon.256 ${destroot}${prefix}/share/icons/mate/256x256/mimetypes/text-x-preview.icon
        ln -s text-x-preview.icon ${destroot}${prefix}/share/icons/mate/256x256/mimetypes/gnome-fs-regular.icon
        ln -s text-x-preview.icon ${destroot}${prefix}/share/icons/mate/256x256/mimetypes/gtk-file.icon
        file copy -force ${filespath}/text-x-preview.icon.48 ${destroot}${prefix}/share/icons/mate/48x48/mimetypes/text-x-preview.icon
        ln -s text-x-preview.icon ${destroot}${prefix}/share/icons/mate/48x48/mimetypes/gnome-fs-regular.icon
        ln -s text-x-preview.icon ${destroot}${prefix}/share/icons/mate/48x48/mimetypes/gtk-file.icon
    }
}