# Template build file for 'pfff'
pkgname=pfff
version=0.29
revision=2
build_style=configure
configure_args="--prefix=/usr"
short_desc="Tools and APIs for code analysis, visualization and transformation"
maintainer="John Regan <john@jrjrtech.com>"
license="LGPL-2.1"
homepage="https://github.com/facebook/pfff"
distfiles="$homepage/archive/v${version}.tar.gz"
checksum="d31c68f1ebb1770297eb26441d21d83728c0fbdb9c7bb3be27625db45fae72d1"
makedepends="perl ocaml ocaml-findlib camlp4 zlib-devel ncurses-devel"
depends="ocaml"
nocross="yes"
nostrip="yes"

post_extract() {
	sed -i s/uint32/uint32_t/g external/ocamlzip/zlibstubs.c
	sed -i '50,${/exception Error/d}' external/ocamlzip/zip.ml #duplicate def
	sed -i 's/-warn-error .a//' Makefile.common lang_php/matcher/Makefile
}

do_build() {
	make depend
	make
	make opt
}

do_install() {
	make DESTDIR=$DESTDIR install
	mkdir -p $DESTDIR/usr/lib/ocaml
	make OCAMLFIND_LDCONF=$DESTDIR/tmp/ld.conf OCAMLFIND_DESTDIR=$DESTDIR/usr/lib/ocaml install-findlib
}

