[oe] [RFC meta-gnome][PATCH 03/16] gjs: add a recipe for gjs (Gnome JavaScript engine)
brendank310
brendank310 at gmail.com
Mon Oct 29 16:41:00 UTC 2018
From: Brendan Kerrigan <kerriganb at ainfosec.com>
Currently this hacks up gjs a little bit and relies on a
specific SRCREV to sidestep the need for mozjs60 support
(use mozjs52 instead).
Signed-off-by: Brendan Kerrigan <kerriganb at ainfosec.com>
---
.../gnome3/gjs/0001-fix-override-allow.patch | 75 +++++++++++++++++++
meta-gnome/recipes-gnome/gnome3/gjs_git.bb | 30 ++++++++
2 files changed, 105 insertions(+)
create mode 100644 meta-gnome/recipes-gnome/gnome3/gjs/0001-fix-override-allow.patch
create mode 100644 meta-gnome/recipes-gnome/gnome3/gjs_git.bb
diff --git a/meta-gnome/recipes-gnome/gnome3/gjs/0001-fix-override-allow.patch b/meta-gnome/recipes-gnome/gnome3/gjs/0001-fix-override-allow.patch
new file mode 100644
index 000000000..fc152db1d
--- /dev/null
+++ b/meta-gnome/recipes-gnome/gnome3/gjs/0001-fix-override-allow.patch
@@ -0,0 +1,75 @@
+gjs: Fix broken override GInterface properties
+
+ [gjs Ticket #186] -- https://gitlab.gnome.org/GNOME/gjs/issues/186
+
+ Overriding introspected GObjectInterface properties
+
+ Signed-off-by: Philip Chimento <philip.chimento at gmail.com>
+
+ The patch was imported from the gjs git server
+ (git://gitlab.gnome.org/GNOME/gjs) with a commit id of
+ 322ffab6b0b24ab0ce36079642021d969b081730.
+
+ Upstream-status: Backport
+
+ This recipe can move to tracking a more appropriate revision
+ once a recipe for building mozjs60 is created, and then this
+ patch can be dropped.
+
+ Signed-off-by: Brendan Kerrigan <kerriganb at ainfosec.com>
+diff --git a/gi/object.cpp b/gi/object.cpp
+index 2b2265da..70032736 100644
+--- a/gi/object.cpp
++++ b/gi/object.cpp
+@@ -717,7 +717,11 @@ bool ObjectPrototype::lazy_define_gobject_property(JSContext* cx,
+ JS::RootedValue private_id(cx, JS::StringValue(JSID_TO_STRING(id)));
+ if (!gjs_define_property_dynamic(
+ cx, obj, name, "gobject_prop", &ObjectBase::prop_getter,
+- &ObjectBase::prop_setter, private_id, GJS_MODULE_PROP_FLAGS))
++ &ObjectBase::prop_setter, private_id,
++ // Make property configurable so that interface properties can be
++ // overridden by GObject.ParamSpec.override in the class that
++ // implements them
++ GJS_MODULE_PROP_FLAGS & ~JSPROP_PERMANENT))
+ return false;
+
+ *resolved = true;
+diff --git a/installed-tests/js/testGObjectInterface.js b/installed-tests/js/testGObjectInterface.js
+index 9eab9746..daefb683 100644
+--- a/installed-tests/js/testGObjectInterface.js
++++ b/installed-tests/js/testGObjectInterface.js
+@@ -84,6 +84,22 @@ const ImplementationOfTwoInterfaces = GObject.registerClass({
+ }
+ });
+
++const ImplementationOfIntrospectedInterface = GObject.registerClass({
++ Implements: [Gio.Action],
++ Properties: {
++ 'enabled': GObject.ParamSpec.override('enabled', Gio.Action),
++ 'name': GObject.ParamSpec.override('name', Gio.Action),
++ 'state': GObject.ParamSpec.override('state', Gio.Action),
++ 'state-type': GObject.ParamSpec.override('state-type', Gio.Action),
++ 'parameter-type': GObject.ParamSpec.override('parameter-type',
++ Gio.Action)
++ }
++}, class ImplementationOfIntrospectedInterface extends GObject.Object {
++ get name() {
++ return 'inaction';
++ }
++});
++
+ describe('GObject interface', function () {
+ it('cannot be instantiated', function () {
+ expect(() => new AGObjectInterface()).toThrow();
+@@ -247,6 +263,11 @@ describe('GObject interface', function () {
+ 253, 'testGObjectMustOverrideInterfaceProperties');
+ });
+
++ it('can have introspected properties overriden', function() {
++ let obj = new ImplementationOfIntrospectedInterface();
++ expect(obj.name).toEqual('inaction');
++ });
++
+ it('can be implemented by a class as well as its parent class', function () {
+ const SubObject = GObject.registerClass(
+ class SubObject extends GObjectImplementingGObjectInterface {});
diff --git a/meta-gnome/recipes-gnome/gnome3/gjs_git.bb b/meta-gnome/recipes-gnome/gnome3/gjs_git.bb
new file mode 100644
index 000000000..db62f507f
--- /dev/null
+++ b/meta-gnome/recipes-gnome/gnome3/gjs_git.bb
@@ -0,0 +1,30 @@
+DESCRIPTION = "GNOME JavaScript engine"
+LICENSE = "MIT|LGPLv2+"
+DEPENDS = " \
+ glib-2.0 \
+ gsettings-desktop-schemas \
+ mozjs \
+ cairo \
+ "
+
+LIC_FILES_CHKSUM = "file://COPYING;md5=beb29cf17fabe736f0639b09ee6e76fa"
+
+SRC_URI = "git://gitlab.gnome.org/GNOME/gjs.git;protocol=http;branch=master \
+ file://0001-fix-override-allow.patch \
+ "
+
+# Last pre-mozjs60 merge commit. Once mozjs is upreved from 52->60,
+# we can select a more sane version.
+SRCREV="f2a8ca3dcfee06e03ae344932537951bc4d7739c"
+S = "${WORKDIR}/git"
+
+inherit autotools pkgconfig gobject-introspection
+EXTRA_OECONF += " --without-dbus-tests "
+
+FILES_${PN} += "${datadir}"
+
+do_configure_prepend() {
+ export GI_DATADIR="${RECIPE_SYSROOT_NATIVE}${datadir}/gobject-introspection-1.0"
+ sed -i 's#mozjs-17#mozjs-52#g' ${S}/configure.ac
+}
+
--
2.17.1
More information about the Openembedded-devel
mailing list