[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#727708: tech-ctte: Decide which init system to default to in Debian.



Hi,

On Sun, 27 Oct 2013 02:47:56 +0800 Thomas Goirand wrote:
> Note that OpenRC already works on some (non-Debian) BSD platforms, and
> that it should be trivial to have it to build on kFreeBSD and Hurd,

And so I came up with the attached patch which gets it building on
GNU/kFreeBSD, and it passed whatever tests are run during build.  I
actually chose Linux implementations for most things, which are really
provided by GNU libc or /proc.

Actually quite amazing how painless that was, though I most certainly
don't expect it to be functional yet.  (For example, I expect it still
needs to know about linprocfs, linsysfs, tmpfs and maybe devfs).

I look forward to seeing OpenRC in the Debian archive.  Thanks!

Regards,
-- 
Steven Chamberlain
steven@pyro.eu.org
diff --git a/etc/rc.conf.GNU-kFreeBSD b/etc/rc.conf.GNU-kFreeBSD
new file mode 100644
index 0000000..e138e3a
--- /dev/null
+++ b/etc/rc.conf.GNU-kFreeBSD
@@ -0,0 +1,12 @@
+##############################################################################
+# GNU/kFreeBSD SPECIFIC OPTIONS
+
+# This is the subsystem type. Valid options on GNU/kFreeBSD:
+# ""        - nothing special
+# "jail"    - FreeBSD jails (not yet implemented)
+# If this is commented out, automatic detection will be used.
+#
+# This should be set to the value representing the environment this file is
+# PRESENTLY in, not the virtualization the environment is capable of.
+#rc_sys=""
+
diff --git a/mk/os-GNU-kFreeBSD.mk b/mk/os-GNU-kFreeBSD.mk
new file mode 100644
index 0000000..9fc9313
--- /dev/null
+++ b/mk/os-GNU-kFreeBSD.mk
@@ -0,0 +1,10 @@
+# Copyright (c) 2008 Roy Marples <roy@marples.name>
+# Released under the 2-clause BSD license.
+
+# Generic definitions
+
+PKG_PREFIX?=	/usr/local
+SFX=		.BSD.in
+
+CPPFLAGS+=	-D_BSD_SOURCE -D_XOPEN_SOURCE=700
+LIBDL=		-Wl,-Bdynamic -ldl
diff --git a/mk/os.mk b/mk/os.mk
index 3e18962..6b2d428 100644
--- a/mk/os.mk
+++ b/mk/os.mk
@@ -3,7 +3,7 @@
 
 # Generic definitions
 
-_OS_SH=		uname -s
+_OS_SH=		uname -s | tr '/' '-'
 _OS:= 		$(shell ${_OS_SH})
 OS?= 		${_OS}
 include ${MK}/os-${OS}.mk
diff --git a/src/librc/librc-daemon.c b/src/librc/librc-daemon.c
index 982da35..7a860c6 100644
--- a/src/librc/librc-daemon.c
+++ b/src/librc/librc-daemon.c
@@ -30,7 +30,7 @@
 
 #include "librc.h"
 
-#if defined(__linux__)
+#if defined(__linux__) || defined (__GLIBC__)
 static bool
 pid_is_exec(pid_t pid, const char *exec)
 {
diff --git a/src/rc/mountinfo.c b/src/rc/mountinfo.c
index eaace13..1006a0c 100644
--- a/src/rc/mountinfo.c
+++ b/src/rc/mountinfo.c
@@ -39,7 +39,7 @@
 #  include <sys/statvfs.h>
 #  define statfs statvfs
 #  define F_FLAGS f_flag
-#elif defined (__linux__)
+#elif defined (__linux__) || defined (__GLIBC__)
 #  include <mntent.h>
 #endif
 
@@ -265,7 +265,7 @@ find_mounts(struct args *args)
 	return list;
 }
 
-#elif defined (__linux__)
+#elif defined (__linux__) || defined (__GLIBC__)
 static struct mntent *
 getmntfile(const char *file)
 {
diff --git a/src/rc/rc-logger.c b/src/rc/rc-logger.c
index 468225f..e8fb0ff 100644
--- a/src/rc/rc-logger.c
+++ b/src/rc/rc-logger.c
@@ -44,7 +44,7 @@
 #include <time.h>
 #include <unistd.h>
 
-#ifdef __linux__
+#if defined(__linux__) || defined(__GLIBC__)
 #  include <pty.h>
 #elif defined(__NetBSD__) || defined(__OpenBSD__)
 #  include <util.h>
diff --git a/src/rc/runscript.c b/src/rc/runscript.c
index e504e4a..f14db11 100644
--- a/src/rc/runscript.c
+++ b/src/rc/runscript.c
@@ -52,7 +52,7 @@
 #include <time.h>
 #include <unistd.h>
 
-#ifdef __linux__
+#if defined(__linux__) || defined(__GLIBC__)
 #  include <pty.h>
 #elif defined(__NetBSD__) || defined(__OpenBSD__)
 #  include <util.h>

Reply to: