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

name                gvfs
epoch               1
version             1.36.2
revision            1
set branch          [join [lrange [split ${version} .] 0 1] .]
maintainers         {devans @dbevans} openmaintainer
categories          devel
license             {LGPL GPL-3}
description         The Gnome Virtual File System.

long_description    gvfs is a userspace virtual filesystem designed \
                    to work with the i/o abstractions of gio (a new \
                    library available with glib). It installs several \
                    modules that are automatically used by applications \
                    using the APIs of libgio. The gvfs model differs \
                    from e.g. gnome-vfs in that filesystems must be \
                    mounted before they are used. There is a central \
                    daemon (gvfsd) that handles coordinting mounts, and \
                    then each mount is (typically) in its own daemon \
                    process (although mounts can share daemon process). \
                    gvfs comes with a set of backends, including trash \
                    support, sftp, smb, http, dav and others. There is \
                    a set of command line programs starting with gvfs- \
                    that lets you run commands (like cat, ls, stat, etc) \
                    on files in the gvfs.

homepage            https://wiki.gnome.org/Projects/gvfs
master_sites        gnome:sources/${name}/${branch}/

use_xz              yes

checksums           rmd160  b70ecd443ef077954ffba5e7dca2dba2445bad5a \
                    sha256  c4e279a33dd9cd208135e8bfc4788ceaf264c61a24a85255f6696a934a0101f7 \
                    size    1250528

depends_build       port:pkgconfig \
                    port:autoconf \
                    port:automake \
                    port:libtool \
                    port:gtk-doc \
                    port:pidof \
                    port:gsed

depends_lib         path:lib/pkgconfig/gtk+-3.0.pc:gtk3 \
                    port:gettext \
                    path:lib/pkgconfig/glib-2.0.pc:glib2 \
                    port:libarchive \
                    port:libgcrypt \
                    port:libgdata \
                    port:openssh \
                    port:libsoup-2.4 \
                    port:libxml2 \
                    port:libsecret

patchfiles          patch-test-run-in-tree.sh.diff \
                    patch-test-gvfs-test.diff

post-patch {
    # gettext version in configure.ac should match; having 0.19 breaks the build on some systems.
    reinplace "s|0.19.4|0.21.1|" ${worksrcpath}/configure.ac
}

configure.cmd       ./autogen.sh

configure.args      --disable-avahi \
                    --disable-fuse \
                    --disable-cdda \
                    --disable-gphoto2 \
                    --disable-samba \
                    --disable-gdu \
                    --disable-udisks2 \
                    --disable-libsystemd-login \
                    --disable-admin \
                    --disable-gudev \
                    --disable-afc \
                    --disable-bluray \
                    --disable-libmtp \
                    --disable-goa \
                    --disable-google \
                    --enable-http \
                    --enable-archive \
                    --enable-afp \
                    --enable-always-build-tests \
                    --disable-silent-rules

platform darwin {
    if {${os.major} > 10 || (${os.major} == 10 && ${configure.build_arch} eq "x86_64")} {
        # This depends on webkit2-gtk, which is broken presently on < 10.6 and 32-bit 10.6:
        depends_lib-append \
                    port:gnome-online-accounts
        configure.args-replace \
                    --disable-goa --enable-goa \
                    --disable-google --enable-google
    }
}

test.run            yes
test.target         check

destroot.keepdirs   ${destroot}${prefix}/share/gvfs/remote-volume-monitors

post-destroot {
    xinstall -d ${destroot}${prefix}/share/gvfs/remote-volume-monitors
    set docdir ${prefix}/share/doc/${name}
    xinstall -d ${destroot}${docdir}
    xinstall -m 644 -W ${worksrcpath} AUTHORS COPYING MAINTAINERS NEWS README \
        ${destroot}${docdir}
}

variant python312 conflicts python313 description {Use Python 3.12 for testing} {
    depends_build-append port:py312-gobject3 port:python312
    post-patch {
        reinplace "s|^#!.*|#!${prefix}/bin/python3.12|" \
            ${worksrcpath}/test/gvfs-test \
            ${worksrcpath}/test/test_polkitd.py
    }
}

variant python313 conflicts python312 description {Use Python 3.13 for testing} {
    depends_build-append port:py313-gobject3 port:python313
    post-patch {
        reinplace "s|^#!.*|#!${prefix}/bin/python3.13|" \
            ${worksrcpath}/test/gvfs-test \
            ${worksrcpath}/test/test_polkitd.py
    }
}

if {![variant_isset python312]} {
   default_variants +python313
}

post-activate {
    system "${prefix}/bin/glib-compile-schemas ${prefix}/share/glib-2.0/schemas"
    system "${prefix}/bin/gio-querymodules ${prefix}/lib/gio/modules"
}

livecheck.type      gnome
