# Maintainer: Antonio Rojas <arojas@archlinux.org>

pkgname=squashfuse
pkgver=0.6.1
pkgrel=1
pkgdesc="FUSE filesystem to mount squashfs archives"
arch=(x86_64 aarch64)
url="https://github.com/vasi/squashfuse"
license=(LicenseRef-squashfuse)
depends=(fuse
         glibc
         lz4
         zlib
         zstd
         xz)
makedepends=(git)
source=(git+https://github.com/vasi/squashfuse#tag=$pkgver)
sha256sums=('7949d6bf8b603a3206b6fa8b6aed20265e1c695ff2d09fe3f434e2e86a307df8')

prepare() {
  cd $pkgname
  autoreconf -vif
}

build() {
  cd $pkgname
  ./configure --prefix=/usr
  sed -e 's/ -shared / -Wl,-O1,--as-needed\0/g' -i libtool # Fix overlinking
  make
}

package() {
  cd $pkgname
  make DESTDIR="$pkgdir" install

  install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname

# install missing headers
  install -Dm644 *.h -t "$pkgdir"/usr/include/squashfuse
}
