# Template file for 'otfcc'
pkgname=otfcc
version=0.10.2alpha
revision=1
_version=${version/alpha/-alpha}
wrksrc=${pkgname}-${_version}
build_style=gnu-makefile
make_build_args="-C build/gmake"
hostmakedepends="premake5"
short_desc="Utility used for parsing and writing OpenType font files"
maintainer="Renato Aguiar <renato@renag.me>"
license="Apache-2.0"
homepage="https://github.com/caryll/otfcc"
distfiles="https://github.com/caryll/otfcc/archive/v${_version}.tar.gz"
checksum=3604d69e4b427c0e22e3a01acaaccc9b2ccd3df42bdcf52263fe201ce921463c

# Yes, there are architectures besides x86 and x64 :-P
case "$XBPS_TARGET_MACHINE" in
	i686*) _platform="x86";;
	x86_64*) _platform="x64";;
	aarch64*) _platform="x64" ;;
	arm*|mips*) _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
	vlicense LICENSE
}
