# Template file for 'collada2gltf'
pkgname=collada2gltf
version=1.0.20160229
revision=2
_gitrev=bc1fe2adaf3e0bec42750ade3bc1d763d0f298aa
wrksrc="glTF"
build_wrksrc="COLLADA2GLTF"
build_style=cmake
nopies=yes
hostmakedepends="cmake git git-perl pkg-config"
makedepends="libpng-devel libxml2-devel pcre-devel"
short_desc="Converter for COLLADA to glTF"
maintainer="Jürgen Buchmüller <pullmoll@t-online.de>"
license="MIT, BSD"
homepage="https://github.com/KhronosGroup/glTF/wiki/converter"

do_fetch() {
	git clone --recurse-submodules https://github.com/KhronosGroup/glTF.git
	cd glTF
	git checkout ${_gitrev}
	if [ -n "$CROSS_BUILD" ]; then
		# Linking test_o3gdc fails in cross build with message:
		# "relocation R_ARM_MOVW_ABS_NC against `__pthread_key_create' can not
		# be used when making a shared object; recompile with -fPIC"
		# Simply disable it because we don't need it for libreoffice
		sed -i COLLADA2GLTF/dependencies/o3dgc/src/CMakeLists.txt \
			-e 's;add_subdirectory ("${${PROJECT_NAME}_SOURCE_DIR}/test");;'
	fi
}

do_install() {
	vbin build/bin/OpenCOLLADAValidator
	vbin build/bin/collada2gltf
	if [ -z "$CROSS_BUILD" ]; then
		vbin build/bin/test_o3dgc
	fi
	cat ${wrksrc}/LICENSE.md | tr -d \013 > LICENSE
	vlicense LICENSE
}
