#!/usr/bin/bash
# JOBoRun		: Jwm OpenBox Obarun RUNit
# Maintainer	: Joe Bo Run <joborun@disroot.org>
# PkgSource		: url="https://gittea.disroot.org/joborun-pkg/jobcore/$pkgname"
# Website		: https://pozol.eu
#-----------------------------------------| DESCRIPTION |---------------------------------------

pkgname=libarchive
pkgver=3.7.2
pkgrel=01
pkgdesc='Multi-format archive and compression library'
url='https://libarchive.org/'
depends=('acl' 'libacl.so' 'bzip2' 'expat' 'lz4' 'openssl' 'xz' 'zlib' 'zstd' 'libcrypto.so')
provides=('libarchive.so')
#options=('debug')
source=("https://github.com/${pkgname}/${pkgname}/releases/download/v${pkgver}/${pkgname}-${pkgver}.tar.xz"{,.asc})

#prepare() {
#  cd "$pkgname-$pkgver"
#
#  patch -Np1 < ../0001-libarchive-Handle-a-calloc-returning-NULL-fixes-1754.patch
#  patch -Np1 < ../0002-Validate-entry_bytes_remaining-in-pax_attribute.patch
#  patch -Np1 < ../0003-libarchive-Do-not-include-sys-mount.h-when-linux-fs..patch
#}

build() {
  cd $pkgname-$pkgver 

  ./configure \
      --prefix=/usr \
      --without-xml2 \
      --without-nettle \
      --disable-static
  make
}

check() {
  cd $pkgname-$pkgver

  make check
}

package() {
  cd $pkgname-$pkgver
  make DESTDIR="$pkgdir" install
#  sed -i "s/iconv //" "$pkgdir"/usr/lib/pkgconfig/libarchive.pc
  install -Dm0644 COPYING "$pkgdir/usr/share/licenses/libarchive/COPYING"
}

#---- arch license gpg-key & sha256sums ----

arch=(x86_64)

license=('BSD')

validpgpkeys=(A5A45B12AD92D964B89EEE2DEC560C81CEC2276E  # Martin Matuska <mm@FreeBSD.org>
              DB2C7CF1B4C265FAEF56E3FC5848A18B8F14184B) # Martin Matuska <martin@matuska.org>

sha256sums=(04357661e6717b6941682cde02ad741ae4819c67a260593dfb2431861b251acb  # libarchive-3.7.2.tar.xz
	2c2b98622c2f3e59608118fae3e412c900100ec1bf9f825775930b3a8b4f5635) # libarchive-3.7.2.tar.xz.asc

##  d46a5e77ba94d7aef18ccfaffbffb835c00195f205167e1333e931a420f84273  libarchive-3.7.2-01-x86_64.pkg.tar.lz

