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

github.setup        libfuse sshfs 3.7.5 sshfs-
github.tarball_from releases
use_xz              yes
revision            1
categories          fuse
github.tarball_from releases

maintainers         {i0ntempest @i0ntempest} openmaintainer
description         SSH filesystem for FUSE
long_description    This is a filesystem client based on the \
                    SSH File Transfer Protocol. Since most SSH \
                    servers already support this protocol it is \
                    very easy to set up: i.e. on the server side \
                    there is nothing to do.  On the client side \
                    mounting the filesystem is as easy as logging \
                    into the server with ssh.

license             GPL-2

checksums           rmd160  62fab0cf2fb1e07859334e9366572c70a797b982 \
                    sha256  0e45db63c2d00919db3174134fa234c6e0682d6fe573c46312d1d53d1d61a8bb \
                    size    51604

set python_branch   3.13
set python_version  [string map {. ""} ${python_branch}]

depends_build-append \
                    port:coreutils \
                    port:py${python_version}-docutils

depends_lib-append  path:lib/pkgconfig/glib-2.0.pc:glib2 \
                    bin:ssh:openssh

post-patch {
    reinplace "s|ln|${prefix}/bin/gln|g" ${worksrcpath}/utils/install_helper.sh
    reinplace "s|'rst2man'|'rst2man-${python_branch}'|" ${worksrcpath}/meson.build
}

if {${os.platform} eq "darwin" && ${os.major} > 22} {
    configure.cflags-append \
                    -Wno-error=incompatible-function-pointer-types
}

# These versions hang indefinitely when compiling.
compiler.blacklist  {clang >= 1403 < 1600}

variant fs_link description "Link ${name} to a .fs bundle in /Library/Filesystems" {
    post-destroot {
        set dir /Library/Filesystems/${name}.fs/Contents/Resources
        xinstall -d ${destroot}${dir}
        ln -s ${prefix}/bin/${name} ${destroot}${dir}/mount_${name}
    }

    destroot.violate_mtree \
                    yes

    notes-append "
        With +fs_link, you may use \'mount -t ${name}\' and use ${name} in /etc/fstab.
    "
}
