Blame mozjs115.spec

1471bd3
%global major 115
1471bd3
1471bd3
# LTO - Enable in Release builds, but consider disabling for development as it increases compile time
1471bd3
%global build_with_lto    1
1471bd3
1471bd3
# Require tests to pass?
1471bd3
%global require_tests     1
1471bd3
1471bd3
%if 0%{?build_with_lto}
1471bd3
# LTO is the default
1471bd3
%else
1471bd3
%define _lto_cflags %{nil}
1471bd3
%endif
1471bd3
1471bd3
# Big endian platforms
1471bd3
%ifarch ppc ppc64 s390 s390x
1471bd3
%global big_endian 1
1471bd3
%endif
1471bd3
1471bd3
Name:           mozjs%{major}
0efa8f1
Version:        115.12.0
1471bd3
Release:        %autorelease
1471bd3
Summary:        SpiderMonkey JavaScript library
1471bd3
1471bd3
License:        MPL-2.0 AND Apache-2.0 AND BSD-3-Clause AND BSD-2-Clause AND MIT AND GPL-3.0-or-later
1471bd3
URL:            https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey
1471bd3
Source0:        https://ftp.mozilla.org/pub/firefox/releases/%{version}esr/source/firefox-%{version}esr.source.tar.xz
1471bd3
1471bd3
# Known failures with system libicu
1471bd3
Source1:        known_failures.txt
1471bd3
1471bd3
# Patches from mozjs68, rebased for mozjs78:
1471bd3
Patch01:        fix-soname.patch
1471bd3
Patch02:        copy-headers.patch
1471bd3
Patch03:        tests-increase-timeout.patch
1471bd3
Patch09:        icu_sources_data.py-Decouple-from-Mozilla-build-system.patch
1471bd3
Patch10:        icu_sources_data-Write-command-output-to-our-stderr.patch
1471bd3
1471bd3
# Build fixes - https://hg.mozilla.org/mozilla-central/rev/ca36a6c4f8a4a0ddaa033fdbe20836d87bbfb873
1471bd3
Patch12:        emitter.patch
1471bd3
Patch13:        tests-Use-native-TemporaryDirectory.patch
1471bd3
1471bd3
# Build fixes
1471bd3
Patch14:        init_patch.patch
1471bd3
Patch15:        remove-sloppy-m4-detection-from-bundled-autoconf.patch
1471bd3
1471bd3
# tentative patch for RUSTFLAGS parsing issue, taken from firefox package:
1471bd3
# https://bugzilla.redhat.com/show_bug.cgi?id=2184743
1471bd3
# https://bugzilla.mozilla.org/show_bug.cgi?id=1474486
1471bd3
Patch16:        firefox-112.0-commasplit.patch
1471bd3
1471bd3
# TODO: Check with mozilla for cause of these fails and re-enable spidermonkey compile time checks if needed
1471bd3
Patch20:        spidermonkey_checks_disable.patch
1471bd3
1471bd3
# s390x/ppc64 fixes
1471bd3
Patch21:        0001-Skip-failing-tests-on-ppc64-and-s390x.patch
1471bd3
2529838
# Tests Fixes
2529838
Patch30:        tests-Replace-pipes-with-shlex-for-Python-3.13.patch
2529838
1471bd3
BuildRequires:  cargo
1471bd3
%if !0%{?rhel}
1471bd3
BuildRequires:  ccache
1471bd3
%endif
1471bd3
BuildRequires:  clang-devel
1471bd3
BuildRequires:  gcc
1471bd3
BuildRequires:  gcc-c++
1471bd3
BuildRequires:  m4
1471bd3
BuildRequires:  make
1471bd3
%if !0%{?rhel}
1471bd3
BuildRequires:  nasm
1471bd3
%endif
1471bd3
BuildRequires:  libicu-devel
1471bd3
BuildRequires:  llvm
1471bd3
BuildRequires:  rust
1471bd3
BuildRequires:  rustfmt
1471bd3
BuildRequires:  perl-devel
1471bd3
BuildRequires:  pkgconfig(libffi)
1471bd3
BuildRequires:  pkgconfig(zlib)
1471bd3
BuildRequires:  python3-devel
1471bd3
BuildRequires:  python3-setuptools
1471bd3
BuildRequires:  python3-six
1471bd3
BuildRequires:  readline-devel
1471bd3
BuildRequires:  wget
1471bd3
BuildRequires:  zip
1471bd3
1471bd3
%description
1471bd3
SpiderMonkey is the code-name for Mozilla Firefox's C++ implementation of
1471bd3
JavaScript. It is intended to be embedded in other applications
1471bd3
that provide host environments for JavaScript.
1471bd3
1471bd3
%package        devel
1471bd3
Summary:        Development files for %{name}
1471bd3
Requires:       %{name}%{?_isa} = %{version}-%{release}
1471bd3
1471bd3
%description    devel
1471bd3
The %{name}-devel package contains libraries and header files for
1471bd3
developing applications that use %{name}.
1471bd3
1471bd3
%prep
b0f7540
%autosetup -n firefox-%{version} -p1
1471bd3
1471bd3
# Purge the bundled six library incompatible with Python 3.12
1471bd3
rm third_party/python/six/six.py
1471bd3
1471bd3
# Link the system six library (build tooling expects that)
1471bd3
ln -s /usr/lib/python%{python3_version}/site-packages/six.py third_party/python/six/six.py
1471bd3
1471bd3
# Copy out the LICENSE file
1471bd3
cp LICENSE js/src/
1471bd3
1471bd3
# Copy out file containing known test failures with system libicu
1471bd3
cp %{SOURCE1} js/src/
1471bd3
1471bd3
# Remove zlib directory (to be sure using system version)
1471bd3
rm -rf modules/zlib
1471bd3
1471bd3
# Remove unneeded bundled stuff
1471bd3
rm -rf js/src/devtools/automation/variants/
1471bd3
rm -rf js/src/octane/
1471bd3
rm -rf js/src/ctypes/libffi/
1471bd3
1471bd3
%build
1471bd3
%if 0%{?build_with_lto}
1471bd3
# https://github.com/ptomato/mozjs/commit/36bb7982b41e0ef9a65f7174252ab996cd6777bd
1471bd3
export CARGO_PROFILE_RELEASE_LTO=true
1471bd3
%endif
1471bd3
1471bd3
# Use bundled autoconf
1471bd3
export M4=m4
1471bd3
export AWK=awk
b0f7540
export AC_MACRODIR=./build/autoconf/
1471bd3
b0f7540
pushd js/src/
1471bd3
#sh ../../build/autoconf/autoconf.sh --localdir=/builddir/build/BUILD/firefox-%%{version}/js/src configure.in > configure
1471bd3
#chmod +x configure
1471bd3
%configure \
1471bd3
  --with-system-icu \
1471bd3
  --with-system-zlib \
1471bd3
  --disable-tests \
1471bd3
  --disable-strip \
1471bd3
  --with-intl-api \
1471bd3
  --enable-readline \
1471bd3
  --enable-shared-js \
1471bd3
  --enable-optimize \
1471bd3
  --disable-debug \
1471bd3
  --enable-pie \
1471bd3
  --disable-jemalloc
1471bd3
1471bd3
%make_build
1471bd3
1471bd3
%install
b0f7540
pushd js/src/
1471bd3
%make_install
1471bd3
1471bd3
# Fix permissions
1471bd3
chmod -x %{buildroot}%{_libdir}/pkgconfig/*.pc
1471bd3
1471bd3
# Avoid multilib conflicts
1471bd3
case `uname -i` in
1471bd3
  i386 | ppc | s390 | sparc )
1471bd3
    wordsize="32"
1471bd3
    ;;
1471bd3
  x86_64 | ppc64 | s390x | sparc64 )
1471bd3
    wordsize="64"
1471bd3
    ;;
1471bd3
  *)
1471bd3
    wordsize=""
1471bd3
    ;;
1471bd3
esac
1471bd3
1471bd3
if test -n "$wordsize"
1471bd3
then
1471bd3
  mv %{buildroot}%{_includedir}/mozjs-%{major}/js-config.h \
1471bd3
     %{buildroot}%{_includedir}/mozjs-%{major}/js-config-$wordsize.h
1471bd3
1471bd3
  cat >%{buildroot}%{_includedir}/mozjs-%{major}/js-config.h <
1471bd3
#ifndef JS_CONFIG_H_MULTILIB
1471bd3
#define JS_CONFIG_H_MULTILIB
1471bd3
1471bd3
#include <bits/wordsize.h>
1471bd3
1471bd3
#if __WORDSIZE == 32
1471bd3
# include "js-config-32.h"
1471bd3
#elif __WORDSIZE == 64
1471bd3
# include "js-config-64.h"
1471bd3
#else
1471bd3
# error "unexpected value for __WORDSIZE macro"
1471bd3
#endif
1471bd3
1471bd3
#endif
1471bd3
EOF
1471bd3
1471bd3
fi
1471bd3
1471bd3
# Remove unneeded files
1471bd3
rm %{buildroot}%{_bindir}/js%{major}-config
1471bd3
rm %{buildroot}%{_libdir}/libjs_static.ajs
1471bd3
1471bd3
# Rename library and create symlinks, following fix-soname.patch
1471bd3
mv %{buildroot}%{_libdir}/libmozjs-%{major}.so \
1471bd3
   %{buildroot}%{_libdir}/libmozjs-%{major}.so.0.0.0
1471bd3
ln -s libmozjs-%{major}.so.0.0.0 %{buildroot}%{_libdir}/libmozjs-%{major}.so.0
1471bd3
ln -s libmozjs-%{major}.so.0 %{buildroot}%{_libdir}/libmozjs-%{major}.so
1471bd3
1471bd3
%check
b0f7540
pushd js/src/
1471bd3
# Run SpiderMonkey tests
1471bd3
%if 0%{?require_tests}
1471bd3
%{python3} tests/jstests.py -d -s -t 2400 --exclude-file=known_failures.txt --no-progress --wpt=disabled ../../js/src/dist/bin/js%{major}
1471bd3
%else
1471bd3
%{python3} tests/jstests.py -d -s -t 2400 --exclude-file=known_failures.txt --no-progress --wpt=disabled ../../js/src/dist/bin/js%{major} || :
1471bd3
%endif
1471bd3
1471bd3
# Run basic JIT tests
1471bd3
%if 0%{?require_tests}
1471bd3
1471bd3
# large-arraybuffers/basic.js fails on s390x
1471bd3
%ifarch s390 s390x
1471bd3
%{python3} jit-test/jit_test.py -s -t 2400 --no-progress -x large-arraybuffers/basic.js ../../js/src/dist/bin/js%{major} basic
1471bd3
%else
1471bd3
%{python3} jit-test/jit_test.py -s -t 2400 --no-progress ../../js/src/dist/bin/js%{major} basic
1471bd3
%endif
1471bd3
1471bd3
%else
1471bd3
%{python3} jit-test/jit_test.py -s -t 2400 --no-progress ../../js/src/dist/bin/js%{major} basic || :
1471bd3
%endif
1471bd3
1471bd3
%files
35fbe3f
%doc js/src/README.html
35fbe3f
%license js/src/LICENSE
1471bd3
%{_libdir}/libmozjs-%{major}.so.0*
1471bd3
1471bd3
%files devel
1471bd3
%{_bindir}/js%{major}
1471bd3
%{_libdir}/libmozjs-%{major}.so
1471bd3
%{_libdir}/pkgconfig/*.pc
1471bd3
%{_includedir}/mozjs-%{major}/
1471bd3
1471bd3
%changelog
1471bd3
%autochangelog