# Template file for 'graphite'
pkgname=graphite
version=1.3.14
revision=1
build_style=cmake
configure_args="-DGRAPHITE2_COMPARE_RENDERER=OFF"
hostmakedepends="pkg-config"
makedepends="freetype-devel"
short_desc="Reimplementation of the SIL Graphite text processing engine"
maintainer="Orphaned <orphan@voidlinux.org>"
license="LGPL-2.1-or-later, GPL-2.0-or-later"
homepage="https://github.com/silnrsi/graphite"
distfiles="https://github.com/silnrsi/graphite/releases/download/${version}/graphite2-${version}.tgz"
checksum=f99d1c13aa5fa296898a181dff9b82fb25f6cc0933dbaa7a475d8109bd54209d

if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
	LDFLAGS+=" -L${XBPS_CROSS_BASE}/usr/lib -lssp_nonshared"
fi

pre_configure() {
	case "$XBPS_TARGET_MACHINE" in
	i686-musl|ppc-musl|ppcle-musl) # fails to link against ssp_nonshared with -nodefaultlibs
		vsed -i src/CMakeLists.txt -e "s;-nodefaultlibs;;"
		;;
	esac
}

graphite-devel_package() {
	depends="${makedepends} ${sourcepkg}-${version}_${revision}"
	short_desc+=" - development files"
	pkg_install() {
		vmove usr/include
		vmove usr/lib/pkgconfig
		vmove "usr/lib/*.so"
		vmove usr/share
	}
}
