# Maintainer: Antoine Martin (ayakael) <dev@ayakael.net>
# Contributor: Antoine Martin (ayakael) <dev@ayakael.net>

pkgname=unrar-dev
pkgver=5.9.2
pkgrel=1
arch=x86_64
url="https://www.rarlab.com/rar_add.htm"
pkgdesc="Library and header file for applications that use libunrar"
depends="musl"
license=custom
options="!check"
source="https://www.rarlab.com/rar/unrarsrc-${pkgver}.tar.gz"

prepare() {
  sed -e '/CXXFLAGS=/d' -e '/LDFLAGS=/d' -i unrar/makefile # Use system build flags
}

build() {
  cp -a unrar libunrar
  export LDFLAGS="${LDFLAGS} -pthread"
  make -C libunrar lib
}

package() {
  cd ${srcdir}/libunrar
  install -Dm755 libunrar.so -t "$pkgdir"/usr/lib/
  install -Dm644 dll.hpp -t "$pkgdir"/usr/include/unrar/
  # install license
  install -Dm644 license.txt "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}
sha512sums="e48dd3327d57522aa676e8fd6e29b7133ee9921eb1525d90ddedc61716ecfeefb51a7eb3a667f4f81f21a5ce8654727617d33463a5b6a40a7bc32252fa9f25df  unrarsrc-5.9.2.tar.gz"