git: 2ddcf036d4ab - main - sysutils/polkit: use spidermonkey 91

From: Baptiste Daroussin <bapt_at_FreeBSD.org>
Date: Sat, 25 Jun 2022 20:47:03 UTC
The branch main has been updated by bapt:

URL: https://cgit.FreeBSD.org/ports/commit/?id=2ddcf036d4ab747c9e82d15ccde39112fd1e15ae

commit 2ddcf036d4ab747c9e82d15ccde39112fd1e15ae
Author:     Baptiste Daroussin <bapt@FreeBSD.org>
AuthorDate: 2022-06-25 20:44:00 +0000
Commit:     Baptiste Daroussin <bapt@FreeBSD.org>
CommitDate: 2022-06-25 20:47:02 +0000

    sysutils/polkit: use spidermonkey 91
    
    Incorporate a patch from upstream which allows to move from spidermonkey 78
    to spidermonkey91
---
 sysutils/polkit/Makefile                           |  4 +--
 sysutils/polkit/distinfo                           |  2 +-
 sysutils/polkit/files/patch-meson.build            | 10 +++++--
 ...-src_polkitbackend_polkitbackendjsauthority.cpp | 33 ++++++++++++++++++++++
 4 files changed, 43 insertions(+), 6 deletions(-)

diff --git a/sysutils/polkit/Makefile b/sysutils/polkit/Makefile
index 839b08d29502..c6485734f0e7 100644
--- a/sysutils/polkit/Makefile
+++ b/sysutils/polkit/Makefile
@@ -2,7 +2,7 @@
 
 PORTNAME=	polkit
 PORTVERSION=	0.120
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	sysutils gnome
 MASTER_SITES=	https://www.freedesktop.org/software/polkit/releases/
 
@@ -18,7 +18,7 @@ LICENSE_FILE=	${WRKSRC}/COPYING
 
 LIB_DEPENDS=	libexpat.so:textproc/expat2 \
 		libdbus-1.so:devel/dbus \
-		libmozjs-78.so:lang/spidermonkey78
+		libmozjs-91.so:lang/spidermonkey91
 
 USERS=		polkitd
 GROUPS=		polkitd
diff --git a/sysutils/polkit/distinfo b/sysutils/polkit/distinfo
index a0a990aa819b..839b6c439a75 100644
--- a/sysutils/polkit/distinfo
+++ b/sysutils/polkit/distinfo
@@ -1,4 +1,4 @@
-TIMESTAMP = 1643152765
+TIMESTAMP = 1656189343
 SHA256 (polkit-0.120.tar.gz) = ee7a599a853117bf273548725719fa92fabd2f136915c7a4906cee98567aee03
 SIZE (polkit-0.120.tar.gz) = 1626659
 SHA256 (e7f3d9e8341d.patch) = 9a84b59d38b3f86c70c5fc3a28cbfe8d7a22cf190eb20ff433f7f53f5ff73a9a
diff --git a/sysutils/polkit/files/patch-meson.build b/sysutils/polkit/files/patch-meson.build
index 440dce3e8fdd..260fe5aafd82 100644
--- a/sysutils/polkit/files/patch-meson.build
+++ b/sysutils/polkit/files/patch-meson.build
@@ -1,7 +1,11 @@
 --- meson.build.orig	2021-09-29 19:16:29 UTC
 +++ meson.build
-@@ -136,7 +136,7 @@ assert(cc.has_function('XML_ParserCreate', dependencie
- mozjs_dep = dependency('mozjs-78')
+@@ -133,10 +133,10 @@ assert(cc.has_function('XML_ParserCreate', dependencie
+ assert(cc.has_header('expat.h', dependencies: expat_dep), 'Can\'t find expat.h. Please install expat.')
+ assert(cc.has_function('XML_ParserCreate', dependencies: expat_dep), 'Can\'t find expat library. Please install expat.')
+ 
+-mozjs_dep = dependency('mozjs-78')
++mozjs_dep = dependency('mozjs-91')
  
  dbus_dep = dependency('dbus-1', required: false)
 -dbus_policydir = pk_prefix / pk_datadir / 'dbus-1/system.d'
@@ -9,7 +13,7 @@
  if dbus_dep.found()
    dbus_system_bus_services_dir = dbus_dep.get_pkgconfig_variable('system_bus_services_dir', define_variable: ['datadir', pk_prefix / pk_datadir])
  else
-@@ -329,15 +329,6 @@ endif
+@@ -329,15 +329,6 @@ configure_file(
  configure_file(
    output: 'config.h',
    configuration: config_h,
diff --git a/sysutils/polkit/files/patch-src_polkitbackend_polkitbackendjsauthority.cpp b/sysutils/polkit/files/patch-src_polkitbackend_polkitbackendjsauthority.cpp
new file mode 100644
index 000000000000..a8f47c895e8f
--- /dev/null
+++ b/sysutils/polkit/files/patch-src_polkitbackend_polkitbackendjsauthority.cpp
@@ -0,0 +1,33 @@
+--- src/polkitbackend/polkitbackendjsauthority.cpp.orig	2022-06-25 20:41:05 UTC
++++ src/polkitbackend/polkitbackendjsauthority.cpp
+@@ -75,6 +75,13 @@
+ 
+ /* ---------------------------------------------------------------------------------------------------- */
+ 
++static class JsInitHelperType
++{
++public:
++	JsInitHelperType() { JS_Init(); }
++	~JsInitHelperType() { JS_ShutDown(); }
++} JsInitHelper;
++
+ struct _PolkitBackendJsAuthorityPrivate
+ {
+   gchar **rules_dirs;
+@@ -589,7 +596,6 @@ polkit_backend_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);
+ }
+@@ -665,8 +671,6 @@ polkit_backend_js_authority_class_init (PolkitBackendJ
+ 
+ 
+   g_type_class_add_private (klass, sizeof (PolkitBackendJsAuthorityPrivate));
+-
+-  JS_Init ();
+ }
+ 
+ /* ---------------------------------------------------------------------------------------------------- */