commit:     b690de43759b5869bfc3af925094a0485d323b41
Author:     stefson <herrtimson <AT> yahoo <DOT> de>
AuthorDate: Wed Sep  9 07:18:15 2020 +0000
Commit:     Jory Pratt <anarchy <AT> gentoo <DOT> org>
CommitDate: Thu Sep 17 15:19:14 2020 +0000
URL:        https://gitweb.gentoo.org/proj/musl.git/commit/?id=b690de43

sys-auth/polkit: add upstream fix for mozjs-78

taken from upstream: 
https://gitlab.freedesktop.org/polkit/polkit/-/merge_requests/64

Keywords are dropped, to allow testing for others.

Signed-off-by: Steffen Kuhn <nielson2 <AT> yandex.com>
Signed-off-by: Jory Pratt <anarchy <AT> gentoo.org>

 sys-auth/polkit/files/polkit-0.117-mozjs-78.patch | 104 ++++++++++++++++
 sys-auth/polkit/polkit-0.117-r1.ebuild            | 138 ++++++++++++++++++++++
 2 files changed, 242 insertions(+)

diff --git a/sys-auth/polkit/files/polkit-0.117-mozjs-78.patch 
b/sys-auth/polkit/files/polkit-0.117-mozjs-78.patch
new file mode 100644
index 0000000..f64a7bf
--- /dev/null
+++ b/sys-auth/polkit/files/polkit-0.117-mozjs-78.patch
@@ -0,0 +1,104 @@
+From 3e1d61868fa8bfc586099302e931433270e5d17d Mon Sep 17 00:00:00 2001
+From: Jan Rybar <jry...@redhat.com>
+Date: Tue, 25 Aug 2020 16:38:34 +0000
+Subject: [PATCH] Port polkit to mozjs78
+
+---
+ configure.ac                                   |  4 ++--
+ src/polkitbackend/polkitbackendjsauthority.cpp | 15 ++++++---------
+ 2 files changed, 8 insertions(+), 11 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index eea70fc7..c4569f10 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -34,7 +34,7 @@ AC_PROG_LN_S
+ AC_SYS_LARGEFILE
+ AM_PROG_CC_C_O
+ AC_PROG_CXX
+-AX_CXX_COMPILE_STDCXX([14], [], [mandatory])
++AX_CXX_COMPILE_STDCXX([17], [], [mandatory])
+ 
+ # Taken from dbus
+ AC_ARG_ENABLE(ansi,             [  --enable-ansi           enable -ansi 
-pedantic gcc flags],enable_ansi=$enableval,enable_ansi=no)
+@@ -80,7 +80,7 @@ PKG_CHECK_MODULES(GLIB, [gmodule-2.0 gio-unix-2.0 >= 2.30.0])
+ AC_SUBST(GLIB_CFLAGS)
+ AC_SUBST(GLIB_LIBS)
+ 
+-PKG_CHECK_MODULES(LIBJS, [mozjs-68])
++PKG_CHECK_MODULES(LIBJS, [mozjs-78])
+ 
+ AC_SUBST(LIBJS_CFLAGS)
+ AC_SUBST(LIBJS_CXXFLAGS)
+diff --git a/src/polkitbackend/polkitbackendjsauthority.cpp 
b/src/polkitbackend/polkitbackendjsauthority.cpp
+index 25bd1f93..ca171083 100644
+--- a/src/polkitbackend/polkitbackendjsauthority.cpp
++++ b/src/polkitbackend/polkitbackendjsauthority.cpp
+@@ -49,6 +49,7 @@
+ #include <js/Realm.h>
+ #include <js/SourceText.h>
+ #include <js/Warnings.h>
++#include <js/Array.h>
+ #include <jsapi.h>
+ 
+ #include "initjs.h" /* init.js */
+@@ -367,7 +368,7 @@ load_scripts (PolkitBackendJsAuthority  *authority)
+ static void
+ reload_scripts (PolkitBackendJsAuthority *authority)
+ {
+-  JS::AutoValueArray<1> args(authority->priv->cx);
++  JS::RootedValueArray<1> args(authority->priv->cx);
+   JS::RootedValue rval(authority->priv->cx);
+ 
+   JS::RootedObject js_polkit(authority->priv->cx, 
authority->priv->js_polkit->get ());
+@@ -482,10 +483,6 @@ polkit_backend_js_authority_constructed (GObject *object)
+   if (!JS::InitSelfHostedCode (authority->priv->cx))
+     goto fail;
+ 
+-  JS::ContextOptionsRef (authority->priv->cx)
+-      .setIon (TRUE)
+-      .setBaseline (TRUE)
+-      .setAsmJS (TRUE);
+   JS::SetWarningReporter(authority->priv->cx, report_error);
+   JS_SetContextPrivate (authority->priv->cx, authority);
+ 
+@@ -720,7 +717,7 @@ set_property_strv (PolkitBackendJsAuthority  *authority,
+         elems[n].setNull ();
+     }
+ 
+-  JS::RootedObject array_object(authority->priv->cx, JS_NewArrayObject 
(authority->priv->cx, elems));
++  JS::RootedObject array_object(authority->priv->cx, JS::NewArrayObject 
(authority->priv->cx, elems));
+ 
+   value_jsval = JS::ObjectValue (*array_object);
+   JS_SetProperty (authority->priv->cx, obj, name, value_jsval);
+@@ -1114,7 +1111,7 @@ polkit_backend_js_authority_get_admin_auth_identities 
(PolkitBackendInteractiveA
+ {
+   PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY 
(_authority);
+   GList *ret = NULL;
+-  JS::AutoValueArray<2> args(authority->priv->cx);
++  JS::RootedValueArray<2> args(authority->priv->cx);
+   JS::RootedValue rval(authority->priv->cx);
+   guint n;
+   GError *error = NULL;
+@@ -1218,7 +1215,7 @@ polkit_backend_js_authority_check_authorization_sync 
(PolkitBackendInteractiveAu
+ {
+   PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY 
(_authority);
+   PolkitImplicitAuthorization ret = implicit;
+-  JS::AutoValueArray<2> args(authority->priv->cx);
++  JS::RootedValueArray<2> args(authority->priv->cx);
+   JS::RootedValue rval(authority->priv->cx);
+   GError *error = NULL;
+   JS::RootedString ret_jsstr (authority->priv->cx);
+@@ -1409,7 +1406,7 @@ js_polkit_spawn (JSContext  *cx,
+   JS::CallArgs args = JS::CallArgsFromVp (js_argc, vp);
+   array_object = &args[0].toObject();
+ 
+-  if (!JS_GetArrayLength (cx, array_object, &array_len))
++  if (!JS::GetArrayLength (cx, array_object, &array_len))
+     {
+       JS_ReportErrorUTF8 (cx, "Failed to get array length");
+       goto out;
+-- 
+GitLab
+
+

diff --git a/sys-auth/polkit/polkit-0.117-r1.ebuild 
b/sys-auth/polkit/polkit-0.117-r1.ebuild
new file mode 100644
index 0000000..4adbf55
--- /dev/null
+++ b/sys-auth/polkit/polkit-0.117-r1.ebuild
@@ -0,0 +1,138 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit autotools pam pax-utils systemd xdg-utils
+
+DESCRIPTION="Policy framework for controlling privileges for system-wide 
services"
+HOMEPAGE="https://www.freedesktop.org/wiki/Software/polkit 
https://gitlab.freedesktop.org/polkit/polkit";
+SRC_URI="https://www.freedesktop.org/software/${PN}/releases/${P}.tar.gz";
+
+LICENSE="LGPL-2"
+SLOT="0"
+#KEYWORDS="~amd64 ~arm ~arm64 ~mips ~ppc ~ppc64 x86"
+IUSE="consolekit elogind examples gtk +introspection jit kde nls pam selinux 
systemd test"
+RESTRICT="!test? ( test )"
+
+REQUIRED_USE="^^ ( consolekit elogind systemd )"
+
+BDEPEND="
+       acct-user/polkitd
+       app-text/docbook-xml-dtd:4.1.2
+       app-text/docbook-xsl-stylesheets
+       dev-libs/gobject-introspection-common
+       dev-libs/libxslt
+       dev-util/glib-utils
+       dev-util/gtk-doc-am
+       dev-util/intltool
+       sys-devel/gettext
+       virtual/pkgconfig
+       introspection? ( dev-libs/gobject-introspection )
+"
+DEPEND="
+       dev-lang/spidermonkey:78[-debug]
+       dev-libs/glib:2
+       dev-libs/expat
+       elogind? ( sys-auth/elogind )
+       pam? (
+               sys-auth/pambase
+               sys-libs/pam
+       )
+       systemd? ( sys-apps/systemd:0=[policykit] )
+"
+RDEPEND="${DEPEND}
+       acct-user/polkitd
+       selinux? ( sec-policy/selinux-policykit )
+"
+PDEPEND="
+       consolekit? ( sys-auth/consolekit[policykit] )
+       gtk? ( || (
+               >=gnome-extra/polkit-gnome-0.105
+               >=lxde-base/lxsession-0.5.2
+       ) )
+       kde? ( kde-plasma/polkit-kde-agent )
+"
+
+DOCS=( docs/TODO HACKING NEWS README )
+
+PATCHES=(
+       # bug 660880
+       "${FILESDIR}"/polkit-0.115-elogind.patch
+
+       # https://gitlab.freedesktop.org/polkit/polkit/-/merge_requests/64
+       "${FILESDIR}"/polkit-0.117-mozjs-78.patch
+
+       # locally rebased patch 
+       "${FILESDIR}"/polkit-0.116-make-netgroup-support-optional-2.patch
+)
+
+QA_MULTILIB_PATHS="
+       usr/lib/polkit-1/polkit-agent-helper-1
+       usr/lib/polkit-1/polkitd"
+
+src_prepare() {
+       default
+
+       sed -i -e 's|unix-group:wheel|unix-user:0|' 
src/polkitbackend/*-default.rules || die #401513
+
+       # Workaround upstream hack around standard gtk-doc behavior, bug #552170
+       sed -i -e 's/@ENABLE_GTK_DOC_TRUE@\(TARGET_DIR\)/\1/' \
+               -e '/install-data-local:/,/uninstall-local:/ 
s/@ENABLE_GTK_DOC_TRUE@//' \
+               -e 's/@ENABLE_GTK_DOC_FALSE@install-data-local://' \
+               docs/polkit/Makefile.in || die
+
+       # disable broken test - bug #624022
+       sed -i -e "/^SUBDIRS/s/polkitbackend//" test/Makefile.am || die
+
+       # Fix cross-building, bug #590764, elogind patch, bug #598615
+       eautoreconf
+}
+
+src_configure() {
+       xdg_environment_reset
+
+       local myeconfargs=(
+               --localstatedir="${EPREFIX}"/var
+               --disable-static
+               --enable-man-pages
+               --disable-gtk-doc
+               --disable-examples
+               $(use_enable elogind libelogind)
+               $(use_enable introspection)
+               $(use_enable nls)
+               $(usex pam "--with-pam-module-dir=$(getpam_mod_dir)" '')
+               --with-authfw=$(usex pam pam shadow)
+               $(use_enable systemd libsystemd-login)
+               --with-systemdsystemunitdir="$(systemd_get_systemunitdir)"
+               $(use_enable test)
+               --with-os-type=gentoo
+       )
+       econf "${myeconfargs[@]}"
+}
+
+src_compile() {
+       default
+
+       # Required for polkitd on hardened/PaX due to spidermonkey's JIT
+       pax-mark mr src/polkitbackend/.libs/polkitd 
test/polkitbackend/.libs/polkitbackendjsauthoritytest
+}
+
+src_install() {
+       default
+
+       if use examples; then
+               insinto /usr/share/doc/${PF}/examples
+               doins src/examples/{*.c,*.policy*}
+       fi
+
+       diropts -m 0700 -o polkitd
+       keepdir /usr/share/polkit-1/rules.d
+
+       find "${ED}" -name '*.la' -delete || die
+}
+
+pkg_postinst() {
+       chmod 0700 "${EROOT}"/{etc,usr/share}/polkit-1/rules.d
+       chown polkitd "${EROOT}"/{etc,usr/share}/polkit-1/rules.d
+}

Reply via email to