# Maintainer: William Pitcock <nenolod@dereferenced.org>
pkgname=mozjs-38
pkgver=38.8.0
pkgrel=4
pkgdesc="standalone mozilla javascript engine"
url="https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/Releases/38"
arch="all !armhf"
license="LGPL"
depends=""
depends_dev="icu-dev nspr-dev libffi-dev readline-dev"
makedepends="$depends_dev python2 perl sed"
install=""
subpackages="$pkgname-dev $pkgname-dbg"
source="https://ftp.mozilla.org/pub/firefox/releases/${pkgver}esr/source/firefox-${pkgver}esr.source.tar.bz2
	fix-fortify-system-wrappers.patch
	copy-headers.patch
	pkg-config-version.patch
	icu-add-bracket.patch
	gcc-alignment.patch"
builddir="$srcdir/mozilla-esr38"
_builddir="$builddir/js/src"
options="!check"

build() {
	cd "$_builddir"
	SHELL=/bin/ash PYTHON=/usr/bin/python ./configure --prefix=/usr \
		--with-system-icu \
		--with-system-nspr \
		--enable-system-ffi \
		--with-system-zlib \
		--with-intl-api \
		--enable-ctypes \
		--enable-threadsafe \
		--enable-shared-js \
		--enable-gcgenerational \
		--disable-optimize \
		--enable-pie
	make
}

package() {
	cd "$_builddir"
	make DESTDIR="$pkgdir" install
	rm -f "$pkgdir"/usr/lib/*.ajs
}

sha512sums="fcd2497a60176b8403a1793d1ad0a1c96a0a60217c2d4d7acd0506abf6810892bd51fd113d8f952f92b20032efc539a6b1233d8d124c2eb72d726b0935c04d65  firefox-38.8.0esr.source.tar.bz2
a4f613ba4e977796fa024824940bbc1d3df549138612bfcdbb643753d54d4d5bfbf601a12f76312a87ecc7ec595ff34ddefb47c2cd1a6e31252c1fa3a263bdae  fix-fortify-system-wrappers.patch
22cc4e4595ddbd7ff037ce5f04755de4156d24921fa57161afbaa6494c795e30b6cfc08e8b999dbcce145c231cc6a3322334134e40f251f514b4688598a75f61  copy-headers.patch
f3d87ffa7232e7242c4a1bf2762c2d1d4e190e72bd1c15fe223bce2480769bf577021ca799aab9570e3219144fcd9978e97cf8648f0cb7abe379bcabc9b03c4c  pkg-config-version.patch
658df4a957b2e11345dc3caf884d2063b4e492c58f002114d3c8d7b595731cde33d1ad43e02cc2eba4ec0e7a751c3c5bbbf0cacab6ca726f2a1158864b09af8c  icu-add-bracket.patch
fba936027456cc30f3fb17036634a1f572078f4d90b8410b9647b579004b5ca5053ad870d7eeb73f3cf3139832cc2b4949c3c4dc7c0f31b87d4066218a6a5965  gcc-alignment.patch"
