aports/community/mozjs102/APKBUILD
2023-05-10 11:01:24 +02:00

134 lines
3.2 KiB
Plaintext

# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Maintainer: Newbyte <newbie13xd@gmail.com>
pkgname=mozjs102
pkgver=102.11.0
pkgrel=1
pkgdesc="Standalone Mozilla JavaScript engine (102 ESR)"
url="https://spidermonkey.dev/"
# s390x: no lld
# armhf: unsupported assembly
arch="all !armhf !s390x"
license="MPL-2.0"
depends_dev="
$pkgname
icu-dev
libffi-dev
nspr-dev
"
_llvmver=16
makedepends="
$depends_dev
cargo
clang
linux-headers
lld
llvm$_llvmver-dev
m4
perl
python3
rust
sed
zlib-dev
"
checkdepends="icu-data-full"
subpackages="$pkgname-dev"
source="https://ftp.mozilla.org/pub/firefox/releases/${pkgver}esr/source/firefox-${pkgver}esr.source.tar.xz
disable-moz-stackwalk.patch
fix-musl-build.patch
fix-rust-target.patch
"
builddir="$srcdir"/firefox-$pkgver
case "$CARCH" in
riscv64)
# binutils can't strip llvm output on riscv for some reason
options="$options !strip"
;;
esac
prepare() {
default_prepare
mkdir "$srcdir/mozbuild"
cat > .mozconfig <<- END
ac_add_options --enable-application=js
mk_add_options MOZ_OBJDIR='${PWD}'/obj
ac_add_options --prefix=/usr
ac_add_options --enable-release
ac_add_options --enable-hardening
ac_add_options --enable-optimize="$CFLAGS -O2"
ac_add_options --enable-rust-simd
ac_add_options --enable-linker=lld
ac_add_options --disable-bootstrap
ac_add_options --disable-debug
ac_add_options --disable-debug-symbols
ac_add_options --disable-jemalloc
ac_add_options --disable-strip
# System libraries
ac_add_options --with-system-icu
ac_add_options --with-system-nspr
ac_add_options --with-system-zlib
# Features
ac_add_options --enable-shared-js
ac_add_options --enable-tests
ac_add_options --with-intl-api
mk_add_options RUSTFLAGS="$RUSTFLAGS"
END
}
build() {
# fixed next major cycle
unset RUSTFLAGS
export LDFLAGS="$LDFLAGS -Wl,-z,stack-size=1048576"
# FF doesn't have SIMD available on armhf/v7
case "$CARCH" in
arm*)
echo 'ac_add_options --disable-rust-simd' >> .mozconfig
;;
*)
echo 'ac_add_options --enable-rust-simd' >> .mozconfig
;;
esac
unset CARGO_PROFILE_RELEASE_OPT_LEVEL
unset CARGO_PROFILE_RELEASE_LTO
export CC=clang
export CXX=clang++
export CFLAGS="$CFLAGS -O2"
export CXXFLAGS="$CXXFLAGS -O2"
export MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE=system
export MOZBUILD_STATE_PATH="$srcdir/mozbuild"
export MOZ_NOSPAM=1
export PYTHON=/usr/bin/python3
export RUST_TARGET="$CTARGET"
export SHELL=/bin/ash
export RUSTFLAGS="$RUSTFLAGS -C debuginfo=1"
./mach build
}
check() {
obj/dist/bin/jsapi-tests \
--format=none \
--exclude-random \
basic
}
package() {
cd obj
make DESTDIR="$pkgdir" install
rm -f "$pkgdir"/usr/lib/*.ajs
}
sha512sums="
fdfed404c87f33001c0ab50f9899fa80c897fac645be8ed832e426f412aafbf1468b1c8301bad463b3f5535b6d6f2005a96a748b6e2d6bf5afbc3b5bc10983d6 firefox-102.11.0esr.source.tar.xz
454ea3263cabce099accbdc47aaf83be26a19f8b5a4568c01a7ef0384601cf8315efd86cd917f9c8bf419c2c845db89a905f3ff9a8eb0c8e41042e93aa96a85c disable-moz-stackwalk.patch
bc91c2fb15eb22acb8acc36d086fb18fbf6f202b4511d138769b5ecaaed4a673349c55f808270c762616fafa42e3b01e74dc0af1dcbeea1289e043926e2750c8 fix-musl-build.patch
0b222a36cf3fd446dfb7fd171d77c58c0f19bc4df8f61cb2d99f2dfa0998a24e4d11a92fb88a1144b1bdd8ace95a858dca0a5e9ad5a4ea37a13b2cb7c245758a fix-rust-target.patch
"