commit:     2360d9ea66979cfa5aa408ea50928074ce7ab8af
Author:     Nicholas Vinson <nvinson234 <AT> gmail <DOT> com>
AuthorDate: Thu Sep  8 03:54:03 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Sep  8 03:56:09 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2360d9ea

net-libs/libsmi: fix build with Clang 15 (implicit function declarations)

Signed-off-by: Nicholas Vinson <nvinson234 <AT> gmail.com>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 ...bsmi-0.5.0-implicit-function-declarations.patch | 74 ++++++++++++++++++++++
 net-libs/libsmi/libsmi-0.5.0-r2.ebuild             | 38 +++++++++++
 2 files changed, 112 insertions(+)

diff --git 
a/net-libs/libsmi/files/libsmi-0.5.0-implicit-function-declarations.patch 
b/net-libs/libsmi/files/libsmi-0.5.0-implicit-function-declarations.patch
new file mode 100644
index 000000000000..f0d52e4ae000
--- /dev/null
+++ b/net-libs/libsmi/files/libsmi-0.5.0-implicit-function-declarations.patch
@@ -0,0 +1,74 @@
+From: Nicholas Vinson <[email protected]>
+To: [email protected]
+Cc: Nicholas Vinson <[email protected]>
+Subject: Implicit function declaration patch
+
+When building libsmi with clang 15.0.0, clang fails to build due to
+errors similar to:
+
+call to undeclared function 'smiyyerror'; ISO C99 and later do not support
+implicit function declarations
+
+This patch corrects those issues by introducing the needed
+declarations defore the function call.
+
+Thanks,
+Nicholas Vinson
+
+--- a/lib/yang-data.h
++++ b/lib/yang-data.h
+@@ -158,10 +158,12 @@ _YangIdentifierRef  *listIdentifierRef(Y
+ /*
+  *  Node and Module functions
+  */
+ _YangNode *addYangNode(const char *value, YangDecl nodeKind, _YangNode 
*parentPtr);
+ 
++void createIdentifierRef(_YangNode *node, char* prefix, char* ident);
++
+ int removeYangNode(_YangNode* target, _YangNode* child);
+ 
+ _YangModuleInfo *createModuleInfo(_YangNode *modulePtr);
+ 
+ void createTypeInfo(_YangNode *node);
+--- a/lib/parser-yang.y
++++ b/lib/parser-yang.y
+@@ -19,10 +19,15 @@
+ #include <config.h>
+     
+ #ifdef BACKEND_YANG
+ 
+ #define _ISOC99_SOURCE
++/* define _DEFAULT_SOURCE to get timegm() */
++#define _DEFAULT_SOURCE 1
++/* define _BSD_SOURCE & _SVID_SOURCE for backwards compatibility */
++#define _BSD_SOURCE 1
++#define _SVID_SOURCE 1
+ #include <stdio.h>
+ #include <errno.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include <ctype.h>
+@@ -44,10 +44,11 @@
+ #include "parser-yang.h"
+ #include "scanner-yang.h"
+ #include "yang-complex-types.h"
+ #include "util.h"
+ #include "error.h"
++#include "yang-check.h"
+     
+ #ifdef HAVE_DMALLOC_H
+ #include <dmalloc.h>
+ #endif
+ 
+--- a/lib/error.h
++++ b/lib/error.h
+@@ -40,6 +40,8 @@ extern char* smiGetErrorMsg(int id);
+ 
+ extern void smiPrintError(Parser *parser, int id, ...);
+ 
+ extern void smiPrintErrorAtLine(Parser *parser, int id, int line, ...);
+ 
++#include "smi-check.h"
++
+ #endif /* _ERROR_H */
+

diff --git a/net-libs/libsmi/libsmi-0.5.0-r2.ebuild 
b/net-libs/libsmi/libsmi-0.5.0-r2.ebuild
new file mode 100644
index 000000000000..1473aeacf5c6
--- /dev/null
+++ b/net-libs/libsmi/libsmi-0.5.0-r2.ebuild
@@ -0,0 +1,38 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+DESCRIPTION="A Library to Access SMI MIB Information"
+HOMEPAGE="https://www.ibr.cs.tu-bs.de/projects/libsmi/";
+SRC_URI="https://www.ibr.cs.tu-bs.de/projects/libsmi/download/${P}.tar.gz";
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~ppc ~ppc64 ~riscv ~s390 ~sparc 
~x86"
+IUSE="static-libs"
+RESTRICT="test"
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-0.5.0-implicit-function-declarations.patch
+)
+
+src_configure() {
+       econf $(use_enable static-libs static)
+}
+
+src_test() {
+       # sming test is known to fail and some other fail if LC_ALL!=C:
+       # https://mail.ibr.cs.tu-bs.de/pipermail/libsmi/2008-March/001014.html
+       sed -i '/^[[:space:]]*smidump-sming.test \\$/d' test/Makefile
+       LC_ALL=C emake -j1 check
+}
+
+src_install() {
+       default
+
+       dodoc ANNOUNCE ChangeLog README THANKS TODO \
+               doc/{*.txt,smi.dia,smi.dtd,smi.xsd} smi.conf-example
+
+       find "${ED}" -name '*.la' -delete || die
+}

Reply via email to