# Template file for 'inkscape'
pkgname=inkscape
version=1.4
revision=1
build_style=cmake
make_check_target="check"
hostmakedepends="automake gettext glib-devel intltool libgraphicsmagick-devel
 libtool perl-XML-Parser pkg-config which python3-Cython ragel"
makedepends="aspell-devel cairomm-devel double-conversion-devel gc-devel
 gdl-devel gsl-devel gspell-devel gtkmm-devel gtkspell3-devel harfbuzz-devel
 hunspell-devel libatomic_ops-devel libcdr-devel libgomp-devel
 libvisio-devel libwpd-devel libwpd-devel libwpg-devel libxslt-devel pango-devel
 poppler-devel poppler-glib-devel potrace-devel gtest-devel gtksourceview4-devel
 boost-devel lib2geom-devel popt-devel readline-devel libxml2-devel"
depends="desktop-file-utils hicolor-icon-theme python3-Pillow python3-appdirs
 python3-cssselect python3-lxml python3-numpy python3-requests python3-scour
 python3-tinycss2"
checkdepends="$depends GraphicsMagick ImageMagick cantarell-fonts gtest-devel bc"
short_desc="Vector-based drawing program"
maintainer="Alex Lohr <alexthkloss@web.de>"
license="GPL-2.0-only, LGPL-2.1-or-later"
homepage="https://inkscape.org/"
distfiles="https://media.inkscape.org/dl/resources/file/inkscape-${version}.tar.xz"
checksum=c59a85453b699addebcd51c1dc07684dd96a10c8aec716b19551db50562e13f5
python_version=3
# some tests still fail on musl: https://gitlab.com/inkscape/inkscape/-/issues/2241
make_check=no

if [ -n "$XBPS_CHECK_PKGS" ]; then
	configure_args+=" -DBUILD_TESTING=ON"
else
	configure_args+=" -DBUILD_TESTING=OFF"
fi

post_patch() {
	if [ "$XBPS_TARGET_LIBC" = musl ]; then
		# disable errors for missing sentinels in glib variadic functions,
		# since inkscape uses NULL instead of nullptr
		vsed -e "/-Werror=format/d" -i CMakeScripts/DefineDependsandFlags.cmake
	fi
}
