Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-libs/libsmi/files/, net-libs/libsmi/
Date: Thu, 08 Sep 2022 03:56:28
Message-Id: 1662609369.2360d9ea66979cfa5aa408ea50928074ce7ab8af.sam@gentoo
1 commit: 2360d9ea66979cfa5aa408ea50928074ce7ab8af
2 Author: Nicholas Vinson <nvinson234 <AT> gmail <DOT> com>
3 AuthorDate: Thu Sep 8 03:54:03 2022 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Thu Sep 8 03:56:09 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2360d9ea
7
8 net-libs/libsmi: fix build with Clang 15 (implicit function declarations)
9
10 Signed-off-by: Nicholas Vinson <nvinson234 <AT> gmail.com>
11 Signed-off-by: Sam James <sam <AT> gentoo.org>
12
13 ...bsmi-0.5.0-implicit-function-declarations.patch | 74 ++++++++++++++++++++++
14 net-libs/libsmi/libsmi-0.5.0-r2.ebuild | 38 +++++++++++
15 2 files changed, 112 insertions(+)
16
17 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
18 new file mode 100644
19 index 000000000000..f0d52e4ae000
20 --- /dev/null
21 +++ b/net-libs/libsmi/files/libsmi-0.5.0-implicit-function-declarations.patch
22 @@ -0,0 +1,74 @@
23 +From: Nicholas Vinson <nvinson234@×××××.com>
24 +To: libsmi@××××××××××××.de
25 +Cc: Nicholas Vinson <nvinson234@×××××.com>
26 +Subject: Implicit function declaration patch
27 +
28 +When building libsmi with clang 15.0.0, clang fails to build due to
29 +errors similar to:
30 +
31 +call to undeclared function 'smiyyerror'; ISO C99 and later do not support
32 +implicit function declarations
33 +
34 +This patch corrects those issues by introducing the needed
35 +declarations defore the function call.
36 +
37 +Thanks,
38 +Nicholas Vinson
39 +
40 +--- a/lib/yang-data.h
41 ++++ b/lib/yang-data.h
42 +@@ -158,10 +158,12 @@ _YangIdentifierRef *listIdentifierRef(Y
43 + /*
44 + * Node and Module functions
45 + */
46 + _YangNode *addYangNode(const char *value, YangDecl nodeKind, _YangNode *parentPtr);
47 +
48 ++void createIdentifierRef(_YangNode *node, char* prefix, char* ident);
49 ++
50 + int removeYangNode(_YangNode* target, _YangNode* child);
51 +
52 + _YangModuleInfo *createModuleInfo(_YangNode *modulePtr);
53 +
54 + void createTypeInfo(_YangNode *node);
55 +--- a/lib/parser-yang.y
56 ++++ b/lib/parser-yang.y
57 +@@ -19,10 +19,15 @@
58 + #include <config.h>
59 +
60 + #ifdef BACKEND_YANG
61 +
62 + #define _ISOC99_SOURCE
63 ++/* define _DEFAULT_SOURCE to get timegm() */
64 ++#define _DEFAULT_SOURCE 1
65 ++/* define _BSD_SOURCE & _SVID_SOURCE for backwards compatibility */
66 ++#define _BSD_SOURCE 1
67 ++#define _SVID_SOURCE 1
68 + #include <stdio.h>
69 + #include <errno.h>
70 + #include <stdlib.h>
71 + #include <string.h>
72 + #include <ctype.h>
73 +@@ -44,10 +44,11 @@
74 + #include "parser-yang.h"
75 + #include "scanner-yang.h"
76 + #include "yang-complex-types.h"
77 + #include "util.h"
78 + #include "error.h"
79 ++#include "yang-check.h"
80 +
81 + #ifdef HAVE_DMALLOC_H
82 + #include <dmalloc.h>
83 + #endif
84 +
85 +--- a/lib/error.h
86 ++++ b/lib/error.h
87 +@@ -40,6 +40,8 @@ extern char* smiGetErrorMsg(int id);
88 +
89 + extern void smiPrintError(Parser *parser, int id, ...);
90 +
91 + extern void smiPrintErrorAtLine(Parser *parser, int id, int line, ...);
92 +
93 ++#include "smi-check.h"
94 ++
95 + #endif /* _ERROR_H */
96 +
97
98 diff --git a/net-libs/libsmi/libsmi-0.5.0-r2.ebuild b/net-libs/libsmi/libsmi-0.5.0-r2.ebuild
99 new file mode 100644
100 index 000000000000..1473aeacf5c6
101 --- /dev/null
102 +++ b/net-libs/libsmi/libsmi-0.5.0-r2.ebuild
103 @@ -0,0 +1,38 @@
104 +# Copyright 1999-2022 Gentoo Authors
105 +# Distributed under the terms of the GNU General Public License v2
106 +
107 +EAPI=7
108 +
109 +DESCRIPTION="A Library to Access SMI MIB Information"
110 +HOMEPAGE="https://www.ibr.cs.tu-bs.de/projects/libsmi/"
111 +SRC_URI="https://www.ibr.cs.tu-bs.de/projects/libsmi/download/${P}.tar.gz"
112 +
113 +LICENSE="BSD"
114 +SLOT="0"
115 +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
116 +IUSE="static-libs"
117 +RESTRICT="test"
118 +
119 +PATCHES=(
120 + "${FILESDIR}"/${PN}-0.5.0-implicit-function-declarations.patch
121 +)
122 +
123 +src_configure() {
124 + econf $(use_enable static-libs static)
125 +}
126 +
127 +src_test() {
128 + # sming test is known to fail and some other fail if LC_ALL!=C:
129 + # https://mail.ibr.cs.tu-bs.de/pipermail/libsmi/2008-March/001014.html
130 + sed -i '/^[[:space:]]*smidump-sming.test \\$/d' test/Makefile
131 + LC_ALL=C emake -j1 check
132 +}
133 +
134 +src_install() {
135 + default
136 +
137 + dodoc ANNOUNCE ChangeLog README THANKS TODO \
138 + doc/{*.txt,smi.dia,smi.dtd,smi.xsd} smi.conf-example
139 +
140 + find "${ED}" -name '*.la' -delete || die
141 +}