mate-desktop / mate-polkit

Authentication Agent for PolicyKit and MATE
https://mate-desktop.org
Other
14 stars 13 forks source link

Configure option to build without Ayatana Appindicators #72

Open L-U-T-i opened 10 months ago

L-U-T-i commented 10 months ago

Expected behaviour

A possibility to build mate-polkit without libayatana-appindicators even if devel package is present in the system (for portability reasons, to avoid this dependency on some other machines).

Actual behaviour

mate-polkit is automatically build with libayatana-appindicators requirement (if -devel package is present)

Steps to reproduce the behaviour

rpmbuild mate-polkit

MATE general version

1.27

Package version

1.27.git

Linux Distribution

Rocky Linux

Link to bugreport of your Distribution (requirement)

Custom builds, distribution has nothing to do with that. Besides, it is more a feature request and not abug report.

It would be nice if it would be relatively simple to switch builds with or without libayatana-indicators, as it is with mate-indicator-applet for instance (using "--with-ayatana-indicators" or "--with-ubuntu-indicators" configure option), no matter if libayatana -devel packages are installed or not.

I'd like to keep those packages installed, but build a complete mate desktop environment without libayatana requirements (I've successfully built libayatana-indicator / libayatana-appindicator / ayatana-ido packages, but many ayatana-indicator-... packages doesn't work in Rocky Linux 9 for me at the moment). I need those ayatana packages for some other package(s) though, so it is really annoying to install / uninstall all the time, depending on what is built...

L-U-T-i commented 10 months ago

Never mind, I've "stolen" a piece of code from mate-indicator-applet configure.ac, and created a simple patch:

diff -up mate-polkit-65a6c367e28e338dc74931dece1af9e53338276f/configure.ac~ mate-polkit-65a6c367e28e338dc74931dece1af9e53338276f/configure.ac
--- mate-polkit-65a6c367e28e338dc74931dece1af9e53338276f/configure.ac~  2023-08-14 15:17:48.167561514 +0200
+++ mate-polkit-65a6c367e28e338dc74931dece1af9e53338276f/configure.ac   2023-08-14 15:17:48.193561699 +0200
@@ -116,6 +116,20 @@ AM_CONDITIONAL([HAVE_ACCOUNTSSERVICE], [
 AYATANA_APPINDICATOR_PKG=ayatana-appindicator3-0.1
 UBUNTU_APPINDICATOR_PKG=appindicator3-0.1

+AC_ARG_WITH([ayatana-indicators],
+             [AS_HELP_STRING([--with-ayatana-indicators],
+                             [build against Ayatana Indicators])],
+             [with_ayatana_indicators='yes'],
+             [with_ayatana_indicators='no']
+)
+
+AC_ARG_WITH([ubuntu-indicators],
+             [AS_HELP_STRING([--with-ubuntu-indicators],
+                             [build against Ubuntu Indicators])],
+             [with_ubuntu_indicators='yes'],
+             [with_ubuntu_indicators='no']
+)
+
 PKG_CHECK_EXISTS($AYATANA_APPINDICATOR_PKG >= $APPINDICATOR_REQUIRED,
         [have_appindicator_ayatana="yes"],
         [have_appindicator_ayatana="no"])
@@ -137,14 +151,14 @@ if  test "x$enable_appindicator" == "xau
 fi

 if test "x$enable_appindicator" == "xyes"; then
-   if test "x$have_appindicator_ayatana" == "xyes"; then
+   if test "x$have_appindicator_ayatana" == "xyes" && test "x$with_ubuntu_indicators" != "xyes"; then
        AC_MSG_NOTICE([Buidling against Ayatana AppIndicator.])
        PKG_CHECK_MODULES(AYATANA_APPINDICATOR,
                  [$AYATANA_APPINDICATOR_PKG >= $APPINDICATOR_REQUIRED],
                  [AC_DEFINE(HAVE_AYATANA_APPINDICATOR, 1, [Have Ayatana AppIndicator])])
        AC_SUBST(AYATANA_APPINDICATOR_CFLAGS)
        AC_SUBST(AYATANA_APPINDICATOR_LIBS)
-   elif test "x$have_appindicator_ubuntu" == "xyes"; then
+   elif test "x$have_appindicator_ubuntu" == "xyes" && test "x$with_ayatana_indicators" != "xyes"; then
        AC_MSG_NOTICE([Buidling against Ubuntu AppIndicator.])
        PKG_CHECK_MODULES(UBUNTU_APPINDICATOR,
                  [$UBUNTU_APPINDICATOR_PKG >= $APPINDICATOR_REQUIRED],

which provides the same configure options as for mate-indicator-applet: --with-ayatana-indicators --with-ubuntu-indicators what perfectly suits my needs.

There seem to be a small bug in configure.ac announcing in Configure summary both indicators are enabled, but I haven't messed with that at this point (as only one or another is actually considered).

I know it would be technically more correct to use "--with-ayatana-appindicator" and "--with-ubuntu-indicator", or even better "--with-legacy-indicator" instead of the second one (as we have such indicator also in fedora / rhel), but as-is makes my copy-paste build processes even more simple... ;-)