commit:     cdc7a0e173b16db2667c4f15ab211532d43040f1
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Oct 19 16:58:28 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Oct 19 16:58:28 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cdc7a0e1

games-arcade/syobon: fix build w/ clang, fix build w/ lto

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

 games-arcade/syobon/files/syobon-1.0.1-lto.patch   | 100 +++++++++++++++++++++
 .../syobon/files/syobon-1.0.1-narrowing.patch      |  15 ++++
 games-arcade/syobon/syobon-1.0.1-r1.ebuild         |   5 ++
 3 files changed, 120 insertions(+)

diff --git a/games-arcade/syobon/files/syobon-1.0.1-lto.patch 
b/games-arcade/syobon/files/syobon-1.0.1-lto.patch
new file mode 100644
index 000000000000..4053edffc3a1
--- /dev/null
+++ b/games-arcade/syobon/files/syobon-1.0.1-lto.patch
@@ -0,0 +1,100 @@
+diff --git a/loadg.cpp b/loadg.cpp
+index 4415cb8..c662c7c 100644
+--- a/loadg.cpp
++++ b/loadg.cpp
+@@ -2,7 +2,7 @@
+ #include "Windows.h"
+ #endif
+ #include "DxLib.h"
+-
++#include "size.h"
+ 
+ void end();
+ 
+@@ -20,7 +20,7 @@ extern Mix_Chunk *otofinal;
+ #endif
+ 
+ extern int anx[160], any[160];
+-extern int ne[40], nf[40];
++extern int ne[nmax], nf[nmax];
+ 
+ void loadg(void)
+ {
+diff --git a/main.h b/main.h
+index 2dd49d8..9aab7cc 100644
+--- a/main.h
++++ b/main.h
+@@ -1,4 +1,6 @@
+ #include "DxLib.h"
++#include "size.h"
++
+ using namespace std;
+ 
+ #define SHORT
+@@ -129,7 +131,6 @@ double pai = 3.1415926535;
+ 
+ 
+ //地面
+-#define smax 31
+ int sx, sco;
+ int sa[smax], sb[smax], sc[smax], sd[smax], stype[smax], sxtype[smax],
+     sr[smax];
+@@ -159,7 +160,6 @@ int mascrollmax = 21000;   //9000
+ //ブロック
+ void tyobi(int x, int y, int type);
+ void brockbreak(int t);
+-#define tmax 641
+ int tco;
+ int ta[tmax], tb[tmax], tc[tmax], td[tmax], thp[tmax], ttype[tmax];
+ int titem[tmax], txtype[tmax];
+@@ -173,7 +173,6 @@ void setfont(int x, int y);
+ //効果を持たないグラ
+ void eyobi(int xa, int xb, int xc, int xd, int xe, int xf, int xnobia,
+          int xnobib, int xgtype, int xtm);
+-#define emax 201
+ int eco;
+ int ea[emax], eb[emax], enobia[emax], enobib[emax], ec[emax], ed[emax];
+ int ee[emax], ef[emax], etm[emax];
+@@ -185,7 +184,6 @@ int egtype[emax];
+ void ayobi(int xa, int xb, int xc, int xd, int xnotm, int xtype,
+          int xxtype);
+ void tekizimen();
+-#define amax 24
+ int aco;
+ int aa[amax], ab[amax], anobia[amax], anobib[amax], ac[amax], ad[amax];
+ int ae[amax], af[amax], abrocktm[amax];
+@@ -196,21 +194,18 @@ int atm[amax], a2tm[amax];
+ int amsgtm[amax], amsgtype[amax];
+ 
+ //敵出現
+-#define bmax 81
+ int bco;
+ int ba[bmax], bb[bmax], btm[bmax];
+ int btype[bmax], bxtype[bmax], bz[bmax];
+ 
+ 
+ //背景
+-#define nmax 41
+ int nxxmax, nco;
+ int na[nmax], nb[nmax], nc[nmax], nd[nmax], ntype[nmax];
+ int ne[nmax], nf[nmax], ng[nmax], nx[nmax];
+ 
+ 
+ //リフト
+-#define srmax 21
+ int srco;
+ int sra[srmax], srb[srmax], src[srmax], srd[srmax], sre[srmax], srf[srmax];
+ int srtype[srmax], srgtype[srmax], sracttype[srmax], srsp[srmax];
+diff --git a/size.h b/size.h
+new file mode 100644
+index 0000000..8f91ec1
+--- /dev/null
++++ b/size.h
+@@ -0,0 +1,7 @@
++#define amax 24
++#define bmax 81
++#define emax 201
++#define nmax 41
++#define smax 31
++#define srmax 21
++#define tmax 641

diff --git a/games-arcade/syobon/files/syobon-1.0.1-narrowing.patch 
b/games-arcade/syobon/files/syobon-1.0.1-narrowing.patch
new file mode 100644
index 000000000000..e8c7f938bde5
--- /dev/null
+++ b/games-arcade/syobon/files/syobon-1.0.1-narrowing.patch
@@ -0,0 +1,15 @@
+https://bugs.gentoo.org/739110
+--- a/DxLib.cpp
++++ b/DxLib.cpp
+@@ -213,7 +213,7 @@ void ChangeFontType(byte type)
+ 
+ void DrawString(int a, int b, const char *x, Uint32 c)
+ {
+-    SDL_Color color = { c >> 16, c >> 8, c };
++    SDL_Color color = { static_cast<unsigned char>(c >> 16), 
static_cast<unsigned char>(c >> 8), static_cast<unsigned char>(c) };
+     SDL_Surface *rendered = TTF_RenderUTF8_Solid(font[fontsize], x, color);
+     if (fontType == DX_FONTTYPE_EDGE) {
+       SDL_Color blk = { 0, 0, 0 };
+-- 
+2.51.1
+

diff --git a/games-arcade/syobon/syobon-1.0.1-r1.ebuild 
b/games-arcade/syobon/syobon-1.0.1-r1.ebuild
index 42e82df2fac9..36b2861a1491 100644
--- a/games-arcade/syobon/syobon-1.0.1-r1.ebuild
+++ b/games-arcade/syobon/syobon-1.0.1-r1.ebuild
@@ -24,6 +24,11 @@ RDEPEND="
 DEPEND="${RDEPEND}"
 BDEPEND="virtual/pkgconfig"
 
+PATCHES=(
+       "${FILESDIR}"/${PN}-1.0.1-narrowing.patch
+       "${FILESDIR}"/${PN}-1.0.1-lto.patch
+)
+
 src_compile() {
        emake GAMEDATA="/usr/share/${PN}"
 }

Reply via email to