# -*- 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           github 1.0
PortGroup           makefile 1.0

github.setup        gerard ext4fuse 0.1.3 v
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
revision            2
categories          fuse
license             GPL-2
maintainers         {i0ntempest @i0ntempest} openmaintainer

description         ext4 filesystem in user space
long_description    Implementation of the ext4 filesystem in user space, \
                    using the FUSE library. This allows read-only access.

checksums           rmd160  33b3f6c3a72f86daec20fe191340f9a1e3294c70 \
                    sha256  9fdf0d1855d62d6ab108157d627e62b4996144a8eb49a38b094712f924448694 \
                    size    27606

post-patch {
    reinplace "s|-mmacosx-version-min=10.5|-mmacosx-version-min=${macosx_version}|g" \
        ${worksrcpath}/Makefile
}

build.target

destroot            {
    xinstall -m 755 ${worksrcpath}/ext4fuse ${destroot}${prefix}/bin/
}

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