# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Maintainer: Sören Tempel <soeren+alpine@soeren-tempel.net>
pkgname=sparse
pkgver=0.5.0
pkgrel=1
pkgdesc="A semantic parser of source files"
url="http://sparse.wiki.kernel.org/"
arch="all"
license="MIT"
depends="gcc"
depends_dev=""
makedepends="libxml2-dev"
install=""
subpackages="$pkgname-dev $pkgname-doc"
source="https://www.kernel.org/pub/software/devel/sparse/dist/$pkgname-$pkgver.tar.xz"

builddir="$srcdir"/$pkgname-$pkgver
prepare() {
	default_prepare || return 1
	sed -i -e '/^PREFIX=/s:=.*:=/usr:' \
		-e '/^CFLAGS =/{s:=:+= $(CPPFLAGS):;s:${CFLAGS}::}' \
		"$builddir"/Makefile || return 1
}

build() {
	cd "$builddir"
	make PREFIX=/usr || return 1
}

package() {
	cd "$builddir"
	make DESTDIR="$pkgdir" install || return 1

	mkdir -p "$pkgdir"/usr/share/doc/$pkgname/
	install -m644 FAQ README \
		Documentation/data-structures.txt \
		Documentation/sparse.txt \
		"$pkgdir"/usr/share/doc/$pkgname/ || return 1
}

md5sums="68bc834c57836251fbee55a7707bab39  sparse-0.5.0.tar.xz"
sha256sums="921fcf918c6778d1359f3886ac8cb4cf632faa6242627bc2ae2db75e983488d5  sparse-0.5.0.tar.xz"
sha512sums="0cb70a74034c4bc4d5340ab7d19288a438f4b6d0c4c63ac95d1f4cc3c5fdfe1370a27a607605a6f0c85ea6f371141c55abfdb4438d9e87b2d544fff5674f7ce4  sparse-0.5.0.tar.xz"
