diff options
4 files changed, 164 insertions, 0 deletions
diff --git a/meta-oe/recipes-support/daemontools/daemontools/0001-error.h-include-errno.h-instead-of-extern-int.diff b/meta-oe/recipes-support/daemontools/daemontools/0001-error.h-include-errno.h-instead-of-extern-int.diff new file mode 100644 index 000000000..ce1959782 --- /dev/null +++ b/meta-oe/recipes-support/daemontools/daemontools/0001-error.h-include-errno.h-instead-of-extern-int.diff | |||
@@ -0,0 +1,25 @@ | |||
1 | From d3e7651e2f2492dd1031d09a99713644b604cab5 Mon Sep 17 00:00:00 2001 | ||
2 | From: Gerrit Pape <pape@smarden.org> | ||
3 | Date: Wed, 12 Dec 2007 13:44:15 +0000 | ||
4 | Subject: [PATCH] error.h: '#include <errno.h>' instead of 'extern int errno;' | ||
5 | |||
6 | --- | ||
7 | daemontools-0.76/src/error.h | 2 +- | ||
8 | 1 files changed, 1 insertions(+), 1 deletions(-) | ||
9 | |||
10 | diff --git daemontools-0.76.orig/src/error.h daemontools-0.76/src/error.h | ||
11 | index 086fb55..f7e8273 100644 | ||
12 | --- daemontools-0.76.orig/src/error.h | ||
13 | +++ daemontools-0.76/src/error.h | ||
14 | @@ -3,7 +3,7 @@ | ||
15 | #ifndef ERROR_H | ||
16 | #define ERROR_H | ||
17 | |||
18 | -extern int errno; | ||
19 | +#include <errno.h> | ||
20 | |||
21 | extern int error_intr; | ||
22 | extern int error_nomem; | ||
23 | -- | ||
24 | 1.5.4.2 | ||
25 | |||
diff --git a/meta-oe/recipes-support/daemontools/daemontools/0002-supervise.c-.-supervise-may-be-a-symlink-if-it-s-da.diff b/meta-oe/recipes-support/daemontools/daemontools/0002-supervise.c-.-supervise-may-be-a-symlink-if-it-s-da.diff new file mode 100644 index 000000000..73dce9072 --- /dev/null +++ b/meta-oe/recipes-support/daemontools/daemontools/0002-supervise.c-.-supervise-may-be-a-symlink-if-it-s-da.diff | |||
@@ -0,0 +1,47 @@ | |||
1 | From 7ee585cab1d5b68f804a5601a66ae87799c8a7c3 Mon Sep 17 00:00:00 2001 | ||
2 | From: Gerrit Pape <pape@smarden.org> | ||
3 | Date: Sun, 24 Feb 2008 10:54:26 +0000 | ||
4 | Subject: [PATCH] supervise.c: ./supervise may be a symlink, if it's dangling, create link target | ||
5 | |||
6 | --- | ||
7 | daemontools-0.76/src/supervise.c | 17 ++++++++++++++++- | ||
8 | 1 files changed, 16 insertions(+), 1 deletions(-) | ||
9 | |||
10 | diff --git daemontools-0.76.orig/src/supervise.c daemontools-0.76/src/supervise.c | ||
11 | index 2482ad2..f43cabf 100644 | ||
12 | --- daemontools-0.76.orig/src/supervise.c | ||
13 | +++ daemontools-0.76/src/supervise.c | ||
14 | @@ -208,6 +208,8 @@ void doit(void) | ||
15 | int main(int argc,char **argv) | ||
16 | { | ||
17 | struct stat st; | ||
18 | + int r; | ||
19 | + char buf[256]; | ||
20 | |||
21 | dir = argv[1]; | ||
22 | if (!dir || argv[2]) | ||
23 | @@ -232,7 +234,20 @@ int main(int argc,char **argv) | ||
24 | if (errno != error_noent) | ||
25 | strerr_die4sys(111,FATAL,"unable to stat ",dir,"/down: "); | ||
26 | |||
27 | - mkdir("supervise",0700); | ||
28 | + if (mkdir("supervise",0700) == -1) { | ||
29 | + if ((r = readlink("supervise", buf, 256)) != -1) { | ||
30 | + if (r == 256) { | ||
31 | + errno = EOVERFLOW; | ||
32 | + strerr_die1sys(111,"unable to readlink ./supervise: "); | ||
33 | + } | ||
34 | + buf[r] = 0; | ||
35 | + mkdir(buf, 0700); | ||
36 | + } | ||
37 | + else { | ||
38 | + if ((errno != ENOENT) && (errno != EINVAL)) | ||
39 | + strerr_die1sys(111, "unable to readlink ./supervise: "); | ||
40 | + } | ||
41 | + } | ||
42 | fdlock = open_append("supervise/lock"); | ||
43 | if ((fdlock == -1) || (lock_exnb(fdlock) == -1)) | ||
44 | strerr_die4sys(111,FATAL,"unable to acquire ",dir,"/supervise/lock: "); | ||
45 | -- | ||
46 | 1.5.4.2 | ||
47 | |||
diff --git a/meta-oe/recipes-support/daemontools/daemontools/cross-compile.patch b/meta-oe/recipes-support/daemontools/daemontools/cross-compile.patch new file mode 100644 index 000000000..f164c2d10 --- /dev/null +++ b/meta-oe/recipes-support/daemontools/daemontools/cross-compile.patch | |||
@@ -0,0 +1,45 @@ | |||
1 | make sure it can be compiled for cross target | ||
2 | |||
3 | 1. never try to compile target binary by native gcc | ||
4 | 2. target's chkshsgr doesn't work on native. | ||
5 | 3. it's wrong to do target tests on native. | ||
6 | |||
7 | Signed-off-by: Bian Naimeng <biannm@cn.fujitsu.com> | ||
8 | |||
9 | diff -Nurp daemontools-0.76.orig/src/conf-cc daemontools-0.76/src/conf-cc | ||
10 | --- daemontools-0.76.orig/src/conf-cc 2001-07-13 00:49:49.000000000 +0800 | ||
11 | +++ daemontools-0.76/src/conf-cc 2014-11-26 09:34:38.828812162 +0800 | ||
12 | @@ -1,3 +1,3 @@ | ||
13 | -gcc -O2 -Wimplicit -Wunused -Wcomment -Wchar-subscripts -Wuninitialized -Wshadow -Wcast-qual -Wcast-align -Wwrite-strings | ||
14 | +${CC} -O2 -Wimplicit -Wunused -Wcomment -Wchar-subscripts -Wuninitialized -Wshadow -Wcast-qual -Wcast-align -Wwrite-strings | ||
15 | |||
16 | This will be used to compile .c files. | ||
17 | diff -Nurp daemontools-0.76.orig/src/conf-ld daemontools-0.76/src/conf-ld | ||
18 | --- daemontools-0.76.orig/src/conf-ld 2001-07-13 00:49:49.000000000 +0800 | ||
19 | +++ daemontools-0.76/src/conf-ld 2014-11-26 09:34:49.880811730 +0800 | ||
20 | @@ -1,3 +1,3 @@ | ||
21 | -gcc -s | ||
22 | +${CC} | ||
23 | |||
24 | This will be used to link .o files into an executable. | ||
25 | diff -Nurp daemontools-0.76.orig/src/Makefile daemontools-0.76/src/Makefile | ||
26 | --- daemontools-0.76.orig/src/Makefile 2001-07-13 00:49:49.000000000 +0800 | ||
27 | +++ daemontools-0.76/src/Makefile 2014-11-26 09:38:47.120802459 +0800 | ||
28 | @@ -165,7 +165,7 @@ hassgprm.h: choose compile hassgprm.h1 h | ||
29 | |||
30 | hasshsgr.h: chkshsgr choose compile hasshsgr.h1 hasshsgr.h2 load \ | ||
31 | tryshsgr.c warn-shsgr | ||
32 | - ./chkshsgr || ( cat warn-shsgr; exit 1 ) | ||
33 | + chkshsgr || ( cat warn-shsgr; exit 1 ) | ||
34 | ./choose clr tryshsgr hasshsgr.h1 hasshsgr.h2 > hasshsgr.h | ||
35 | |||
36 | haswaitp.h: choose compile haswaitp.h1 haswaitp.h2 load trywaitp.c | ||
37 | @@ -265,7 +265,7 @@ readproctitle.o: compile error.h readpro | ||
38 | rts: envdir envuidgid fghack matchtest multilog pgrphack \ | ||
39 | readproctitle rts.tests setlock setuidgid softlimit supervise svc \ | ||
40 | svok svscan svscanboot svstat tai64n tai64nlocal | ||
41 | - env - /bin/sh rts.tests 2>&1 | cat -v > rts | ||
42 | + echo "Warning: We can not run test on cross target." | ||
43 | |||
44 | scan_ulong.o: compile scan.h scan_ulong.c | ||
45 | ./compile scan_ulong.c | ||
diff --git a/meta-oe/recipes-support/daemontools/daemontools_0.76.bb b/meta-oe/recipes-support/daemontools/daemontools_0.76.bb new file mode 100644 index 000000000..fb87ea8ad --- /dev/null +++ b/meta-oe/recipes-support/daemontools/daemontools_0.76.bb | |||
@@ -0,0 +1,47 @@ | |||
1 | SUMMARY = "DJB daemontools" | ||
2 | DESCRIPTION = "supervise monitors a service. It starts the service and restarts the \ | ||
3 | service if it dies. The companion svc program stops, pauses, or restarts \ | ||
4 | the service on sysadmin request. The svstat program prints a one-line \ | ||
5 | status report. \ | ||
6 | multilog saves error messages to one or more logs. It optionally timestamps \ | ||
7 | each line and, for each log, includes or excludes lines matching specified \ | ||
8 | patterns. It automatically rotates logs to limit the amount of disk space \ | ||
9 | used. If the disk fills up, it pauses and tries again, without losing any \ | ||
10 | data." | ||
11 | |||
12 | SECTION = "System/Servers" | ||
13 | |||
14 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/PD;md5=b3597d12946881e13cb3b548d1173851" | ||
15 | LICENSE = "PD" | ||
16 | |||
17 | SRC_URI = "http://cr.yp.to/daemontools/${BPN}-${PV}.tar.gz \ | ||
18 | file://0001-error.h-include-errno.h-instead-of-extern-int.diff \ | ||
19 | file://0002-supervise.c-.-supervise-may-be-a-symlink-if-it-s-da.diff " | ||
20 | |||
21 | SRC_URI_append_class-target = "file://cross-compile.patch" | ||
22 | |||
23 | SRC_URI[md5sum] = "1871af2453d6e464034968a0fbcb2bfc" | ||
24 | SRC_URI[sha256sum] = "a55535012b2be7a52dcd9eccabb9a198b13be50d0384143bd3b32b8710df4c1f" | ||
25 | |||
26 | S = "${WORKDIR}/admin/${BPN}-${PV}" | ||
27 | |||
28 | DEPENDS += "daemontools-native" | ||
29 | DEPENDS_virtclass-native = "" | ||
30 | |||
31 | do_compile() { | ||
32 | ./package/compile | ||
33 | } | ||
34 | |||
35 | do_install() { | ||
36 | install -d ${D}/${bindir} | ||
37 | } | ||
38 | |||
39 | do_install_append_class-native() { | ||
40 | install -m 755 ${S}/compile/chkshsgr ${D}/${bindir} | ||
41 | } | ||
42 | |||
43 | do_install_append_class-target() { | ||
44 | install -m755 ${S}/command/* ${D}/${bindir} | ||
45 | } | ||
46 | |||
47 | BBCLASSEXTEND = "native" | ||