# Template file for 'inkscape'
pkgname=inkscape
version=1.1.1
revision=7
build_style=cmake
# builds executables then runs checks
# some tests still fail on musl: https://gitlab.com/inkscape/inkscape/-/issues/2241
make_check_target=check
hostmakedepends="automake pkg-config libtool intltool gettext
 glib-devel perl-XML-Parser which"
makedepends="harfbuzz-devel libsoup-devel gsl-devel pango-devel libatomic_ops-devel
 double-conversion-devel gc-devel libwpd-devel libcdr-devel libvisio-devel
 poppler-devel libwpd-devel potrace-devel gtkmm-devel gdl-devel gtkspell3-devel
 aspell-devel libxslt-devel libgomp-devel libwpg-devel poppler-glib-devel"
depends="desktop-file-utils hicolor-icon-theme python3-appdirs python3-lxml python3-numpy
 python3-scour python3-Pillow"
checkdepends="$depends gtest-devel ImageMagick cantarell-fonts"
short_desc="Vector-based drawing program"
maintainer="Alex Lohr <alex.lohr@logmein.com>"
license="GPL-2.0-only, LGPL-2.1-or-later"
homepage="http://inkscape.org/"
distfiles="https://media.inkscape.org/dl/resources/file/inkscape-${version}.tar.xz"
checksum=aeca0b9d33b5b1cfa9aa70433bdee6a8c3d020ffafc2e6f0c9a60eed7a7978af
python_version=3

if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
	makedepends+=" libatomic-devel"
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
	# disable glyph tests that fail due to different hinting
	vsed -e \
		"s/\(test-glyph-y-pos\|test-rtl-vertical\|text-glyphs-combining\|text-glyphs-vertical\)/# \1 - skipped due to hinting issues/" \
		-i testfiles/rendering_tests/CMakeLists.txt
}
