commit:     f1015f45233053c975697981e6078b0dce19e5ba
Author:     Petr Vaněk <arkamar <AT> gentoo <DOT> org>
AuthorDate: Mon Mar  3 11:38:37 2025 +0000
Commit:     Petr Vaněk <arkamar <AT> gentoo <DOT> org>
CommitDate: Mon Mar  3 12:05:49 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f1015f45

dev-lang/jwasm: GCC 15 fixes

- add missing includes and append -D_POSIX_SOURCE cppflag in order to
  resolve implicit function declaration issues
- set -std=c17 because upstream typedefs bool in code base

Upstream-PR: https://github.com/Baron-von-Riedesel/JWasm/pull/34
Closes: https://bugs.gentoo.org/944893
Signed-off-by: Petr Vaněk <arkamar <AT> gentoo.org>

 .../jwasm/files/jwasm-2.18-missing-includes.patch  | 56 ++++++++++++++++++++++
 .../{jwasm-2.18.ebuild => jwasm-2.18-r1.ebuild}    |  9 ++--
 2 files changed, 62 insertions(+), 3 deletions(-)

diff --git a/dev-lang/jwasm/files/jwasm-2.18-missing-includes.patch 
b/dev-lang/jwasm/files/jwasm-2.18-missing-includes.patch
new file mode 100644
index 000000000000..08a6aa40ebd2
--- /dev/null
+++ b/dev-lang/jwasm/files/jwasm-2.18-missing-includes.patch
@@ -0,0 +1,56 @@
+From fa8bf4476f74679c1a5e1a4ca55bf5327b4bd558 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20Van=C4=9Bk?= <[email protected]>
+Date: Mon, 3 Mar 2025 12:16:23 +0100
+Subject: [PATCH] add missing includes
+
+Several includes are missing based on linux man pages:
+
+- strings.h for strcasecmp
+- alloca.h  for alloca
+- stdio.h   for fileno
+
+The compilation with GCC 15 fails without those with implicit function
+declaration error.
+---
+
+Upstream-PR: https://github.com/Baron-von-Riedesel/JWasm/pull/34
+
+diff --git a/src/H/globals.h b/src/H/globals.h
+index 2992cc7..607e5f5 100644
+--- a/src/H/globals.h
++++ b/src/H/globals.h
+@@ -39,6 +39,7 @@
+ 
+ #if defined(__UNIX__) || defined(__CYGWIN__) || defined(__DJGPP__) /* avoid 
for MinGW! */
+ 
++#include <strings.h>
+ #define _stricmp strcasecmp
+ #ifndef __WATCOMC__
+ #define _memicmp strncasecmp
+diff --git a/src/H/memalloc.h b/src/H/memalloc.h
+index d2a8460..7a4e364 100644
+--- a/src/H/memalloc.h
++++ b/src/H/memalloc.h
+@@ -44,6 +44,7 @@ extern void MemFree( void *ptr );
+ 
+ #elif defined(__GNUC__) || defined(__TINYC__)
+ 
++#include <alloca.h>
+ #define myalloca  alloca
+ #ifndef __FreeBSD__  /* added v2.08 */
+ #include <malloc.h>  /* added v2.07 */
+diff --git a/src/omf.c b/src/omf.c
+index 8d98b1f..d90afae 100644
+--- a/src/omf.c
++++ b/src/omf.c
+@@ -62,6 +62,7 @@
+ 
+ #if TRUNCATE
+ #if defined(__UNIX__) || defined(__CYGWIN__) || defined(__DJGPP__)
++#include <stdio.h>
+ #include <unistd.h>
+ #else
+ #include <io.h>
+-- 
+2.45.3
+

diff --git a/dev-lang/jwasm/jwasm-2.18.ebuild 
b/dev-lang/jwasm/jwasm-2.18-r1.ebuild
similarity index 68%
rename from dev-lang/jwasm/jwasm-2.18.ebuild
rename to dev-lang/jwasm/jwasm-2.18-r1.ebuild
index 465a5756422b..513ad11b1401 100644
--- a/dev-lang/jwasm/jwasm-2.18.ebuild
+++ b/dev-lang/jwasm/jwasm-2.18-r1.ebuild
@@ -1,9 +1,9 @@
-# Copyright 1999-2024 Gentoo Authors
+# Copyright 1999-2025 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
 
-inherit toolchain-funcs
+inherit flag-o-matic toolchain-funcs
 
 DESCRIPTION="MASM-compatible TASM-similar assembler (fork of Wasm)"
 HOMEPAGE="https://github.com/Baron-von-Riedesel/JWasm";
@@ -17,6 +17,7 @@ KEYWORDS="amd64 ~x86"
 PATCHES=(
        "${FILESDIR}"/${PN}-2.18-types-test.patch
        "${FILESDIR}"/${PN}-2.18-makefile-dep-fix.patch
+       "${FILESDIR}"/${PN}-2.18-missing-includes.patch #944893
 )
 
 src_prepare() {
@@ -27,7 +28,9 @@ src_prepare() {
 }
 
 src_compile() {
-       emake -f GccUnix.mak CC="$(tc-getCC) ${CFLAGS} ${LDFLAGS}"
+       # -std=c17 and -D_POSIX_C_SOURCE=200809L are both related to bug #944893
+       append-cflags -std=c17
+       emake -f GccUnix.mak CC="$(tc-getCC) ${CFLAGS} 
-D_POSIX_C_SOURCE=200809L ${LDFLAGS}"
 }
 
 src_install() {

Reply via email to