aboutsummaryrefslogtreecommitdiffstats
path: root/community/mozjs78/APKBUILD
blob: bbe19c01456262eaf80043c960df6286006d0e05 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Maintainer: Rasmus Thomsen <oss@cogitri.dev>
pkgname=mozjs78
pkgver=78.6.1
pkgrel=0
pkgdesc="Standalone Mozilla JavaScript engine"
url="https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey"
arch="x86_64 armv7 armhf aarch64 x86 ppc64le" # limited by rust and cargo
license="MPL-2.0"
depends_dev="
	icu-dev
	nspr-dev
	libffi-dev
	readline-dev
	$pkgname
	"
_llvmver=10
makedepends="
	$depends_dev
	zlib-dev
	python3
	perl
	sed
	autoconf2.13
	linux-headers
	rust
	cargo
	llvm$_llvmver
	clang-dev
	"
subpackages="$pkgname-dev"
source="https://ftp.mozilla.org/pub/firefox/releases/${pkgver}esr/source/firefox-${pkgver}esr.source.tar.xz
	0001-silence-sandbox-violations.patch
	disable-jslint.patch
	fd6847c9416f9eebde636e21d794d25d1be8791d.patch
	fix-musl-build.patch
	fix-rust-target.patch
	"
builddir="$srcdir"/firefox-$pkgver
_builddir="$builddir/js/src"

# secfixes:
#   78.5.0-r0:
#     - CVE-2020-26968
#   78.4.1-r0:
#     - CVE-2020-26950

build() {
	local _clangver=$(clang --version | awk '$3 == "version" {print $4}')
	if [ "${_clangver#$_llvmver}" = "$_clangver" ]; then
		error "clang version $_clangver does not match llvm version $_llvmver"
		return 1
	fi

	cd "$_builddir"

	export LDFLAGS="$LDFLAGS -Wl,-z,stack-size=1048576"

	# avoid complains about autoconf
	touch configure

	# Fix broken ARM_ARCH check which doesn't work with newer GCCs it seems.
	case "$CTARGET" in
		armv*)
			ARM_ARCH=$(echo ${CTARGET#*armv} | sed "s|-.*||")
			sed -i "s|ARM_ARCH=.*|ARM_ARCH=$ARM_ARCH|" "$builddir"/build/autoconf/arch.m4
			;;
	esac

	export RUST_TARGET="$CTARGET"

	export SHELL=/bin/ash
	export PYTHON=/usr/bin/python3
	./configure --prefix=/usr \
		--with-clang-path=/usr/bin/clang \
		--with-intl-api \
		--with-libclang-path=/usr/lib \
		--with-system-icu \
		--with-system-nspr \
		--with-system-zlib \
		--enable-ctypes \
		--enable-hardening \
		--enable-optimize="$CFLAGS -O2" \
		--enable-readline \
		--enable-release \
		--enable-shared-js \
		--enable-system-ffi \
		--enable-tests \
		--disable-debug \
		--disable-debug-symbols \
		--disable-jemalloc \
		--disable-strip
	make
}

check() {
	cd "$_builddir"
	dist/bin/jsapi-tests \
		--format=none \
		--exclude-random \
		basic
}

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

sha512sums="ae6d99fab6e8d9343ad8b0e9e522f20b5c63064598356cd4b31fc02b3b20d62b30590dec42d956e77352559a642157924c2b1c3e887b496962ba305260ed84e7  firefox-78.6.1esr.source.tar.xz
f7e5bee97cfa495d491dac4b8b98e5d3081346d920700e8bb6d077543e18245e5c82201a9981036ec0bf16d9fbdd42fd76e8cf6d90bb811e7338261204020149  0001-silence-sandbox-violations.patch
4f2cb93f91e798218d83cb3ac4c60b61a3658c5b269bfe250f4c4875aedaacbd77598d8d20e3a868626e49988b2073a2404e37d6918b11def774c25db68dd08d  disable-jslint.patch
60845dcb034b2c4459c30f7d5f25c8176cf42df794e2cc0e86c3e2abb6541c24b962f3a16ca70a288d4d6f377b68d00b2904b22463108559612053d835d9bff1  fd6847c9416f9eebde636e21d794d25d1be8791d.patch
bc91c2fb15eb22acb8acc36d086fb18fbf6f202b4511d138769b5ecaaed4a673349c55f808270c762616fafa42e3b01e74dc0af1dcbeea1289e043926e2750c8  fix-musl-build.patch
c397bd594428b009d1533922a3728a0ec74403714417f4b90c38c1b7751749b0585d48e77c79efa05c6c22a0d9a8ac04d535eb5bb8deb51684852c03c05d94cd  fix-rust-target.patch"