net-analyzer/iplog: fix implicit declarations in configure, bool

Port to modern compilers and C23, and also fix for MUSL compile problem

Bug: https://bugs.gentoo.org/712644
Bug: https://bugs.gentoo.org/875155
Bug: https://bugs.gentoo.org/899936
Bug: https://bugs.gentoo.org/945194
Signed-off-by: NHOrus <jy6x2b32pie9@yahoo.com>
Closes: https://github.com/gentoo/gentoo/pull/40131
Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
NHOrus
2025-01-14 17:40:25 +04:00
committed by Sam James
parent 2eb2b82b8c
commit 35a01318e8
2 changed files with 77 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
https://bugs.gentoo.org/945194 - guard bool for modern compilers
https://bugs.gentoo.org/712644 - type aliaces for musl
--- a/src/iplog.h
+++ b/src/iplog.h
@@ -21,6 +21,9 @@
#ifndef __IPLOG_H
#define __IPLOG_H
+#define _GNU_SOURCE 1
+#include <sys/types.h> /* for u_* types */
+
#ifndef HAVE_IPADDR_T
typedef u_int32_t ipaddr_t;
#endif
@@ -82,7 +82,9 @@
# define min(x,y) ((x) < (y) ? (x) : (y))
#endif
+#if __STDC_VERSION__ <= 201710L
typedef enum { false, true } bool;
+#endif
#ifdef HAVE_PATHS_H
# include <paths.h>
C23 and GNU-15 compatibility, explicitly cast sockaddr
--- a/src/iplog_tcp.c
+++ b/src/iplog_tcp.c
@@ -144,7 +144,7 @@
ret = sendto(raw_sock, (char *) xip,
sizeof(struct ip) + sizeof(struct tcphdr), 0,
-#if !defined(__GLIBC__) || (__GLIBC__ < 2)
+#if !defined(__GLIBC__) || (__GLIBC__ < 2) || (__STDC_VERSION__ > 201710L)
(struct sockaddr *)
#endif
&fn_sin,

View File

@@ -0,0 +1,41 @@
# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit flag-o-matic toolchain-funcs autotools
DESCRIPTION="TCP/IP traffic logger"
HOMEPAGE="https://ojnk.sourceforge.net/"
SRC_URI="https://downloads.sourceforge.net/ojnk/${P}.tar.gz"
LICENSE="|| ( GPL-2 FDL-1.1 )"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~ppc ~sparc ~x86"
DEPEND="net-libs/libpcap"
RDEPEND="${DEPEND}"
PATCHES=(
"${FILESDIR}/${PV}-DLT_LINUX_SSL.patch"
"${FILESDIR}/${P}-C23.patch")
DOCS=( AUTHORS NEWS README TODO example-iplog.conf )
src_prepare() {
default
#https://bugs.gentoo.org/899936
#https://bugs.gentoo.org/875155
eautoreconf
}
src_compile() {
append-cppflags -D_REENTRANT
emake CC="$(tc-getCC)" CFLAGS="${CFLAGS}" CPPFLAGS="${CPPFLAGS}" all
}
src_install() {
default
newinitd "${FILESDIR}"/iplog.rc6 iplog
}