# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Antonio Rojas <arojas@archlinux.org>

pkgname=squashfuse
pkgver=0.5.2
pkgrel=1
pkgdesc="FUSE filesystem to mount squashfs archives"
arch=(x86_64 powerpc64le powerpc64 powerpc riscv64)
url="https://github.com/vasi/squashfuse"
license=(LicenseRef-squashfuse)
depends=(fuse
         glibc
         lz4
         zlib
         zstd
         xz)
makedepends=()
source=(https://github.com/vasi/squashfuse/archive/$pkgver/$pkgname-$pkgver.tar.gz)
sha256sums=('db0238c5981dabbd80ee09ae15387f390091668ca060a7bc38047912491443d3')

prepare() {
  cd $pkgname-$pkgver
  ./autogen.sh
}

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

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

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

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