pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

gromit-mpx: Conditionalize appindicator support



Module Name:	pkgsrc-wip
Committed By:	Leonardo Taccari <leot%NetBSD.org@localhost>
Pushed By:	leot
Date:		Sun May 4 21:36:39 2025 +0200
Changeset:	27c3d8e1f6744d4a566e1ab5fb915f7be9709232

Modified Files:
	gromit-mpx/Makefile
	gromit-mpx/distinfo
	gromit-mpx/patches/patch-CMakeLists.txt
	gromit-mpx/patches/patch-src_main.c
	gromit-mpx/patches/patch-src_main.h
Added Files:
	gromit-mpx/patches/patch-CMakeOptions.txt
	gromit-mpx/patches/patch-build-config.h__cmake__in

Log Message:
gromit-mpx: Conditionalize appindicator support

In this way we can possibly upstream such patches so all package
managers could benefit of them to possibly avoid a dbus dependency.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=27c3d8e1f6744d4a566e1ab5fb915f7be9709232

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 gromit-mpx/Makefile                                |  2 +
 gromit-mpx/distinfo                                |  8 ++-
 gromit-mpx/patches/patch-CMakeLists.txt            | 65 ++++++++++++++++++----
 gromit-mpx/patches/patch-CMakeOptions.txt          |  9 +++
 gromit-mpx/patches/patch-build-config.h__cmake__in | 14 +++++
 gromit-mpx/patches/patch-src_main.c                | 45 ++++++++-------
 gromit-mpx/patches/patch-src_main.h                | 25 +++++----
 7 files changed, 122 insertions(+), 46 deletions(-)

diffs:
diff --git a/gromit-mpx/Makefile b/gromit-mpx/Makefile
index 8fea07cdf9..69ac6dc947 100644
--- a/gromit-mpx/Makefile
+++ b/gromit-mpx/Makefile
@@ -11,6 +11,8 @@ LICENSE=	gnu-gpl-v2
 
 USE_TOOLS+=	pkg-config
 
+CMAKE_CONFIGURE_ARGS+=	-DENABLE_APPINDICATOR=OFF
+
 USE_PKGLOCALEDIR=	yes
 
 BUILD_DEFS+=		PKG_SYSCONFBASE
diff --git a/gromit-mpx/distinfo b/gromit-mpx/distinfo
index 7dfe18c350..0ae818b3a1 100644
--- a/gromit-mpx/distinfo
+++ b/gromit-mpx/distinfo
@@ -3,7 +3,9 @@ $NetBSD$
 BLAKE2s (gromit-mpx-1.7.0.tar.gz) = 828d7483e15bdec3af7ca907dfebf506a5043f7ecd558aed50d66b6b7c5e43b7
 SHA512 (gromit-mpx-1.7.0.tar.gz) = 26baee4ec035eb6cd20faea96c6f6790dce2b6aaaed9578a1e975fb0d4b3a9062f0463607ca2ca53add8193aa0c7a2e94b730604d071dcea48a085aa8fdc4797
 Size (gromit-mpx-1.7.0.tar.gz) = 2165825 bytes
-SHA1 (patch-CMakeLists.txt) = 9b45afa4d42e2f2fc8808d11362681b77e4b24c2
+SHA1 (patch-CMakeLists.txt) = e7b3dbc3232f9a0d8c5a9be4db94ef0fb2095e21
+SHA1 (patch-CMakeOptions.txt) = 55707b749d646fb362c504ace9559751cf8ec12d
+SHA1 (patch-build-config.h__cmake__in) = aa3001dc174488c6c7bf44549df0e05cd69bcd81
 SHA1 (patch-src_coordlist__ops.c) = e3ff1e823b0ca8911d1707f6db12235a54ecc0d2
-SHA1 (patch-src_main.c) = d36a81c81606db81f79a959d47346221ffb1fd27
-SHA1 (patch-src_main.h) = 2335f833410caf5741266b16f64ca6509da02cae
+SHA1 (patch-src_main.c) = 7305d1a7353078631980d4f680d047384bc67536
+SHA1 (patch-src_main.h) = 86cdee5ca6174642ec084bfb1689eb0a7541c7f8
diff --git a/gromit-mpx/patches/patch-CMakeLists.txt b/gromit-mpx/patches/patch-CMakeLists.txt
index fa5bd3e19f..2257e275d1 100644
--- a/gromit-mpx/patches/patch-CMakeLists.txt
+++ b/gromit-mpx/patches/patch-CMakeLists.txt
@@ -1,14 +1,21 @@
 $NetBSD$
 
-- Disable appindicator3 support to avoid dbus dependency.
-
-  From OpenBSD ports.
+- Permit to disable appindicator3 support to avoid dbus dependency.
+  Inspired by OpenBSD ports.
 - Install configuration files under examples directory so they can be handled
   via pkgsrc properly.
 
 --- CMakeLists.txt.orig	2024-09-09 18:39:05.000000000 +0000
 +++ CMakeLists.txt
-@@ -24,11 +24,6 @@ find_package(Gettext)
+@@ -18,16 +18,21 @@ endif(CMAKE_GENERATOR MATCHES "Unix Make
+ 
+ set(CMAKE_C_FLAGS  " ${CMAKE_C_FLAGS} -Wall -Wextra -Wno-unused-parameter")
+ 
++include( CMakeOptions.txt )
++
+ find_package(PkgConfig)
+ find_package(Gettext)
+ 
  pkg_check_modules(gtk3 REQUIRED "gtk+-3.0 >= 3.22")
  pkg_check_modules(xinput REQUIRED "xi >= 1.3")
  pkg_check_modules(x11 REQUIRED x11)
@@ -16,11 +23,17 @@ $NetBSD$
 -if(NOT appindicator3_FOUND)
 -  pkg_check_modules(appindicator3 REQUIRED "appindicator3-0.1 >= 0.4.92")
 -  set(APPINDICATOR_IS_LEGACY 1)
--endif()
++if (ENABLE_APPINDICATOR)
++  set(ENABLE_APPINDICATOR 1)
++  pkg_check_modules(appindicator3 "ayatana-appindicator3-0.1 >= 0.5")
++  if(NOT appindicator3_FOUND)
++    pkg_check_modules(appindicator3 REQUIRED "appindicator3-0.1 >= 0.4.92")
++    set(APPINDICATOR_IS_LEGACY 1)
++  endif()
+ endif()
  pkg_check_modules(lz4 REQUIRED liblz4)
  
- configure_file(build-config.h_cmake_in build-config.h)
-@@ -36,7 +31,6 @@ configure_file(build-config.h_cmake_in b
+@@ -36,19 +41,27 @@ configure_file(build-config.h_cmake_in b
  include_directories(
      ${CMAKE_CURRENT_BINARY_DIR}
      ${gtk3_INCLUDE_DIRS}
@@ -28,7 +41,12 @@ $NetBSD$
      ${xinput_INCLUDE_DIRS}
      ${x11_INCLUDE_DIRS}
      ${lz4_INCLUDE_DIRS}
-@@ -44,7 +38,6 @@ include_directories(
+ )
++if (ENABLE_APPINDICATOR)
++include_directories(
++    ${appindicator3_INCLUDE_DIRS}
++)
++endif()
  
  link_directories(
      ${gtk3_LIBRARY_DIRS}
@@ -36,15 +54,40 @@ $NetBSD$
      ${xinput_LIBRARY_DIRS}
      ${x11_LIBRARY_DIRS}
      ${lz4_LIBRARY_DIRS}
-@@ -71,7 +64,6 @@ add_executable(${target_name} ${sources}
+ )
++if (ENABLE_APPINDICATOR)
++link_directories(
++    ${appindicator3_LIBRARY_DIRS}
++)
++endif()
  
- target_link_libraries(${target_name}
+ set(sources
+     src/callbacks.c
+@@ -69,15 +82,20 @@ set(sources
+ 
+ add_executable(${target_name} ${sources})
+ 
+-target_link_libraries(${target_name}
++set(LIBS
      ${gtk3_LIBRARIES}
 -    ${appindicator3_LIBRARIES}
      ${xinput_LIBRARIES}
      ${x11_LIBRARIES}
      ${lz4_LIBRARIES}
-@@ -88,7 +80,7 @@ GETTEXT_PROCESS_PO_FILES(pt_BR ALL PO_FI
+     -lm
+ )
+-
++if (ENABLE_APPINDICATOR)
++  list(APPEND LIBS
++    ${appindicator3_LIBRARIES})
++endif()
++target_link_libraries(${target_name}
++    ${LIBS}
++)
+ 
+ GETTEXT_PROCESS_PO_FILES(de ALL PO_FILES po/de.po)
+ GETTEXT_PROCESS_PO_FILES(es ALL PO_FILES po/es.po)
+@@ -88,7 +106,7 @@ GETTEXT_PROCESS_PO_FILES(pt_BR ALL PO_FI
  
  install(TARGETS ${target_name} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
  install(FILES data/net.christianbeier.Gromit-MPX.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)
diff --git a/gromit-mpx/patches/patch-CMakeOptions.txt b/gromit-mpx/patches/patch-CMakeOptions.txt
new file mode 100644
index 0000000000..d4b37c8a6c
--- /dev/null
+++ b/gromit-mpx/patches/patch-CMakeOptions.txt
@@ -0,0 +1,9 @@
+$NetBSD$
+
+Permit to disable appindicator3 support to avoid dbus dependency.
+Inspired by OpenBSD ports.
+
+--- CMakeOptions.txt.orig	2025-05-04 19:18:48.857093871 +0000
++++ CMakeOptions.txt
+@@ -0,0 +1 @@
++option(ENABLE_APPINDICATOR	"Build with appindicator3 support" ON)
diff --git a/gromit-mpx/patches/patch-build-config.h__cmake__in b/gromit-mpx/patches/patch-build-config.h__cmake__in
new file mode 100644
index 0000000000..64ee67624d
--- /dev/null
+++ b/gromit-mpx/patches/patch-build-config.h__cmake__in
@@ -0,0 +1,14 @@
+$NetBSD$
+
+--- build-config.h_cmake_in.orig	2025-05-04 19:21:11.175864598 +0000
++++ build-config.h_cmake_in
+@@ -18,6 +18,9 @@
+ 
+ #define SYSCONFDIR "${CMAKE_INSTALL_FULL_SYSCONFDIR}"
+ 
++/* This is defined when appindicator is enabled. */
++#cmakedefine ENABLE_APPINDICATOR 1
++
+ /* This is defined when libappindicator is not libayatana-libappindicator. */
+ #cmakedefine APPINDICATOR_IS_LEGACY 1
+ 
diff --git a/gromit-mpx/patches/patch-src_main.c b/gromit-mpx/patches/patch-src_main.c
index 9dcf2b266d..7f3bde588a 100644
--- a/gromit-mpx/patches/patch-src_main.c
+++ b/gromit-mpx/patches/patch-src_main.c
@@ -1,41 +1,44 @@
 $NetBSD$
 
-Disable appindicator3 support to avoid dbus dependency.
-
-From OpenBSD ports.
+Permit to disable appindicator3 support to avoid dbus dependency.
+Inspired by OpenBSD ports.
 
 --- src/main.c.orig	2024-09-09 18:39:05.000000000 +0000
 +++ src/main.c
-@@ -864,15 +864,6 @@ void setup_main_app (GromitData *data, i
+@@ -864,6 +864,7 @@ void setup_main_app (GromitData *data, i
    if (activate)
      acquire_grab (data, NULL); /* grab all */
  
--  /*
--     TRAY ICON
--  */
--  data->trayicon = app_indicator_new (PACKAGE_NAME,
--				      "net.christianbeier.Gromit-MPX",
--				      APP_INDICATOR_CATEGORY_APPLICATION_STATUS);
--
--  app_indicator_set_status (data->trayicon, APP_INDICATOR_STATUS_ACTIVE);
--
++#ifdef ENABLE_APPINDICATOR
+   /*
+      TRAY ICON
+   */
+@@ -872,6 +873,7 @@ void setup_main_app (GromitData *data, i
+ 				      APP_INDICATOR_CATEGORY_APPLICATION_STATUS);
+ 
+   app_indicator_set_status (data->trayicon, APP_INDICATOR_STATUS_ACTIVE);
++#endif
+ 
  
  
-   /* create the menu */
-@@ -1019,7 +1010,6 @@ void setup_main_app (GromitData *data, i
+@@ -1019,7 +1021,9 @@ void setup_main_app (GromitData *data, i
    gtk_widget_show (quit_item);
  
  
--  app_indicator_set_menu (data->trayicon, GTK_MENU(menu));
++#ifdef ENABLE_APPINDICATOR
+   app_indicator_set_menu (data->trayicon, GTK_MENU(menu));
++#endif
  
    /*
      Build the support menu
-@@ -1267,8 +1257,4 @@ int main (int argc, char **argv)
+@@ -1267,8 +1271,10 @@ int main (int argc, char **argv)
  
  void indicate_active(GromitData *data, gboolean YESNO)
  {
--    if(YESNO)
--	app_indicator_set_icon(data->trayicon, "net.christianbeier.Gromit-MPX.active");
--    else
--	app_indicator_set_icon(data->trayicon, "net.christianbeier.Gromit-MPX");
++#ifdef ENABLE_APPINDICATOR
+     if(YESNO)
+ 	app_indicator_set_icon(data->trayicon, "net.christianbeier.Gromit-MPX.active");
+     else
+ 	app_indicator_set_icon(data->trayicon, "net.christianbeier.Gromit-MPX");
++#endif
  }
diff --git a/gromit-mpx/patches/patch-src_main.h b/gromit-mpx/patches/patch-src_main.h
index e69a8f91b2..306f6a0202 100644
--- a/gromit-mpx/patches/patch-src_main.h
+++ b/gromit-mpx/patches/patch-src_main.h
@@ -1,28 +1,31 @@
 $NetBSD$
 
-Disable appindicator3 support to avoid dbus dependency.
-
-From OpenBSD ports.
+Permit to disable appindicator3 support to avoid dbus dependency.
+Inspired by OpenBSD ports.
 
 --- src/main.h.orig	2024-09-09 18:39:05.000000000 +0000
 +++ src/main.h
-@@ -29,11 +29,6 @@
+@@ -29,11 +29,13 @@
  #include <glib/gi18n.h>
  #include <gdk/gdk.h>
  #include <gtk/gtk.h>
--#ifdef APPINDICATOR_IS_LEGACY
--#include <libappindicator/app-indicator.h>
--#else
--#include <libayatana-appindicator/app-indicator.h>
--#endif
++#ifdef ENABLE_APPINDICATOR
+ #ifdef APPINDICATOR_IS_LEGACY
+ #include <libappindicator/app-indicator.h>
+ #else
+ #include <libayatana-appindicator/app-indicator.h>
+ #endif
++#endif
  
  #define GROMIT_MOUSE_EVENTS ( GDK_BUTTON_MOTION_MASK | \
                                GDK_BUTTON_PRESS_MASK | \
-@@ -116,7 +111,6 @@ typedef struct
+@@ -116,7 +118,9 @@ typedef struct
  typedef struct
  {
    GtkWidget   *win;
--  AppIndicator *trayicon;
++#ifdef ENABLE_APPINDICATOR
+   AppIndicator *trayicon;
++#endif
  
    GdkCursor   *paint_cursor;
    GdkCursor   *erase_cursor;


Home | Main Index | Thread Index | Old Index