git: 3bfe839f239d - main - audio/gogglesmm: Fix build with FOX 1.7.80

From: Jason E. Hale <jhale_at_FreeBSD.org>
Date: Fri, 28 Oct 2022 04:35:30 UTC
The branch main has been updated by jhale:

URL: https://cgit.FreeBSD.org/ports/commit/?id=3bfe839f239d372035983dbedeaf89a8c06469d0

commit 3bfe839f239d372035983dbedeaf89a8c06469d0
Author:     Jason E. Hale <jhale@FreeBSD.org>
AuthorDate: 2022-10-28 04:10:46 +0000
Commit:     Jason E. Hale <jhale@FreeBSD.org>
CommitDate: 2022-10-28 04:10:46 +0000

    audio/gogglesmm: Fix build with FOX 1.7.80
    
    While here, remove stale KDE patch.
---
 audio/gogglesmm/Makefile                           |  2 +-
 audio/gogglesmm/files/patch-CMakeLists.txt         | 10 +++---
 audio/gogglesmm/files/patch-gap_CMakeLists.txt     |  4 +--
 audio/gogglesmm/files/patch-gap_fox.h              | 40 ++++++++++++++++++++++
 audio/gogglesmm/files/patch-src_GMFilename.cpp     | 40 ++++++++++++++++++++++
 audio/gogglesmm/files/patch-src_GMIconTheme.cpp    | 16 +++++++++
 audio/gogglesmm/files/patch-src_GMIconTheme.h      | 16 +++++++++
 .../gogglesmm/files/patch-src_GMPlayerManager.cpp  | 14 --------
 audio/gogglesmm/files/patch-src_GMTrayIcon.cpp     | 11 +++---
 audio/gogglesmm/files/patch-src_gmdefs.h           | 32 +++++++++++++++++
 10 files changed, 158 insertions(+), 27 deletions(-)

diff --git a/audio/gogglesmm/Makefile b/audio/gogglesmm/Makefile
index 7a166f883516..d54e0476509d 100644
--- a/audio/gogglesmm/Makefile
+++ b/audio/gogglesmm/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	gogglesmm
 PORTVERSION=	1.2.2
-PORTREVISION=	8
+PORTREVISION=	9
 CATEGORIES=	audio
 
 MAINTAINER=	jhale@FreeBSD.org
diff --git a/audio/gogglesmm/files/patch-CMakeLists.txt b/audio/gogglesmm/files/patch-CMakeLists.txt
index d14109c8ce17..73376258ab1c 100644
--- a/audio/gogglesmm/files/patch-CMakeLists.txt
+++ b/audio/gogglesmm/files/patch-CMakeLists.txt
@@ -1,6 +1,6 @@
---- CMakeLists.txt.orig	2017-06-10 02:18:06 UTC
+--- CMakeLists.txt.orig	2020-12-27 21:40:54 UTC
 +++ CMakeLists.txt
-@@ -57,6 +57,11 @@ if(HAS_CXX_OPTIMIZE_DEBUG AND CMAKE_BUILD_TYPE MATCHES
+@@ -67,6 +67,11 @@ endif()
    add_compile_options(-Og)
  endif()
  
@@ -12,7 +12,7 @@
  # FIXME Doesn't work on all platforms.
  #CHECK_CXX_COMPILER_FLAG(-flto HAS_CXX_OPTIMIZE_LINKTIME)
  if(HAS_CXX_OPTIMIZE_LINKTIME AND NOT CMAKE_BUILD_TYPE MATCHES Debug)
-@@ -81,11 +86,13 @@ add_subdirectory(src)
+@@ -100,11 +105,13 @@ add_subdirectory(src)
  #-------------------------------------------------------------------------------
  
  # Extra Installation Files
@@ -31,9 +31,9 @@
  
  install(FILES icons/gogglesmm_16.png DESTINATION share/icons/hicolor/16x16/apps RENAME gogglesmm.png)
  install(FILES extra/gogglesmm_22.png DESTINATION share/icons/hicolor/22x22/apps RENAME gogglesmm.png)
-@@ -96,7 +103,7 @@ install(FILES extra/gogglesmm_64.png DESTINATION share
+@@ -115,7 +122,7 @@ install(FILES extra/gogglesmm.desktop DESTINATION shar
  install(FILES extra/gogglesmm.svg DESTINATION share/icons/hicolor/scalable/apps RENAME gogglesmm.svg)
- install(FILES extra/gogglesmm.appdata.xml DESTINATION share/appdata)
+ install(FILES extra/gogglesmm.appdata.xml DESTINATION share/metainfo)
  install(FILES extra/gogglesmm.desktop DESTINATION share/applications)
 -install(FILES extra/gogglesmm.1 DESTINATION share/man/man1)
 +install(FILES extra/gogglesmm.1 DESTINATION man/man1)
diff --git a/audio/gogglesmm/files/patch-gap_CMakeLists.txt b/audio/gogglesmm/files/patch-gap_CMakeLists.txt
index 35f8b2c7aef5..d295beae7774 100644
--- a/audio/gogglesmm/files/patch-gap_CMakeLists.txt
+++ b/audio/gogglesmm/files/patch-gap_CMakeLists.txt
@@ -1,6 +1,6 @@
---- gap/CMakeLists.txt.orig	2017-02-08 01:48:39 UTC
+--- gap/CMakeLists.txt.orig	2020-12-27 21:40:54 UTC
 +++ gap/CMakeLists.txt
-@@ -215,7 +215,7 @@ else()
+@@ -242,7 +242,7 @@ else()
    endif()
  
    if(WITH_OPENSSL)
diff --git a/audio/gogglesmm/files/patch-gap_fox.h b/audio/gogglesmm/files/patch-gap_fox.h
new file mode 100644
index 000000000000..c9d375c0b72a
--- /dev/null
+++ b/audio/gogglesmm/files/patch-gap_fox.h
@@ -0,0 +1,40 @@
+Fix build with FOX 1.7.80
+
+--- gap/fox.h.orig	2020-12-27 21:40:54 UTC
++++ gap/fox.h
+@@ -35,6 +35,9 @@
+ #define FXVERSION(major,minor,release) ((release)+(minor*1000)+(major*100000))
+ 
+ #include <fxdefs.h>
++#if FOXVERSION >= FXVERSION(1, 7, 80)
++#include <fxchar.h>
++#endif
+ #include <fxendian.h>
+ #include <fxascii.h>
+ #include <fxunicode.h>
+@@ -121,6 +124,25 @@ constexpr FXTime operator"" _ms(unsigned long long int
+ {
+   return value * NANOSECONDS_PER_MILLISECOND;
+ }
++
++#if FOXVERSION >= FXVERSION(1, 7, 80)
++#include <utility>
++#define FX_ALIAS_SPEC(SPECS, NEW_NAME, ...)                      \
++  template <typename... Args>                                    \
++  SPECS auto NEW_NAME(Args &&... args)                           \
++    noexcept(noexcept(__VA_ARGS__(std::forward<Args>(args)...))) \
++    -> decltype(__VA_ARGS__(std::forward<Args>(args)...)) {      \
++    return __VA_ARGS__(std::forward<Args>(args)...);             \
++  }
++
++#define FX_ALIAS(NEW_NAME, ...)                                  \
++  FX_ALIAS_SPEC(inline, NEW_NAME, __VA_ARGS__)
++
++FX_ALIAS(compare, FXString::compare)
++FX_ALIAS(comparecase, FXString::comparecase)
++FX_ALIAS(compareversion, FXString::comparenatural)
++#define FXISFOLLOWUTF8 followUTF8
++#endif
+ 
+ #endif
+ 
diff --git a/audio/gogglesmm/files/patch-src_GMFilename.cpp b/audio/gogglesmm/files/patch-src_GMFilename.cpp
new file mode 100644
index 000000000000..96f978ded968
--- /dev/null
+++ b/audio/gogglesmm/files/patch-src_GMFilename.cpp
@@ -0,0 +1,40 @@
+Fix build with FOX 1.7.80
+
+--- src/GMFilename.cpp.orig	2022-10-28 03:22:22 UTC
++++ src/GMFilename.cpp
+@@ -102,7 +102,11 @@ FXString TextConverter::apply_filters(const FXString &
+       else if (modifiers&UPPERCASE)
+         n+=wc2utf(Unicode::toUpper(src.wc(i)));
+       else
++#if FOXVERSION >= FXVERSION(1,7, 80)
++        n+=lenUTF8(src[i]);
++#else
+         n+=src.extent(i);
++#endif
+       }
+     }
+ 
+@@ -167,7 +171,11 @@ FXString TextConverter::apply_codec(const FXString & s
+     else if (Unicode::isPrint(src.wc(i))) {
+       if (codec->wc2mb(&c,1,src.wc(i))==1) {
+         if (c==undefined_character) {
++#if FOXVERSION >= FXVERSION(1,7,80)
++          FXString dcm = FXString::decompose(src.mid(i,lenUTF8(src[i])),false);
++#else
+           FXString dcm = FXString::decompose(src.mid(i,src.extent(i)),false);
++#endif
+           for (FXint j=0;j<dcm.length();j+=dcm.inc(j)) {
+             if (Unicode::isPrint(dcm.wc(j)) && codec->wc2mb(&c,1,dcm.wc(j)) && c!=0x1a) {
+               n++;
+@@ -190,7 +198,11 @@ FXString TextConverter::apply_codec(const FXString & s
+         if (c==undefined_character) {
+           /* If codec didn't contain a mapping to the required character,
+              do a compatibility decomposition and try mapping those */
++#if FOXVERSION >= FXVERSION(1,7,80)
++          FXString dcm = FXString::decompose(src.mid(i,lenUTF8(src[i])),false);
++#else
+           FXString dcm = FXString::decompose(src.mid(i,src.extent(i)),false);
++#endif
+           for (FXint j=0;j<dcm.length();j+=dcm.inc(j)) {
+             if (Unicode::isPrint(dcm.wc(j)) && codec->wc2mb(&c,1,dcm.wc(j)) && c!=undefined_character) {
+               dst[n++]=c;
diff --git a/audio/gogglesmm/files/patch-src_GMIconTheme.cpp b/audio/gogglesmm/files/patch-src_GMIconTheme.cpp
new file mode 100644
index 000000000000..72d2d976b545
--- /dev/null
+++ b/audio/gogglesmm/files/patch-src_GMIconTheme.cpp
@@ -0,0 +1,16 @@
+Fix build with FOX 1.7.80
+
+--- src/GMIconTheme.cpp.orig	2022-10-28 03:25:41 UTC
++++ src/GMIconTheme.cpp
+@@ -569,7 +569,11 @@ void GMIconTheme::loadLarge(FXIconPtr & icon,const FXc
+     loadIcon(icon,FXString::null,largesize,value,blendcolor);
+   }
+ 
++#if FOXVERSION >= FXVERSION(1, 7, 80)
++void GMIconTheme::loadResource(FXIconPtr & icon,const FXuchar * data,const FXColor blendcolor,const char * type) {
++#else
+ void GMIconTheme::loadResource(FXIconPtr & icon,const void * data,const FXColor blendcolor,const char * type) {
++#endif
+   FXIconSource source;
+   FXIcon * newicon = source.loadIconData(app,data,type);
+   FXASSERT(newicon);
diff --git a/audio/gogglesmm/files/patch-src_GMIconTheme.h b/audio/gogglesmm/files/patch-src_GMIconTheme.h
new file mode 100644
index 000000000000..09f947bb85f3
--- /dev/null
+++ b/audio/gogglesmm/files/patch-src_GMIconTheme.h
@@ -0,0 +1,16 @@
+Fix build with FOX 1.7.80
+
+--- src/GMIconTheme.h.orig	2022-10-28 03:25:54 UTC
++++ src/GMIconTheme.h
+@@ -47,7 +47,11 @@ class GMIconTheme { (protected)
+   FXImage * loadImage(const FXString & filename);
+ protected:
+   void loadIcon(FXIconPtr & icon,const FXString &pathlist,FXint size,const char * value,const FXColor blend);
++#if FOXVERSION >= FXVERSION(1, 7, 80)
++  void loadResource(FXIconPtr & icon,const FXuchar * data,const FXColor blend,const char * type="png");
++#else
+   void loadResource(FXIconPtr & icon,const void * data,const FXColor blend,const char * type="png");
++#endif
+ protected:
+   FXbool load_cache();
+   void   save_cache();
diff --git a/audio/gogglesmm/files/patch-src_GMPlayerManager.cpp b/audio/gogglesmm/files/patch-src_GMPlayerManager.cpp
deleted file mode 100644
index 56fe89851954..000000000000
--- a/audio/gogglesmm/files/patch-src_GMPlayerManager.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-Re-enable tray icon for KDE4 until KDE5 is in the ports tree. Mpris plugin
-works, but tray icon might be wanted to minimize app in the time being.
-
---- src/GMPlayerManager.cpp.orig	2017-06-10 02:18:06 UTC
-+++ src/GMPlayerManager.cpp
-@@ -757,7 +757,7 @@ FXint GMPlayerManager::run(int& argc,cha
-     // KDE5 comes with mpris plugin on the toolbar, no need for
-     // tray icon
-     if (gm_desktop_session()==DESKTOP_SESSION_KDE_PLASMA) {
--      preferences.gui_tray_icon_disabled=true;
-+      preferences.gui_tray_icon_disabled=false;
-       }
- 
-     /// Grab Media Player Keys
diff --git a/audio/gogglesmm/files/patch-src_GMTrayIcon.cpp b/audio/gogglesmm/files/patch-src_GMTrayIcon.cpp
index 27d690c3ebc0..9f924409a7ea 100644
--- a/audio/gogglesmm/files/patch-src_GMTrayIcon.cpp
+++ b/audio/gogglesmm/files/patch-src_GMTrayIcon.cpp
@@ -1,6 +1,6 @@
 Add pseudo transparency to the tray icon
 
---- src/GMTrayIcon.cpp.orig	2016-10-22 17:13:46 UTC
+--- src/GMTrayIcon.cpp.orig	2020-12-27 21:40:54 UTC
 +++ src/GMTrayIcon.cpp
 @@ -81,17 +81,17 @@ void GMTrayIcon::updateIcon() {
  
@@ -23,7 +23,7 @@ Add pseudo transparency to the tray icon
      icon->create();
  
      // Mark Dirty
-@@ -230,13 +230,8 @@ void GMTrayIcon::create(){
+@@ -230,14 +230,9 @@ void GMTrayIcon::dock() {
  
  void GMTrayIcon::dock() {
    if (findSystemTray()){
@@ -34,12 +34,13 @@ Add pseudo transparency to the tray icon
 -      else
 -        opaque=false;
 -      }
-+
-+    opaque=false;
  
++    opaque=false;
++
      if (!opaque) {
        /// Don't draw the background
-@@ -276,16 +271,16 @@ long GMTrayIcon::onConfigure(FXObject*,F
+       XSetWindowAttributes sattr;
+@@ -276,16 +271,16 @@ long GMTrayIcon::onConfigure(FXObject*,FXSelector,void
  
    if (icon==nullptr) {
      if (size<=16) {
diff --git a/audio/gogglesmm/files/patch-src_gmdefs.h b/audio/gogglesmm/files/patch-src_gmdefs.h
new file mode 100644
index 000000000000..20e946110452
--- /dev/null
+++ b/audio/gogglesmm/files/patch-src_gmdefs.h
@@ -0,0 +1,32 @@
+Fix build with FOX 1.7.80
+
+--- src/gmdefs.h.orig	2020-12-27 21:40:54 UTC
++++ src/gmdefs.h
+@@ -93,5 +93,27 @@ extern const FXchar * fxtr(const FXchar *) FX_FORMAT(1
+ // Best Image Scaler in FXImage
+ #define FOX_SCALE_BEST 2
+ 
++#if FOXVERSION >= FXVERSION(1, 7, 80)
++#include <utility>
++#define FX_ALIAS_SPEC(SPECS, NEW_NAME, ...)                      \
++  template <typename... Args>                                    \
++  SPECS auto NEW_NAME(Args &&... args)                           \
++    noexcept(noexcept(__VA_ARGS__(std::forward<Args>(args)...))) \
++    -> decltype(__VA_ARGS__(std::forward<Args>(args)...)) {      \
++    return __VA_ARGS__(std::forward<Args>(args)...);             \
++  }
++
++#define FX_ALIAS(NEW_NAME, ...)                                  \
++  FX_ALIAS_SPEC(inline, NEW_NAME, __VA_ARGS__)
++
++FX_ALIAS(compare, FXString::compare)
++FX_ALIAS(comparecase, FXString::comparecase)
++FX_ALIAS(compareversion, FXString::comparenatural)
++#define FXISFOLLOWUTF8 followUTF8
++#define FXISLEADUTF16 leadUTF16
++#define FXISFOLLOWUTF16 followUTF16
++#define FXISSEQUTF16 seqUTF16
++#endif
++
+ #endif
+