# Template file for 'spin2cpp'
pkgname=spin2cpp
version=5.2.0
revision=1
build_style=gnu-makefile
hostmakedepends="bison"
short_desc="Converting languages for the Parallax Inc. Propeller 1 and 2"
maintainer="Orphaned <orphan@voidlinux.org>"
license="MIT"
homepage="https://github.com/totalspectrum/spin2cpp/"
distfiles="https://github.com/totalspectrum/${pkgname}/archive/v${version}.tar.gz"
checksum=aa5a356440e14543cfc367c436f782436900eec25ce9a13e9972bfe28706dfbe

CFLAGS="-I. -I./build -DFLEXSPIN_BUILD -fcommon"

do_check() {
	make CFLAGS="$CFLAGS" ${makejobs} test || true # some tests fail
}

do_install() {
	vmkdir usr/libexec/p2tools/bin
	vcopy include usr/libexec/p2tools
	vcopy doc usr/libexec/p2tools
	vmkdir usr/libexec/p2tools/spin2cpp
	vinstall version.h 644 usr/libexec/p2tools/spin2cpp

	vmkdir usr/bin
	for f in flexcc flexspin spin2cpp; do
		vinstall build/$f 755 usr/libexec/p2tools/bin/
		ln -s /usr/libexec/p2tools/bin/$f ${DESTDIR}/usr/bin/
	done
	vlicense COPYING
}
