Browse Source

gjs package update

Signed-off-by: guibuilder_pel7x64builder0 <guibuilder@powerel.org>
master
guibuilder_pel7x64builder0 6 years ago
parent
commit
6e8367aea8
  1. 99
      SOURCES/0001-Revert-js-Convert-scripts-to-UTF-16-before-evaluatin.patch
  2. 183
      SPECS/gjs.spec

99
SOURCES/0001-Revert-js-Convert-scripts-to-UTF-16-before-evaluatin.patch

@ -0,0 +1,99 @@
From 6a194ae2b4479fefb803fc38a2ccad3ebc766440 Mon Sep 17 00:00:00 2001
From: Kalev Lember <klember@redhat.com>
Date: Tue, 15 May 2018 21:14:16 +0200
Subject: [PATCH] Revert "js: Convert scripts to UTF-16 before evaluating"

RHEL 7 libstdc++ 4.8 doesn't have <codecvt> header that gjs needs. In
order to work this around, this commit reverts the patch that introduced
the requirement.

This reverts commit bc36f39ff09629e1b4c5c54f334028d2b2f8c545.
---
gjs/jsapi-util.cpp | 15 ++++++---------
gjs/module.cpp | 15 ++++++---------
2 files changed, 12 insertions(+), 18 deletions(-)

diff --git a/gjs/jsapi-util.cpp b/gjs/jsapi-util.cpp
index 322a41b..6033dff 100644
--- a/gjs/jsapi-util.cpp
+++ b/gjs/jsapi-util.cpp
@@ -24,9 +24,6 @@
#include <config.h>
-#include <codecvt>
-#include <locale>
-
#include <util/log.h>
#include <util/glib.h>
#include <util/misc.h>
@@ -851,19 +848,19 @@ gjs_eval_with_scope(JSContext *context,
eval_obj = JS_NewPlainObject(context);
JS::CompileOptions options(context);
- options.setFileAndLine(filename, start_line_number)
+ options.setUTF8(true)
+ .setFileAndLine(filename, start_line_number)
.setSourceIsLazy(true);
- std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> convert;
- std::u16string utf16_string = convert.from_bytes(script);
- JS::SourceBufferHolder buf(utf16_string.c_str(), utf16_string.size(),
- JS::SourceBufferHolder::NoOwnership);
+ JS::RootedScript compiled_script(context);
+ if (!JS::Compile(context, options, script, real_len, &compiled_script))
+ return false;
JS::AutoObjectVector scope_chain(context);
if (!scope_chain.append(eval_obj))
g_error("Unable to append to vector");
- if (!JS::Evaluate(context, scope_chain, options, buf, retval))
+ if (!JS_ExecuteScript(context, scope_chain, compiled_script, retval))
return false;
gjs_schedule_gc_if_needed(context);
diff --git a/gjs/module.cpp b/gjs/module.cpp
index cc6657a..4b8bd40 100644
--- a/gjs/module.cpp
+++ b/gjs/module.cpp
@@ -21,9 +21,6 @@
* IN THE SOFTWARE.
*/
-#include <codecvt>
-#include <locale>
-
#include <gio/gio.h>
#include "jsapi-util.h"
@@ -89,20 +86,20 @@ class GjsModule {
int line_number)
{
JS::CompileOptions options(cx);
- options.setFileAndLine(filename, line_number)
+ options.setUTF8(true)
+ .setFileAndLine(filename, line_number)
.setSourceIsLazy(true);
- std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> convert;
- std::u16string utf16_string = convert.from_bytes(script);
- JS::SourceBufferHolder buf(utf16_string.c_str(), utf16_string.size(),
- JS::SourceBufferHolder::NoOwnership);
+ JS::RootedScript compiled_script(cx);
+ if (!JS::Compile(cx, options, script, script_len, &compiled_script))
+ return false;
JS::AutoObjectVector scope_chain(cx);
if (!scope_chain.append(module))
g_error("Unable to append to vector");
JS::RootedValue ignored_retval(cx);
- if (!JS::Evaluate(cx, scope_chain, options, buf, &ignored_retval))
+ if (!JS_ExecuteScript(cx, scope_chain, compiled_script, &ignored_retval))
return false;
gjs_schedule_gc_if_needed(cx);
--
1.8.3.1

183
SPECS/gjs.spec

@ -2,61 +2,23 @@
%global gobject_introspection_version 1.41.4 %global gobject_introspection_version 1.41.4
%global gtk3_version 3.20 %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 Name: gjs
Version: 1.50.4 Version: 1.52.3
Release: 4%{?dist} Release: 1%{?dist}
Summary: Javascript Bindings for GNOME Summary: Javascript Bindings for GNOME


# The following files contain code from Mozilla which # The following files contain code from Mozilla which
# is triple licensed under MPL1.1/LGPLv2+/GPLv2+: # is triple licensed under MPL1.1/LGPLv2+/GPLv2+:
# The console module (modules/console.c) # The console module (modules/console.c)
# Stack printer (gjs/stack.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+) License: MIT and (MPLv1.1 or GPLv2+ or LGPLv2+)
%endif
URL: https://wiki.gnome.org/Projects/Gjs URL: https://wiki.gnome.org/Projects/Gjs
Source0: https://download.gnome.org/sources/%{name}/1.50/%{name}-%{version}.tar.xz Source0: https://download.gnome.org/sources/%{name}/1.52/%{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 # Downstream RHEL patches
Patch0003: disable-extra-threads.patch Patch0001: 0001-Revert-js-Convert-scripts-to-UTF-16-before-evaluatin.patch
Patch0004: disable-destoyed-object-criticals.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: cairo-gobject-devel
BuildRequires: chrpath BuildRequires: chrpath
BuildRequires: gobject-introspection-devel >= %{gobject_introspection_version} BuildRequires: gobject-introspection-devel >= %{gobject_introspection_version}
@ -65,31 +27,15 @@ BuildRequires: dbus-glib-devel
BuildRequires: gettext BuildRequires: gettext
BuildRequires: glib2-devel >= %{glib2_version} BuildRequires: glib2-devel >= %{glib2_version}
BuildRequires: gtk3-devel >= %{gtk3_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 BuildRequires: mozjs52-devel
%endif
BuildRequires: pkgconfig BuildRequires: pkgconfig


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


%if 0%{?bundled_mozjs} # Filter provides for private libraries
# 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 __provides_exclude_from ^%{_libdir}/gjs/
%global __requires_exclude ^libmozjs-%{mozjs_major}\\.so.*
%endif


%description %description
Gjs allows using GNOME libraries from Javascript. It's based on the Gjs allows using GNOME libraries from Javascript. It's based on the
@ -112,106 +58,14 @@ The gjs-tests package contains tests that can be used to verify
the functionality of the installed gjs package. the functionality of the installed gjs package.


%prep %prep
%setup -q %autosetup -p1

%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 %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 %configure --disable-static --enable-installed-tests --without-dbus-tests


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


%install %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 %make_install


# Remove lib64 rpaths # Remove lib64 rpaths
@ -221,23 +75,6 @@ chrpath --delete %{buildroot}%{_libexecdir}/gjs/installed-tests/minijasmine
find %{buildroot} -name '*.la' -exec rm -f {} ';' find %{buildroot} -name '*.la' -exec rm -f {} ';'


%check %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 #make check


%post -p /sbin/ldconfig %post -p /sbin/ldconfig
@ -257,12 +94,20 @@ popd
%{_includedir}/gjs-1.0 %{_includedir}/gjs-1.0
%{_libdir}/pkgconfig/gjs-1.0.pc %{_libdir}/pkgconfig/gjs-1.0.pc
%{_libdir}/*.so %{_libdir}/*.so
%dir %{_datadir}/gjs-1.0
%{_datadir}/gjs-1.0/lsan/
%{_datadir}/gjs-1.0/valgrind/


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


%changelog %changelog
* Tue May 08 2018 Kalev Lember <klember@redhat.com> - 1.52.3-1
- Update to 1.52.3
- Switch to building against system mozjs52
- Resolves: #1567325

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

Loading…
Cancel
Save