# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=pth
pkgver=2.0.7
pkgrel=4
pkgdesc="The GNU Portable Threads."
url="https://www.gnu.org/software/pth"
arch="all"
license="LGPL-2.1"
depends=""
subpackages="$pkgname-dev $pkgname-doc"
options="!libc_musl"
source="ftp://ftp.gnu.org/gnu/$pkgname/$pkgname-$pkgver.tar.gz
	pth-2.0.5-parallelfix.patch
	pth-2.0.6-ldflags.patch
	pth-2.0.6-sigstack.patch
	"

_builddir="$srcdir/$pkgname-$pkgver"

prepare() {
	cd "$_builddir"
	update_config_sub || return 1

	for i in ../*.patch; do
		msg "Applying $i..."
		patch -p1 < $i || return 1
	done
}

build() {
	cd "$_builddir"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--localstatedir=/var \
		--mandir=/usr/share/man \
		|| return 1

	make || return 1
}

package() {
	cd "$_builddir"
	make -j1 DESTDIR="$pkgdir" install
}

sha512sums="f79d74047c50e06f3198356f88647c5c1c8a04ebdd94641fc31d5ab0fd2750d86615fcb81da2f98d7ea73d012a501195d3fa09060571d18dcfdaec5d7a0ecb12  pth-2.0.7.tar.gz
bda7d23a6dd15097c72428003ece7e453b8c1791573853a711dda7bb432593d847053bef436b55050f4a80edd7574e1178ef9fbe001eb20d91c717b8cae43957  pth-2.0.5-parallelfix.patch
099c8221d0011dd5284a96d216ed5315619ae377c3c0a01d15af2976aec57e286166601740b139852f340b36fdc7c5ce62f69faf268d6feaabe70db2bbfdf372  pth-2.0.6-ldflags.patch
0011405ae5e8371390adb2a718277d675db5bc085fe5c5f6054ba1bb08f2276d9e5f4d5c083e833417893173210b1e791a2d0f0a9b6d13194f11c9f587397635  pth-2.0.6-sigstack.patch"
