# Template file for 'otfcc'
pkgname=otfcc
version=0.10.4
revision=1
build_style=gnu-makefile
make_build_args="-C build/gmake"
hostmakedepends="premake5"
short_desc="Utility used for parsing and writing OpenType font files"
maintainer="Orphaned <orphan@voidlinux.org>"
license="Apache-2.0"
homepage="https://github.com/caryll/otfcc"
distfiles="https://github.com/caryll/otfcc/archive/v${version}.tar.gz"
checksum=d9c74825ddac700eb429de31de7cb0a249636f47c6a4cc64eaa102a40966cf00

# Yes, there are architectures besides x86 and x64 :-P
case "$XBPS_TARGET_MACHINE" in
	aarch64*|x86_64*|ppc64*) _platform="x64" ;;
	arm*|i686*|mips*|ppc*) _platform="x86";;
esac

pre_build() {
	premake5 gmake
	case "$XBPS_TARGET_MACHINE" in
	i686*|x86_64*)
		# Use the generated *.make files
		;;
	*)	# Remove useless flags hindering cross builds
		sed -i build/gmake/*.make \
		-e "s;-L/usr/lib32 ;;g" \
		-e "s;-L/usr/lib64 ;;g" \
		-e "s;-m32 ;;g" \
		-e "s;-m64 ;;g"
		;;
	esac
	make_build_args+=" config=release_${_platform}"
}

do_install() {
	vbin bin/release-${_platform}/otfccbuild
	vbin bin/release-${_platform}/otfccdump
}
