# Contributor: Aaron Hurt <ahurt@ena.com>
# Maintainer: Aaron Hurt <ahurt@ena.com>
pkgname=pacparser
pkgver=1.3.7
pkgrel=0
pkgdesc="A library to parse proxy auto-config (PAC) files"
url="http://pacparser.manugarg.com"
# x86, armhf: https://github.com/pacparser/pacparser/issues/77
arch="x86_64"
license="LGPL-3.0-or-later"
depends=""
makedepends="bash python2-dev"
subpackages="py-$pkgname:pymod $pkgname-doc $pkgname-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/pacparser/pacparser/archive/$pkgver.tar.gz
	spidermonkey-make.patch"
builddir="$srcdir/$pkgname-$pkgver"

prepare() {
	find "$builddir" -name \*.git\* -delete
	default_prepare
}

build() {
	cd "$builddir"

	# There's some concurrency problem, so we must disable parallel build.
	# https://github.com/pacparser/pacparser/issues/27
	make -j1 -C src pactester pymod
}

package() {
	cd "$builddir"
	make -C src DESTDIR="$pkgdir" install
}

pymod() {
	depends="python2"

	cd "$builddir"
	make -C src DESTDIR="$subpkgdir" install-pymod
}

md5sums="6ea7f2bf2e93eb7e8e58f75b77885c22  pacparser-1.3.7.tar.gz
0d3415d45ea010e881b9ce439a84a736  spidermonkey-make.patch"
sha256sums="575c5d8096b4c842b2af852bbb8bcfde96170b28b49f33249dbe2057a8beea13  pacparser-1.3.7.tar.gz
6342cf7de9bb10f1804c54c67919436e5d7123ec52d1348ec94726e04b6a60a2  spidermonkey-make.patch"
sha512sums="9722dbfb0935824c5bea5f092e7bf82b74a0e59387e2a887d1c4e9234bcdb0af3ba4b58d5041dc6192e10200e46746481568a36bcdeca4860cdf00a921adfd2d  pacparser-1.3.7.tar.gz
6f584acfb1f9f16385bef277f4c6bd30fa5f1e77d137cdd3306d50ce60e4917da34d47cd943ea078a264298dfa4a8c3256b447072dd108349e8deddfa536a60d  spidermonkey-make.patch"
