# Contributor: Stuart Cardall <developer@it-offshore.co.uk>
# Maintainer: Stuart Cardall <developer@it-offshore.co.uk>
pkgname=cpio
pkgver=2.15
pkgrel=0
pkgdesc="tool to copy files into or out of a cpio or tar archive"
url="https://www.gnu.org/software/cpio"
arch="all"
license="GPL-3.0-or-later"
checkdepends="autoconf"
subpackages="$pkgname-doc"
source="https://ftp.gnu.org/gnu/cpio/cpio-$pkgver.tar.bz2"

# secfixes:
#   2.13-r2:
#     - CVE-2021-38185
#   2.13-r0:
#     - CVE-2015-1197
#     - CVE-2019-14866
#   2.12-r3:
#     - CVE-2016-2037

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--localstatedir=/var \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--enable-largefile \
		--disable-mt \
		--disable-rpath \
		--disable-nls
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install
	rm -f "$pkgdir"/usr/lib/charset.alias
	rm -f "$pkgdir"/usr/libexec/rmt # part of the tar pkg
	rm "$pkgdir"/usr/share/man/*/rmt.*
}

sha512sums="
e3c3d0344d13d540887198ee5d6209a9254ed34b87c3b3cabe6dc3ce22ef94d3f380bb60d3395eee44e4b0ec8460b957032c6251f101b4a9fbc5951a701aadff  cpio-2.15.tar.bz2
"
