summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXi Ruoyao <xry111@mengyan1223.wang>2022-01-27 10:16:32 +0000
committerJan Rybar <jrybar@redhat.com>2022-01-27 10:16:32 +0000
commita6bedfd09b7bba753de7a107dc471da0db801858 (patch)
treed1575d5344b4fd20bbb24b1d8ad26172e180b415
parenta2bf5c9c83b6ae46cbd5c779d3055bff81ded683 (diff)
downloadpolkit-a6bedfd09b7bba753de7a107dc471da0db801858.tar.gz
jsauthority: port to mozjs-91
-rw-r--r--.gitlab-ci.yml2
-rw-r--r--Makefile.am2
-rw-r--r--configure.ac2
-rw-r--r--meson.build2
-rw-r--r--src/polkitbackend/polkitbackendjsauthority.cpp9
5 files changed, 12 insertions, 5 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 942415d..fbc7940 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -13,7 +13,7 @@ variables:
make
libxslt
pkgconfig(gio-2.0)
- pkgconfig(mozjs-78)
+ pkgconfig(mozjs-91)
pkgconfig(duktape)
expat-devel
pkgconfig(libsystemd)
diff --git a/Makefile.am b/Makefile.am
index 199576a..bfdfa8c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -22,6 +22,8 @@ DISTCHECK_CONFIGURE_FLAGS= \
--disable-introspection \
--enable-gtk-doc \
--with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir) \
+ --enable-libsystemd-login=yes \
+ --enable-libelogind=no \
$(NULL)
sign : dist
diff --git a/configure.ac b/configure.ac
index e182238..0280dde 100644
--- a/configure.ac
+++ b/configure.ac
@@ -89,7 +89,7 @@ AS_IF([test x${with_duktape} == xyes], [
AC_SUBST(LIBJS_CFLAGS)
AC_SUBST(LIBJS_LIBS)
], [
- PKG_CHECK_MODULES(LIBJS, [mozjs-78])
+ PKG_CHECK_MODULES(LIBJS, [mozjs-91])
AC_SUBST(LIBJS_CFLAGS)
AC_SUBST(LIBJS_CXXFLAGS)
diff --git a/meson.build b/meson.build
index ad9ab07..dd09b28 100644
--- a/meson.build
+++ b/meson.build
@@ -143,7 +143,7 @@ if js_engine == 'duktape'
func = 'pthread_condattr_setclock'
config_h.set('HAVE_' + func.to_upper(), cc.has_function(func, prefix : '#include <pthread.h>'))
elif js_engine == 'mozjs'
- js_dep = dependency('mozjs-78')
+ js_dep = dependency('mozjs-91')
endif
dbus_dep = dependency('dbus-1', required: false)
diff --git a/src/polkitbackend/polkitbackendjsauthority.cpp b/src/polkitbackend/polkitbackendjsauthority.cpp
index 11e91c0..660407f 100644
--- a/src/polkitbackend/polkitbackendjsauthority.cpp
+++ b/src/polkitbackend/polkitbackendjsauthority.cpp
@@ -53,6 +53,13 @@
/* ---------------------------------------------------------------------------------------------------- */
+static class JsInitHelperType
+{
+public:
+ JsInitHelperType() { JS_Init(); }
+ ~JsInitHelperType() { JS_ShutDown(); }
+} JsInitHelper;
+
struct _PolkitBackendJsAuthorityPrivate
{
gchar **rules_dirs;
@@ -458,7 +465,6 @@ polkit_backend_common_js_authority_finalize (GObject *object)
delete authority->priv->js_polkit;
JS_DestroyContext (authority->priv->cx);
- /* JS_ShutDown (); */
G_OBJECT_CLASS (polkit_backend_js_authority_parent_class)->finalize (object);
}
@@ -490,7 +496,6 @@ polkit_backend_js_authority_class_init (PolkitBackendJsAuthorityClass *klass)
polkit_backend_common_js_authority_class_init_common (klass);
g_type_class_add_private (klass, sizeof (PolkitBackendJsAuthorityPrivate));
- JS_Init ();
}
/* ---------------------------------------------------------------------------------------------------- */