From a47a55e4338d6221232e12ad6edcac0d3b8cda0a Mon Sep 17 00:00:00 2001 From: Peter Woodman Date: Mon, 18 Jan 2021 23:03:08 -0500 Subject: sysklogd: fix building against musl taking guidance from alpine linux's patch[1], removed a few ifdefs and fixed up some includes. [1]: https://git.alpinelinux.org/aports/tree/main/sysklogd/fix-includes.patch --- pkgs/os-specific/linux/sysklogd/default.nix | 2 +- pkgs/os-specific/linux/sysklogd/fix-includes.patch | 118 +++++++++++++++++++++ pkgs/os-specific/linux/sysklogd/systemd.patch | 2 +- 3 files changed, 120 insertions(+), 2 deletions(-) create mode 100644 pkgs/os-specific/linux/sysklogd/fix-includes.patch (limited to 'pkgs/os-specific/linux/sysklogd') diff --git a/pkgs/os-specific/linux/sysklogd/default.nix b/pkgs/os-specific/linux/sysklogd/default.nix index 454527321fb..2ee7daca0eb 100644 --- a/pkgs/os-specific/linux/sysklogd/default.nix +++ b/pkgs/os-specific/linux/sysklogd/default.nix @@ -8,7 +8,7 @@ stdenv.mkDerivation { sha256 = "00f2wy6f0qng7qzga4iicyzl9j8b7mp6mrpfky5jxj93ms2w2rji"; }; - patches = [ ./systemd.patch ./union-wait.patch ]; + patches = [ ./systemd.patch ./union-wait.patch ./fix-includes.patch ]; NIX_CFLAGS_COMPILE = "-DSYSV"; diff --git a/pkgs/os-specific/linux/sysklogd/fix-includes.patch b/pkgs/os-specific/linux/sysklogd/fix-includes.patch new file mode 100644 index 00000000000..e7dbe431275 --- /dev/null +++ b/pkgs/os-specific/linux/sysklogd/fix-includes.patch @@ -0,0 +1,118 @@ +diff -u sysklogd-1.5.1.orig/klogd.c sysklogd-1.5.1/klogd.c +--- sysklogd-1.5.1.orig/klogd.c 2014-10-04 15:47:18.000000000 -0400 ++++ sysklogd-1.5.1/klogd.c 2021-01-18 23:09:23.000000000 -0500 +@@ -260,11 +260,8 @@ + #include + #include + #include +-#include ++#include + #include +-#if !defined(__GLIBC__) +-#include +-#endif /* __GLIBC__ */ + #include + #include + #include +@@ -277,13 +274,8 @@ + + #define __LIBRARY__ + #include +-#if !defined(__GLIBC__) +-# define __NR_ksyslog __NR_syslog +-_syscall3(int,ksyslog,int, type, char *, buf, int, len); +-#else + #include + #define ksyslog klogctl +-#endif + + #define LOG_BUFFER_SIZE 4096 + #define LOG_LINE_LENGTH 1000 +diff -u sysklogd-1.5.1.orig/ksym_mod.c sysklogd-1.5.1/ksym_mod.c +--- sysklogd-1.5.1.orig/ksym_mod.c 2014-10-04 15:47:18.000000000 -0400 ++++ sysklogd-1.5.1/ksym_mod.c 2021-01-18 23:09:57.000000000 -0500 +@@ -113,12 +113,9 @@ + #include + #include + #include +-#include ++#include + #include + #include "module.h" +-#if !defined(__GLIBC__) +-#include +-#endif /* __GLIBC__ */ + #include + #include + #include +diff -u sysklogd-1.5.1.orig/pidfile.c sysklogd-1.5.1/pidfile.c +--- sysklogd-1.5.1.orig/pidfile.c 2014-10-04 15:47:18.000000000 -0400 ++++ sysklogd-1.5.1/pidfile.c 2021-01-18 23:23:55.000000000 -0500 +@@ -25,6 +25,7 @@ + */ + + #include ++#include + #include + #include + #include +diff -u sysklogd-1.5.1.orig/syslog.c sysklogd-1.5.1/syslog.c +--- sysklogd-1.5.1.orig/syslog.c 2014-10-04 15:47:18.000000000 -0400 ++++ sysklogd-1.5.1/syslog.c 2021-01-18 23:11:45.000000000 -0500 +@@ -55,7 +55,6 @@ + #include + #include + #include +-#include + #include + #if 0 + #include "syslog.h" +@@ -64,6 +63,8 @@ + + #include + #include ++#include ++#include + #include + #include + #include +diff -u sysklogd-1.5.1.orig/syslogd.c sysklogd-1.5.1/syslogd.c +--- sysklogd-1.5.1.orig/syslogd.c 2014-10-04 15:47:18.000000000 -0400 ++++ sysklogd-1.5.1/syslogd.c 2021-01-18 23:13:25.000000000 -0500 +@@ -519,9 +519,9 @@ + #include + + #define SYSLOG_NAMES ++#include + #include + #include +-#include + #include + #include + #include +@@ -818,9 +818,7 @@ + void init(); + void cfline(char *line, register struct filed *f); + int decode(char *name, struct code *codetab); +-#if defined(__GLIBC__) + #define dprintf mydprintf +-#endif /* __GLIBC__ */ + static void dprintf(char *, ...); + static void allocate_log(void); + void sighup_handler(); +@@ -840,15 +838,9 @@ + register char *p; + #ifndef TESTING + ssize_t msglen; +-#endif +-#if !defined(__GLIBC__) +- int len, num_fds; +-#else /* __GLIBC__ */ +-#ifndef TESTING + socklen_t len; + #endif + int num_fds; +-#endif /* __GLIBC__ */ + /* + * It took me quite some time to figure out how this is + * supposed to work so I guess I should better write it down. diff --git a/pkgs/os-specific/linux/sysklogd/systemd.patch b/pkgs/os-specific/linux/sysklogd/systemd.patch index 0a7fb166bd7..a170f67cadb 100644 --- a/pkgs/os-specific/linux/sysklogd/systemd.patch +++ b/pkgs/os-specific/linux/sysklogd/systemd.patch @@ -71,9 +71,9 @@ diff -ruN -x '*~' sysklogd-1.5-old/sd-daemon.c sysklogd-1.5/sd-daemon.c +#include +#include +#include -+#include +#include +#include ++#include +#include +#include +#include -- cgit 1.4.1