diff --git a/0001-Fix-signature-of-main-function.patch b/0001-Fix-signature-of-main-function.patch new file mode 100644 index 0000000..4b332a0 --- /dev/null +++ b/0001-Fix-signature-of-main-function.patch @@ -0,0 +1,209 @@ +From 269f18d5e6698fdd34fec2798f10c6fe072f3cd5 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Thu, 1 Sep 2022 23:36:52 -0700 +Subject: [PATCH] Fix signature of main function + +Clang-15 errors out otherewise. +Include needed headers for missing functions + +Upstream-Status: Pending +Signed-off-by: Khem Raj +--- + src/chkshsgr.c | 2 +- + src/tai64n.c | 2 +- + src/tai64nlocal.c | 2 +- + src/trycpp.c | 5 +++-- + src/tryflock.c | 4 ++-- + src/trymkffo.c | 2 +- + src/trypoll.c | 3 ++- + src/trysgact.c | 4 ++-- + src/trysgprm.c | 4 ++-- + src/tryshsgr.c | 3 ++- + src/tryulong64.c | 4 ++-- + src/trywaitp.c | 4 ++-- + src/x86cpuid.c | 2 +- + 13 files changed, 22 insertions(+), 19 deletions(-) + +diff --git a/src/chkshsgr.c b/src/chkshsgr.c +index 038afe9..9547a4c 100644 +--- a/src/chkshsgr.c ++++ b/src/chkshsgr.c +@@ -5,7 +5,7 @@ + #include + #include + +-int main() ++int main(int argc, char *argv[]) + { + gid_t x[4]; + +diff --git a/src/tai64n.c b/src/tai64n.c +index 17bdb82..7096ab3 100644 +--- a/src/tai64n.c ++++ b/src/tai64n.c +@@ -27,7 +27,7 @@ buffer in = BUFFER_INIT(myread,0,inbuf,sizeof inbuf); + + char stamp[TIMESTAMP + 1]; + +-int main() ++int main(int argc, char *argv[]) + { + char ch; + +diff --git a/src/tai64nlocal.c b/src/tai64nlocal.c +index ce16ad8..2435737 100644 +--- a/src/tai64nlocal.c ++++ b/src/tai64nlocal.c +@@ -28,7 +28,7 @@ unsigned long nanosecs; + unsigned long u; + struct tm *t; + +-int main() ++int main(int argc, char *argv[]) + { + char ch; + +diff --git a/src/trycpp.c b/src/trycpp.c +index e4503d4..d96c955 100644 +--- a/src/trycpp.c ++++ b/src/trycpp.c +@@ -1,6 +1,7 @@ + /* Public domain. */ +- +-int main() ++#include ++#include ++int main(int argc, char *argv[]) + { + #ifdef NeXT + printf("nextstep\n"); exit(0); +diff --git a/src/tryflock.c b/src/tryflock.c +index a82ffc2..5ca97d3 100644 +--- a/src/tryflock.c ++++ b/src/tryflock.c +@@ -3,8 +3,8 @@ + #include + #include + #include +- +-main() ++void ++main(int argc, char *argv[]) + { + flock(0,LOCK_EX | LOCK_UN | LOCK_NB); + } +diff --git a/src/trymkffo.c b/src/trymkffo.c +index 9356342..f92414a 100644 +--- a/src/trymkffo.c ++++ b/src/trymkffo.c +@@ -3,7 +3,7 @@ + #include + #include + +-void main() ++void main(int argc, char *argv[]) + { + mkfifo("temp-trymkffo",0); + } +diff --git a/src/trypoll.c b/src/trypoll.c +index 6506617..cb888cc 100644 +--- a/src/trypoll.c ++++ b/src/trypoll.c +@@ -3,8 +3,9 @@ + #include + #include + #include ++#include + +-int main() ++int main(int argc, char *argv[]) + { + struct pollfd x; + +diff --git a/src/trysgact.c b/src/trysgact.c +index e264ef2..25da013 100644 +--- a/src/trysgact.c ++++ b/src/trysgact.c +@@ -1,8 +1,8 @@ + /* Public domain. */ + + #include +- +-main() ++void ++main(int argc, char *argv[]) + { + struct sigaction sa; + sa.sa_handler = 0; +diff --git a/src/trysgprm.c b/src/trysgprm.c +index a46c82c..5a9491c 100644 +--- a/src/trysgprm.c ++++ b/src/trysgprm.c +@@ -1,8 +1,8 @@ + /* Public domain. */ + + #include +- +-main() ++void ++main(int argc, char *argv[]) + { + sigset_t ss; + +diff --git a/src/tryshsgr.c b/src/tryshsgr.c +index c5ed6d6..d111e40 100644 +--- a/src/tryshsgr.c ++++ b/src/tryshsgr.c +@@ -1,6 +1,7 @@ + /* Public domain. */ + +-int main() ++#include ++int main(int argc, char *argv[]) + { + short x[4]; + +diff --git a/src/tryulong64.c b/src/tryulong64.c +index 003548a..20a3a40 100644 +--- a/src/tryulong64.c ++++ b/src/tryulong64.c +@@ -1,6 +1,6 @@ + /* Public domain. */ +- +-int main() ++#include ++int main(int argc, char *argv[]) + { + unsigned long u; + u = 1; +diff --git a/src/trywaitp.c b/src/trywaitp.c +index 319b81f..90bc5aa 100644 +--- a/src/trywaitp.c ++++ b/src/trywaitp.c +@@ -2,8 +2,8 @@ + + #include + #include +- +-main() ++void ++main(int argc, char *argv[]) + { + waitpid(0,0,0); + } +diff --git a/src/x86cpuid.c b/src/x86cpuid.c +index f81c593..1cb1ea6 100644 +--- a/src/x86cpuid.c ++++ b/src/x86cpuid.c +@@ -7,7 +7,7 @@ void nope() + exit(1); + } + +-int main() ++int main(int argc, char *argv[]) + { + unsigned long x[4]; + unsigned long y[4]; +-- +2.37.3 + diff --git a/0001-daemontools-Fix-QA-Issue.patch b/0001-daemontools-Fix-QA-Issue.patch new file mode 100644 index 0000000..139ff30 --- /dev/null +++ b/0001-daemontools-Fix-QA-Issue.patch @@ -0,0 +1,28 @@ +From a86c4209da695909424db0c9108592194a3094b7 Mon Sep 17 00:00:00 2001 +From: Lei Maohui +Date: Sat, 6 Aug 2016 00:47:37 +0900 +Subject: [PATCH] daemontools: Fix QA Issue + +To fix the QA Issues as following: + +ERROR: daemontools-0.76-r0 do_package_qa: QA Issue: No GNU_HASH in the elf binary: '/build-poky/tmp/work/i586-poky-linux/daemontools/0.76-r0/packages-split/daemontools/usr/bin/tai64nlocal' + +Signed-off-by: Lei Maohui +--- +Upstream-Status: Pending + + src/conf-ld | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/conf-ld b/src/conf-ld +index 2a44210..c7e7755 100644 +--- a/src/conf-ld ++++ b/src/conf-ld +@@ -1,3 +1,3 @@ +-${CC} ++${CC} ${LDFLAGS} + + This will be used to link .o files into an executable. +-- +2.7.4 + diff --git a/0001-error.h-include-errno.h-instead-of-extern-int.patch b/0001-error.h-include-errno.h-instead-of-extern-int.patch new file mode 100644 index 0000000..b5eb7d8 --- /dev/null +++ b/0001-error.h-include-errno.h-instead-of-extern-int.patch @@ -0,0 +1,27 @@ +From d3e7651e2f2492dd1031d09a99713644b604cab5 Mon Sep 17 00:00:00 2001 +From: Gerrit Pape +Date: Wed, 12 Dec 2007 13:44:15 +0000 +Subject: [PATCH] error.h: '#include ' instead of 'extern int errno;' + +--- +Upstream-Status: Pending + + daemontools-0.76/src/error.h | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git daemontools-0.76.orig/src/error.h daemontools-0.76/src/error.h +index 086fb55..f7e8273 100644 +--- daemontools-0.76.orig/src/error.h ++++ daemontools-0.76/src/error.h +@@ -3,7 +3,7 @@ + #ifndef ERROR_H + #define ERROR_H + +-extern int errno; ++#include + + extern int error_intr; + extern int error_nomem; +-- +1.5.4.2 + diff --git a/0002-supervise.c-.-supervise-may-be-a-symlink-if-it-s-da.patch b/0002-supervise.c-.-supervise-may-be-a-symlink-if-it-s-da.patch new file mode 100644 index 0000000..16a0148 --- /dev/null +++ b/0002-supervise.c-.-supervise-may-be-a-symlink-if-it-s-da.patch @@ -0,0 +1,49 @@ +From 7ee585cab1d5b68f804a5601a66ae87799c8a7c3 Mon Sep 17 00:00:00 2001 +From: Gerrit Pape +Date: Sun, 24 Feb 2008 10:54:26 +0000 +Subject: [PATCH] supervise.c: ./supervise may be a symlink, if it's dangling, create link target + +--- +Upstream-Status: Pending + + daemontools-0.76/src/supervise.c | 17 ++++++++++++++++- + 1 files changed, 16 insertions(+), 1 deletions(-) + +diff --git daemontools-0.76.orig/src/supervise.c daemontools-0.76/src/supervise.c +index 2482ad2..f43cabf 100644 +--- daemontools-0.76.orig/src/supervise.c ++++ daemontools-0.76/src/supervise.c +@@ -208,6 +208,8 @@ void doit(void) + int main(int argc,char **argv) + { + struct stat st; ++ int r; ++ char buf[256]; + + dir = argv[1]; + if (!dir || argv[2]) +@@ -232,7 +234,20 @@ int main(int argc,char **argv) + if (errno != error_noent) + strerr_die4sys(111,FATAL,"unable to stat ",dir,"/down: "); + +- mkdir("supervise",0700); ++ if (mkdir("supervise",0700) == -1) { ++ if ((r = readlink("supervise", buf, 256)) != -1) { ++ if (r == 256) { ++ errno = EOVERFLOW; ++ strerr_die1sys(111,"unable to readlink ./supervise: "); ++ } ++ buf[r] = 0; ++ mkdir(buf, 0700); ++ } ++ else { ++ if ((errno != ENOENT) && (errno != EINVAL)) ++ strerr_die1sys(111, "unable to readlink ./supervise: "); ++ } ++ } + fdlock = open_append("supervise/lock"); + if ((fdlock == -1) || (lock_exnb(fdlock) == -1)) + strerr_die4sys(111,FATAL,"unable to acquire ",dir,"/supervise/lock: "); +-- +1.5.4.2 + diff --git a/cross-compile.patch b/cross-compile.patch new file mode 100644 index 0000000..98d4a5e --- /dev/null +++ b/cross-compile.patch @@ -0,0 +1,47 @@ +Upstream-Status: Pending + +make sure it can be compiled for cross target + +1. never try to compile target binary by native gcc +2. target's chkshsgr doesn't work on native. +3. it's wrong to do target tests on native. + +Signed-off-by: Bian Naimeng + +diff -Nurp daemontools-0.76.orig/src/conf-cc daemontools-0.76/src/conf-cc +--- daemontools-0.76.orig/src/conf-cc 2001-07-13 00:49:49.000000000 +0800 ++++ daemontools-0.76/src/conf-cc 2014-11-26 09:34:38.828812162 +0800 +@@ -1,3 +1,3 @@ +-gcc -O2 -Wimplicit -Wunused -Wcomment -Wchar-subscripts -Wuninitialized -Wshadow -Wcast-qual -Wcast-align -Wwrite-strings ++${CC} -O2 -Wimplicit -Wunused -Wcomment -Wchar-subscripts -Wuninitialized -Wshadow -Wcast-qual -Wcast-align -Wwrite-strings + + This will be used to compile .c files. +diff -Nurp daemontools-0.76.orig/src/conf-ld daemontools-0.76/src/conf-ld +--- daemontools-0.76.orig/src/conf-ld 2001-07-13 00:49:49.000000000 +0800 ++++ daemontools-0.76/src/conf-ld 2014-11-26 09:34:49.880811730 +0800 +@@ -1,3 +1,3 @@ +-gcc -s ++${CC} + + This will be used to link .o files into an executable. +diff -Nurp daemontools-0.76.orig/src/Makefile daemontools-0.76/src/Makefile +--- daemontools-0.76.orig/src/Makefile 2001-07-13 00:49:49.000000000 +0800 ++++ daemontools-0.76/src/Makefile 2014-11-26 09:38:47.120802459 +0800 +@@ -165,7 +165,7 @@ hassgprm.h: choose compile hassgprm.h1 h + + hasshsgr.h: chkshsgr choose compile hasshsgr.h1 hasshsgr.h2 load \ + tryshsgr.c warn-shsgr +- ./chkshsgr || ( cat warn-shsgr; exit 1 ) ++ echo "Warning: We can not run test on cross target. - ignoring ./chkshsgr || ( cat warn-shsgr; exit 1 )" + ./choose clr tryshsgr hasshsgr.h1 hasshsgr.h2 > hasshsgr.h + + haswaitp.h: choose compile haswaitp.h1 haswaitp.h2 load trywaitp.c +@@ -265,7 +265,7 @@ readproctitle.o: compile error.h readpro + rts: envdir envuidgid fghack matchtest multilog pgrphack \ + readproctitle rts.tests setlock setuidgid softlimit supervise svc \ + svok svscan svscanboot svstat tai64n tai64nlocal +- env - /bin/sh rts.tests 2>&1 | cat -v > rts ++ echo "Warning: We can not run test on cross target. - ignoring env - /bin/sh rts.tests 2>&1 | cat -v > rts" + + scan_ulong.o: compile scan.h scan_ulong.c + ./compile scan_ulong.c diff --git a/daemontools.spec b/daemontools.spec index d713fb8..f02a799 100644 --- a/daemontools.spec +++ b/daemontools.spec @@ -7,8 +7,22 @@ License: Check with djb Group: Utilities/System Name: daemontools Provides: daemontools -Release: 6%{?dist} +Release: 7%{?dist} Source: http://cr.yp.to/%{name}/%{name}-%{version}.tar.gz + +# 2006 http://bugs.gentoo.org/124487 +Patch0: warnings.patch +# 2007 error.h: '#include ' instead of 'extern int errno;' https://bugs.gentoo.org/16396 +Patch1: 0001-error.h-include-errno.h-instead-of-extern-int.patch +# 2008 supervise.c: ./supervise may be a symlink, if it's dangling, create link target +Patch2: 0002-supervise.c-.-supervise-may-be-a-symlink-if-it-s-da.patch +# 2014 make sure it can be compiled for cross target +Patch3: cross-compile.patch +# 2016 ERROR: daemontools-0.76-r0 do_package_qa: QA Issue: No GNU_HASH in the elf binary: '/build-poky/tmp/work/i586-poky-linux/daemontools/0.76-r0/packages-split/daemontools/usr/bin/tai64nlocal' +Patch4: 0001-daemontools-Fix-QA-Issue.patch +# 2022 Khem Raj Clang-15 errors out otherewise. Include needed headers for missing functions +Patch5: 0001-Fix-signature-of-main-function.patch + Summary: Various tools to start/stop/monitor daemons. %define debug_package %{nil} %define __arch_install_post %{nil} @@ -30,6 +44,13 @@ Version: 0.76 %prep %setup -c -n package +cd admin/%name-%version +%patch0 -p1 +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch5 -p1 %build cd admin/%name-%version @@ -48,7 +69,8 @@ else chmod 755 package/upgrade fi -echo gcc -O2 --include /usr/include/errno.h > src/conf-cc +echo gcc $RPM_OPT_FLAGS -O2 --include /usr/include/errno.h > src/conf-cc +CC="gcc $RPM_OPT_FLAGS -s " CFLAGS="$RPM_OPT_FLAGS" \ package/compile cd ../.. @@ -107,6 +129,9 @@ rm -rf %destdir %changelog +* Mon Mar 18 2024 Jean-Philippe Pialasse 0.76-7.sme +- import patches from gentoo and openembedded to allow to build on el8 [SME: 12512] + * Thu Oct 26 2023 BogusDateBot - Eliminated rpmbuild "bogus date" warnings due to inconsistent weekday, by assuming the date is correct and changing the weekday. diff --git a/warnings.patch b/warnings.patch new file mode 100644 index 0000000..5c9c711 --- /dev/null +++ b/warnings.patch @@ -0,0 +1,76 @@ +Upstream-Status: Pending + +Fixup misc warnings + +Patch by RiverRat + +http://bugs.gentoo.org/124487 + +--- a/src/chkshsgr.c ++++ b/src/chkshsgr.c +@@ -1,10 +1,13 @@ + /* Public domain. */ + ++#include ++#include ++#include + #include + + int main() + { +- short x[4]; ++ gid_t x[4]; + + x[0] = x[1] = 0; + if (getgroups(1,x) == 0) if (setgroups(1,x) == -1) _exit(1); +--- a/src/matchtest.c ++++ b/src/matchtest.c +@@ -1,3 +1,4 @@ ++#include + #include "match.h" + #include "buffer.h" + #include "str.h" +--- a/src/multilog.c ++++ b/src/multilog.c +@@ -1,3 +1,4 @@ ++#include + #include + #include + #include +--- a/src/prot.c ++++ b/src/prot.c +@@ -1,5 +1,8 @@ + /* Public domain. */ + ++#include ++#include ++#include + #include "hasshsgr.h" + #include "prot.h" + +--- a/src/seek_set.c ++++ b/src/seek_set.c +@@ -1,6 +1,7 @@ + /* Public domain. */ + + #include ++#include + #include "seek.h" + + #define SET 0 /* sigh */ +--- a/src/supervise.c ++++ b/src/supervise.c +@@ -1,3 +1,4 @@ ++#include + #include + #include + #include +--- a/src/pathexec_run.c ++++ b/src/pathexec_run.c +@@ -1,5 +1,6 @@ + /* Public domain. */ + ++#include + #include "error.h" + #include "stralloc.h" + #include "str.h"