# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Maintainer: 
pkgname=pax-utils
pkgver=1.2.4
pkgrel=0
pkgdesc="ELF related utils for ELF 32/64 binaries"
url="https://wiki.gentoo.org/wiki/Hardened/PaX_Utilities"
arch="all"
options="!check"  # Requires unpackaged dependencies
license="GPL-2.0-only"
depends="scanelf"
makedepends_build=""
makedepends_host="linux-headers libcap-dev"
makedepends="$makedepends_build $makedepends_host"
source="https://distfiles.adelielinux.org/source/upstream/pax-utils-$pkgver.tar.xz
	fix-eitype.patch"
subpackages="$pkgname-doc scanelf:_scanelf"

build() {
	make USE_CAP=yes
}

package() {
	make DESTDIR="$pkgdir/" install

	# Don't conflict with lddtree package
	rm -f "$pkgdir"/usr/bin/lddtree
}

_scanelf() {
	pkgdesc="Scan ELF binaries for stuff"
	depends=""
	replaces="pax-utils"
	mkdir -p "$subpkgdir"/usr/bin
	mv "$pkgdir"/usr/bin/scanelf "$subpkgdir"/usr/bin/
}

sha512sums="03b84054c59e8ce64d2c07276c61245c8e9b3eca2fc430269531e2dafe120009b541ebb6adc4ff54c13a1da63caf0755fb026ba272cf17d04f75e06b893a3e95  pax-utils-1.2.4.tar.xz
8076d3a7ae17b49945fb21bb2aa1f488f12cdca31514cc7d9b1195c93448a627dd58234fe8495c29206816d5bd04f409b2349fc050717bc8884657aaadbc1707  fix-eitype.patch"