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

github.setup        plougher squashfs-tools 4.7.5
github.tarball_from archive
revision            0
checksums           rmd160  d460195adb84cce1a94abf125d26baaaabe9582f \
                    sha256  547b7b7f4d2e44bf91b6fc554664850c69563701deab9fd9cd7e21f694c88ea6 \
                    size    412571

categories          sysutils
license             GPL-2+
maintainers         {mit.edu:quentin @quentinmit} \
                    openmaintainer

description         Tools to create and extract Squashfs filesystems
long_description \
    Squashfs is a highly compressed read-only filesystem for Linux. \
    It uses zlib compression to compress both files, inodes and directories. \
    Inodes in the system are very small and all blocks are packed to minimise \
    data overhead. Block sizes greater than 4K are supported up to a maximum of \
    64K.\
    \
    Squashfs is intended for general read-only filesystem use, for archival \
    use (i.e. in cases where a .tar.gz file may be used), and in constrained \
    block device/memory systems (e.g. embedded systems) where low overhead is \
    needed.

legacysupport.newest_darwin_requires_legacy 16

depends_build-append \
                    port:gsed

depends_lib-append  port:zlib \
                    port:xz \
                    port:lzo2 \
                    port:lz4 \
                    port:zstd

worksrcdir          ${distname}/${name}

# Fix Darwin struct stat field: st_atim -> st_atimespec on macOS
# https://github.com/plougher/squashfs-tools/pull/356
patchfiles          patch-mksquashfs-st_atimespec.diff

use_configure       no

build.pre_args-append \
                    EXTRA_CFLAGS="${configure.cppflags}" \
                    EXTRA_LDFLAGS="${configure.ldflags}"

build.args-append   XZ_SUPPORT=1 \
                    LZO_SUPPORT=1 \
                    LZ4_SUPPORT=1 \
                    ZSTD_SUPPORT=1 \
                    XATTR_SUPPORT=1

destroot.destdir
destroot.args-append \
                    INSTALL_PREFIX=${destroot}${prefix} \
                    INSTALL_MANPAGES_DIR=${destroot}${prefix}/share/man/man1
