# Template file for 'PrusaSlicer'
pkgname=PrusaSlicer
version=2.5.2
revision=5
build_style=cmake
build_helper="qemu cmake-wxWidgets-gtk3"
# Pre-Compiled Headers seems to be slower
configure_args="-DSLIC3R_WX_STABLE=1 -DSLIC3R_FHS=1 -DSLIC3R_GTK=3
 -DSLIC3R_ENC_CHECK=0 -DUSE_BLOSC=ON -DUSE_EXR=ON -DSLIC3R_PCH=OFF"
hostmakedepends="pkg-config"
makedepends="boost-devel cereal cgal-devel dbus-devel eigen glew-devel
 glu-devel gmpxx-devel gtest-devel gtk+3-devel libcurl-devel libglib-devel
 libpng-devel nlopt-devel openvdb-devel tbb-devel mpfr-devel c-blosc-devel
 libopenexr-devel wxWidgets-gtk3-devel occt-devel"
short_desc="G-code generator for 3D printers (RepRap, Makerbot, Ultimaker etc.)"
maintainer="Orphaned <orphan@voidlinux.org>"
license="GPL-3.0-or-later"
homepage="https://www.prusa3d.com/prusaslicer/"
distfiles="https://github.com/prusa3d/Prusaslicer/archive/version_${version}.tar.gz"
checksum=e58278067b9d49a42dc9bb02b74307b3cb365bb737f28e246ca8c6f466095d6b

CXXFLAGS="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"

if [ -z "${XBPS_CHECK_PKGS}" ]; then
	configure_args+=" -DSLIC3R_BUILD_TESTS=OFF"
fi

post_extract() {
	# Mark tests that fail on certain targets
	case "$XBPS_TARGET_MACHINE" in
		*-musl)
			vsed -i tests/libslic3r/test_mutable_priority_queue.cpp \
			-e 's/\(TEST_CASE("Mutable priority queue - first pop", "\[MutableSkipHeapPriorityQueue\]\)\(")\)/\1[!mayfail]\2/'
			;;
		i686*)
			vsed -i tests/libslic3r/test_voronoi.cpp \
			-e 's/\(TEST_CASE("Voronoi offset 2", "\[VoronoiOffset\]\)\(")\)/\1[!mayfail]\2/'
			vsed -i tests/fff_print/test_trianglemesh.cpp \
			-e 's/\(SCENARIO( "make_xxx functions produce meshes."\)\()\)/\1, "[!mayfail]"\2/'
			;;
	esac
	# rm -rf src/boost
}

Slic3rPE_package() {
	build_style=meta
	short_desc+=" (transitional dummy package)"
	depends="${sourcepkg}>=${version}_${revision}"
	pkg_install() {
		vdoc ${FILESDIR}/README.voidlinux
	}
}
