Blob Blame History Raw
%global glib2_version 2.50.0
%global gobject_introspection_version 1.41.4
%global gtk3_version 3.20

%global bundled_mozjs 1

%if 0%{?bundled_mozjs}
%global mozjs_major 52
%global mozjs_version 52.6.0

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

Name:          gjs
Version:       1.50.4
Release:       4%{?dist}
Summary:       Javascript Bindings for GNOME

# The following files contain code from Mozilla which
# is triple licensed under MPL1.1/LGPLv2+/GPLv2+:
# The console module (modules/console.c)
# Stack printer (gjs/stack.c)
%if 0%{?bundled_mozjs}
License:       MIT and (MPLv1.1 or GPLv2+ or LGPLv2+) and MPLv2.0 and MPLv1.1 and BSD and GPLv2+ and GPLv3+ and LGPLv2.1 and LGPLv2.1+ and AFL and ASL 2.0
%else
License:       MIT and (MPLv1.1 or GPLv2+ or LGPLv2+)
%endif
URL:           https://wiki.gnome.org/Projects/Gjs
Source0:       https://download.gnome.org/sources/%{name}/1.50/%{name}-%{version}.tar.xz

%if 0%{?bundled_mozjs}
Source1:       https://ftp.mozilla.org/pub/firefox/releases/%{mozjs_version}esr/source/firefox-%{mozjs_version}esr.source.tar.xz
Provides:      bundled(mozjs) = %{mozjs_version}

# https://bugzilla.redhat.com/show_bug.cgi?id=1510876
Patch0001:     gjs-mozjs-dont-export-abort.patch

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

# Downstream RHEL patches
Patch0003:     disable-extra-threads.patch
Patch0004:     disable-destoyed-object-criticals.patch

# Patches from https://github.com/ptomato/mozjs / Debian mozjs52_52.3.1-4.debian.tar.xz
Patch0101:     disable-mozglue.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
%endif

BuildRequires: cairo-gobject-devel
BuildRequires: chrpath
BuildRequires: gobject-introspection-devel >= %{gobject_introspection_version}
BuildRequires: readline-devel
BuildRequires: dbus-glib-devel
BuildRequires: gettext
BuildRequires: glib2-devel >= %{glib2_version}
BuildRequires: gtk3-devel >= %{gtk3_version}
%if 0%{?bundled_mozjs}
BuildRequires: autoconf213
BuildRequires: perl-devel
BuildRequires: pkgconfig(libffi)
BuildRequires: pkgconfig(zlib)
BuildRequires: python2-devel
BuildRequires: readline-devel
BuildRequires: /usr/bin/zip
%else
BuildRequires: mozjs52-devel
%endif
BuildRequires: pkgconfig

Requires: glib2%{?_isa} >= %{glib2_version}
Requires: gobject-introspection%{?_isa} >= %{gobject_introspection_version}
Requires: gtk3%{?_isa} >= %{gtk3_version}

%if 0%{?bundled_mozjs}
# Firefox does not allow to build with system version of jemalloc
Provides: bundled(jemalloc) = 4.3.1

# Make sure we don't add requires/provides for private libraries
%global __provides_exclude_from ^%{_libdir}/gjs/
%global __requires_exclude ^libmozjs-%{mozjs_major}\\.so.*
%endif

%description
Gjs allows using GNOME libraries from Javascript. It's based on the
Spidermonkey Javascript engine from Mozilla and the GObject introspection
framework.

%package devel
Summary: Development package for %{name}
Requires: %{name}%{?_isa} = %{version}-%{release}

%description devel
Files for development with %{name}.

%package tests
Summary: Tests for the gjs package
Requires: %{name}%{?_isa} = %{version}-%{release}

%description tests
The gjs-tests package contains tests that can be used to verify
the functionality of the installed gjs package.

%prep
%setup -q

%if 0%{?bundled_mozjs}
# Extract mozjs archive
tar -xf %{S:1}

# Apply mozjs patches
pushd firefox-%{mozjs_version}esr
%patch0001 -p1
%patch0002 -p1
%patch0003 -p1

%patch0101 -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
%endif

%patch304 -p1 -b .1253216

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

%patch0004 -p1 -b .debug
%endif

%build
%if 0%{?bundled_mozjs}
pushd firefox-%{mozjs_version}esr/js/src
# Disable null pointer gcc6 optimization in gcc6 (rhbz#1328045)
export CFLAGS="%{optflags} -fno-tree-vrp -fno-strict-aliasing -fno-delete-null-pointer-checks"
export CXXFLAGS=$CFLAGS
LINKFLAGS="%{?__global_ldflags}"
export PYTHON=/usr/bin/python2

autoconf-2.13
%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 \
%endif
%ifarch %{arm} aarch64 ppc ppc64 ppc64le
  --disable-ion
%endif

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

%make_build
popd

cat > mozjs-%{mozjs_major}.pc << EOF
Name: SpiderMonkey %{mozjs_version}
Description: The Mozilla library for JavaScript
Version: %{mozjs_version}

Libs: -L`pwd`/firefox-%{mozjs_version}esr/js/src/dist/sdk/lib -Wl,-rpath=%{_libdir}/gjs -lmozjs-%{mozjs_major}
Cflags: -include `pwd`/firefox-%{mozjs_version}esr/js/src/dist/include/js/RequiredDefines.h -I`pwd`/firefox-%{mozjs_version}esr/js/src/dist/include
EOF
%endif

%if 0%{?bundled_mozjs}
export PKG_CONFIG_PATH=`pwd`
export LD_LIBRARY_PATH=`pwd`/firefox-%{mozjs_version}esr/js/src/dist/sdk/lib
export LDFLAGS="%{?__global_ldflags} -Wl,--as-needed"
%endif
%configure --disable-static --enable-installed-tests --without-dbus-tests

make %{?_smp_mflags} V=1
%if 0%{?bundled_mozjs}
sed -i -e 's/ mozjs-%{mozjs_major}//g' gjs-1.0.pc
%endif

%install
%if 0%{?bundled_mozjs}
mkdir -p %{buildroot}%{_libdir}/gjs
cp -a firefox-%{mozjs_version}esr/js/src/js/src/libmozjs-%{mozjs_major}.so %{buildroot}%{_libdir}/gjs/
%endif
%make_install

# Remove lib64 rpaths
chrpath --delete %{buildroot}%{_bindir}/gjs-console
chrpath --delete %{buildroot}%{_libexecdir}/gjs/installed-tests/minijasmine

find %{buildroot} -name '*.la' -exec rm -f {} ';'

%check
%if 0%{?bundled_mozjs}
pushd firefox-%{mozjs_version}esr/js/src
# Run SpiderMonkey tests
%ifarch %{ix86} x86_64 %{arm} aarch64
tests/jstests.py -d -s -t 1800 --no-progress ../../js/src/js/src/shell/js
%else
tests/jstests.py -d -s -t 1800 --no-progress ../../js/src/js/src/shell/js || :
%endif

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

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%license COPYING
%doc NEWS README
%{_bindir}/gjs
%{_bindir}/gjs-console
%{_libdir}/*.so.*
%{_libdir}/gjs

%files devel
%doc examples/*
%{_includedir}/gjs-1.0
%{_libdir}/pkgconfig/gjs-1.0.pc
%{_libdir}/*.so

%files tests
%{_libexecdir}/gjs/installed-tests
%{_datadir}/installed-tests

%changelog
* Fri Feb 16 2018 Kalev Lember <klember@redhat.com> - 1.50.4-4
- Avoid emitting critical warnings for finalized objects
  Resolves: #1546059

* Mon Feb 12 2018 Ray Strode <rstrode@redhat.com> - 1.50.4-3
- Fix ppc64le architecture check
  Related: #1523121

* Thu Feb 08 2018 Ray Strode <rstrode@redhat.com> - 1.50.4-2
- Diasble JS Helper threads on ppc64le
  Related: #1523121

* Thu Feb 01 2018 Kalev Lember <klember@redhat.com> - 1.50.4-1
- Update to 1.50.4
- Update mozjs52 to 52.6.0
- Related: #1525499

* Thu Feb 01 2018 Kalev Lember <klember@redhat.com> - 1.50.2-4
- Fix /usr/bin/gjs-console multilib file conflict
- Resolves: #1517890

* Mon Dec 04 2017 Debarshi Ray <rishi@fedoraproject.org> - 1.50.2-3
- Fix start-up on aarch64
- Resolves: #1510876

* Wed Nov 08 2017 Kalev Lember <klember@redhat.com> - 1.50.2-2
- Fix /usr/bin/gjs linking with bundled mozjs52
- Resolves: #1510876

* Wed Nov 01 2017 Kalev Lember <klember@redhat.com> - 1.50.2-1
- Update to 1.50.2
- Related: #1505747

* Mon Oct 30 2017 Kalev Lember <klember@redhat.com> - 1.50.1-1
- Update to 1.50.1
- Bundle mozjs52 52.4.0 as a private library
- Resolves: #1505747

* Tue Oct 24 2017 Florian Müllner <fmuellner@redhat.com> - 1.47.0-1
- Update to 1.47.0
- Related: #1481381

* Wed Sep 21 2016 Kalev Lember <klember@redhat.com> - 1.46.0-1
- Update to 1.46.0
- Resolves: #1386870

* Thu Mar 19 2015 Richard Hughes <rhughes@redhat.com> - 1.42.0-1
- Update to 1.42.0
- Resolves: #1174518

* Tue Mar 18 2014 Colin Walters <walters@redhat> - 1.36.1-2
- Revert previous attempts to build 1.37.1, just go back to 1.36.1-2
- Resolves: #1070805

* Mon Apr 29 2013 Kalev Lember <kalevlember@gmail.com> - 1.36.1-1
- Update to 1.36.1

* Tue Mar 26 2013 Kalev Lember <kalevlember@gmail.com> - 1.36.0-1
- Update to 1.36.0

* Thu Mar 21 2013 Kalev Lember <kalevlember@gmail.com> - 1.35.9-1
- Update to 1.35.9

* Wed Feb 20 2013 Richard Hughes <rhughes@redhat.com> - 1.35.8-1
- Update to 1.35.8

* Wed Feb 13 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.35.4-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

* Tue Jan 15 2013 Matthias Clasen <mclasen@redhat.com> - 1.35.4-1
- Update to 1.35.4

* Thu Dec 20 2012 Kalev Lember <kalevlember@gmail.com> - 1.35.3-1
- Update to 1.35.3

* Tue Nov 20 2012 Richard Hughes <hughsient@gmail.com> - 1.35.2-1
- Update to 1.35.2

* Tue Sep 25 2012 Kalev Lember <kalevlember@gmail.com> - 1.34.0-1
- Update to 1.34.0

* Wed Sep 19 2012 Richard Hughes <hughsient@gmail.com> - 1.33.14-1
- Update to 1.33.14

* Thu Sep 06 2012 Richard Hughes <hughsient@gmail.com> - 1.33.10-1
- Update to 1.33.10

* Tue Aug 21 2012 Richard Hughes <hughsient@gmail.com> - 1.33.9-1
- Update to 1.33.9

* Thu Jul 19 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.33.4-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Tue Jul 17 2012 Richard Hughes <hughsient@gmail.com> - 1.33.4-1
- Update to 1.33.4

* Thu Jul  5 2012 Peter Robinson <pbrobinson@fedoraproject.org> - 1.33.3-2
- Enable verbose build

* Tue Jun 26 2012 Richard Hughes <hughsient@gmail.com> - 1.33.3-1
- Update to 1.33.3

* Sat Jun  9 2012 Matthias Clasen <mclasen@redhat.com> - 1.33.2-2
- Fix the build

* Thu Jun 07 2012 Richard Hughes <hughsient@gmail.com> - 1.33.2-1
- Update to 1.33.2

* Wed Mar 28 2012 Richard Hughes <hughsient@gmail.com> - 1.32.0-1
- Update to 1.32.0

* Wed Mar 21 2012 Matthias Clasen <mclasen@redhat.com> - 1.31.22-1
- Update to 1.31.22

* Mon Mar  5 2012 Matthias Clasen <mclasen@redhat.com> - 1.31.20-1
- Update to 1.31.20

* Tue Feb  7 2012 Colin Walters <walters@verbum.org> - 1.31.10-2
- Drop custom .gir/.typelib directories; see upstream commit
  ea4d639eab307737870479b6573d5dab9fb2915a

* Thu Jan 19 2012 Matthias Clasen <mclasen@redhat.com> - 1.31.10-1
- 1.31.10

* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.31.6-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild

* Tue Dec 20 2011 Matthias Clasen <mclasen@redhat.com> 1.31.6-1
- 1.31.6

* Fri Dec 02 2011 Karsten Hopp <karsten@redhat.com> 1.31.0-2
- fix crash on PPC, bugzilla 749604

* Wed Nov  2 2011 Matthias Clasen <mclasen@redhat.com> - 1.31.0-1
- Update to 1.31.0

* Tue Sep 27 2011 Ray <rstrode@redhat.com> - 1.30.0-1
- Update to 1.30.0

* Wed Sep 21 2011 Matthias Clasen <mclasen@redhat.com> 1.29.18-1
- Update to 1.29.18

* Mon Sep 05 2011 Luis Bazan <bazanluis20@gmail.com> 1.29.17-2
- mass rebuild

* Tue Aug 30 2011 Matthias Clasen <mclasen@redhat.com> 1.29.17-1
- Update to 1.29.17

* Thu Aug 18 2011 Matthias Clasen <mclasen@redhat.com> 1.29.16-1
- Update to 1.29.16

* Thu Jul 28 2011 Colin Walters <walters@verbum.org> - 1.29.0-3
- BR latest g-i to fix build issue

* Mon Jun 27 2011 Adam Williamson <awilliam@redhat.com> - 1.29.0-2
- build against js, not gecko (from f15 branch, but patch not needed)
- BR cairo-devel (also from f15)

* Fri Jun 17 2011 Tomas Bzatek <tbzatek@redhat.com> - 1.29.0-1
- Update to 1.29.0

* Thu Apr 28 2011 Christopher Aillon <caillon@redhat.com> - 0.7.14-3
- Rebuild against newer gecko

* Thu Apr 14 2011 Colin Walters <walters@verbum.org> - 0.7.14-2
- BR readline; closes #696254

* Mon Apr  4 2011 Colin Walters <walters@verbum.org> - 0.7.14-1
- Update to 0.7.14; fixes notification race condition on login

* Tue Mar 22 2011 Christopher Aillon <caillon@redhat.com> - 0.7.13-3
- Rebuild against newer gecko

* Fri Mar 18 2011 Christopher Aillon <caillon@redhat.com> - 0.7.13-2
- Rebuild against newer gecko

* Thu Mar 10 2011 Colin Walters <walters@verbum.org> - 0.7.13-1
- Update to 0.7.13

* Wed Mar  9 2011 Christopher Aillon <caillon@redhat.com> - 0.7.11-3
- Rebuild against newer gecko

* Fri Feb 25 2011 Christopher Aillon <caillon@redhat.com> - 0.7.11-2
- Rebuild against newer gecko

* Tue Feb 22 2011 Owen Taylor <otaylor@redhat.com> - 0.7.11-1
- Update to 0.7.11

* Thu Feb 10 2011 Christopher Aillon <caillon@redhat.com> - 0.7.10-4
- Require gecko-libs instead of xulrunner

* Wed Feb  9 2011 Colin Walters <walters@verbum.org> - 0.7.10-3
- Add a hardcoded Requires on xulrunner; see comment

* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.7.10-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Tue Jan 25 2011 Colin Walters <walters@verbum.org> - 0.7.10-1
- New upstream release

* Tue Jan 25 2011 Christopher Aillon <caillon@redhat.com> - 0.7.9-3
- Rebuild for new xulrunner

* Fri Jan 14 2011 Christopher Aillon <caillon@redhat.com> - 0.7.9-2
- Rebuild for new xulrunner

* Fri Jan 14 2011 Colin Walters <walters@verbum.org> - 0.7.9-1
- 0.7.9

* Wed Jan 12 2011 Colin Walters <walters@verbum.org> - 0.7.8-1
- Update to 0.7.8
- Drop upstreamed patches
- BR latest g-i for GI_TYPE_TAG_UNICHAR

* Wed Dec 29 2010 Dan Williams <dcbw@redhat.com> - 0.7.7-3
- Work around Mozilla JS API changes

* Wed Dec 22 2010 Colin Walters <walters@verbum.org> - 0.7.7-2
- Remove rpath removal; we need an rpath on libmozjs, since
  it's in a nonstandard directory.

* Mon Nov 15 2010 Owen Taylor <otaylor@redhat.com> - 0.7.7-1
- Update to 0.7.7

* Tue Nov  9 2010 Owen Taylor <otaylor@redhat.com> - 0.7.6-1
- Update to 0.7.6

* Fri Oct 29 2010 Owen Taylor <otaylor@redhat.com> - 0.7.5-1
- Update to 0.7.5

* Mon Oct  4 2010 Owen Taylor <otaylor@redhat.com> - 0.7.4-1
- Update to 0.7.4

* Wed Jul 14 2010 Colin Walters <walters@verbum.org> - 0.7.1-3
- Rebuild for new gobject-introspection

* Mon Jul 12 2010 Colin Walters <walters@verbum.org> - 0.7.1-2
- New upstream version
- Changes to allow builds from snapshots

* Fri May 28 2010 Matthias Clasen <mclasen@redhat.com> 0.7-1
- Update to 0.7

* Wed Mar 24 2010 Peter Robinson <pbrobinson@gmail.com> 0.6-1
- New upstream 0.6 stable release

* Sat Feb 20 2010 Peter Robinson <pbrobinson@gmail.com> 0.5-1
- New upstream 0.5 release

* Thu Jan 14 2010 Peter Robinson <pbrobinson@gmail.com> 0.5-0.1
- Move to git snapshot to fix compile against xulrunner 1.9.2.1

* Thu Aug 27 2009 Peter Robinson <pbrobinson@gmail.com> 0.4-1
- New upstream 0.4 release

* Fri Aug  7 2009 Peter Robinson <pbrobinson@gmail.com> 0.3-2
- Updates from the review request

* Wed Jul  8 2009 Peter Robinson <pbrobinson@gmail.com> 0.3-1
- New upstream release. Clarify licensing for review

* Sat Jun 27 2009 Peter Robinson <pbrobinson@gmail.com> 0.2-1
- Initial packaging