# Contributor: Leon Marz <main@lmarz.org>
# Maintainer: Leon Marz <main@lmarz.org>
pkgname=ptex
pkgver=2.4.3
pkgrel=0
pkgdesc="texture mapping system by Walt Disney Animation Studios"
url="https://ptex.us/"
# s390x: no big-endian support
arch="all !s390x"
license="BSD-3-Clause"
makedepends="cmake doxygen graphviz samurai zlib-dev"
subpackages="$pkgname-static $pkgname-dev $pkgname-doc $pkgname-tools:tools"
source="$pkgname-$pkgver.tar.gz::https://github.com/wdas/ptex/archive/v$pkgver.tar.gz
	0001-fix-soversion.patch
	parallel-tests.patch
	"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=None \
		-DPTEX_VER=$pkgver
	cmake --build build
}

check() {
	cd build
	ctest
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

tools() {
	pkgdesc="$pkgdesc (tools)"
	depends=""
	amove /usr/bin
}

sha512sums="
34fcaf1c4fe27cb4e66d66bb729137ef17ffeea2bc2d849f2f5f543b19acc250f425633142320ce797c2a086e04bc3e0870c94928ad45d94e34faee71af36890  ptex-2.4.3.tar.gz
5c82637192986e3dace72e70f8aa539aacc29da5c4c29359616140070b77af2eaa906bad93a793e60baecdb1bd135ca76984451240c071ce2f9133ecc0495a03  0001-fix-soversion.patch
25a3e964cfe85a564a713331594456457cab731c3ed5b305621d30ac79c7f4fb005c309118aeaacc37ad521522c37472db60505384b0187c818786007eafb7ff  parallel-tests.patch
"
