237 lines
7.2 KiB
Bash
237 lines
7.2 KiB
Bash
# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
|
|
# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
|
|
|
|
pkgname=js128
|
|
pkgver=128.7.0
|
|
pkgrel=1
|
|
pkgdesc="JavaScript interpreter and libraries - Version 128"
|
|
url="https://spidermonkey.dev/"
|
|
arch=(x86_64 powerpc64le powerpc64 powerpc riscv64)
|
|
license=(MPL-2.0)
|
|
depends=(
|
|
gcc-libs
|
|
glibc
|
|
gtk3
|
|
libpulse
|
|
libxss
|
|
libxt
|
|
readline
|
|
sh
|
|
zlib
|
|
)
|
|
makedepends=(
|
|
alsa-lib
|
|
cbindgen
|
|
clang
|
|
lld
|
|
llvm
|
|
python311
|
|
rust
|
|
unzip
|
|
zip
|
|
)
|
|
makedepends_powerpc64le=(nodejs-lts-iron)
|
|
makedepends_powerpc64=(nodejs-lts-iron)
|
|
makedepends_riscv64=(nodejs-lts-iron)
|
|
makedepends_x86_64=(nodejs-lts-iron)
|
|
checkdepends=(
|
|
git
|
|
mercurial
|
|
)
|
|
options=(
|
|
!lto
|
|
)
|
|
_relver=${pkgver}esr
|
|
source=(
|
|
https://archive.mozilla.org/pub/firefox/releases/$_relver/source/firefox-$_relver.source.tar.xz{,.asc}
|
|
823087.diff
|
|
823088.diff
|
|
823089.diff
|
|
823090.diff
|
|
823091.diff
|
|
823092.diff
|
|
823093.diff
|
|
823094.diff
|
|
)
|
|
validpgpkeys=(
|
|
# Mozilla Software Releases <release@mozilla.com>
|
|
# https://blog.mozilla.org/security/2023/05/11/updated-gpg-key-for-signing-firefox-releases/
|
|
14F26682D0916CDD81E37B6D61B7B526D98F0353
|
|
)
|
|
sha256sums=('e0a7bf4eddfa33cbc8797d68ecea8fb4e6404ca197d3b2242cbc8daed03794f7'
|
|
'SKIP'
|
|
'1b3efa82eae364cc50db78de48370c2c10b6866d522bb7d00baa63d193e8ec5f'
|
|
'62e5ec5c05346dd830c54d0ac1b798b3215b86512f7488823ac3c843e7a56e13'
|
|
'79a4003f987c633e5901661eec2a3978a47b53a543568e256bd61e5a25ed2616'
|
|
'95d5e0f0b130a228e5c61b38010db23b477eca0f43ae8d5476a647fabb60a878'
|
|
'b8374dcd345e3bbe04e70b7959de1ff41261447126993bf1fb82f2394ae52003'
|
|
'db6927686b009996f32585e29e30ee5cf573f2e280ed1c066f76018001ebd0dc'
|
|
'5126a85a7d007c51272afe830c055adb6081d13839ef44bf34029b6aaf800279'
|
|
'034f96f1dfbe072a9916ffac98257674373a0407f147e154867ce1fa04e3c0d9')
|
|
b2sums=('08bf5b571707b7a5acf1ebde12e370be5999e3ac8cac2e952fae635faa16e07ba4d9d0a00b304ba43b5a327c825cae04c1ccf8434456e27d4c396e5b09a4b6a7'
|
|
'SKIP'
|
|
'32988e6cbe7d224cb44fd83bc58212e39dc96184ad77a9fefa5acb8a29cb3d6bf90a507b2a33894f4a3c3b928b7d9a8d4d82e1166a9d9c5f07e99149dfc16051'
|
|
'53ebae2b30f8f9f5fae494dbb8c92cae8e344deccebeb783c23b53000a059e8b708e4d7f9c3d9ec637a1c048c335b5bec63b2519e57097cf9220b001f99011ea'
|
|
'8f5c07a2abc9249f3dcbff9b3d2921bc95454e5069cb824f41b5a22cd3ad624f595761acbde2113bc5211b6a51901058d989dd7718f5e430e33c3de263572781'
|
|
'424e9cf8f458024e1e71266a9e35cebeae0f1205caf67c0c4dfdcda5d9e87e5207a43496e00d4ec6e073ea5b81f20ec24adbd49e22a4c9a8feac7f057d0d75fa'
|
|
'c45216d489603463abd4a155e3289909c20f204b72fff3b9d91d859997c245a6699dce4ee306b108b4aab838c46b12a1de4904dd76dd3da6854acd69525ba89b'
|
|
'0e2bf48c6a3821f1fdc6255a809ff60eb221d51e3585ddd34cd3fc03ec7c0941d819acf076cc54c7fdbb28481893786e57bba3670e43d331428f98073d428685'
|
|
'1a5460512332d50be90ebf5cb274d21822036ba84018cd84bf17e71c9b7967bcd3b9bd397acca61f218faf3bdcea34f60ca53f748a120aa1445e4168249800a1'
|
|
'810e13dff4c35e8053ac99e11e317a5ebbf3c43468c8f7d4cd5b7e45ee534b0c684d31034baf9531bf2aad25d4e70d355d698aae879989444863468577115056')
|
|
|
|
# Make sure the duplication between bin and lib is found
|
|
COMPRESSZST+=(--long)
|
|
|
|
prepare() {
|
|
mkdir mozbuild
|
|
cd firefox-$pkgver
|
|
|
|
patch -Np1 -i ${srcdir}/823087.diff
|
|
patch -Np1 -i ${srcdir}/823088.diff
|
|
patch -Np1 -i ${srcdir}/823089.diff
|
|
patch -Np1 -i ${srcdir}/823090.diff
|
|
patch -Np1 -i ${srcdir}/823091.diff
|
|
patch -Np1 -i ${srcdir}/823092.diff
|
|
patch -Np1 -i ${srcdir}/823093.diff
|
|
patch -Np1 -i ${srcdir}/823094.diff
|
|
|
|
cat >../mozconfig <<END
|
|
ac_add_options --enable-application=js
|
|
mk_add_options MOZ_OBJDIR=${PWD@Q}/obj
|
|
|
|
ac_add_options --prefix=/usr
|
|
ac_add_options --enable-release
|
|
ac_add_options --enable-hardening
|
|
ac_add_options --enable-optimize=
|
|
ac_add_options --enable-rust-simd
|
|
ac_add_options --disable-bootstrap
|
|
ac_add_options --disable-debug
|
|
ac_add_options --disable-jemalloc
|
|
ac_add_options --disable-strip
|
|
|
|
# System libraries
|
|
ac_add_options --with-system-zlib
|
|
ac_add_options --without-system-icu
|
|
|
|
# Features
|
|
ac_add_options --enable-readline
|
|
ac_add_options --enable-shared-js
|
|
ac_add_options --enable-tests
|
|
ac_add_options --with-intl-api
|
|
END
|
|
|
|
case "${CARCH}" in
|
|
powerpc64le)
|
|
echo 'ac_add_options --enable-lto=full' >> ../mozconfig
|
|
echo 'ac_add_options --enable-linker=bfd' >> ../mozconfig
|
|
echo 'ac_add_options --enable-jit' >> ../mozconfig
|
|
echo 'ac_add_options --with-libclang-path=/usr/lib/' >> ../mozconfig
|
|
echo "export CXXFLAGS='-O2 -pipe -mcpu=power8 -fpermissive'" >> ../mozconfig
|
|
;;
|
|
x86_64)
|
|
echo 'ac_add_options --enable-jit' >> ../mozconfig
|
|
echo 'ac_add_options --enable-linker=lld' >> ../mozconfig
|
|
;;
|
|
*)
|
|
echo 'ac_add_options --disable-jit' >> ../mozconfig
|
|
echo 'ac_add_options --enable-lto=full' >> ../mozconfig
|
|
echo 'ac_add_options --enable-linker=bfd' >> ../mozconfig
|
|
echo "export CXXFLAGS='-O2 -pipe -fpermissive'" >> ../mozconfig
|
|
;;
|
|
esac
|
|
}
|
|
|
|
build() {
|
|
cd firefox-$pkgver
|
|
|
|
export MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE=pip
|
|
export MOZBUILD_STATE_PATH="$srcdir/mozbuild"
|
|
export MOZ_BUILD_DATE="$(date -u${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH} +%Y%m%d%H%M%S)"
|
|
export MOZ_NOSPAM=1
|
|
|
|
# malloc_usable_size is used in various parts of the codebase
|
|
CFLAGS="${CFLAGS/_FORTIFY_SOURCE=3/_FORTIFY_SOURCE=2}"
|
|
CXXFLAGS="${CXXFLAGS/_FORTIFY_SOURCE=3/_FORTIFY_SOURCE=2}"
|
|
|
|
case "${CARCH}" in
|
|
powerpc*)
|
|
export CC=${CHOST}-gcc
|
|
export CXX=${CHOST}-g++
|
|
;;
|
|
esac
|
|
|
|
case "${CARCH}" in
|
|
x86_64)
|
|
# Do 3-tier PGO
|
|
echo "Building instrumented JS..."
|
|
cat >.mozconfig ../mozconfig - <<END
|
|
ac_add_options --enable-profile-generate
|
|
END
|
|
python3.11 ./mach build --priority normal
|
|
|
|
echo "Profiling instrumented JS..."
|
|
(
|
|
local js="$PWD/obj/dist/bin/js"
|
|
export LLVM_PROFILE_FILE="$PWD/js-%p-%m.profraw"
|
|
|
|
cd js/src/octane
|
|
"$js" run.js
|
|
|
|
cd ../../../third_party/webkit/PerformanceTests/ARES-6
|
|
"$js" cli.js
|
|
|
|
cd ../SunSpider/sunspider-0.9.1
|
|
"$js" sunspider-standalone-driver.js
|
|
)
|
|
|
|
llvm-profdata merge -o merged.profdata *.profraw
|
|
|
|
stat -c "Profile data found (%s bytes)" merged.profdata
|
|
test -s merged.profdata
|
|
|
|
echo "Removing instrumented JS..."
|
|
python3.11 ./mach clobber objdir
|
|
|
|
echo "Building optimized JS..."
|
|
cat >.mozconfig ../mozconfig - <<END
|
|
ac_add_options --enable-lto=full
|
|
ac_add_options --enable-profile-use
|
|
ac_add_options --with-pgo-profile-path=${PWD@Q}/merged.profdata
|
|
END
|
|
;;
|
|
*)
|
|
cp ../mozconfig .mozconfig
|
|
;;
|
|
esac
|
|
|
|
python3.11 ./mach build --priority normal
|
|
}
|
|
|
|
check() {
|
|
local jstests_extra_args=(
|
|
--format=none
|
|
--exclude-random
|
|
--wpt=disabled
|
|
) jittest_extra_args=(
|
|
--format=none
|
|
--timeout 300
|
|
) jittest_test_args=(
|
|
basic
|
|
)
|
|
|
|
cd firefox-$pkgver/obj
|
|
make -C js/src check-jstests check-jit-test \
|
|
JSTESTS_EXTRA_ARGS="${jstests_extra_args[*]}" \
|
|
JITTEST_EXTRA_ARGS="${jittest_extra_args[*]}" \
|
|
JITTEST_TEST_ARGS="${jittest_test_args[*]}"
|
|
}
|
|
|
|
package() {
|
|
cd firefox-$pkgver/obj
|
|
make DESTDIR="$pkgdir" install
|
|
rm "$pkgdir"/usr/lib/*.ajs
|
|
find "$pkgdir"/usr/{lib/pkgconfig,include} -type f -exec chmod -c a-x {} +
|
|
}
|
|
|
|
# vim:set sw=2 sts=-1 et:
|