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}
95774b8
# LTO is default since F33 and F32 package is backported as is, so no LTO there
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}
0b01ee3
Version:        91.1.0
95774b8
Release:        1%{?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
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
95774b8
95774b8
# TODO: Check with mozilla for cause of these fails and re-enable spidermonkey compile time checks if needed
95774b8
Patch16:        spidermonkey_checks_disable.patch
95774b8
95774b8
# armv7 fixes
95774b8
Patch17:        definitions_for_user_vfp.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
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
95774b8
95774b8
%ifarch armv7hl
95774b8
# Include definitions for user vfp on armv7 as it causes the compilation to fail without them
95774b8
# https://bugzilla.mozilla.org/show_bug.cgi?id=1526653
95774b8
%patch17 -p1
95774b8
%endif
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/
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 \
95774b8
  --without-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}
95774b8
%{python3} tests/jstests.py -d -s -t 2400 --no-progress --wpt=disabled ../../js/src/dist/bin/js%{major}
95774b8
%else
95774b8
%{python3} tests/jstests.py -d -s -t 2400 --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
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