# Contributor: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
# Maintainer: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
pkgname=coccinelle
pkgver=1.0.7
pkgrel=0
pkgdesc="A SmPL (Semantic Patch Language) implementation"
url="http://coccinelle.lip6.fr/"
# x86, armhf, s390x: limited by ocaml aport
arch="all !x86 !armhf !armv7 !s390x"
license="GPL-2.0-only"
subpackages="$pkgname-doc"
makedepends="
	autoconf
	automake
	ocaml-dev
	ocaml-findlib-dev
	ocaml-num-dev
	ocaml-ocamldoc
	pcre-dev
	"
depends="python3"
source="
	http://$pkgname.lip6.fr/distrib/$pkgname-$pkgver.tar.gz
	SCORE_expected.sexp
	"
builddir="$srcdir/$pkgname-$pkgver"

prepare() {
	cd "$builddir"
	ln -sf ../../SCORE_expected.sexp tests/
}

build() {
	cd "$builddir"
	./autogen
	./configure \
		--prefix=/usr \
		--enable-release=yes \
		--with-python=/usr/bin/python3
	# Workaround: Build fails without forbidding parallel build
	make -j 1
}

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

package() {
	cd "$builddir"
	make DESTDIR="$pkgdir" MANDIR="/usr/share/man" install
}

sha512sums="94770f9ac41f34b519e1680e0b7b042c15862b3df7cfa94fbbc54d1ed0ee4743a993d3eac271decdd46d1fc3fcbe4aadabfcbab91b691c2b6e1a6019b46f1d28  coccinelle-1.0.7.tar.gz
2f8aa98483c1710fb9a660de04f6a7ba0014e9ea3caf2b9d13a27c73b899afa86d799f78f119135739727a3570247585cad61a2a3a7fda8868a0fd75e1498d6b  SCORE_expected.sexp"
