# -*- 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               fuse 1.0
PortGroup               sourcehut 1.0
PortGroup               legacysupport 1.1
PortGroup               makefile 1.0

sourcehut.setup         nabijaczleweli archivemount-ng 1b
name                    archivemount
revision                0
categories              fuse
license                 LGPL-2+ BSD
maintainers             {@TheRealKeto gmail.com:therealketo} openmaintainer

description             File system for accessing archives using libarchive
long_description        Archivemount is a piece of glue code between libarchive \
                        and FUSE. It can be used to mount a (possibly compressed) \
                        archive (as in .tar.gz or .tar.bz2) and use it like an \
                        ordinary filesystem.

checksums               rmd160  79974bc390766d313698ff63583394681df597e9 \
                        sha256  de10cfee3bff8c1dd2b92358531d3c0001db36a99e1098ed0c9d205d110e903d \
                        size    29224

depends_lib-append      port:libarchive

post-patch {
    reinplace "s|-std=c++2b|-std=gnu++2b|" ${worksrcpath}/Makefile
}

configure.cppflags-append \
                        -DFUSE_DARWIN_ENABLE_EXTENSIONS=0

compiler.cxx_standard   2020
build.args-append       VERSION=${version}

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.
    "
}
