1 # Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
6 pkgdesc="JavaScript interpreter and libraries - Version 91"
8 url="https://spidermonkey.dev/"
10 depends=(gcc-libs readline zlib sh)
11 makedepends=(zip autoconf2.13 python-setuptools python-psutil rustup llvm clang lld)
12 checkdepends=(mercurial git)
15 source=(https://archive.mozilla.org/pub/firefox/releases/$_relver/source/firefox-$_relver.source.tar.xz{,.asc})
16 sha256sums=('53be2bcde0b5ee3ec106bd8ba06b8ae95e7d489c484e881dfbe5360e4c920762'
18 validpgpkeys=('14F26682D0916CDD81E37B6D61B7B526D98F0353') # Mozilla Software Releases <release@mozilla.com>
20 # Make sure the duplication between bin and lib is found
24 # packed_simd no longer builds with 1.63.0
25 rustup toolchain update --profile minimal 1.62.1
31 cat >../mozconfig <<END
32 ac_add_options --enable-application=js
33 mk_add_options MOZ_OBJDIR=${PWD@Q}/obj
35 ac_add_options --prefix=/usr
36 ac_add_options --enable-release
37 ac_add_options --enable-hardening
38 ac_add_options --enable-optimize
39 ac_add_options --enable-rust-simd
40 ac_add_options --enable-linker=lld
41 ac_add_options --disable-bootstrap
42 ac_add_options --disable-debug
43 ac_add_options --disable-debug-symbols
44 ac_add_options --disable-jemalloc
45 ac_add_options --disable-strip
48 ac_add_options --with-system-zlib
49 ac_add_options --without-system-icu
52 ac_add_options --enable-readline
53 ac_add_options --enable-shared-js
54 ac_add_options --enable-tests
55 ac_add_options --with-intl-api
63 export MOZBUILD_STATE_PATH="$srcdir/mozbuild"
64 export MACH_USE_SYSTEM_PYTHON=1
67 echo "Building instrumented JS..."
68 cat >.mozconfig ../mozconfig - <<END
69 ac_add_options --enable-profile-generate=cross
73 echo "Profiling instrumented JS..."
75 local js="$PWD/obj/dist/bin/js"
76 export LLVM_PROFILE_FILE="$PWD/js-%p-%m.profraw"
81 cd ../../../third_party/webkit/PerformanceTests/ARES-6
84 cd ../SunSpider/sunspider-0.9.1
85 "$js" sunspider-standalone-driver.js
88 llvm-profdata merge -o merged.profdata *.profraw
90 stat -c "Profile data found (%s bytes)" merged.profdata
91 test -s merged.profdata
93 echo "Removing instrumented JS..."
96 echo "Building optimized JS..."
97 cat >.mozconfig ../mozconfig - <<END
98 ac_add_options --enable-lto=cross
99 ac_add_options --enable-profile-use=cross
100 ac_add_options --with-pgo-profile-path=${PWD@Q}/merged.profdata
106 local jstests_extra_args=(
110 ) jittest_extra_args=(
113 ) jittest_test_args=(
117 cd firefox-$pkgver/obj
118 make -C js/src check-jstests check-jit-test \
119 JSTESTS_EXTRA_ARGS="${jstests_extra_args[*]}" \
120 JITTEST_EXTRA_ARGS="${jittest_extra_args[*]}" \
121 JITTEST_TEST_ARGS="${jittest_test_args[*]}"
125 cd firefox-$pkgver/obj
126 make DESTDIR="$pkgdir" install
127 rm "$pkgdir"/usr/lib/*.ajs
128 find "$pkgdir"/usr/{lib/pkgconfig,include} -type f -exec chmod -c a-x {} +