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

name                file-roller
version             3.42.0
revision            0
license             GPL-2+
set branch          [join [lrange [split ${version} .] 0 1] .]
description         An archive manager for GNOME
long_description    File Roller is an archive manager for the GNOME \
                    environment that allows you to \
                    \n    * Create and modify archives.  \
                    \n    * View the content of an archive.  \
                    \n    * View a file contained in the archive.  \
                    \n    * Extract files from the archive.
maintainers         {devans @dbevans} openmaintainer
categories          gnome
homepage            https://wiki.gnome.org/Apps/FileRoller
master_sites        gnome:sources/${name}/${branch}/

use_xz              yes

checksums           rmd160  02eb7288b41bd82ef5c2ec8f61afdaa59029f3f6 \
                    sha256  1c438e6d53ec10ff4f2eb5b22d7bbf28a7c2a84957ab64a751c1cdf3c52302c7 \
                    size    878968

set py_ver          3.12
set py_ver_nodot    [string map {. {}} ${py_ver}]

depends_build-append \
                    port:gettext \
                    port:gnome-common \
                    port:intltool \
                    port:itstool \
                    port:pkgconfig

depends_lib-append  port:desktop-file-utils \
                    path:lib/pkgconfig/gdk-pixbuf-2.0.pc:gdk-pixbuf2 \
                    path:lib/pkgconfig/gtk+-3.0.pc:gtk3 \
                    port:json-glib \
                    port:libarchive \
                    port:libhandy \
                    port:libmagic \
                    port:libnotify

depends_run         port:adwaita-icon-theme

configure.python    ${prefix}/bin/python${py_ver}

post-patch {
    reinplace "s|/usr/bin/env python3|${configure.python}|" \
                    ${worksrcpath}/postinstall.py \
                    ${worksrcpath}/data/set-mime-type-entry.py \
                    ${worksrcpath}/po/make-potfiles-in.py
}

# hdy-swipe-tracker.h: error: redefinition of typedef ‘HdySwipeTracker’
compiler.blacklist-append \
                    *gcc-4.0 *gcc-4.2

configure.args      -Dnautilus-actions=disabled \
                    -Dpackagekit=false

platform darwin 23 {
    configure.cflags-append \
                    -Wno-error=incompatible-function-pointer-types
}

variant nautilus description {Enable nautilus context menu actions} {
    depends_lib-append \
                    port:nautilus
    configure.args-replace \
                    -Dnautilus-actions=disabled -Dnautilus-actions=enabled
}

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

livecheck.type      gnome
