commit:     ee26005f02f103b52d7da0a5f0b3dd59da777983
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 12 10:06:03 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Jun 12 10:36:24 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ee26005f

media-sound/mpdscribble: fix build with GCC 12

Closes: https://bugs.gentoo.org/851513
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../files/mpdscribble-0.23-gcc12-time.patch        | 37 ++++++++++++++++++++++
 media-sound/mpdscribble/mpdscribble-0.24.ebuild    |  1 +
 2 files changed, 38 insertions(+)

diff --git a/media-sound/mpdscribble/files/mpdscribble-0.23-gcc12-time.patch 
b/media-sound/mpdscribble/files/mpdscribble-0.23-gcc12-time.patch
new file mode 100644
index 000000000000..7a6a247d73d0
--- /dev/null
+++ b/media-sound/mpdscribble/files/mpdscribble-0.23-gcc12-time.patch
@@ -0,0 +1,37 @@
+https://github.com/MusicPlayerDaemon/mpdscribble/pull/42
+
+From: Sam James <[email protected]>
+Date: Sun, 12 Jun 2022 11:11:08 +0100
+Subject: [PATCH] Fix build with GCC 12 (missing <time.h> include)
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Fixes the following build failure with GCC 12:
+```
+FAILED: mpdscribble.p/src_Log.cxx.o
+[...]
+../mpdscribble-0.24/src/Log.cxx: In function ‘const char* log_date()’:
+../mpdscribble-0.24/src/Log.cxx:48:13: error: ‘time’ was not declared in this 
scope
+   48 |         t = time(nullptr);
+      |             ^~~~
+../mpdscribble-0.24/src/Log.cxx:49:15: error: ‘localtime’ was not declared in 
this scope
+   49 |         tmp = localtime(&t);
+      |               ^~~~~~~~~
+../mpdscribble-0.24/src/Log.cxx:55:14: error: ‘strftime’ was not declared in 
this scope
+   55 |         if (!strftime(buf, sizeof(buf), "%Y-%m-%dT%H:%M:%S%z", tmp)) {
+      |              ^~~~~~~~
+```
+
+Bug: https://bugs.gentoo.org/851513
+--- a/src/Log.cxx
++++ b/src/Log.cxx
+@@ -29,6 +29,7 @@
+ #include <stdio.h>
+ #include <string.h>
+ #include <errno.h>
++#include <time.h>
+ 
+ #ifdef HAVE_SYSLOG
+ #include <syslog.h>
+

diff --git a/media-sound/mpdscribble/mpdscribble-0.24.ebuild 
b/media-sound/mpdscribble/mpdscribble-0.24.ebuild
index 9265bd6c5a2d..cecfbd65aaba 100644
--- a/media-sound/mpdscribble/mpdscribble-0.24.ebuild
+++ b/media-sound/mpdscribble/mpdscribble-0.24.ebuild
@@ -30,6 +30,7 @@ DOCS=( AUTHORS COPYING NEWS README.rst )
 PATCHES=(
        
"${FILESDIR}"/${PN}-0.23-Unconditionally-generate-systemd-unit-files.patch
        
"${FILESDIR}"/${PN}-0.23-Don-t-install-AUTHORS-COPYING-NEWS-README.rst.patch
+       "${FILESDIR}"/${PN}-0.23-gcc12-time.patch
 )
 
 src_install() {

Reply via email to