[ekg2-commit] r4257 - in trunk: . scons.d: trunk/SConstruct trunk/scons.d/compat

SVN commit svn w toxygen.net
Sob, 9 Sie 2008, 21:22:33 CEST


Author: peres
Date: 2008-08-09 21:22:33 +0200 (Sat, 09 Aug 2008)
New Revision: 4257

Modified:
   trunk/SConstruct
   trunk/scons.d/compat
Log:

Move compat compilation to scons.d, initial code for dependency checking.



Modified: trunk/SConstruct
===================================================================
--- trunk/SConstruct	2008-08-09 17:51:21 UTC (rev 4256)
+++ trunk/SConstruct	2008-08-09 19:22:33 UTC (rev 4257)
@@ -17,6 +17,9 @@
 	'UNICODE':		'USE_UNICODE'
 	}
 
+plugin_states = ['nocompile', 'deprecated', 'unknown', 'experimental', 'unstable', 'stable']
+plugin_symbols = ['!', '!', '?', '*', '~', '']
+
 import glob, sys
 
 def die(reason):
@@ -53,16 +56,21 @@
 	context.Result(result)
 	return not not result
 
+ExtTestsCache = {}
+
 def ExtTest(name, addexports = []):
+	if name in ExtTestsCache.keys():
+		return ExtTestsCache[name]
 	exports = ['conf', 'defines']
 	exports.extend(addexports)
 	ret = SConscript('scons.d/%s' % (name), exports)
+	ExtTestsCache[name] = ret
 	return ret
 
 opts = Options('options.cache')
 
 avplugins = [elem.split('/')[1] for elem in glob.glob('plugins/*/')]
-avplugins.extend(['stable', 'unstable', 'experimental'])
+avplugins.extend(plugin_states)
 opts.Add(ListOption('PLUGINS', 'List of plugins to build', 'unstable', avplugins))
 opts.Add(BoolOption('UNICODE', 'Whether to build unicode version of ekg2', True))
 
@@ -88,18 +96,17 @@
 ekg_libs = []
 
 ExtTest('standard', ['ekg_libs'])
-compat = []
-ExtTest('compat', ['ekg_libs', 'compat'])
+ExtTest('compat', ['ekg_libs', 'env'])
 
 plugin_def = {
 	'type':			'misc',
-	'state':		'experimental',
-	'depends':		[]
+	'state':		'unknown',
+	'depends':		[],
+	'optdepends':	[]
 	}
 
 plugins = env['PLUGINS']
-plugin_states = ['nocompile', 'deprecated', 'experimental', 'unstable', 'stable']
-plugins_state = plugin_states.index('experimental')
+plugins_state = 0
 
 for st in plugin_states:
 	if st in avplugins:
@@ -121,6 +128,10 @@
 	info = SConscript('%s/SConscript' % (plugpath))
 	if not info:
 		info = plugin_def
+	else:
+		for k in plugin_def.keys():
+			if not k in info:
+				info[k] = plugin_def[k]
 	if plugin_states.index(info['state']) < plugins_state:
 		plugins.remove(plugin)
 		continue
@@ -129,15 +140,18 @@
 		plugins.remove(plugin)
 		print '[%s] Disabling due to build system incompatibility (probably junk in srcdir).' % (plugin)
 		continue
-	if info['depends']:
-		plugins.remove(plugin)
-		print '[%s] Unknown dependencies: %s' % (plugin, ', '.join(info['depends']))
+	for dep in info['depends']:
+		if not ExtTest(dep):
+			plugins.remove(plugin)
+			print '[%s] Dependency not satisfied: %s' % (plugin, dep)
+			info['fail'] = True
+	if 'fail' in info:
 		continue
 
 	type = info['type']
 	if not pl.has_key(type):
 		pl[type] = []
-	pl[type].append(plugin)
+	pl[type].append('%s%s' % (plugin_symbols[plugin_states.index(info['state'])], plugin))
 
 if pl:
 	print 'Enabled plugins:'
@@ -148,9 +162,6 @@
 
 writedefines()
 
-if compat:
-	StaticLibrary('compat/compat', compat)
-
 env.Program('ekg/ekg2', Glob('ekg/*.c'), LIBS = ekg_libs, LIBPATH = './compat')
 
 for plugin in plugins:

Modified: trunk/scons.d/compat
===================================================================
--- trunk/scons.d/compat	2008-08-09 17:51:21 UTC (rev 4256)
+++ trunk/scons.d/compat	2008-08-09 19:22:33 UTC (rev 4257)
@@ -9,24 +9,24 @@
 		'getopt_long': ['getopt', 'getopt1']
 	}
 
-#compat = []
+compat = []
 
 for func in compat_funcs:
 	have_it = conf.CheckFunc(func)
 	defines['HAVE_%s' % (func.upper())] = have_it
 	if not have_it:
-		compat.append('compat/%s.c' % (func))
+		compat.append('../compat/%s.c' % (func))
 
 for func, files in compat_spec.items():
 	have_it = conf.CheckFunc(func)
 	defines['HAVE_%s' % (func.upper())] = have_it
 	if not have_it:
 		for file in files:
-			compat.append('compat/%s.c' % (file))
+			compat.append('../compat/%s.c' % (file))
 
 if compat:
 	ekg_libs.append('compat')
-#	StaticLibrary('compat/compat', compat)
+	env.StaticLibrary('../compat/compat', compat)
 
 ret = True
 Return('ret')



Więcej informacji o liście dyskusyjnej ekg2-commit