0d9273a
%global major 78
0d9273a
0d9273a
# LTO - Enable in Release builds, but consider disabling for development as it increases compile time
0d9273a
%global build_with_lto    1
0d9273a
0d9273a
# Require tests to pass?
0d9273a
%global require_tests     1
0d9273a
0d9273a
%if 0%{?build_with_lto}
0fa6e64
# LTO is default since F33 and F32 package is backported as is, so no LTO there
0d9273a
%else
0d9273a
%define _lto_cflags %{nil}
0d9273a
%endif
0d9273a
0d9273a
# Require libatomic for ppc
0d9273a
%ifarch ppc
0d9273a
%global system_libatomic 1
0d9273a
%endif
0d9273a
0d9273a
# Big endian platforms
0d9273a
%ifarch ppc ppc64 s390 s390x
0d9273a
%global big_endian 1
0d9273a
%endif
0d9273a
0d9273a
Name:           mozjs%{major}
051bec2
Version:        78.15.0
ee01bd1
Release:        1%{?dist}
0d9273a
Summary:        SpiderMonkey JavaScript library
0d9273a
0d9273a
License:        MPLv2.0 and MPLv1.1 and BSD and GPLv2+ and GPLv3+ and LGPLv2+ and AFL and ASL 2.0
0d9273a
URL:            https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey
0d9273a
Source0:        https://ftp.mozilla.org/pub/firefox/releases/%{version}esr/source/firefox-%{version}esr.source.tar.xz
0d9273a
0d9273a
# Patches from mozjs68, rebased for mozjs78:
0d9273a
Patch01:        fix-soname.patch
0d9273a
Patch02:        copy-headers.patch
0d9273a
Patch03:        tests-increase-timeout.patch
0d9273a
Patch09:        icu_sources_data.py-Decouple-from-Mozilla-build-system.patch
0d9273a
Patch10:        icu_sources_data-Write-command-output-to-our-stderr.patch
0d9273a
0d9273a
# Build fixes - https://hg.mozilla.org/mozilla-central/rev/ca36a6c4f8a4a0ddaa033fdbe20836d87bbfb873
0d9273a
Patch12:        emitter.patch
0d9273a
0d9273a
# Build fixes
381069b
Patch13:        Fixup-compatibility-of-mozbuild-with-Python-3.10.patch
0d9273a
Patch14:        init_patch.patch
0d9273a
# TODO: Check with mozilla for cause of these fails and re-enable spidermonkey compile time checks if needed
0d9273a
Patch15:        spidermonkey_checks_disable.patch
0d9273a
0d9273a
# armv7 fixes
0ebbe70
Patch17:        definitions_for_user_vfp.patch
0d9273a
0d9273a
# s390x/ppc64 fixes, TODO: file bug report upstream?
0d9273a
Patch18:        spidermonkey_style_check_disable_s390x.patch
0d9273a
Patch19:        0001-Skip-failing-tests-on-ppc64-and-s390x.patch
0d9273a
15ae20d
# Fix for https://bugzilla.mozilla.org/show_bug.cgi?id=1644600 ( SharedArrayRawBufferRefs is not exported )
15ae20d
# https://github.com/0ad/0ad/blob/83e81362d850cc6f2b3b598255b873b6d04d5809/libraries/source/spidermonkey/FixSharedArray.diff
15ae20d
Patch30:        FixSharedArray.diff
a6933fc
a6933fc
# Avoid autoconf213 dependency, backported from upstream
a6933fc
# https://bugzilla.mozilla.org/show_bug.cgi?id=1663863
0be21c3
Patch31:        0002-D89554-autoconf1.diff
0be21c3
Patch32:        0003-D94538-autoconf2.diff
15ae20d
0d9273a
BuildRequires:  cargo
0d9273a
BuildRequires:  clang-devel
0d9273a
BuildRequires:  gcc
0d9273a
BuildRequires:  gcc-c++
a6933fc
BuildRequires:  m4
a6933fc
BuildRequires:  make
778cb22
%if !0%{?rhel}
0d9273a
BuildRequires:  nasm
778cb22
%endif
0d9273a
BuildRequires:  llvm
0d9273a
BuildRequires:  llvm-devel
0d9273a
BuildRequires:  rust
0d9273a
BuildRequires:  perl-devel
0d9273a
BuildRequires:  pkgconfig(libffi)
0d9273a
BuildRequires:  pkgconfig(zlib)
0d9273a
BuildRequires:  python3-devel
0fa6e64
BuildRequires:  python3-setuptools
0d9273a
BuildRequires:  python3-six
0d9273a
BuildRequires:  readline-devel
0d9273a
BuildRequires:  zip
79c7973
79c7973
%if 0%{?big_endian}
79c7973
BuildRequires:  icu
79c7973
%endif
79c7973
0d9273a
%if 0%{?system_libatomic}
0d9273a
BuildRequires:  libatomic
0d9273a
%endif
0d9273a
0d9273a
%description
0d9273a
SpiderMonkey is the code-name for Mozilla Firefox's C++ implementation of
0d9273a
JavaScript. It is intended to be embedded in other applications
0d9273a
that provide host environments for JavaScript.
0d9273a
0d9273a
%package        devel
0d9273a
Summary:        Development files for %{name}
0d9273a
Requires:       %{name}%{?_isa} = %{version}-%{release}
0d9273a
0d9273a
%description    devel
0d9273a
The %{name}-devel package contains libraries and header files for
0d9273a
developing applications that use %{name}.
0d9273a
0d9273a
%prep
0d9273a
%setup -q -n firefox-%{version}/js/src
0d9273a
0d9273a
pushd ../..
0d9273a
%patch01 -p1
0d9273a
%patch02 -p1
0d9273a
%patch03 -p1
0d9273a
%patch09 -p1
0d9273a
%patch10 -p1
0d9273a
0d9273a
%patch12 -p1
381069b
%patch13 -p1
0d9273a
%patch14 -p1
0d9273a
%patch15 -p1
0d9273a
0d9273a
%ifarch armv7hl
0ebbe70
# Include definitions for user vfp on armv7 as it causes the compilation to fail without them
0d9273a
# https://bugzilla.mozilla.org/show_bug.cgi?id=1526653
0d9273a
%patch17 -p1
0d9273a
%endif
0d9273a
0d9273a
%ifarch s390x
0d9273a
%patch18 -p1
0d9273a
%endif
0d9273a
0d9273a
# Fixes for ppc64 and s390x, there is no need to keep it in ifarch here since mozilla tests support ifarch conditions
0d9273a
%patch19 -p1
0d9273a
15ae20d
# Export SharedArrayRawBufferRefs
15ae20d
%patch30 -p1
a6933fc
a6933fc
# Avoid autoconf213 dependency
0be21c3
%patch31 -p1 -b .autoconf213
0be21c3
%patch32 -p1 -b .autoconf213-2
15ae20d
0d9273a
# Copy out the LICENSE file
0d9273a
cp LICENSE js/src/
0d9273a
popd
0d9273a
0d9273a
# Remove zlib directory (to be sure using system version)
0d9273a
rm -rf ../../modules/zlib
0d9273a
0d9273a
%build
0fa6e64
# Prefer GCC for now
0d9273a
export CC=gcc
0d9273a
export CXX=g++
0d9273a
0d9273a
# Workaround
0d9273a
# error: options `-C embed-bitcode=no` and `-C lto` are incompatible
0d9273a
# error: could not compile `jsrust`.
0d9273a
# https://github.com/japaric/cargo-call-stack/issues/25
0d9273a
export RUSTFLAGS="-C embed-bitcode"
0d9273a
0fa6e64
%if 0%{?build_with_lto}
0fa6e64
# https://github.com/ptomato/mozjs/commit/36bb7982b41e0ef9a65f7174252ab996cd6777bd
0fa6e64
export CARGO_PROFILE_RELEASE_LTO=true
0fa6e64
%endif
0fa6e64
0d9273a
export CFLAGS="%{optflags}"
0d9273a
export CXXFLAGS="$CFLAGS"
0d9273a
export LINKFLAGS="%{?__global_ldflags}"
0d9273a
export PYTHON="%{__python3}"
0d9273a
0d9273a
%configure \
0d9273a
  --without-system-icu \
0d9273a
  --with-system-zlib \
0d9273a
  --disable-tests \
0d9273a
  --disable-strip \
0d9273a
  --with-intl-api \
0d9273a
  --enable-readline \
0d9273a
  --enable-shared-js \
79c7973
  --enable-optimize \
79c7973
  --disable-debug \
0d9273a
  --enable-pie \
0d9273a
  --disable-jemalloc
0d9273a
0d9273a
%if 0%{?big_endian}
0d9273a
echo "Generate big endian version of config/external/icu/data/icud67l.dat"
0d9273a
pushd ../..
0d9273a
  icupkg -tb config/external/icu/data/icudt67l.dat config/external/icu/data/icudt67b.dat
0d9273a
  rm -f config/external/icu/data/icudt*l.dat
0d9273a
popd
0d9273a
%endif
0d9273a
0d9273a
%make_build
0d9273a
0d9273a
%install
0d9273a
%make_install
0d9273a
0d9273a
# Fix permissions
0d9273a
chmod -x %{buildroot}%{_libdir}/pkgconfig/*.pc
0d9273a
0d9273a
# Avoid multilib conflicts
0d9273a
case `uname -i` in
0d9273a
  i386 | ppc | s390 | sparc )
0d9273a
    wordsize="32"
0d9273a
    ;;
0d9273a
  x86_64 | ppc64 | s390x | sparc64 )
0d9273a
    wordsize="64"
0d9273a
    ;;
0d9273a
  *)
0d9273a
    wordsize=""
0d9273a
    ;;
0d9273a
esac
0d9273a
0d9273a
if test -n "$wordsize"
0d9273a
then
0d9273a
  mv %{buildroot}%{_includedir}/mozjs-%{major}/js-config.h \
0d9273a
     %{buildroot}%{_includedir}/mozjs-%{major}/js-config-$wordsize.h
0d9273a
0d9273a
  cat >%{buildroot}%{_includedir}/mozjs-%{major}/js-config.h <
0d9273a
#ifndef JS_CONFIG_H_MULTILIB
0d9273a
#define JS_CONFIG_H_MULTILIB
0d9273a
0d9273a
#include <bits/wordsize.h>
0d9273a
0d9273a
#if __WORDSIZE == 32
0d9273a
# include "js-config-32.h"
0d9273a
#elif __WORDSIZE == 64
0d9273a
# include "js-config-64.h"
0d9273a
#else
0d9273a
# error "unexpected value for __WORDSIZE macro"
0d9273a
#endif
0d9273a
0d9273a
#endif
0d9273a
EOF
0d9273a
0d9273a
fi
0d9273a
0d9273a
# Remove unneeded files
0d9273a
rm %{buildroot}%{_bindir}/js%{major}-config
0d9273a
rm %{buildroot}%{_libdir}/libjs_static.ajs
0d9273a
0d9273a
# Rename library and create symlinks, following fix-soname.patch
0d9273a
mv %{buildroot}%{_libdir}/libmozjs-%{major}.so \
0d9273a
   %{buildroot}%{_libdir}/libmozjs-%{major}.so.0.0.0
0d9273a
ln -s libmozjs-%{major}.so.0.0.0 %{buildroot}%{_libdir}/libmozjs-%{major}.so.0
0d9273a
ln -s libmozjs-%{major}.so.0 %{buildroot}%{_libdir}/libmozjs-%{major}.so
0d9273a
0d9273a
%check
0d9273a
# Run SpiderMonkey tests
0d9273a
%if 0%{?require_tests}
0d9273a
PYTHONPATH=tests/lib %{__python3} tests/jstests.py -d -s -t 1800 --no-progress --wpt=disabled ../../js/src/dist/bin/js%{major}
0d9273a
%else
0d9273a
PYTHONPATH=tests/lib %{__python3} tests/jstests.py -d -s -t 1800 --no-progress --wpt=disabled ../../js/src/dist/bin/js%{major} || :
0d9273a
%endif
0d9273a
0d9273a
# Run basic JIT tests
0d9273a
%if 0%{?require_tests}
0d9273a
PYTHONPATH=tests/lib %{__python3} jit-test/jit_test.py -s -t 1800 --no-progress ../../js/src/dist/bin/js%{major} basic
0d9273a
%else
0d9273a
PYTHONPATH=tests/lib %{__python3} jit-test/jit_test.py -s -t 1800 --no-progress ../../js/src/dist/bin/js%{major} basic || :
0d9273a
%endif
0d9273a
0d9273a
%ldconfig_scriptlets
0d9273a
0d9273a
%files
0d9273a
%doc README.html
0d9273a
%license LICENSE
0d9273a
%{_libdir}/libmozjs-%{major}.so.0*
0d9273a
0d9273a
%files devel
0d9273a
%{_bindir}/js%{major}
0d9273a
%{_libdir}/libmozjs-%{major}.so
0d9273a
%{_libdir}/pkgconfig/*.pc
0d9273a
%{_includedir}/mozjs-%{major}/
0d9273a
0d9273a
%changelog
051bec2
* Mon Oct 04 2021 Frantisek Zatloukal <fzatlouk@redhat.com> - 78.15.0-1
051bec2
- Update to 78.15.0
051bec2
96a9dba
* Mon Sep 27 2021 Frantisek Zatloukal <fzatlouk@redhat.com> - 78.14.0-1
96a9dba
- Update to 78.14.0
96a9dba
ee01bd1
* Mon Aug 09 2021 Frantisek Zatloukal <fzatlouk@redhat.com> - 78.13.0-1
ee01bd1
- Update to 78.13.0
ee01bd1
ce171e0
* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 78.12.0-3
ce171e0
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
ce171e0
381069b
* Tue Jul 13 2021 Frantisek Zatloukal <fzatlouk@redhat.com> - 78.12.0-2
381069b
- Fixup compatibility of mozbuild with Python 3.10
381069b
001ea36
* Tue Jul 13 2021 Frantisek Zatloukal <fzatlouk@redhat.com> - 78.12.0-1
001ea36
- Update to 78.12.0
001ea36
05ad375
* Wed Jun 02 2021 Frantisek Zatloukal <fzatlouk@redhat.com> - 78.11.0-1
05ad375
- Update to 78.11.0
05ad375
4c34eab
* Tue Apr 20 2021 Frantisek Zatloukal <fzatlouk@redhat.com> - 78.10.0-1
4c34eab
- Update to 78.10.0
4c34eab
0be21c3
* Mon Apr 12 2021 Jan Horak <jhorak@redhat.com> - 78.9.0-3
0be21c3
- Removed autoconf213 dependency
0be21c3
015769a
* Tue Mar 30 2021 Jonathan Wakely <jwakely@redhat.com> - 78.9.0-2
015769a
- Rebuilt for removed libstdc++ symbol (#1937698)
015769a
0ebbe70
* Thu Mar 25 2021 Frantisek Zatloukal <fzatlouk@redhat.com> - 78.9.0-1
0ebbe70
- Update to 78.9.0
0ebbe70
- Rebase patches
0ebbe70
- Replace armv7_disable_WASM_EMULATE_ARM_UNALIGNED_FP_ACCESS with patch from Debian to include vfp defs
0ebbe70
778cb22
* Tue Feb 23 2021 Frantisek Zatloukal <fzatlouk@redhat.com> - 78.8.0-2
778cb22
- Don't BR nasm on RHEL
778cb22
15ae20d
* Tue Feb 23 2021 Frantisek Zatloukal <fzatlouk@redhat.com> - 78.8.0-1
15ae20d
- Update to 78.8.0
15ae20d
- Add fix for MOZBZ#1644600
15ae20d
9a3f96c
* Tue Jan 26 2021 Frantisek Zatloukal <fzatlouk@redhat.com> - 78.7.0-1
9a3f96c
- Update to 78.7.0
9a3f96c
26c6ed7
* Tue Dec 15 2020 Frantisek Zatloukal <fzatlouk@redhat.com> - 78.6.0-1
26c6ed7
- Update to 78.6.0
26c6ed7
79c7973
* Tue Nov 17 2020 Frantisek Zatloukal <fzatlouk@redhat.com> - 78.5.0-1
79c7973
- Update to 78.5.0
79c7973
- Build with: --enable-optimize, --disable-debug
79c7973
256e02e
* Mon Oct 19 2020 Frantisek Zatloukal <fzatlouk@redhat.com> - 78.4.0-1
256e02e
- Update to 78.4.0
256e02e
4ea8890
* Tue Sep 22 2020 Frantisek Zatloukal <fzatlouk@redhat.com> - 78.3.0-1
4ea8890
- Update to 78.3.0
4ea8890
1ffb265
* Mon Aug 24 2020 Frantisek Zatloukal <fzatlouk@redhat.com> - 78.2.0-1
1ffb265
- Update to 78.2.0
1ffb265
0fa6e64
* Mon Aug 17 2020 Frantisek Zatloukal <fzatlouk@redhat.com> - 78.1.0-2
0fa6e64
- Add BR: python3-setuptools
0fa6e64
- Backport fix for https://bugzilla.mozilla.org/show_bug.cgi?id=1654696
0fa6e64
- Set CARGO_PROFILE_RELEASE_LTO=true
0fa6e64
0d9273a
* Tue Jul 28 2020 Frantisek Zatloukal <fzatlouk@redhat.com> - 78.1.0-1
0d9273a
- Initial mozjs78 package based on mozjs68