Blame mozjs91.spec

95774b8
%global major 91
95774b8
95774b8
# LTO - Enable in Release builds, but consider disabling for development as it increases compile time
95774b8
%global build_with_lto    1
95774b8
95774b8
# Require tests to pass?
95774b8
%global require_tests     1
95774b8
95774b8
%if 0%{?build_with_lto}
0a4dac7
# LTO is the default
95774b8
%else
95774b8
%define _lto_cflags %{nil}
95774b8
%endif
95774b8
95774b8
# Big endian platforms
95774b8
%ifarch ppc ppc64 s390 s390x
95774b8
%global big_endian 1
95774b8
%endif
95774b8
95774b8
Name:           mozjs%{major}
0a15bbb
Version:        91.11.0
e372916
Release:        2%{?dist}
95774b8
Summary:        SpiderMonkey JavaScript library
95774b8
95774b8
License:        MPLv2.0 and MPLv1.1 and BSD and GPLv2+ and GPLv3+ and LGPLv2+ and AFL and ASL 2.0
95774b8
URL:            https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey
95774b8
Source0:        https://ftp.mozilla.org/pub/firefox/releases/%{version}esr/source/firefox-%{version}esr.source.tar.xz
95774b8
78fd9c4
# Known failures with system libicu
78fd9c4
Source1:        known_failures.txt
78fd9c4
95774b8
# Patches from mozjs68, rebased for mozjs78:
95774b8
Patch01:        fix-soname.patch
95774b8
Patch02:        copy-headers.patch
95774b8
Patch03:        tests-increase-timeout.patch
95774b8
Patch09:        icu_sources_data.py-Decouple-from-Mozilla-build-system.patch
95774b8
Patch10:        icu_sources_data-Write-command-output-to-our-stderr.patch
95774b8
95774b8
# Build fixes - https://hg.mozilla.org/mozilla-central/rev/ca36a6c4f8a4a0ddaa033fdbe20836d87bbfb873
95774b8
Patch12:        emitter.patch
95774b8
Patch13:        tests-Use-native-TemporaryDirectory.patch
95774b8
95774b8
# Build fixes
95774b8
Patch14:        init_patch.patch
95774b8
Patch15:        remove-sloppy-m4-detection-from-bundled-autoconf.patch
e372916
Patch16:        0001-Python-Build-Use-r-instead-of-rU-file-read-modes.patch
95774b8
95774b8
# TODO: Check with mozilla for cause of these fails and re-enable spidermonkey compile time checks if needed
e372916
Patch17:        spidermonkey_checks_disable.patch
95774b8
95774b8
# s390x/ppc64 fixes
95774b8
Patch19:        0001-Skip-failing-tests-on-ppc64-and-s390x.patch
95774b8
95774b8
BuildRequires:  cargo
95774b8
BuildRequires:  clang-devel
95774b8
BuildRequires:  gcc
95774b8
BuildRequires:  gcc-c++
95774b8
BuildRequires:  m4
95774b8
BuildRequires:  make
95774b8
%if !0%{?rhel}
95774b8
BuildRequires:  nasm
95774b8
%endif
78fd9c4
BuildRequires:  libicu-devel
95774b8
BuildRequires:  llvm
95774b8
BuildRequires:  rust
95774b8
BuildRequires:  perl-devel
95774b8
BuildRequires:  pkgconfig(libffi)
95774b8
BuildRequires:  pkgconfig(zlib)
95774b8
BuildRequires:  python3-devel
95774b8
BuildRequires:  python3-setuptools
95774b8
BuildRequires:  python3-six
95774b8
BuildRequires:  readline-devel
95774b8
BuildRequires:  zip
95774b8
95774b8
%description
95774b8
SpiderMonkey is the code-name for Mozilla Firefox's C++ implementation of
95774b8
JavaScript. It is intended to be embedded in other applications
95774b8
that provide host environments for JavaScript.
95774b8
95774b8
%package        devel
95774b8
Summary:        Development files for %{name}
95774b8
Requires:       %{name}%{?_isa} = %{version}-%{release}
95774b8
95774b8
%description    devel
95774b8
The %{name}-devel package contains libraries and header files for
95774b8
developing applications that use %{name}.
95774b8
95774b8
%prep
95774b8
%setup -q -n firefox-%{version}/js/src
95774b8
95774b8
pushd ../..
95774b8
%patch01 -p1
95774b8
%patch02 -p1
95774b8
%patch03 -p1
95774b8
%patch09 -p1
95774b8
%patch10 -p1
95774b8
95774b8
%patch12 -p1
95774b8
%patch13 -p1
95774b8
%patch14 -p1
95774b8
%patch15 -p1
95774b8
%patch16 -p1
e372916
%patch17 -p1
95774b8
95774b8
# Fixes for ppc64 and s390x, there is no need to keep it in ifarch here since mozilla tests support ifarch conditions
95774b8
%patch19 -p1
95774b8
95774b8
# Copy out the LICENSE file
95774b8
cp LICENSE js/src/
78fd9c4
78fd9c4
# Copy out file containing known test failures with system libicu
78fd9c4
cp %{SOURCE1} js/src/
95774b8
popd
95774b8
95774b8
# Remove zlib directory (to be sure using system version)
95774b8
rm -rf ../../modules/zlib
95774b8
95774b8
%build
95774b8
# Prefer GCC for now
95774b8
export CC=gcc
95774b8
export CXX=g++
95774b8
95774b8
# Workaround
95774b8
# error: options `-C embed-bitcode=no` and `-C lto` are incompatible
95774b8
# error: could not compile `jsrust`.
95774b8
# https://github.com/japaric/cargo-call-stack/issues/25
95774b8
export RUSTFLAGS="-C embed-bitcode"
95774b8
95774b8
%if 0%{?build_with_lto}
95774b8
# https://github.com/ptomato/mozjs/commit/36bb7982b41e0ef9a65f7174252ab996cd6777bd
95774b8
export CARGO_PROFILE_RELEASE_LTO=true
95774b8
%endif
95774b8
95774b8
export CFLAGS="%{optflags}"
95774b8
export CXXFLAGS="$CFLAGS"
95774b8
export LINKFLAGS="%{?build_ldflags}"
95774b8
export PYTHON="%{python3}"
95774b8
95774b8
# Use bundled autoconf
95774b8
export M4=m4
95774b8
export AWK=awk
95774b8
export AC_MACRODIR=/builddir/build/BUILD/firefox-%{version}/build/autoconf/
95774b8
95774b8
sh ../../build/autoconf/autoconf.sh --localdir=/builddir/build/BUILD/firefox-%{version}/js/src configure.in > configure
95774b8
chmod +x configure
95774b8
95774b8
%configure \
78fd9c4
  --with-system-icu \
95774b8
  --with-system-zlib \
95774b8
  --disable-tests \
95774b8
  --disable-strip \
95774b8
  --with-intl-api \
95774b8
  --enable-readline \
95774b8
  --enable-shared-js \
95774b8
  --enable-optimize \
95774b8
  --disable-debug \
95774b8
  --enable-pie \
95774b8
  --disable-jemalloc
95774b8
95774b8
%make_build
95774b8
95774b8
%install
95774b8
%make_install
95774b8
95774b8
# Fix permissions
95774b8
chmod -x %{buildroot}%{_libdir}/pkgconfig/*.pc
95774b8
95774b8
# Avoid multilib conflicts
95774b8
case `uname -i` in
95774b8
  i386 | ppc | s390 | sparc )
95774b8
    wordsize="32"
95774b8
    ;;
95774b8
  x86_64 | ppc64 | s390x | sparc64 )
95774b8
    wordsize="64"
95774b8
    ;;
95774b8
  *)
95774b8
    wordsize=""
95774b8
    ;;
95774b8
esac
95774b8
95774b8
if test -n "$wordsize"
95774b8
then
95774b8
  mv %{buildroot}%{_includedir}/mozjs-%{major}/js-config.h \
95774b8
     %{buildroot}%{_includedir}/mozjs-%{major}/js-config-$wordsize.h
95774b8
95774b8
  cat >%{buildroot}%{_includedir}/mozjs-%{major}/js-config.h <
95774b8
#ifndef JS_CONFIG_H_MULTILIB
95774b8
#define JS_CONFIG_H_MULTILIB
95774b8
95774b8
#include <bits/wordsize.h>
95774b8
95774b8
#if __WORDSIZE == 32
95774b8
# include "js-config-32.h"
95774b8
#elif __WORDSIZE == 64
95774b8
# include "js-config-64.h"
95774b8
#else
95774b8
# error "unexpected value for __WORDSIZE macro"
95774b8
#endif
95774b8
95774b8
#endif
95774b8
EOF
95774b8
95774b8
fi
95774b8
95774b8
# Remove unneeded files
95774b8
rm %{buildroot}%{_bindir}/js%{major}-config
95774b8
rm %{buildroot}%{_libdir}/libjs_static.ajs
95774b8
95774b8
# Rename library and create symlinks, following fix-soname.patch
95774b8
mv %{buildroot}%{_libdir}/libmozjs-%{major}.so \
95774b8
   %{buildroot}%{_libdir}/libmozjs-%{major}.so.0.0.0
95774b8
ln -s libmozjs-%{major}.so.0.0.0 %{buildroot}%{_libdir}/libmozjs-%{major}.so.0
95774b8
ln -s libmozjs-%{major}.so.0 %{buildroot}%{_libdir}/libmozjs-%{major}.so
95774b8
95774b8
%check
95774b8
# Run SpiderMonkey tests
95774b8
%if 0%{?require_tests}
78fd9c4
%{python3} tests/jstests.py -d -s -t 2400 --exclude-file=known_failures.txt --no-progress --wpt=disabled ../../js/src/dist/bin/js%{major}
95774b8
%else
78fd9c4
%{python3} tests/jstests.py -d -s -t 2400 --exclude-file=known_failures.txt --no-progress --wpt=disabled ../../js/src/dist/bin/js%{major} || :
95774b8
%endif
95774b8
95774b8
# Run basic JIT tests
95774b8
%if 0%{?require_tests}
95774b8
95774b8
# large-arraybuffers/basic.js fails on s390x
95774b8
%ifarch s390 s390x
95774b8
%{python3} jit-test/jit_test.py -s -t 2400 --no-progress -x large-arraybuffers/basic.js ../../js/src/dist/bin/js%{major} basic
95774b8
%else
95774b8
%{python3} jit-test/jit_test.py -s -t 2400 --no-progress ../../js/src/dist/bin/js%{major} basic
95774b8
%endif
95774b8
95774b8
%else
95774b8
%{python3} jit-test/jit_test.py -s -t 2400 --no-progress ../../js/src/dist/bin/js%{major} basic || :
95774b8
%endif
95774b8
95774b8
%files
95774b8
%doc README.html
95774b8
%license LICENSE
95774b8
%{_libdir}/libmozjs-%{major}.so.0*
95774b8
95774b8
%files devel
95774b8
%{_bindir}/js%{major}
95774b8
%{_libdir}/libmozjs-%{major}.so
95774b8
%{_libdir}/pkgconfig/*.pc
95774b8
%{_includedir}/mozjs-%{major}/
95774b8
95774b8
%changelog
e372916
* Mon Jun 27 2022 Frantisek Zatloukal <fzatlouk@redhat.com> - 91.11.0-2
e372916
- Fixup Python 3.11 build
e372916
0a15bbb
* Mon Jun 27 2022 Frantisek Zatloukal <fzatlouk@redhat.com> - 91.11.0-1
0a15bbb
- mozjs91-91.11.0
0a15bbb
8b7ae67
* Tue Jun 14 2022 Frantisek Zatloukal <fzatlouk@redhat.com> - 91.10.0-1
8b7ae67
- mozjs91-91.10.0
8b7ae67
bb2c9dc
* Sun May 08 2022 Frantisek Zatloukal <fzatlouk@redhat.com> - 91.9.0-1
bb2c9dc
- mozjs91-91.9.0
bb2c9dc
d0074a6
* Sat Apr 09 2022 Frantisek Zatloukal <fzatlouk@redhat.com> - 91.8.0-1
d0074a6
- mozjs91-91.8.0
d0074a6
deea748
* Tue Mar 08 2022 Frantisek Zatloukal <fzatlouk@redhat.com> - 91.7.0-1
deea748
- mozjs91-91.7.0
deea748
78fd9c4
* Sun Feb 20 2022 Frantisek Zatloukal <fzatlouk@redhat.com> - 91.6.0-1
78fd9c4
- mozjs91-91.6.0
78fd9c4
- switch to system libicu
78fd9c4
2647937
* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 91.5.0-2
2647937
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
2647937
9ac1d37
* Tue Jan 11 2022 Frantisek Zatloukal <fzatlouk@redhat.com> - 91.5.0-1
9ac1d37
- mozjs91-91.5.0
9ac1d37
74d6db9
* Mon Dec 06 2021 Frantisek Zatloukal <fzatlouk@redhat.com> - 91.4.0-1
74d6db9
- mozjs91-91.4.0
74d6db9
0a4dac7
* Wed Nov 03 2021 Frantisek Zatloukal <fzatlouk@redhat.com> - 91.3.0-1
0a4dac7
- mozjs91-91.3.0
0a4dac7
65899ef
* Mon Oct 04 2021 Frantisek Zatloukal <fzatlouk@redhat.com> - 91.2.0-1
65899ef
- mozjs91-91.2.0
65899ef
0b01ee3
* Mon Sep 20 2021 Frantisek Zatloukal <fzatlouk@redhat.com> - 91.1.0-1
0b01ee3
- mozjs91-91.1.0
0b01ee3
95774b8
* Mon Aug 09 2021 Frantisek Zatloukal <fzatlouk@redhat.com> - 91.0-1
95774b8
- Initial mozjs91 package based on mozjs78