283 lines
7.3 KiB
RPMSpec
283 lines
7.3 KiB
RPMSpec
|
|
%global major 102
|
||
|
|
|
||
|
|
# LTO - Enable in Release builds, but consider disabling for development as it increases compile time
|
||
|
|
%global build_with_lto 1
|
||
|
|
|
||
|
|
# Require tests to pass?
|
||
|
|
%global require_tests 0
|
||
|
|
|
||
|
|
%if 0%{?build_with_lto}
|
||
|
|
# LTO is the default
|
||
|
|
%else
|
||
|
|
%define _lto_cflags %{nil}
|
||
|
|
%endif
|
||
|
|
|
||
|
|
# Big endian platforms
|
||
|
|
%ifarch ppc ppc64 s390 s390x
|
||
|
|
%global big_endian 1
|
||
|
|
%endif
|
||
|
|
|
||
|
|
%ifarch riscv64
|
||
|
|
%global build_mold 0
|
||
|
|
%endif
|
||
|
|
|
||
|
|
Name: mozjs%{major}
|
||
|
|
Version: 102.9.0
|
||
|
|
Release: 8
|
||
|
|
Summary: SpiderMonkey JavaScript library
|
||
|
|
License: MPL-2.0 AND Apache-2.0 AND BSD-3-Clause AND BSD-2-Clause AND MIT AND GPL-3.0-or-later
|
||
|
|
URL: https://hg.mozilla.org/releases/mozilla-esr102
|
||
|
|
Source0: https://ftp.mozilla.org/pub/firefox/releases/%{version}esr/source/firefox-%{version}esr.source.tar.xz
|
||
|
|
|
||
|
|
# Known failures with system libicu
|
||
|
|
Source1: known_failures.txt
|
||
|
|
|
||
|
|
# Patches from mozjs68, rebased for mozjs78:
|
||
|
|
Patch01: fix-soname.patch
|
||
|
|
Patch02: copy-headers.patch
|
||
|
|
Patch03: tests-increase-timeout.patch
|
||
|
|
Patch09: icu_sources_data.py-Decouple-from-Mozilla-build-system.patch
|
||
|
|
Patch10: icu_sources_data-Write-command-output-to-our-stderr.patch
|
||
|
|
|
||
|
|
# Build fixes - https://hg.mozilla.org/mozilla-central/rev/ca36a6c4f8a4a0ddaa033fdbe20836d87bbfb873
|
||
|
|
Patch12: emitter.patch
|
||
|
|
Patch13: tests-Use-native-TemporaryDirectory.patch
|
||
|
|
|
||
|
|
# Build fixes
|
||
|
|
Patch14: init_patch.patch
|
||
|
|
Patch15: remove-sloppy-m4-detection-from-bundled-autoconf.patch
|
||
|
|
Patch16: icu-76.patch
|
||
|
|
|
||
|
|
# TODO: Check with mozilla for cause of these fails and re-enable spidermonkey compile time checks if needed
|
||
|
|
Patch20: spidermonkey_checks_disable.patch
|
||
|
|
|
||
|
|
# s390x/ppc64 fixes
|
||
|
|
Patch21: 0001-Skip-failing-tests-on-ppc64-and-s390x.patch
|
||
|
|
|
||
|
|
# riscv64 sipdermonkey jit
|
||
|
|
Patch22: spidermonkey-riscv64-plct.patch
|
||
|
|
Patch23: CVE-2023-44488.patch
|
||
|
|
Patch25: CVE-2023-6209.patch
|
||
|
|
|
||
|
|
|
||
|
|
# mold
|
||
|
|
%if 0%{?build_mold}
|
||
|
|
Patch23: D134330.diff
|
||
|
|
%endif
|
||
|
|
# Enable jit compiler in loongarch64
|
||
|
|
Patch24: enable-jit-compiler-of-loongarch64-port-by-default.patch
|
||
|
|
|
||
|
|
# add sw_64 support
|
||
|
|
Patch26: add-sw_64-support.patch
|
||
|
|
|
||
|
|
BuildRequires: cargo
|
||
|
|
BuildRequires: ccache
|
||
|
|
BuildRequires: clang-devel
|
||
|
|
BuildRequires: gcc
|
||
|
|
BuildRequires: gcc-c++
|
||
|
|
BuildRequires: m4
|
||
|
|
BuildRequires: make
|
||
|
|
%if !0%{?rhel}
|
||
|
|
BuildRequires: nasm
|
||
|
|
%endif
|
||
|
|
BuildRequires: libicu-devel
|
||
|
|
BuildRequires: llvm
|
||
|
|
BuildRequires: rust
|
||
|
|
BuildRequires: rustfmt
|
||
|
|
BuildRequires: perl-devel
|
||
|
|
BuildRequires: pkgconfig(libffi)
|
||
|
|
BuildRequires: pkgconfig(zlib)
|
||
|
|
BuildRequires: python3-devel
|
||
|
|
BuildRequires: python3-setuptools
|
||
|
|
BuildRequires: python3-six
|
||
|
|
BuildRequires: readline-devel
|
||
|
|
BuildRequires: wget
|
||
|
|
BuildRequires: zip
|
||
|
|
%if 0%{?build_mold}
|
||
|
|
BuildRequires: mold
|
||
|
|
%endif
|
||
|
|
|
||
|
|
%description
|
||
|
|
SpiderMonkey is the code-name for Mozilla Firefox's C++ implementation of
|
||
|
|
JavaScript. It is intended to be embedded in other applications
|
||
|
|
that provide host environments for JavaScript.
|
||
|
|
|
||
|
|
%package devel
|
||
|
|
Summary: Development files for %{name}
|
||
|
|
Requires: %{name}%{?_isa} = %{version}-%{release}
|
||
|
|
|
||
|
|
%description devel
|
||
|
|
The %{name}-devel package contains libraries and header files for
|
||
|
|
developing applications that use %{name}.
|
||
|
|
|
||
|
|
%prep
|
||
|
|
%autosetup -n firefox-%{version}/js/src -N
|
||
|
|
|
||
|
|
pushd ../..
|
||
|
|
%autopatch -p1
|
||
|
|
|
||
|
|
# Copy out the LICENSE file
|
||
|
|
cp LICENSE js/src/
|
||
|
|
|
||
|
|
# Copy out file containing known test failures with system libicu
|
||
|
|
cp %{SOURCE1} js/src/
|
||
|
|
|
||
|
|
# Remove zlib directory (to be sure using system version)
|
||
|
|
rm -rf modules/zlib
|
||
|
|
|
||
|
|
# Remove unneeded bundled stuff
|
||
|
|
rm -rf js/src/devtools/automation/variants/
|
||
|
|
rm -rf js/src/octane/
|
||
|
|
rm -rf js/src/ctypes/libffi/
|
||
|
|
|
||
|
|
popd
|
||
|
|
|
||
|
|
%build
|
||
|
|
%if 0%{?build_with_lto}
|
||
|
|
# https://github.com/ptomato/mozjs/commit/36bb7982b41e0ef9a65f7174252ab996cd6777bd
|
||
|
|
export CARGO_PROFILE_RELEASE_LTO=true
|
||
|
|
%endif
|
||
|
|
|
||
|
|
# Use bundled autoconf
|
||
|
|
export M4=m4
|
||
|
|
export AWK=awk
|
||
|
|
export AC_MACRODIR=%{_builddir}/firefox-%{version}/build/autoconf/
|
||
|
|
|
||
|
|
sh ../../build/autoconf/autoconf.sh --localdir=%{_builddir}/firefox-%{version}/js/src configure.in > configure
|
||
|
|
chmod +x configure
|
||
|
|
|
||
|
|
%configure \
|
||
|
|
--with-system-icu \
|
||
|
|
--with-system-zlib \
|
||
|
|
--disable-tests \
|
||
|
|
--disable-strip \
|
||
|
|
--with-intl-api \
|
||
|
|
--enable-readline \
|
||
|
|
--enable-shared-js \
|
||
|
|
--enable-optimize \
|
||
|
|
--disable-debug \
|
||
|
|
--enable-pie \
|
||
|
|
--disable-jemalloc \
|
||
|
|
%if 0%{?build_mold}
|
||
|
|
--enable-linker=mold \
|
||
|
|
%endif
|
||
|
|
%{nil}
|
||
|
|
|
||
|
|
%make_build
|
||
|
|
|
||
|
|
%install
|
||
|
|
%make_install
|
||
|
|
|
||
|
|
# Fix permissions
|
||
|
|
chmod -x %{buildroot}%{_libdir}/pkgconfig/*.pc
|
||
|
|
|
||
|
|
# Avoid multilib conflicts
|
||
|
|
case `uname -i` in
|
||
|
|
i386 | ppc | s390 | sparc )
|
||
|
|
wordsize="32"
|
||
|
|
;;
|
||
|
|
x86_64 | ppc64 | s390x | sparc64 | riscv64 | loongarch64 )
|
||
|
|
wordsize="64"
|
||
|
|
;;
|
||
|
|
*)
|
||
|
|
wordsize=""
|
||
|
|
;;
|
||
|
|
esac
|
||
|
|
|
||
|
|
if test -n "$wordsize"
|
||
|
|
then
|
||
|
|
mv %{buildroot}%{_includedir}/mozjs-%{major}/js-config.h \
|
||
|
|
%{buildroot}%{_includedir}/mozjs-%{major}/js-config-$wordsize.h
|
||
|
|
|
||
|
|
cat >%{buildroot}%{_includedir}/mozjs-%{major}/js-config.h <<EOF
|
||
|
|
#ifndef JS_CONFIG_H_MULTILIB
|
||
|
|
#define JS_CONFIG_H_MULTILIB
|
||
|
|
|
||
|
|
#include <bits/wordsize.h>
|
||
|
|
|
||
|
|
#if __WORDSIZE == 32
|
||
|
|
# include "js-config-32.h"
|
||
|
|
#elif __WORDSIZE == 64
|
||
|
|
# include "js-config-64.h"
|
||
|
|
#else
|
||
|
|
# error "unexpected value for __WORDSIZE macro"
|
||
|
|
#endif
|
||
|
|
|
||
|
|
#endif
|
||
|
|
EOF
|
||
|
|
|
||
|
|
fi
|
||
|
|
|
||
|
|
# Remove unneeded files
|
||
|
|
rm %{buildroot}%{_bindir}/js%{major}-config
|
||
|
|
rm %{buildroot}%{_libdir}/libjs_static.ajs
|
||
|
|
|
||
|
|
# Rename library and create symlinks, following fix-soname.patch
|
||
|
|
mv %{buildroot}%{_libdir}/libmozjs-%{major}.so \
|
||
|
|
%{buildroot}%{_libdir}/libmozjs-%{major}.so.0.0.0
|
||
|
|
ln -s libmozjs-%{major}.so.0.0.0 %{buildroot}%{_libdir}/libmozjs-%{major}.so.0
|
||
|
|
ln -s libmozjs-%{major}.so.0 %{buildroot}%{_libdir}/libmozjs-%{major}.so
|
||
|
|
|
||
|
|
%check
|
||
|
|
# Run SpiderMonkey tests
|
||
|
|
%if 0%{?require_tests}
|
||
|
|
%{__python3} tests/jstests.py -d -s -t 2400 --exclude-file=known_failures.txt --no-progress --wpt=disabled ../../js/src/dist/bin/js%{major}
|
||
|
|
%else
|
||
|
|
%{__python3} tests/jstests.py -d -s -t 2400 --exclude-file=known_failures.txt --no-progress --wpt=disabled ../../js/src/dist/bin/js%{major} || :
|
||
|
|
%endif
|
||
|
|
|
||
|
|
# Run basic JIT tests
|
||
|
|
%if 0%{?require_tests}
|
||
|
|
|
||
|
|
# large-arraybuffers/basic.js fails on s390x
|
||
|
|
%ifarch s390 s390x
|
||
|
|
%{__python3} jit-test/jit_test.py -s -t 2400 --no-progress -x large-arraybuffers/basic.js ../../js/src/dist/bin/js%{major} basic
|
||
|
|
%else
|
||
|
|
%{__python3} jit-test/jit_test.py -s -t 2400 --no-progress ../../js/src/dist/bin/js%{major} basic
|
||
|
|
%endif
|
||
|
|
|
||
|
|
%else
|
||
|
|
%{__python3} jit-test/jit_test.py -s -t 2400 --no-progress ../../js/src/dist/bin/js%{major} basic || :
|
||
|
|
%endif
|
||
|
|
|
||
|
|
%files
|
||
|
|
%doc README.html
|
||
|
|
%license LICENSE
|
||
|
|
%{_libdir}/libmozjs-%{major}.so.0*
|
||
|
|
|
||
|
|
%files devel
|
||
|
|
%{_bindir}/js%{major}
|
||
|
|
%{_libdir}/libmozjs-%{major}.so
|
||
|
|
%{_libdir}/pkgconfig/*.pc
|
||
|
|
%{_includedir}/mozjs-%{major}/
|
||
|
|
|
||
|
|
%changelog
|
||
|
|
* Tue Mar 11 2025 Funda Wang <fundawang@yeah.net> - 102.9.0-8
|
||
|
|
- fix build with icu 76
|
||
|
|
|
||
|
|
* Mon Mar 10 2025 mahailiang <mahailiang@uniontech.com> - 102.9.0-7
|
||
|
|
- add sw_64 support
|
||
|
|
|
||
|
|
* Wed Jul 10 2024 liweigang <liweiganga@uniontech.com> - 102.9.0-6
|
||
|
|
- enable debug package
|
||
|
|
|
||
|
|
* Wed Jul 10 2024 lvfei <lvfei@kylinos.cn> - 102.9.0-5
|
||
|
|
- Fix CVE-2023-6209
|
||
|
|
|
||
|
|
* Tue Jun 25 2024 lvfei <lvfei@kylinos.cn> - 102.9.0-4
|
||
|
|
- Fix CVE-2023-44488.patch
|
||
|
|
|
||
|
|
* Thu Apr 11 2024 misaka00251 <liuxin@iscas.ac.cn> - 102.9.0-3
|
||
|
|
- Disable mold for riscv64
|
||
|
|
|
||
|
|
* Thu Mar 28 2024 Wenlong Zhang <zhangwenlong@loongson.cn> - 102.9.0-2
|
||
|
|
- fix build error for loongarch64
|
||
|
|
|
||
|
|
* Thu Mar 16 2023 Jingwiw <wangjingwei@iscas.ac.cn> - 102.9.0-1
|
||
|
|
- upgrade to 102.9.0
|
||
|
|
- add sipdermonkey jit support for riscv64
|
||
|
|
|
||
|
|
* Mon Jan 02 2023 lin zhang <lin.zhang@turbolinux.com.cn> - 102.6.0-1
|
||
|
|
- Initial package.
|
||
|
|
|