# Contributor: k0r10n <k0r10n.dev@gmail.com>
# Contributor: Jose-Luis Rivas <ghostbar@riseup.net>
# Maintainer: Carlo Landmeter <clandmeter@gmail.com>
pkgname=libzip
pkgver=1.3.1
pkgrel=0
pkgdesc="A C library for reading, creating, and modifying zip archives"
url="http://www.nih.at/libzip/index.html"
arch="all"
license="BSD"
depends_dev="zlib-dev"
makedepends="$depends_dev perl"
subpackages="$pkgname-dev $pkgname-doc $pkgname-tools"
source="http://www.nih.at/libzip/$pkgname-$pkgver.tar.gz"
builddir="$srcdir/$pkgname-$pkgver"

# secfixes:
#   1.3.0:
#     - CVE-2017-14107

build() {
	cd "$builddir"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var
	make
}

check() {
	cd "$builddir"
	make check
}

package() {
	cd "$builddir"
	make DESTDIR="$pkgdir" -j1 install
}

tools() {
	pkgdesc="$pkgname cmp and merge tools"
	install -d "$subpkgdir"/usr
	mv "$pkgdir"/usr/bin "$subpkgdir"/usr
}

sha512sums="3889077ed0fa07c702f2f7d01e97072faef3b0a3677b6ed8bab228bb8edcce46c78a2bcd8dd1e19f9c8624ca17e74dba66d11d07b756959e00751276fd959c23  libzip-1.3.1.tar.gz"
