From: <pie...@ff...> - 2007-08-29 15:18:20
|
Author: arnonym Date: 2007-08-29 08:18:06 -0700 (Wed, 29 Aug 2007) New Revision: 588 Added: trunk/libffado/admin/dbus.py Modified: trunk/libffado/SConstruct trunk/libffado/external/dbus/SConscript trunk/libffado/tests/SConscript Log: refactor the dbus-builders into their own module... Modified: trunk/libffado/SConstruct =================================================================== --- trunk/libffado/SConstruct 2007-08-29 15:09:34 UTC (rev 587) +++ trunk/libffado/SConstruct 2007-08-29 15:18:06 UTC (rev 588) @@ -55,7 +55,7 @@ else: buildenv['PKG_CONFIG_PATH']='' -env = Environment( tools=['default','scanreplace','pyuic'], toolpath=['admin'], ENV = buildenv, options=opts ) +env = Environment( tools=['default','scanreplace','pyuic','dbus'], toolpath=['admin'], ENV = buildenv, options=opts ) Help( """ For building ffado you can set different options as listed below. You have to @@ -231,34 +231,19 @@ pkgconfig = env.ScanReplace( "libffado.pc.in" ) env.Alias( "install", env.Install( env['libdir'] + '/pkgconfig', pkgconfig ) ) -# build helper tools first -subdirs=['external'] +subdirs=['external','src','libffado','tests','support'] if build_base: env.SConscript( dirs=subdirs, exports="env", build_dir=build_base+subdir ) else: env.SConscript( dirs=subdirs, exports="env" ) -if not env.GetOption('clean'): - Default( 'external' ) -Import( 'dbusxx_xml2cpp_adaptor_builder' ) -env.Append(BUILDERS = {'XML2CPP_ADAPTOR' : dbusxx_xml2cpp_adaptor_builder}) - -Import( 'dbusxx_xml2cpp_proxy_builder' ) -env.Append(BUILDERS = {'XML2CPP_PROXY' : dbusxx_xml2cpp_proxy_builder}) - -# now build our own stuff, which can use the tools defined above -subdirs=['src','libffado','tests','support'] -if build_base: - env.SConscript( dirs=subdirs, exports="env", build_dir=build_base+subdir ) -else: - env.SConscript( dirs=subdirs, exports="env" ) - - # By default only src is built but all is cleaned if not env.GetOption('clean'): + Default( 'external' ) Default( 'src' ) if env['BUILD_TESTS']: Default( 'tests' ) + # Cachedir has to be fixed... #env.Alias( "install", env["cachedir"], os.makedirs( env["cachedir"] ) ) - env.Alias( "install", env.Install( env["cachedir"], "" ) ) #os.makedirs( env["cachedir"] ) ) + #env.Alias( "install", env.Install( env["cachedir"], "" ) ) #os.makedirs( env["cachedir"] ) ) Added: trunk/libffado/admin/dbus.py =================================================================== --- trunk/libffado/admin/dbus.py (rev 0) +++ trunk/libffado/admin/dbus.py 2007-08-29 15:18:06 UTC (rev 588) @@ -0,0 +1,29 @@ +#!/usr/bin/python + +# +# xml translator +# + +def dbusxx_xml2cpp_emitter(target, source, env): + env.Depends(target, "#/external/dbus/dbusxx-xml2cpp" ) + return (target, source) + +def dbusxx_xml2cpp_adaptor_action( target, source, env ): + env.Execute( "./external/dbus/dbusxx-xml2cpp %s --adaptor=%s" % ( source[0], target[0] ) ) + return 0 + +def dbusxx_xml2cpp_proxy_action( target, source, env ): + env.Execute( "./external/dbus/dbusxx-xml2cpp %s --proxy=%s" % ( source[0], target[0] ) ) + return 0 + +def generate( env, **kw ): + env['BUILDERS']['Xml2Cpp_Adaptor'] = env.Builder(action = dbusxx_xml2cpp_adaptor_action, + emitter = dbusxx_xml2cpp_emitter, + suffix = '.h', src_suffix = '.xml') + env['BUILDERS']['Xml2Cpp_Proxy'] = env.Builder(action = dbusxx_xml2cpp_proxy_action, + emitter = dbusxx_xml2cpp_emitter, + suffix = '.h', src_suffix = '.xml', single_source=True ) + +def exists( env ): + return 1 + Modified: trunk/libffado/external/dbus/SConscript =================================================================== --- trunk/libffado/external/dbus/SConscript 2007-08-29 15:09:34 UTC (rev 587) +++ trunk/libffado/external/dbus/SConscript 2007-08-29 15:18:06 UTC (rev 588) @@ -8,21 +8,9 @@ #Import( 'env' ) Import( 'externalenv' ) #dbus_env = env.Copy() -#buildenv={} -#if os.environ.has_key('PATH'): -# buildenv['PATH']=os.environ['PATH'] -#else: -# buildenv['PATH']='' -#if os.environ.has_key('PKG_CONFIG_PATH'): -# buildenv['PKG_CONFIG_PATH']=os.environ['PKG_CONFIG_PATH'] -#else: -# buildenv['PKG_CONFIG_PATH']='' +dbus_env = externalenv.Copy() -dbus_env = externalenv.Copy() #Environment( ENV = buildenv ) - -#CacheDir( 'cache/objects' ) - if dbus_env.has_key('DBUS1_FLAGS'): dbus_env.MergeFlags( dbus_env['DBUS1_FLAGS'] ) @@ -82,21 +70,3 @@ dbusxx_introspect = tools_env.Program('dbusxx-introspect', introspect_sources) dbusxx_xml2cpp = tools_env.Program('dbusxx-xml2cpp', xml2cpp_sources) -# -# xml translator -# - -def dbusxx_xml2cpp_emitter(target, source, env): - dbus_env.Depends(target, dbusxx_xml2cpp) - return (target, source) - -dbusxx_xml2cpp_adaptor_builder = Builder(action = dbusxx_xml2cpp[0].abspath + ' $SOURCE --adaptor=$TARGET', - emitter = dbusxx_xml2cpp_emitter, - suffix = '.h', src_suffix = '.xml') - -dbusxx_xml2cpp_proxy_builder = Builder(action = dbusxx_xml2cpp[0].abspath + ' $SOURCE --proxy=$TARGET', - emitter = dbusxx_xml2cpp_emitter, - suffix = '.h', src_suffix = '.xml') - -Export('dbusxx_xml2cpp_adaptor_builder') -Export('dbusxx_xml2cpp_proxy_builder') Modified: trunk/libffado/tests/SConscript =================================================================== --- trunk/libffado/tests/SConscript 2007-08-29 15:09:34 UTC (rev 587) +++ trunk/libffado/tests/SConscript 2007-08-29 15:18:06 UTC (rev 588) @@ -20,10 +20,10 @@ env.Program( target="test-sytmonitor", source = env.Split( "test-sytmonitor.cpp SytMonitor.cpp" ) ) -env.XML2CPP_PROXY('controlclient-glue.h', 'control-interface.xml') +env.Xml2Cpp_Proxy('controlclient-glue.h', 'control-interface.xml') env.Program( target="test-dbus", source = env.Split( "test-dbus.cpp controlclient.cpp" ) ) -env.XML2CPP_ADAPTOR('controlserver-glue.h', 'control-interface.xml') +env.Xml2Cpp_Adaptor('controlserver-glue.h', 'control-interface.xml') env.Program( target="test-dbus-server", source = env.Split( "test-dbus-server.cpp controlserver.cpp" ) ) env.Program( target="test-ffado", source = env.Split( "test-ffado.cpp controlserver.cpp" ) ) |