Control: tags -1 + patch upstream

On Sat, 23 Oct 2021 at 20:38:16 +0200, Lucas Nussbaum wrote:
> > /usr/include/c++/11/type_traits:44:3: error: template with C linkage
> >    44 |   template<typename... _Elements>
> >       |   ^~~~~~~~
> > /<<PKGBUILDDIR>>/src/npplayer.cpp:24:1: note: ‘extern "C"’ linkage started 
> > here
> >    24 | extern "C" {
> >       | ^~~~~~~~~~

This is caused by a behaviour change in GLib 2.68, which now uses inline
C++ in some headers when they are compiled as C++, for better type-safety
for C++ callers.

Since knpplayer seems to be a standalone host for NPAPI browser plugins
(which are an obsolete technology) and depends on the obsolete libraries
GTK 2 and dbus-glib, I would personally suggest disabling/removing the
knpplayer part of this package instead of fixing it: see #999459 for
details and a patch (builds successfully, otherwise untested).

Or, if that's not considered acceptable, there are two strategies that
kmplayer could use to solve this: it can either ask GLib to behave more
like the older GLib versions for which this module was developed, or
move the header inclusion out from under the extern "C" guards. See the
attached patches for more information.

Either one of the attached patches is sufficient to make this package
build (again, compiled successfully but otherwise untested), but it would
be most robust to do both.

    smcv
From: Simon McVittie <s...@debian.org>
Date: Fri, 12 Nov 2021 09:33:59 +0000
Subject: npplayer: Don't wrap third-party headers in extern "C"

These libraries all include extern "C" guards in their headers when
compiled as C++ (in some cases via a macro such as GLib's G_BEGIN_DECLS),
so it is unnecessary to wrap them in another layer of extern "C".

Some C library headers make use of C++ in inline functions when compiled
as C++: in particular, GLib 2.68+ does this for better type-safety.
This will not work inside an extern "C" block.

Bug-Debian: https://bugs.debian.org/997118
---
 src/npplayer.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/npplayer.cpp b/src/npplayer.cpp
index 6881abe..a38f898 100644
--- a/src/npplayer.cpp
+++ b/src/npplayer.cpp
@@ -21,7 +21,6 @@
 http://devedge-temp.mozilla.org/library/manuals/2002/plugin/1.0/
 http://dbus.freedesktop.org/doc/dbus/libdbus-tutorial.html
 */
-extern "C" {
 #include <unistd.h>
 #include <string.h>
 #include <stdio.h>
@@ -50,6 +49,8 @@ extern "C" {
 
 #define INITIAL_WINDOW_WIDTH 1920
 
+extern "C" {
+
 typedef const char* (* NP_LOADDS NP_GetMIMEDescriptionUPP)();
 typedef NPError (* NP_GetValueUPP)(void *inst, NPPVariable var, void *value);
 typedef NPError (* NP_InitializeUPP)(NPNetscapeFuncs*, NPPluginFuncs*);
From: Simon McVittie <s...@debian.org>
Date: Fri, 12 Nov 2021 09:49:41 +0000
Subject: npplayer: Target a specific GLib API version

Since GLib 2.32 (2012), setting GLIB_VERSION_MIN_REQUIRED selects the
minimum required version of GLib for this project. Code that was
deprecated after that version will not cause deprecation warnings, and
where header files have changed their compile-time behaviour over time,
the behaviour that was seen in the selected version will be used where
possible.

In particular, this disables new C++ behaviour introduced in GLib 2.68,
which caused this project to fail to build.

Similarly, setting GLIB_VERSION_MAX_ALLOWED causes GLib to emit warnings
if a function introduced after the selected version is used, even inside
a GLIB_CHECK_VERSION guard.

There is no particular significance to 2.50, except that it's the
version in Debian 9 (2017), which is the oldest build environment that
I have conveniently available.

Bug-Debian: https://bugs.debian.org/997118
---
 src/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 7a05382..4fd436c 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -135,7 +135,7 @@ if (KMPLAYER_WITH_NPP)
     add_executable(knpplayer ${knpplayer_SRCS})
 
     SET_TARGET_PROPERTIES(knpplayer PROPERTIES COMPILE_FLAGS
-        "${GLibDBusCflags} ${GTKCflags} ${GThreadCflags} ${GModuleCflags}"
+        "-DGLIB_VERSION_MAX_ALLOWED=\"G_ENCODE_VERSION(2,50)\" -DGLIB_VERSION_MIN_REQUIRED=\"G_ENCODE_VERSION(2,50)\" ${GLibDBusCflags} ${GTKCflags} ${GThreadCflags} ${GModuleCflags}"
     )
 
     target_link_libraries(knpplayer ${GLibDBusLinkFlags} ${GTKLinkFlags} ${GThreadLinkFlags} ${GModuleLinkFlags}
_______________________________________________
pkg-kde-extras mailing list
pkg-kde-extras@alioth-lists.debian.net
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/pkg-kde-extras

Reply via email to