# Template file for 'opentoonz'
pkgname=opentoonz
version=1.7.1
revision=2
build_wrksrc="toonz/sources"
build_style=cmake
make_cmd=make
hostmakedepends="qt5-qmake qt5-host-tools pkg-config automake libtool"
makedepends="qt5-devel qt5-svg-devel qt5-script-devel qt5-tools-devel qt5-multimedia-devel
 superlu-devel glew-devel libjpeg-turbo-devel liblzma-devel liblz4-devel lzo-devel
 libusb-devel SDL2-devel libmypaint-devel boost-devel libfreeglut-devel
 openblas-devel qt5-serialport-devel libopencv-devel"
short_desc="Full-featured 2D animation creation software"
maintainer="Orphaned <orphan@voidlinux.org>"
license="BSD-3-Clause"
homepage="https://opentoonz.github.io/e/"
distfiles="https://github.com/opentoonz/opentoonz/archive/v${version}.tar.gz"
checksum=d0daf60d06510efe15d0db3f9eed0162499ed58061504dca27892c2b9ea5f22d

export CMAKE_GENERATOR="Unix Makefiles"

if [ "$XBPS_TARGET_LIBC" = musl ]; then
	makedepends+=" libexecinfo-devel"
	configure_args+=" -DCMAKE_CXX_STANDARD_LIBRARIES=-lexecinfo"
fi

pre_configure() {
	# Upstream uses their own modified version of tiff
	if [ "$CROSS_BUILD" ]; then
		configure_args+="
		 -DTIFF_LIBRARY=${wrksrc}/thirdparty/tiff-4.0.3/libtiff/.libs/libtiff.a
		 -DTIFF_INCLUDE_DIR=${wrksrc}/thirdparty/tiff-4.0.3/libtiff
		"
		_args="--host=${XBPS_TRIPLET}"
	fi

	cd ${wrksrc}/thirdparty/tiff-4.0.3
	autoreconf -fi
	./configure --with-pic --disable-jbig ${_args}
	make ${makejobs}
}

post_install() {
	vlicense ${wrksrc}/LICENSE.txt
}
