summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNHOrus <jy6x2b32pie9@yahoo.com>2025-01-09 22:08:09 +0400
committerJoonas Niilola <juippis@gentoo.org>2025-01-17 15:35:59 +0200
commitadabb301fc3fb6780031a6497f7c88d2985ae340 (patch)
tree381005b7e46a9a19844ea6cc4774d3ba3f2c305d /net-misc
parentsys-process/dcron: add 4.6 with new upstream (diff)
downloadgentoo-adabb301fc3fb6780031a6497f7c88d2985ae340.tar.gz
gentoo-adabb301fc3fb6780031a6497f7c88d2985ae340.tar.bz2
gentoo-adabb301fc3fb6780031a6497f7c88d2985ae340.zip
net-misc/netkit-timed: port to C99/C23
Changing code to semantically identical, but syntactically correct. Added _DEFAULT_CODE definitions and include reordering where needed, for successful compilation with GCC-14 and -std=c23 Also converted sed to patch Bug: https://bugs.gentoo.org/715776 Closes: https://bugs.gentoo.org/919876 Signed-off-by: NHOrus <jy6x2b32pie9@yahoo.com> Closes: https://github.com/gentoo/gentoo/pull/36019 Signed-off-by: Joonas Niilola <juippis@gentoo.org>
Diffstat (limited to 'net-misc')
-rw-r--r--net-misc/netkit-timed/files/netkit-timed-0.17-accept-build-flags.patch23
-rw-r--r--net-misc/netkit-timed/files/netkit-timed-0.17-c23-port.patch65
-rw-r--r--net-misc/netkit-timed/files/netkit-timed-0.17-c99-port.patch44
-rw-r--r--net-misc/netkit-timed/netkit-timed-0.17-r12.ebuild39
4 files changed, 171 insertions, 0 deletions
diff --git a/net-misc/netkit-timed/files/netkit-timed-0.17-accept-build-flags.patch b/net-misc/netkit-timed/files/netkit-timed-0.17-accept-build-flags.patch
new file mode 100644
index 000000000000..c72452ff0fdc
--- /dev/null
+++ b/net-misc/netkit-timed/files/netkit-timed-0.17-accept-build-flags.patch
@@ -0,0 +1,23 @@
+was sed -i -e '/^LDFLAGS=/d' configure || die "sed configure"
+--- a/configure 2024-05-09 06:02:18.884496589 -0000
++++ b/configure 2024-05-09 06:02:26.304490777 -0000
+@@ -115,7 +115,6 @@
+ echo 'no'
+ fi
+
+-LDFLAGS=
+ LIBS=
+
+ rm -f __conftest*
+was sed -i -e "s|ar -cruv|\${AR} -cruv|g" timed/lib/Makefile || die
+--- a/timed/lib/Makefile 2024-05-09 06:02:18.886496588 -0000
++++ b/timed/lib/Makefile 2024-05-09 06:02:31.568486653 -0000
+@@ -7,7 +7,7 @@
+ OBJS = byteorder.o measure.o cksum.o
+
+ libtimed.a: $(OBJS)
+- ar -cruv $@ $^
++ ${AR} -cruv $@ $^
+
+ install: ;
+ clean:
diff --git a/net-misc/netkit-timed/files/netkit-timed-0.17-c23-port.patch b/net-misc/netkit-timed/files/netkit-timed-0.17-c23-port.patch
new file mode 100644
index 000000000000..ad0410db4421
--- /dev/null
+++ b/net-misc/netkit-timed/files/netkit-timed-0.17-c23-port.patch
@@ -0,0 +1,65 @@
+#bug https://bugs.gentoo.org/715776
+#bug https://bugs.gentoo.org/919876
+and general port to C23
+--- a/configure
++++ b/configure
+@@ -134,6 +100,7 @@
+
+ echo -n 'Checking for BSD signal semantics... '
+ cat <<EOF >__conftest.c
++#define _DEFAULT_SOURCE
+ #include <unistd.h>
+ #include <signal.h>
+ int count=0;
+--- a/timed/lib/cksum.c
++++ b/timed/lib/cksum.c
+@@ -41,6 +41,7 @@
+ #ident "$Revision: 1.4 $"
+ #endif
+
++#define _DEFAULT_SOURCE
+ #include <sys/types.h>
+ #include <sys/time.h>
+ #include "timed-extern.h"
+--- a/timed/timed/globals.h
++++ b/timed/timed/globals.h
+@@ -37,6 +37,7 @@
+ #ident "$Revision: 1.5 $"
+ #endif
+
++#define _DEFAULT_SOURCE
+ #include <sys/param.h>
+ #include <sys/time.h>
+ #include <sys/socket.h>
+--- a/timed/timedc/cmds.c
++++ b/timed/timedc/cmds.c
+@@ -41,6 +41,7 @@
+ #ident "$Revision: 1.11 $"
+ #endif
+
++#define _DEFAULT_SOURCE
+ #include "timedc.h"
+ #include <string.h>
+ #include <sys/file.h>
+--- a/timed/timedc/timedc.c
++++ b/timed/timedc/timedc.c
+@@ -45,6 +45,7 @@
+ #ident "$Revision: 1.8 $"
+ #endif
+
++#define _DEFAULT_SOURCE
+ #include "timedc.h"
+ #include <string.h>
+ #include <signal.h>
+--- a/timed/timed/networkdelta.c
++++ b/timed/timed/networkdelta.c
+@@ -40,8 +40,8 @@
+ #ifdef sgi
+ #ident "$Revision: 1.4 $"
+ #endif
+-#include <math.h>
+ #include "globals.h"
++#include <math.h>
+
+ static long median(float, float*, long*, long*, unsigned int);
+
diff --git a/net-misc/netkit-timed/files/netkit-timed-0.17-c99-port.patch b/net-misc/netkit-timed/files/netkit-timed-0.17-c99-port.patch
new file mode 100644
index 000000000000..f46408049b14
--- /dev/null
+++ b/net-misc/netkit-timed/files/netkit-timed-0.17-c99-port.patch
@@ -0,0 +1,44 @@
+Simple port to C99
+#bug https://bugs.gentoo.org/919876
+--- a/timed/lib/measure.c
++++ b/timed/lib/measure.c
+@@ -75,7 +75,7 @@ measure(u_long maxmsec, /* wait this many msec at most */
+ struct sockaddr_in *xaddr,
+ int doprint) /* print complaints on stderr */
+ {
+- size_t length;
++ socklen_t length;
+ int measure_status;
+ int rcvcount, trials = 0;
+ int cc, count;
+--- a/timed/timed/correct.c
++++ b/timed/timed/correct.c
+@@ -165,7 +165,7 @@ adjclock(struct timeval *corr)
+ }
+ } else {
+ syslog(LOG_WARNING,
+- "clock correction %d sec too large to adjust",
++ "clock correction %ld sec too large to adjust",
+ adj.tv_sec);
+ (void) gettimeofday(&now, 0);
+ timevaladd(&now, corr);
+--- a/timed/timed/networkdelta.c
++++ b/timed/timed/networkdelta.c
+@@ -40,7 +40,7 @@ char nd_rcsid[] =
+ #ifdef sgi
+ #ident "$Revision: 1.4 $"
+ #endif
+-
++#include <math.h>
+ #include "globals.h"
+
+ static long median(float, float*, long*, long*, unsigned int);
+@@ -238,7 +238,7 @@ median(float a, /* initial guess for the median */
+ (long)a, pass, npts);
+ return a;
+ }
+- eps = AFAC*abs(aa - a);
++ eps = AFAC*fabsf(aa - a);
+ *eps_ptr = eps;
+ a = aa;
+ }
diff --git a/net-misc/netkit-timed/netkit-timed-0.17-r12.ebuild b/net-misc/netkit-timed/netkit-timed-0.17-r12.ebuild
new file mode 100644
index 000000000000..286bd0d6e057
--- /dev/null
+++ b/net-misc/netkit-timed/netkit-timed-0.17-r12.ebuild
@@ -0,0 +1,39 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit flag-o-matic toolchain-funcs
+
+DESCRIPTION="Netkit - timed: Time daemon"
+HOMEPAGE="https://wiki.linuxfoundation.org/networking/netkit"
+SRC_URI="http://ftp.linux.org.uk/pub/linux/Networking/netkit/${P}.tar.gz"
+
+LICENSE="BSD GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+PATCHES=(
+ "${FILESDIR}/0.17-CFLAG-DEF-fix.patch"
+ "${FILESDIR}/0.17-timed-opt-parsing.patch"
+ "${FILESDIR}/${P}-c99-port.patch"
+ "${FILESDIR}/${P}-accept-build-flags.patch"
+ "${FILESDIR}/${P}-c23-port.patch"
+)
+
+src_configure() {
+ tc-export AR
+ # Note this is not an autoconf configure script. econf fails
+ append-flags -DCLK_TCK=CLOCKS_PER_SEC
+ ./configure --prefix=/usr --with-c-compiler="$(tc-getCC)" || die "bad configure"
+}
+
+src_install() {
+ dosbin timed/timed/timed
+ doman timed/timed/timed.8
+ dosbin timed/timedc/timedc
+ doman timed/timedc/timedc.8
+ einstalldocs
+
+ newinitd "${FILESDIR}"/timed.rc6 timed
+}