Warning, /utilities/qrca/flatpak/polkit-build-Add-option-to-build-without-polkitd.patch is written in an unsupported language. File is not indexed.
0001 From 1073a44277316348d40d86ecec908f1d4812f360 Mon Sep 17 00:00:00 2001 0002 From: Christian Hergert <chergert@redhat.com> 0003 Date: Mon, 27 May 2019 11:49:09 -0700 0004 Subject: [PATCH] flatpak: make polkit suitable for use within flatpak 0005 0006 This is based on patches from Patrick Griffis with additional fixes 0007 to allow us to disable use of PAM within Flaptak. 0008 --- 0009 configure.ac | 20 ++++++++++++++++---- 0010 src/Makefile.am | 6 +++++- 0011 src/polkitagent/Makefile.am | 5 +++++ 0012 test/Makefile.am | 6 +++++- 0013 4 files changed, 31 insertions(+), 6 deletions(-) 0014 0015 diff --git a/configure.ac b/configure.ac 0016 index 5cedb4e..729d78d 100644 0017 --- a/configure.ac 0018 +++ b/configure.ac 0019 @@ -79,11 +79,13 @@ PKG_CHECK_MODULES(GLIB, [gmodule-2.0 gio-unix-2.0 >= 2.30.0]) 0020 AC_SUBST(GLIB_CFLAGS) 0021 AC_SUBST(GLIB_LIBS) 0022 0023 -PKG_CHECK_MODULES(LIBJS, [mozjs-78]) 0024 +AS_IF([test x${enable_polkitd} = yes], [ 0025 + PKG_CHECK_MODULES(LIBJS, [mozjs-78]) 0026 0027 -AC_SUBST(LIBJS_CFLAGS) 0028 -AC_SUBST(LIBJS_CXXFLAGS) 0029 -AC_SUBST(LIBJS_LIBS) 0030 + AC_SUBST(LIBJS_CFLAGS) 0031 + AC_SUBST(LIBJS_CXXFLAGS) 0032 + AC_SUBST(LIBJS_LIBS) 0033 +]) 0034 0035 EXPAT_LIB="" 0036 AC_ARG_WITH(expat, [ --with-expat=<dir> Use expat from here], 0037 @@ -236,6 +238,15 @@ if test "x$with_systemdsystemunitdir" != "xno"; then 0038 fi 0039 AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$systemdsystemunitdir"]) 0040 0041 +dnl --------------------------------------------------------------------------- 0042 +dnl - Disable polkitd when using library alone 0043 +dnl --------------------------------------------------------------------------- 0044 + 0045 +AC_ARG_ENABLE([polkitd], 0046 + [AS_HELP_STRING([--disable-polkitd], [Do not build polkitd])], 0047 + [enable_polkitd=$enableval], [enable_polkitd=yes]) 0048 +AM_CONDITIONAL(BUILD_POLKITD, [test x${enable_polkitd} = yes]) 0049 + 0050 dnl --------------------------------------------------------------------------- 0051 dnl - User for running polkitd 0052 dnl --------------------------------------------------------------------------- 0053 @@ -579,6 +590,7 @@ echo " 0054 Session tracking: ${SESSION_TRACKING} 0055 PAM support: ${have_pam} 0056 systemdsystemunitdir: ${systemdsystemunitdir} 0057 + polkitd: ${enable_polkitd} 0058 polkitd user: ${POLKITD_USER}" 0059 0060 if test "$have_pam" = yes ; then 0061 diff --git a/src/Makefile.am b/src/Makefile.am 0062 index 09fc7b3..c6fe91b 100644 0063 --- a/src/Makefile.am 0064 +++ b/src/Makefile.am 0065 @@ -1,5 +1,9 @@ 0066 0067 -SUBDIRS = polkit polkitbackend polkitagent programs 0068 +SUBDIRS = polkit polkitagent programs 0069 + 0070 +if BUILD_POLKITD 0071 +SUBDIRS += polkitbackend 0072 +endif 0073 0074 if BUILD_EXAMPLES 0075 SUBDIRS += examples 0076 diff --git a/src/polkitagent/Makefile.am b/src/polkitagent/Makefile.am 0077 index 49720db..633f9d4 100644 0078 --- a/src/polkitagent/Makefile.am 0079 +++ b/src/polkitagent/Makefile.am 0080 @@ -79,6 +79,7 @@ libpolkit_agent_1_la_LIBADD = \ 0081 0082 libpolkit_agent_1_la_LDFLAGS = -export-symbols-regex '(^polkit_.*)' 0083 0084 +if !POLKIT_AUTHFW_NONE 0085 libprivdir = $(prefix)/lib/polkit-1 0086 libpriv_PROGRAMS = polkit-agent-helper-1 0087 0088 @@ -113,6 +114,8 @@ polkit_agent_helper_1_LDFLAGS = \ 0089 $(AM_LDFLAGS) \ 0090 $(NULL) 0091 0092 +endif # !POLKIT_AUTHFW_NONE 0093 + 0094 if HAVE_INTROSPECTION 0095 0096 girdir = $(INTROSPECTION_GIRDIR) 0097 @@ -142,6 +145,7 @@ include $(INTROSPECTION_MAKEFILE) 0098 0099 endif # HAVE_INTROSPECTION 0100 0101 +if !POLKIT_AUTHFW_NONE 0102 # polkit-agent-helper-1 need to be setuid root because it's used to 0103 # authenticate not only the invoking user, but possibly also root 0104 # and/or other users. 0105 @@ -149,6 +153,7 @@ endif # HAVE_INTROSPECTION 0106 install-data-hook: 0107 -chown root $(DESTDIR)$(libprivdir)/polkit-agent-helper-1 0108 -chmod 4755 $(DESTDIR)$(libprivdir)/polkit-agent-helper-1 0109 +endif # !POLKIT_AUTHFW_NONE 0110 0111 EXTRA_DIST = polkitagentmarshal.list polkitagentenumtypes.h.template polkitagentenumtypes.c.template 0112 CLEANFILES = $(gir_DATA) $(typelibs_DATA) 0113 diff --git a/test/Makefile.am b/test/Makefile.am 0114 index 59d0680..d43b0fe 100644 0115 --- a/test/Makefile.am 0116 +++ b/test/Makefile.am 0117 @@ -1,7 +1,11 @@ 0118 0119 -SUBDIRS = mocklibc . polkit polkitbackend 0120 +SUBDIRS = mocklibc . polkit 0121 AM_CFLAGS = $(GLIB_CFLAGS) 0122 0123 +if BUILD_POLKITD 0124 +SUBDIRS += polkitbackend 0125 +endif 0126 + 0127 noinst_LTLIBRARIES = libpolkit-test-helper.la 0128 libpolkit_test_helper_la_SOURCES = polkittesthelper.c polkittesthelper.h 0129 libpolkit_test_helper_la_LIBADD = $(GLIB_LIBS) 0130 -- 0131 2.21.0 0132 0133