# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Maintainer: Aaron Griffin <aaron@archlinux.org>
# Original TU: Jeff Mickey <j@codemac.net>
# Contributor: ciccio.a

pkgname=squashfs-tools
pkgver=4.4
pkgrel=1
_commit=52eb4c279cd283ed9802dd1ceb686560b22ffb67
pkgdesc="Tools for squashfs, a highly compressed read-only filesystem for Linux."
url="https://github.com/plougher/squashfs-tools"
license=("GPL")
arch=('x86_64')
depends=('zlib' 'lzo' 'xz' 'lz4' 'zstd')
makedepends=('git')
source=("git+https://github.com/plougher/squashfs-tools#commit=${_commit}")
sha256sums=('SKIP')

prepare() {
    cd "$srcdir"/${pkgname}/${pkgname}
    sed -i '1,1i#include <sys/sysmacros.h>' mksquashfs.c unsquashfs.c
}

build() {
    cd "$srcdir"/${pkgname}/${pkgname}
    make \
        GZIP_SUPPORT=1 \
        XZ_SUPPORT=1 \
        LZO_SUPPORT=1 \
        LZMA_XZ_SUPPORT=1 \
        LZ4_SUPPORT=1 \
        ZSTD_SUPPORT=1 \
        XATTR_SUPPORT=1
}

package() {
    cd "$srcdir"/${pkgname}/${pkgname}
    make install INSTALL_DIR="${pkgdir}"/usr/bin
}
