On Friday 27 November 2009, Cyril Brulebois wrote:
> Maarten ter Huurne <[email protected]> (27/11/2009):
> > Instead of matching "gnu/kfreebsd" as FreeBSD and then checking for
> > glibc, maybe it would be simpler to map any system name starting
> > with "gnu/" to openMSX OS "gnu"?
> 
> I'm open to any suggestions. :) If you want a testbuild with a given
> patch and/or source package, just ask me.

I've committed a fix to SVN (r10821). I also attached the same change as a 
diff to this mail. Could you please test if system detection works now?

> Please note that “GNU”
> itself can be a bit misguiding, since it's used by GNU/Hurd to
> identify itself. (But since you're looking for a string match rather
> than a string comparison, that might be OK.)

openMSX does support GNU/Hurd under the name "gnu". Since we don't access 
the kernel directly, I am assuming GNU/kFreeBSD would require the same 
compile flags etc as GNU/Hurd. So for openMSX, there is no need to 
distinguish the two systems.

Bye,
                Maarten
Index: build/detectsys.py
===================================================================
--- build/detectsys.py	(revision 10796)
+++ build/detectsys.py	(working copy)
@@ -3,7 +3,7 @@
 # Actually we rely on the Python "platform" module and map its output to names
 # that the openMSX build understands.
 
-from platform import libc_ver, machine, system
+from platform import machine, system
 import sys
 
 def detectCPU():
@@ -55,18 +55,13 @@
 	Raises ValueError if no known OS is detected.
 	'''
 	os = system().lower()
-	if os in ('linux', 'darwin', 'netbsd', 'openbsd', 'gnu'):
+	if os in ('linux', 'darwin', 'freebsd', 'netbsd', 'openbsd', 'gnu'):
 		return os
-	elif os == 'freebsd':
-		lib, version_ = libc_ver()
-		if lib == 'glibc':
-			# Debian kFreeBSD is GNU userland on a FreeBSD kernel; for openMSX
-			# the kernel is not really relevant, so treat it like a generic
-			# GNU system.
-			return 'gnu'
-		else:
-			# Actual FreeBSD.
-			return 'freebsd'
+	elif os.startswith('gnu/'):
+		# GNU userland on non-Hurd kernel, for example Debian GNU/kFreeBSD.
+		# For openMSX the kernel is not really relevant, so treat it like
+		# a generic GNU system.
+		return 'gnu'
 	elif os.startswith('mingw') or os == 'windows':
 		return 'mingw32'
 	elif os == 'sunos':

Reply via email to