# Template file for 'cparser'
pkgname=cparser
version=1.22.0
revision=1
wrksrc="${pkgname}-${pkgname}-${version}"
makedepends="libfirm-devel"
depends="gcc" # to link and assemble
short_desc="C99 parser (with GNU extensions) and libfirm frontend"
maintainer="Christian Neukirchen <chneukirchen@gmail.com>"
license="GPL-2"
homepage="http://libfirm.org/"
distfiles="https://github.com/MatzeB/${pkgname}/archive/${pkgname}-${version}.tar.gz"
checksum=0965aa23d8ed7d4cce309806fec2d2c18ad20a74a084340baed0dc874b24175b

post_extract() {
	rmdir libfirm
}

do_configure() {
	cat <<EOF >config.mak
variant = release
CFLAGS_release = $CFLAGS
LINKFLAGS_release = $LDFLAGS
V = 1
CC = $CC
FIRM_CPPFLAGS =
FIRM_LIBS = -lfirm -lm
COMPILER_INCLUDE_DIR = -DCOMPILER_INCLUDE_DIR=\"/usr/lib/${pkgname}/include\"
EOF
}

do_build() {
	make ${makejobs}
}

do_install() {
	vbin build/release/cparser
	vman cparser.1
	vmkdir usr/lib/${pkgname}
	vcopy include usr/lib/${pkgname}
}
