# Contributor: Sean Summers <seansummers@gmail.com>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=tomcat-native
pkgver=2.0.8
pkgrel=0
pkgdesc="Native resources optional component for Apache Tomcat"
url="https://tomcat.apache.org/native-doc/"
# riscv64: blocked by java-jdk
arch="all !riscv64"
license="Apache-2.0"
makedepends="
	apr-dev
	chrpath
	java-jdk
	libtool
	openssl-dev
	"
subpackages="$pkgname-dev"
source="https://archive.apache.org/dist/tomcat/tomcat-connectors/native/$pkgver/source/tomcat-native-$pkgver-src.tar.gz"
builddir="$srcdir/$pkgname-$pkgver-src/native"
options="!check" # package has no tests

build() {
	./configure \
		--prefix=/usr \
		--with-apr=/usr/bin/apr-1-config \
		--with-java-home=/usr/lib/jvm/default-jvm \
		--with-ssl=/usr/lib
	make
}

package() {
	make DESTDIR="$pkgdir" install

	# Remove redundant rpath.
	chrpath --delete "$pkgdir"/usr/lib/libtcnative-*.so

	rm -f "$pkgdir"/usr/lib/*.la
}

dev() {
	default_dev
	mv "$subpkgdir"/usr/lib/libtcnative-*.so "$pkgdir"/usr/lib/
}

sha512sums="
fd45533b9c34b008717d18ed49334c7286b93c849c487c1c42746f2998cc4a6ff0362e536a8b5124c6539847a92a9f7631c7638a21cd5d22134fe1a9bb0f0702  tomcat-native-2.0.8-src.tar.gz
"
