Blob Blame Raw
%global major 52

# Big endian platforms
%ifarch ppc ppc64 s390 s390x
%define big_endian 1

Name:           mozjs%{major}
Version:        52.4.0
Release:        2%{?dist}
Summary:        SpiderMonkey JavaScript library

License:        MPLv2.0 and MPLv1.1 and BSD and GPLv2+ and GPLv3+ and LGPLv2.1 and LGPLv2.1+ and AFL and ASL 2.0

# Patches from Debian mozjs52_52.3.1-4.debian.tar.xz:
Patch0001:      fix-soname.patch
Patch0002:      copy-headers.patch

# Patches from / Debian mozjs52_52.3.1-4.debian.tar.xz
Patch0101:      disable-mozglue.patch
Patch0103:      tests-skip-on-all-64-bit-archs.patch
Patch0104:      include-configure-script.patch

# Patches from Fedora firefox package:
Patch18:        xulrunner-24.0-jemalloc-ppc.patch
Patch19:        xulrunner-24.0-s390-inlines.patch
Patch26:        build-icu-big-endian.patch
Patch36:        build-missing-xlocale-h.patch
Patch304:       mozilla-1253216.patch

BuildRequires:  autoconf213
BuildRequires:  perl-devel
BuildRequires:  pkgconfig(libffi)
BuildRequires:  pkgconfig(zlib)
BuildRequires:  python2-devel
BuildRequires:  readline-devel
BuildRequires:  /usr/bin/zip

# Firefox does not allow to build with system version of jemalloc
Provides: bundled(jemalloc) = 4.3.1

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}.

%setup -q -n firefox-%{version}esr/js/src

pushd ../..
%patch0001 -p1
%patch0002 -p1

%patch0101 -p1
%patch0103 -p1
%patch0104 -p1

%patch18 -p1 -b .jemalloc-ppc
%patch19 -p2 -b .s390-inlines

# Patch for big endian platforms only
%if 0%{?big_endian}
%patch26 -p1 -b .icu
%patch36 -p2 -b .xlocale

%patch304 -p1 -b .1253216

# Remove zlib directory (to be sure using system version)
rm -rf ../../modules/zlib

# Disable null pointer gcc6 optimization in gcc6 (rhbz#1328045)
export CFLAGS="%{optflags} -fno-tree-vrp -fno-strict-aliasing -fno-delete-null-pointer-checks"
export PYTHON=/usr/bin/python2

%configure \
  --without-system-icu \
  --enable-posix-nspr-emulation \
  --with-system-zlib \
  --enable-tests \
  --disable-strip \
  --with-intl-api \
  --enable-readline \
  --enable-shared-js \
  --disable-optimize \
  --enable-pie \
%ifarch s390 s390x
  --disable-jemalloc \
%ifarch %{arm} aarch64 ppc ppc64 ppc64le

%if 0%{?big_endian}
echo "Generate big endian version of config/external/icu/data/icud58l.dat"
pushd ../..
  ./mach python intl/ .
  ls -l config/external/icu/data
  rm -f config/external/icu/data/icudt*l.dat



# Fix permissions
chmod -x %{buildroot}%{_libdir}/pkgconfig/*.pc

# We only need the shared library
rm %{buildroot}%{_bindir}/js*
rm %{buildroot}%{_libdir}/libjs_static.ajs

# Rename library and create symlinks, following fix-soname.patch
mv %{buildroot}%{_libdir}/ \
ln -s %{buildroot}%{_libdir}/
ln -s %{buildroot}%{_libdir}/

# Run SpiderMonkey tests
%ifarch %{ix86} x86_64 %{arm} aarch64
tests/ -d -s -t 1800 --no-progress ../../js/src/js/src/shell/js
tests/ -d -s -t 1800 --no-progress ../../js/src/js/src/shell/js || :

# Run basic JIT tests
%ifarch %{ix86} x86_64 %{arm} aarch64
jit-test/ -s -t 1800 --no-progress ../../js/src/js/src/shell/js basic
jit-test/ -s -t 1800 --no-progress ../../js/src/js/src/shell/js basic || :

%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig

%doc README.html

%files devel

* Tue Oct 31 2017 Kalev Lember <> - 52.4.0-2
- Various secondary arch fixes

* Thu Sep 28 2017 Kalev Lember <> - 52.4.0-1
- Update to 52.4.0

* Wed Sep 20 2017 Kalev Lember <> - 52.3.0-1
- Initial Fedora packaging, based on earlier mozjs45 work