commit:     effe2edd232d7f8decce455309dd6ae252316cfe
Author:     Azamat H. Hackimov <azamat.hackimov <AT> gmail <DOT> com>
AuthorDate: Mon Jun  8 09:58:02 2020 +0000
Commit:     Stefan Strogin <steils <AT> gentoo <DOT> org>
CommitDate: Fri Jun 12 03:13:10 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=effe2edd

games-action/heroes: fix compilation; update ebuild

Fix compilation on GCC 10 (#708794, patch taken from Debian
https://salsa.debian.org/games-team/heroes/-/blob/master/debian/patches/single-declaration.patch),
update to EAPI 7, minor cleanups.

Closes: https://bugs.gentoo.org/708794
Package-Manager: Portage-2.3.99, Repoman-2.3.22
Signed-off-by: Azamat H. Hackimov <azamat.hackimov <AT> gmail.com>

Add patch to add a missing header and packed attributes for structures
[https://salsa.debian.org/games-team/heroes/-/blob/master/debian/patches/compilation-fixes.patch]
Closes: https://github.com/gentoo/gentoo/pull/16116
Signed-off-by: Stefan Strogin <steils <AT> gentoo.org>

 .../heroes/files/heroes-0.21-compilation.patch     | 48 ++++++++++++++++++++++
 ...ix.patch => heroes-0.21-cvs-segfault-fix.patch} |  0
 games-action/heroes/files/heroes-0.21-gcc10.patch  | 16 ++++++++
 games-action/heroes/heroes-0.21-r2.ebuild          | 42 +++++++++++--------
 4 files changed, 89 insertions(+), 17 deletions(-)

diff --git a/games-action/heroes/files/heroes-0.21-compilation.patch 
b/games-action/heroes/files/heroes-0.21-compilation.patch
new file mode 100644
index 00000000000..e972953093c
--- /dev/null
+++ b/games-action/heroes/files/heroes-0.21-compilation.patch
@@ -0,0 +1,48 @@
+Description: GCC 6 compilation fixes
+Author: Stephen Kitt <sk...@debian.org>
+
+Add a missing header.
+Propagate packed attributes as necessary.
+
+--- a/lib/xstrduplwr.c
++++ b/lib/xstrduplwr.c
+@@ -25,6 +25,7 @@
+ 
+ #include <sys/types.h>
+ #include <ctype.h>
++#include <string.h>
+ 
+ #include "xalloc.h"
+ #include "xstrduplwr.h"
+--- a/src/pcx.h
++++ b/src/pcx.h
+@@ -23,7 +23,7 @@
+ 
+ #include "video.h"
+ 
+-typedef struct pcx_header_type
++typedef struct ATTRIBUTE_PACKED pcx_header_type
+ {
+   a_u8 signature;
+   a_u8 version;
+@@ -39,9 +39,9 @@
+   a_u16 palette_kind;
+   a_u8 rien[58];
+ }
+-a_pcx_header ATTRIBUTE_PACKED;
++a_pcx_header;
+ 
+-typedef struct
++typedef struct ATTRIBUTE_PACKED
+ {
+   a_u8 r, g, b;
+ }
+@@ -54,7 +54,7 @@
+ }
+ a_palette;
+ 
+-typedef struct img_type
++typedef struct ATTRIBUTE_PACKED img_type
+ {
+   a_pcx_header header;
+   a_palette palette;

diff --git a/games-action/heroes/files/0.21-cvs-segfault-fix.patch 
b/games-action/heroes/files/heroes-0.21-cvs-segfault-fix.patch
similarity index 100%
rename from games-action/heroes/files/0.21-cvs-segfault-fix.patch
rename to games-action/heroes/files/heroes-0.21-cvs-segfault-fix.patch

diff --git a/games-action/heroes/files/heroes-0.21-gcc10.patch 
b/games-action/heroes/files/heroes-0.21-gcc10.patch
new file mode 100644
index 00000000000..b806e3e8878
--- /dev/null
+++ b/games-action/heroes/files/heroes-0.21-gcc10.patch
@@ -0,0 +1,16 @@
+Descriptions: Ensure variables are only declared once
+Author: Stephen Kitt <sk...@debian.org>
+
+--- a/src/persona.h
++++ b/src/persona.h
+@@ -28,8 +28,8 @@
+  * difference only if the program has a sgid or suid bit.
+  */
+ 
+-bool keep_sgid;                       /* Whether we should keep the  */
+-bool keep_suid;                       /* SGID or SUID priviledge. */
++extern bool keep_sgid;                        /* Whether we should keep the  
*/
++extern bool keep_suid;                        /* SGID or SUID priviledge. */
+ 
+ /* Get information about the current persona,
+    and switch to the user persona.  */

diff --git a/games-action/heroes/heroes-0.21-r2.ebuild 
b/games-action/heroes/heroes-0.21-r2.ebuild
index 5ab9018ee3d..9e7f8d9fcc0 100644
--- a/games-action/heroes/heroes-0.21-r2.ebuild
+++ b/games-action/heroes/heroes-0.21-r2.ebuild
@@ -1,8 +1,9 @@
-# Copyright 1999-2017 Gentoo Foundation
+# Copyright 1999-2020 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI=6
-inherit eutils autotools
+EAPI=7
+
+inherit autotools
 
 data_ver=1.5
 snd_trk_ver=1.0
@@ -21,11 +22,17 @@ KEYWORDS="~amd64 ~x86"
 IUSE="ggi nls sdl"
 RESTRICT="test"
 
-RDEPEND="
-       ggi? ( media-libs/libggi media-libs/libgii media-libs/libmikmod )
+REQUIRED_USE="^^ ( ggi sdl )"
+RDEPEND="ggi? (
+               media-libs/libggi
+               media-libs/libgii
+               media-libs/libmikmod
+       )
        nls? ( virtual/libintl )
-       sdl? ( media-libs/libsdl media-libs/sdl-mixer )
-       !sdl? ( !ggi? ( media-libs/libsdl media-libs/sdl-mixer ) )"
+       sdl? (
+               media-libs/libsdl
+               media-libs/sdl-mixer
+       )"
 DEPEND="${RDEPEND}
        nls? ( sys-devel/gettext )"
 
@@ -34,7 +41,9 @@ PATCHES=(
        "${FILESDIR}/${P}"-automake-1.12.patch
        "${FILESDIR}/${P}"-gcc4.patch
        "${FILESDIR}/${P}"-underlink.patch
-       "${FILESDIR}/${PV}"-cvs-segfault-fix.patch
+       "${FILESDIR}/${P}"-cvs-segfault-fix.patch
+       "${FILESDIR}/${P}"-compilation.patch
+       "${FILESDIR}/${P}"-gcc10.patch
 )
 
 src_prepare() {
@@ -45,13 +54,13 @@ src_prepare() {
 }
 
 src_configure() {
-       local myconf
-
-       if use sdl || ! use ggi ; then
-               myconf="${myconf} --with-sdl --with-sdl-mixer"
-       else
-               myconf="${myconf} --with-ggi --with-mikmod"
-       fi
+       local myconf=(
+               $(use_with sdl)
+               $(use_with sdl sdl-mixer)
+               $(use_with ggi)
+               $(use_with ggi mikmod)
+               $(use_enable nls)
+       )
 
        local pkg
        for pkg in ${A//.tar.bz2} ; do
@@ -59,8 +68,7 @@ src_configure() {
                econf \
                        --disable-heroes-debug \
                        --disable-optimizations \
-                       $(use_enable nls) \
-                       ${myconf}
+                       "${myconf[@]}"
        done
 }
 

Reply via email to