# Contributor: Leonardo Arena <rnalrd@alpinelinux.org>
# Maintainer: Leonardo Arena <rnalrd@alpinelinux.org>
setvar pkgname = 'pciutils'
setvar pkgver = '3.5.4'
setvar pkgrel = '1'
setvar pkgdesc = ""PCI bus configuration space access library and tools""
setvar url = ""http://mj.ucw.cz/pciutils.html""
setvar arch = ""all""
setvar license = ""GPL""
setvar depends = ""hwdata-pci""
setvar makedepends = ""linux-headers""
setvar options = ""!check""
setvar install = ''
setvar subpackages = ""$pkgname-doc $pkgname-dev $pkgname-libs""
setvar source = ""http://www.kernel.org/pub/software/utils/$pkgname/$pkgname-$pkgver.tar.gz
	fix-linking-pci-malloc-Makefile.patch
	pread.patch
	""

proc build {
	cd $builddir
	sed -i -e "106s/^/\#/" Makefile
	make OPT="$CFLAGS" ZLIB=no \
		SHARED=yes \
		PREFIX=/usr \
		SHAREDIR=/usr/share/hwdata \
		MANDIR=/usr/share/man \
		all
}

proc package {
	cd $builddir
	make PREFIX="$pkgdir"/usr \
		SHARED=yes \
		SHAREDIR="$pkgdir"/usr/share/hwdata \
		MANDIR="$pkgdir"/usr/share/man \
		install

	install -d "$pkgdir"/usr/lib
	ln -s libpci.so.${pkgver%%.*} "$pkgdir"/usr/lib/libpci.so
	install -D -m 644 lib/libpci.pc "$pkgdir"/usr/lib/pkgconfig/libpci.pc
	for i in config.h header.h pci.h types.h {
		install -D -m 644 lib/${i} "$pkgdir"/usr/include/pci/${i}
	}

}

setvar sha512sums = ""502a28ba0e159c5df6b832585fb3db581c54bbde1ed17ddbf7f6e31fc2a145c8c6736be98876e0fe3b6e679ea39efb6b069417e2f4f0ec0a03b015e2eff4530b  pciutils-3.5.4.tar.gz
520b39602078e4325d7dac2d460547b360f7b52c668d88cf3d776c59246c8cfcb537b7b4f50575da9d2fcea1e207b3e99626ce4f23df890d2565b7dac1db2d94  fix-linking-pci-malloc-Makefile.patch
aa1d3272500180256929b39a5fc4ea38ddb6a9fad090d732832ded9cc396303cf56efc91cfdeb76edbcfefc9a7c8eb058562c3c2b09a9090a59d3e68c27cec62  pread.patch""