From b65fadfdcc507d346791c1381ae69b3f5f381e02 Mon Sep 17 00:00:00 2001 From: sletz Date: Thu, 6 Mar 2008 17:55:18 +0000 Subject: [PATCH] Marc-Olivier Barre scons patch (3) git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@1910 0c269be4-1314-0410-8aa9-9f06e86f4224 --- ChangeLog | 4 + SConstruct | 244 +++++++++++++++---------------------- common/SConscript | 105 +++++++--------- example-clients/SConscript | 83 ++++++------- linux/SConscript | 11 +- macosx/SConscript | 25 ++-- tests/SConscript | 56 ++++++--- 7 files changed, 245 insertions(+), 283 deletions(-) diff --git a/ChangeLog b/ChangeLog index 755d191e..fe079232 100644 --- a/ChangeLog +++ b/ChangeLog @@ -18,6 +18,10 @@ Marc-Olivier Barre Jackdmp changes log --------------------------- +2008-03-06 Stephane Letz + + * Marc-Olivier Barre scons patch (3). + 2008-03-06 Stephane Letz * Fix JackSocketClientChannel::ClientClose: async call from the client and server does not need to write any reply. diff --git a/SConstruct b/SConstruct index 1bb28908..07726da1 100644 --- a/SConstruct +++ b/SConstruct @@ -1,6 +1,7 @@ # # Copyright (C) 2007 Arnold Krille # Copyright (C) 2007 Pieter Palmers +# Copyright (C) 2008 Marc-Olivier Barre # # This file originates from FFADO (www.ffado.org) # @@ -23,46 +24,48 @@ from string import Template platform = ARGUMENTS.get('OS', str(Platform())) -build_dir = ARGUMENTS.get('BUILDDIR', "") +build_dir = ARGUMENTS.get('BUILDDIR', '') if build_dir: - build_base=build_dir+'/' - if not os.path.isdir( build_base ): - os.makedirs( build_base ) - print "Building into: " + build_base + build_base = build_dir + '/' + if not os.path.isdir(build_base): + os.makedirs(build_base) + print 'Building into: ' + build_base else: build_base='' -if not os.path.isdir( "cache" ): - os.makedirs( "cache" ) +if not os.path.isdir('cache'): + os.makedirs('cache') -opts = Options( "cache/"+build_base+"options.cache" ) - -# make this into a command line option and/or a detected value -build_for_linux = True +opts = Options('cache/'+build_base+'options.cache') # -# If this is just to display a help-text for the variable used via ARGUMENTS, then its wrong... -opts.Add( "BUILDDIR", "Path to place the built files in", "") +# Command-line options section +# +# If this is just to display a help-text for the variable used via ARGUMENTS, then its wrong... +opts.Add( 'BUILDDIR', 'Path to place the built files in', '') opts.AddOptions( -# BoolOption( "DEBUG", """\ -#Toggle debug-build. DEBUG means \"-g -Wall\" and more, otherwise we will use -# \"-O2\" to optimise.""", True ), - PathOption( "PREFIX", "The prefix where jackdmp will be installed to.", "/usr/local", PathOption.PathAccept ), - PathOption( "BINDIR", "Overwrite the directory where apps are installed to.", "$PREFIX/bin", PathOption.PathAccept ), - PathOption( "LIBDIR", "Overwrite the directory where libs are installed to.", "$PREFIX/lib", PathOption.PathAccept ), - PathOption( "INCLUDEDIR", "Overwrite the directory where headers are installed to.", "$PREFIX/include", PathOption.PathAccept ), - BoolOption( "ENABLE_ALSA", "Enable/Disable the ALSA backend.", True ), - BoolOption( "ENABLE_FREEBOB", "Enable/Disable the FreeBoB backend.", True ), - BoolOption( "ENABLE_FIREWIRE", "Enable/Disable the FireWire backend.", True ), - BoolOption( "DEBUG", """Do a debug build.""", True ), - BoolOption( "BUILD_TESTS", """Build tests where applicable.""", True ), - BoolOption( "BUILD_EXAMPLES", """Build the example clients in their directory.""", True ), - BoolOption( "INSTALL_EXAMPLES", """Install the example clients in the BINDIR directory.""", True ), - BoolOption( "BUILD_DOXYGEN_DOCS", """Build doxygen documentation.""", True ), + PathOption('PREFIX', 'The prefix where jackdmp will be installed to', '/usr/local', PathOption.PathAccept), + PathOption('BINDIR', 'Overwrite the directory where apps are installed to', '$PREFIX/bin', PathOption.PathAccept), + PathOption('LIBDIR', 'Overwrite the directory where libs are installed to', '$PREFIX/lib', PathOption.PathAccept), + PathOption('INCLUDEDIR', 'Overwrite the directory where headers are installed to', '$PREFIX/include', PathOption.PathAccept), + # TODO: The next one is stupid, should be autodetected + BoolOption('BUILD_FOR_LINUX', 'Enable/Disable depending on your system', True), + BoolOption('ENABLE_ALSA', 'Enable/Disable the ALSA backend', True), + BoolOption('ENABLE_FREEBOB', 'Enable/Disable the FreeBoB backend', True), + BoolOption('ENABLE_FIREWIRE', 'Enable/Disable the FireWire backend', True), + BoolOption('DEBUG', 'Do a debug build', False), + BoolOption('BUILD_TESTS', 'Build tests where applicable', True), + BoolOption('BUILD_EXAMPLES', 'Build the example clients in their directory', True), + BoolOption('INSTALL_EXAMPLES', 'Install the example clients in the BINDIR directory', True), + BoolOption('BUILD_DOXYGEN_DOCS', 'Build doxygen documentation', False), ) -## Load the builders in config +# +# Configuration section +# + +# Load the builders in config buildenv = os.environ if os.environ.has_key('PATH'): buildenv['PATH'] = os.environ['PATH'] @@ -79,171 +82,127 @@ if os.environ.has_key('LD_LIBRARY_PATH'): else: buildenv['LD_LIBRARY_PATH'] = '' -env = Environment( tools=['default','scanreplace','pkgconfig', 'doxygen'], toolpath=['admin'], - ENV=buildenv, PLATFORM = platform, options=opts ) - -Help( """ -For building jackdmp you can set different options as listed below. You have to -specify them only once, scons will save the last value you used and re-use -that. -To really undo your settings and return to the factory defaults, remove the -"cache"-folder and the file ".sconsign.dblite" from this directory. -For example with: "rm -Rf .sconsign.dblite cache" +env = Environment(tools=['default', 'scanreplace', 'pkgconfig', 'doxygen'], toolpath = ['admin'], ENV=buildenv, PLATFORM = platform, options = opts) -""" ) -Help( opts.GenerateHelpText( env ) ) +Help('To build jackdmp you can set different options as listed below. You have to specify them only once, scons will save the latest values you set and re-use then. To really undo your settings and return to the factory defaults, remove the .sconsign.dblite and options.cache files from your BUILDDIR directory.') +Help(opts.GenerateHelpText(env)) # make sure the necessary dirs exist -if not os.path.isdir( "cache/" + build_base ): - os.makedirs( "cache/" + build_base ) -if not os.path.isdir( 'cache/objects' ): - os.makedirs( 'cache/objects' ) +if not os.path.isdir('cache/' + build_base): + os.makedirs('cache/' + build_base) if build_base: - env['build_base']="#/"+build_base + env['build_base']='#/'+build_base else: - env['build_base']="#/" - + env['build_base']='#/' -CacheDir( 'cache/objects' ) -opts.Save( 'cache/' + build_base + "options.cache", env ) +opts.Save('cache/' + build_base + 'options.cache', env) tests = {} -tests.update( env['PKGCONFIG_TESTS'] ) +tests.update(env['PKGCONFIG_TESTS']) if not env.GetOption('clean'): - conf = Configure( env, + conf = Configure(env, custom_tests = tests, - conf_dir = "cache/" + build_base, - log_file = "cache/" + build_base + 'config.log' ) + conf_dir = 'cache/' + build_base, + log_file = 'cache/' + build_base + 'config.log') - # # Check if the environment can actually compile c-files by checking for a - # header shipped with gcc. - # - if not conf.CheckHeader( "stdio.h" ): - print "It seems as if stdio.h is missing. This probably means that your build environment is broken, please make sure you have a working c-compiler and libstdc installed and usable." - Exit( 1 ) - - # - # The following checks are for headers and libs and packages we need. - # - allpresent = 1; + # header shipped with gcc + if not conf.CheckHeader( 'stdio.h' ): + print 'Error: It seems as if stdio.h is missing. This probably means that your build environment is broken, please make sure you have a working c-compiler and libstdc installed and usable.' + Exit(1) - if build_for_linux: - allpresent &= conf.CheckForPKGConfig(); + # The following checks are for headers, libs and packages we depend on + allpresent = 1; -# example on how to check for additional libs -# pkgs = { -# 'alsa' : '1.0.0', -# } -# for pkg in pkgs: -# name2 = pkg.replace("+","").replace(".","").replace("-","").upper() -# env['%s_FLAGS' % name2] = conf.GetPKGFlags( pkg, pkgs[pkg] ) -# if env['%s_FLAGS'%name2] == 0: -# allpresent &= 0 + if env['BUILD_FOR_LINUX']: + allpresent &= conf.CheckForPKGConfig('0.20'); if not allpresent: - print """ -(At least) One of the dependencies is missing. I can't go on without it, please -install the needed packages (remember to also install the *-devel packages) -""" - Exit( 1 ) - - # jack doesn't have to be present, but it would be nice to know if it is - env['JACK_FLAGS'] = conf.GetPKGFlags( 'jack', '0.100.0' ) + print "--> At least one of the dependencies is missing. I can't go on without it, please install the needed packages (remember to also install the *-devel packages)" + Exit(1) + + # If jack has the same PREFIX as the one we plan to use, exit with an error message + env['JACK_FLAGS'] = conf.GetPKGFlags('jack', '0.90') if env['JACK_FLAGS']: - env['JACK_PREFIX'] = conf.GetPKGPrefix( 'jack' ) - env['JACK_EXEC_PREFIX'] = conf.GetPKGExecPrefix( 'jack' ) - env['JACK_LIBDIR'] = conf.GetPKGLibdir( 'jack' ) - env['JACK_INCLUDEDIR'] = conf.GetPKGIncludedir( 'jack' ) + print "--> Found an existing JACK installation, let's be careful not to erase it" + if conf.GetPKGPrefix( 'jack' ) == env['PREFIX']: + print '--> JACK is installed in the same directory as our current PREFIX. Either remove JACK or change your installation PREFIX.' + Exit(1) - # # Optional checks follow: - # - if build_for_linux and env['ENABLE_ALSA']: - env['ALSA_FLAGS'] = conf.GetPKGFlags( 'alsa', '1.0.0' ) + if env['BUILD_FOR_LINUX'] and env['ENABLE_ALSA']: + env['ALSA_FLAGS'] = conf.GetPKGFlags('alsa', '1.0.0') if env['ALSA_FLAGS'] == 0: - print " Disabling 'alsa' backend since no useful ALSA installation found." + print "--> Disabling 'alsa' backend since no useful ALSA installation found" env['ENABLE_ALSA'] = False - if build_for_linux and env['ENABLE_FREEBOB']: - env['FREEBOB_FLAGS'] = conf.GetPKGFlags( 'libfreebob', '1.0.0' ) + if env['BUILD_FOR_LINUX'] and env['ENABLE_FREEBOB']: + env['FREEBOB_FLAGS'] = conf.GetPKGFlags('libfreebob', '1.0.0') if env['FREEBOB_FLAGS'] == 0: - print " Disabling 'freebob' backend since no useful FreeBoB installation found." + print "--> Disabling 'freebob' backend since no useful FreeBoB installation found" env['ENABLE_FREEBOB'] = False - if build_for_linux and env['ENABLE_FIREWIRE']: - env['FFADO_FLAGS'] = conf.GetPKGFlags( 'libffado', '1.999.14' ) + if env['BUILD_FOR_LINUX'] and env['ENABLE_FIREWIRE']: + env['FFADO_FLAGS'] = conf.GetPKGFlags('libffado', '1.999.14') if env['FFADO_FLAGS'] == 0: - print " Disabling 'firewire' backend since no useful FFADO installation found." + print "--> Disabling 'firewire' backend since no useful FFADO installation found" env['ENABLE_FIREWIRE'] = False env = conf.Finish() if env['DEBUG']: - print "Doing a DEBUG build" - # -Werror could be added to, which would force the devs to really remove all the warnings :-) - env.AppendUnique( CCFLAGS=["-DDEBUG","-Wall","-g"] ) + print '--> Doing a DEBUG build' + # TODO: -Werror could be added to, which would force the devs to really remove all the warnings :-) + env.AppendUnique(CCFLAGS = ['-DDEBUG', '-Wall', '-g']) else: - env.AppendUnique( CCFLAGS=["-O3","-DNDEBUG"] ) - -env.AppendUnique( CCFLAGS=["-fPIC", "-DSOCKET_RPC_FIFO_SEMA", "-D__SMP__"] ) -env.AppendUnique( CFLAGS=["-fPIC", "-DUSE_POSIX_SHM"] ) + env.AppendUnique(CCFLAGS = ['-O3','-DNDEBUG']) -# -# XXX: Maybe we can even drop these lower-case variables and only use the uppercase ones? -# -env['prefix'] = Template( os.path.join( env['PREFIX'] ) ).safe_substitute( env ) -env['bindir'] = Template( os.path.join( env['BINDIR'] ) ).safe_substitute( env ) -env['libdir'] = Template( os.path.join( env['LIBDIR'] ) ).safe_substitute( env ) -env['includedir'] = Template( os.path.join( env['INCLUDEDIR'] ) ).safe_substitute( env ) +env.AppendUnique(CCFLAGS = ['-fPIC', '-DSOCKET_RPC_FIFO_SEMA', '-D__SMP__']) +env.AppendUnique(CFLAGS = ['-fPIC', '-DUSE_POSIX_SHM']) -env.Alias( "install", env['libdir'] ) -env.Alias( "install", env['includedir'] ) -env.Alias( "install", env['bindir'] ) +env.Alias('install', env['LIBDIR']) +env.Alias('install', env['INCLUDEDIR']) +env.Alias('install', env['BINDIR']) # for config.h.in -env['ADDON_DIR']='%s' % env['prefix'] +# TODO: Is that necessary ? +env['ADDON_DIR']='%s' % env['PREFIX'] env['LIB_DIR']='lib' -env['JACK_LOCATION']='%s' % env['bindir'] +env['JACK_LOCATION']='%s' % env['BINDIR'] -# # To have the top_srcdir as the doxygen-script is used from auto* -# -env['top_srcdir'] = env.Dir( "." ).abspath +# TODO: Understand the previous comment +env['top_srcdir'] = env.Dir('.').abspath -#subprojects = env.Split('common common/jack tests example-clients linux/alsa linux/freebob linux/firewire') +env.ScanReplace( 'config.h.in' ) +# TODO: find out what's that about. Is it useful ? +AlwaysBuild('config.h') -#for subproject in subprojects: - #env.AppendUnique( CCFLAGS=["-I%s" % subproject] ) - #env.AppendUnique( CFLAGS=["-I%s" % subproject] ) - -env.ScanReplace( "config.h.in" ) -# ensure that the config.h is always updated, since it -# sometimes fails to pick up the changes -# note: this still doesn't seem to cause dependent files to be rebuilt. -NoCache("config.h") -AlwaysBuild("config.h") - -# ensure we have a path to where the libraries are -env.AppendUnique( LIBPATH=["#/common"] ) +# Ensure we have a path to where the libraries are +env.AppendUnique(LIBPATH=['#/common']) # -# Start building +# Build section # + if env['BUILD_DOXYGEN_DOCS']: - env.Doxygen("doxyfile") + env.Doxygen('doxyfile') subdirs=['common'] + +# TODO: Really handle each platform automatically if env['PLATFORM'] == 'posix': subdirs.append('linux') -if env['PLATFORM'] == 'macosx': # FIXME FOR SLETZ: check macosx/SConscript +# TODO FOR SLETZ: test macosx/SConscript +if env['PLATFORM'] == 'macosx': subdirs.append('macosx') -if env['PLATFORM'] == 'windows': # FIXME FOR SLETZ: create/check macosx/SConscript - subdirs.append('windows') +# TODO FOR SLETZ & MARC: create/check windows/SConscript +#if env['PLATFORM'] == 'windows': +# subdirs.append('windows') if env['BUILD_EXAMPLES']: subdirs.append('example-clients') @@ -252,7 +211,6 @@ if env['BUILD_TESTS']: subdirs.append('tests') if build_base: - env.SConscript( dirs=subdirs, exports="env", build_dir=build_base+subdir ) + env.SConscript(dirs=subdirs, exports='env', build_dir=build_base+subdir) else: - env.SConscript( dirs=subdirs, exports="env" ) - + env.SConscript(dirs=subdirs, exports='env') diff --git a/common/SConscript b/common/SConscript index 19485e45..b7796717 100644 --- a/common/SConscript +++ b/common/SConscript @@ -1,8 +1,9 @@ # # Copyright (C) 2007 Arnold Krille # Copyright (C) 2007 Pieter Palmers +# Copyright (C) 2008 Marc-Olivier Barre # -# This file originally was part of FFADO +# This file originates from FFADO (www.ffado.org) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -22,19 +23,31 @@ import os import glob from string import Template -Import( 'env' ) +Import('env') -# paths where include files can be found -env.AppendUnique( CPPPATH=["#/", "#/common", "#/common/jack"] ) +# Define the library suffix for POSIX like systems +if env['PLATFORM'] == 'posix': + env.AppendUnique(SHLIBSUFFIX='.0.0') + +# Paths where include files can be found +env.AppendUnique(CPPPATH=['#/', '#/common', '#/common/jack']) + +# Needed libraries +env.AppendUnique(LIBS=['rt', 'pthread']) # HACK: this should not be here ideally -env.AppendUnique( CPPPATH=["#/linux","#/macosx"] ) +env.AppendUnique(CPPPATH=['#/linux','#/macosx']) -# a symlinking command -symlinkcmd = 'cd $TARGET.dir && rm -f -v $TARGET.name && ln -v -s $SOURCE.name $TARGET.name' +# A symlinking command for our libraries' names +symlinkcmd = 'cd $TARGET.dir && rm -f $TARGET.name && ln -s $SOURCE.name $TARGET.name' + +# Library names +clientlib_name = 'jackmp' +serverlib_name = 'jackservermp' +wrapperlib_name = 'jackwrapper' # -# Define the source files +# Source files section # srcfiles_common_serverlib = [ @@ -134,64 +147,28 @@ jack_headers = [ ] # -# Start building +# Build/install section # -env.AppendUnique( LIBS=["rt", "pthread"] ) +# Libraries +clientlib = env.SharedLibrary(clientlib_name, srcfiles_common_clientlib) +serverlib = env.SharedLibrary(serverlib_name, srcfiles_common_serverlib) +wrapperlib = env.SharedLibrary(wrapperlib_name, srcfiles_common_wrapperlib) +env.Install( env['LIBDIR'], [clientlib, serverlib, wrapperlib]) +env.Alias('install', env['LIBDIR']) -# build the common stuff -if env['PLATFORM'] == 'posix': - env.AppendUnique( SHLIBSUFFIX=".0.0" ) -clientlib_name = "jackmp" -serverlib_name = "jackservermp" -wrapperlib_name = "jackwrapper" -clientlib = env.SharedLibrary( clientlib_name, srcfiles_common_clientlib ) -serverlib = env.SharedLibrary( serverlib_name, srcfiles_common_serverlib ) -wrapperlib = env.SharedLibrary( wrapperlib_name, srcfiles_common_wrapperlib ) -env.Install( env['libdir'], [clientlib, serverlib, wrapperlib]) -env.Alias("install", env['libdir']) +# Handle the way we name libraries on a POSIX system +# TODO: this is not quite clean yet. changing the library version is a pain we'll need a nicer loop and a config value somewhere if env['PLATFORM'] == 'posix': - for lib_name, lib in [(clientlib_name, clientlib), (serverlib_name, serverlib), (wrapperlib_name, wrapperlib)]: - env.Command('lib' + lib_name + '.so.0', lib, symlinkcmd) - env.Command('lib' + lib_name + '.so', 'lib'+lib_name+'.so.0', symlinkcmd) - env.Command(env['libdir'] + '/lib' + lib_name + '.so.0', env['libdir'] + '/lib' + lib_name + '.so.0.0', symlinkcmd) - env.Command(env['libdir'] + '/lib' + lib_name + '.so', env['libdir'] + '/lib' + lib_name + '.so.0', symlinkcmd) - env.Alias("install", env['libdir'] + '/lib' + lib_name + '.so.0') - env.Alias("install", env['libdir'] + '/lib' + lib_name + '.so') - -# install the headers + for lib_name, lib in [(clientlib_name, clientlib), (serverlib_name, serverlib), (wrapperlib_name, wrapperlib)]: + env.Command('lib' + lib_name + '.so.0', lib, symlinkcmd) + env.Command('lib' + lib_name + '.so', 'lib'+lib_name+'.so.0', symlinkcmd) + env.Command(env['LIBDIR'] + '/lib' + lib_name + '.so.0', env['LIBDIR'] + '/lib' + lib_name + '.so.0.0', symlinkcmd) + env.Command(env['LIBDIR'] + '/lib' + lib_name + '.so', env['LIBDIR'] + '/lib' + lib_name + '.so.0', symlinkcmd) + env.Alias('install', env['LIBDIR'] + '/lib' + lib_name + '.so.0') + env.Alias('install', env['LIBDIR'] + '/lib' + lib_name + '.so') + +# Headers for header in jack_headers: - env.Install(env['includedir'] + '/jack', 'jack/' + header) - env.Alias("install", env['includedir']) -#if env['JACK_FLAGS']: - #jack_include_dir = env['JACK_INCLUDEDIR'] - #if 'install' in COMMAND_LINE_TARGETS and os.path.isdir( jack_include_dir ): - #if env.GetOption('clean'): - #pass - #else: - #jack_old_includes_dir = env['includedir'] + '/jack_up' - #print "moving old jack includes to %s..." % jack_old_includes_dir - #env.Command(jack_old_includes_dir, jack_include_dir, Move("$TARGET", "$SOURCE")) - -# install the libs -#jack_libdir = env['JACK_LIBDIR'] -#libjackdmp_location = env['libdir'] + '/libjackmp.so' -#if 'install' in COMMAND_LINE_TARGETS and os.path.isdir( jack_libdir ): - #if env.GetOption('clean'): - #note: is this executed before the actual uninstall? - #lib_files = glob.glob(jack_libdir + '/libjack.so.*.up') - #for old_name in lib_files: - #new_name = old_name[:-3] - #print "restoring old jack lib %s to %s..." % (old_name, new_name) - #env.Command(Delete(new_name)) - #env.Command(new_name, old_name, Move("$TARGET", "$SOURCE")) - #else: - #lib_files = glob.glob(jack_libdir + '/libjack.so.*') - #env.Alias("install", env.Install(env['libdir'], serverlib)) - #env.Alias("install", env.Install(env['libdir'], clientlib)) - #for old_name in lib_files: - #new_name = old_name + '.up' - #print "moving old jack lib %s to %s..." % (old_name, new_name) - #env.Command(new_name, old_name, Move("$TARGET", "$SOURCE")) - #print " linking to %s..." % (libjackdmp_location) - #env.Command(old_name, libjackdmp_location, "ln -s $TARGET $SOURCE") \ No newline at end of file + env.Install(env['INCLUDEDIR'] + '/jack', 'jack/' + header) + env.Alias('install', env['INCLUDEDIR']) diff --git a/example-clients/SConscript b/example-clients/SConscript index 40c624ea..9af72385 100644 --- a/example-clients/SConscript +++ b/example-clients/SConscript @@ -1,6 +1,7 @@ # # Copyright (C) 2007 Arnold Krille # Copyright (C) 2007 Pieter Palmers +# Copyright (C) 2008 Marc-Olivier Barre # # This file originates from FFADO (www.ffado.org) # @@ -21,66 +22,60 @@ import os from string import Template -Import( 'env' ) +Import('env') # paths where include files can be found -env.AppendUnique( CPPPATH=["#/", "#/common"] ) +env.AppendUnique(CPPPATH=['#/', '#/common']) # -# Define the source files +# Source files section # -example_client_programs = { - "jack_freewheel" : "freewheel.c", - "jack_connect" : "connect.c", - "jack_lsp" : "lsp.c", - "jack_metro" : "metro.c", - #"jack_midiseq" : "midiseq.c", - #"jack_midisine" : "midisine.c", - "jack_showtime" : "showtime.c", - "jack_simple_client" : "simple_client.c", - "jack_zombie" : "zombie.c", - "jack_load" : "ipload.c", - "jack_unload" : "ipunload.c", -} +example_programs = { + 'jack_freewheel' : 'freewheel.c', + 'jack_connect' : 'connect.c', + 'jack_lsp' : 'lsp.c', + 'jack_metro' : 'metro.c', + 'jack_midiseq' : 'midiseq.c', + 'jack_midisine' : 'midisine.c', + 'jack_showtime' : 'showtime.c', + 'jack_simple_client' : 'simple_client.c', + 'jack_zombie' : 'zombie.c', + 'jack_load' : 'ipload.c', + 'jack_unload' : 'ipunload.c', + } -example_client_libs = { - "inprocess" : "inprocess.c", -} +example_libs = { + 'inprocess' : 'inprocess.c', + } -# link extra libs? +# Libraries to link extra_libs = {} -for example_client_program in example_client_programs.keys(): - extra_libs[example_client_program] = ["jackservermp", "dl"] - -# special cases -extra_libs["jack_load"] = ["jackmp"] -extra_libs["jack_unload"] = ["jackmp"] +for example_program in example_programs: + extra_libs[example_program] = ['jackservermp', 'dl'] +# Replace library listing for some special cases +extra_libs['jack_load'] = ['jackmp'] +extra_libs['jack_unload'] = ['jackmp'] +# TODO: we need to really test for READLINE... env['HAS_READLINE']=True if env['HAS_READLINE']: - extra_libs["jack_transport"] = ["readline", "jackservermp", "dl"] - example_client_programs["jack_transport"] = "transport.c" + extra_libs['jack_transport'] = ['readline', 'jackservermp', 'dl'] + example_programs['jack_transport'] = 'transport.c' # -# Start building +# Build/install section # -# build the example clients if env['BUILD_EXAMPLES']: clientenv = env.Copy() - clientenv.PrependUnique( LIBPATH=env['build_base'] ) - - for example_client_program in example_client_programs.keys(): - clientenv.Program(target=example_client_program, - source=env.Split( example_client_programs[example_client_program]), - LIBS=extra_libs[example_client_program] ) - if env['INSTALL_EXAMPLES']: - clientenv.Install( "$bindir", example_client_program ) - - for example_client_lib in example_client_libs.keys(): - clientenv.SharedLibrary(target=example_client_lib, - source=env.Split( example_client_libs[example_client_lib] ) ) + clientenv.PrependUnique(LIBPATH=env['build_base']) + for example_program, example_program_source in example_programs.items(): + clientenv.Program(example_program, example_program_source, LIBS=extra_libs[example_program]) if env['INSTALL_EXAMPLES']: - #clientenv.Install( "$libdir", example_client_lib ) - pass + clientenv.Install(env['BINDIR'], example_program) + for example_lib, example_lib_source in example_libs.items(): + clientenv.SharedLibrary(example_lib, example_lib_source) +# TODO: Not working yet. Do we even intend to install a test library ? +# if env['INSTALL_EXAMPLES']: +# clientenv.Install(env['LIBDIR'], example_client_lib) diff --git a/linux/SConscript b/linux/SConscript index 091cfffb..af3ef69b 100644 --- a/linux/SConscript +++ b/linux/SConscript @@ -1,6 +1,7 @@ # # Copyright (C) 2007 Arnold Krille # Copyright (C) 2007 Pieter Palmers +# Copyright (C) 2008 Marc-Olivier Barre # # This file originates from FFADO (www.ffado.org) # @@ -58,25 +59,25 @@ serverenv.PrependUnique( LIBPATH=env['build_base'] ) serverenv.PrependUnique( LIBS=["jackservermp", "dl"] ) server = serverenv.Program("jackdmp", srcfiles_linux_server) -serverenv.Install( env['bindir'], server ) +serverenv.Install( env['BINDIR'], server ) drv = serverenv.SharedLibrary( "jack_dummy", srcfiles_linux_dummy ) -serverenv.InstallAs( env['libdir']+ "/jackmp/jack_dummy.so", drv ) +serverenv.InstallAs( env['LIBDIR']+ "/jackmp/jack_dummy.so", drv ) if env['ENABLE_ALSA']: if not env.GetOption('clean'): serverenv.MergeFlags( env['ALSA_FLAGS'] ) drv = serverenv.SharedLibrary( "jack_alsa", srcfiles_linux_alsa ) - serverenv.InstallAs( env['libdir']+ "/jackmp/jack_alsa.so", drv ) + serverenv.InstallAs( env['LIBDIR']+ "/jackmp/jack_alsa.so", drv ) if env['ENABLE_FREEBOB']: if not env.GetOption('clean'): serverenv.MergeFlags( env['FREEBOB_FLAGS'] ) drv = serverenv.SharedLibrary( "jack_freebob", srcfiles_linux_freebob ) - serverenv.InstallAs( env['libdir']+ "/jackmp/jack_freebob.so", drv ) + serverenv.InstallAs( env['LIBDIR']+ "/jackmp/jack_freebob.so", drv ) if env['ENABLE_FIREWIRE']: if not env.GetOption('clean'): serverenv.MergeFlags( env['FFADO_FLAGS'] ) drv = serverenv.SharedLibrary( "jack_firewire", srcfiles_linux_ffado ) - serverenv.InstallAs( env['libdir']+ "/jackmp/jack_firewire.so", drv ) + serverenv.InstallAs( env['LIBDIR']+ "/jackmp/jack_firewire.so", drv ) diff --git a/macosx/SConscript b/macosx/SConscript index ff5e3a8a..c386dafa 100644 --- a/macosx/SConscript +++ b/macosx/SConscript @@ -1,6 +1,7 @@ # # Copyright (C) 2007 Arnold Krille # Copyright (C) 2007 Pieter Palmers +# Copyright (C) 2008 Marc-Olivier Barre # # This file originates from FFADO (www.ffado.org) # @@ -21,13 +22,13 @@ import os from string import Template -Import( 'env' ) +Import('env') -# paths where include files can be found -env.AppendUnique( CPPPATH=["#/", "#/common", "#/common/jack", "#/macosx"] ) +# Paths to include files +env.AppendUnique(CPPPATH = ['#/', '#/common', '#/common/jack', '#/macosx']) # -# Define the source files +# Source files section # srcfiles_macosx_server = ['#/common/Jackdmp.cpp'] @@ -37,19 +38,19 @@ srcfiles_macosx_coreaudio = ['JackCoreAudioDriver.cpp'] srcfiles_macosx_dummy = ['#/common/JackDummyDriver.cpp'] # -# Start building +# Build/install section # # build the server and its backends serverenv = env.Copy() serverenv.PrependUnique( LIBPATH=env['build_base'] ) -serverenv.PrependUnique( LIBS=["jackdmp", "dl"] ) +serverenv.PrependUnique( LIBS=['jackdmp', 'dl'] ) -server = serverenv.Program("jackdmp", srcfiles_macosx_server) -serverenv.Install( env['bindir'], server ) +server = serverenv.Program('jackdmp', srcfiles_macosx_server) +serverenv.Install( env['BINDIR'], server ) -drv = serverenv.SharedLibrary( "jack_dummy", srcfiles_macosx_dummy ) -serverenv.InstallAs( env['libdir']+ "/jackmp/jack_dummy.so", drv ) +drv = serverenv.SharedLibrary( 'jack_dummy', srcfiles_macosx_dummy ) +serverenv.InstallAs( env['LIBDIR']+ '/jackmp/jack_dummy.so', drv ) -drv = serverenv.SharedLibrary( "jack_coreaudio", srcfiles_macosx_coreaudio ) -serverenv.InstallAs( env['libdir']+ "/jackmp/jack_coreaudio.so", drv ) +drv = serverenv.SharedLibrary( 'jack_coreaudio', srcfiles_macosx_coreaudio ) +serverenv.InstallAs( env['LIBDIR']+ '/jackmp/jack_coreaudio.so', drv ) diff --git a/tests/SConscript b/tests/SConscript index 0a122437..36eb12c6 100644 --- a/tests/SConscript +++ b/tests/SConscript @@ -1,6 +1,7 @@ # # Copyright (C) 2007 Arnold Krille # Copyright (C) 2007 Pieter Palmers +# Copyright (C) 2008 Marc-Olivier Barre # # This file originates from FFADO (www.ffado.org) # @@ -21,32 +22,57 @@ import os from string import Template -Import( 'env' ) +Import('env') -# paths where include files can be found -env.AppendUnique( CPPPATH=["#/", "#/common"] ) +# Paths where include files can be found +env.AppendUnique(CPPPATH=['#/', '#/common']) # -# Define the source files +# Source files section # test_programs = { - "synchroClient" : "testSynchroClient.cpp #/common/JackPosixSemaphore.cpp #/common/JackPosixThread.cpp #/common/JackError.c #/common/JackFifo.cpp", - "synchroServer" : "testSynchroServer.cpp #/common/JackPosixSemaphore.cpp #/common/JackPosixThread.cpp #/common/JackError.c #/common/JackFifo.cpp", - "synchroServerClient" : "testSynchroServerClient.cpp #/common/JackPosixSemaphore.cpp #/common/JackPosixThread.cpp #/common/JackError.c #/common/JackFifo.cpp", - "testSem" : "testSem.cpp #/common/JackPosixSemaphore.cpp #/common/JackPosixThread.cpp #/common/JackError.c #/common/JackFifo.cpp", - "jack_test" : "jack_test.cpp", + 'synchroClient': [ + 'testSynchroClient.cpp', + '#/common/JackPosixSemaphore.cpp', + '#/common/JackPosixThread.cpp', + '#/common/JackError.c', + '#/common/JackFifo.cpp' + ], + 'synchroServer': [ + 'testSynchroServer.cpp', + '#/common/JackPosixSemaphore.cpp', + '#/common/JackPosixThread.cpp', + '#/common/JackError.c', + '#/common/JackFifo.cpp' + ], + 'synchroServerClient': [ + 'testSynchroServerClient.cpp', + '#/common/JackPosixSemaphore.cpp', + '#/common/JackPosixThread.cpp', + '#/common/JackError.c', + '#/common/JackFifo.cpp' + ], + 'testSem': [ + 'testSem.cpp', + '#/common/JackPosixSemaphore.cpp', + '#/common/JackPosixThread.cpp', + '#/common/JackError.c', + '#/common/JackFifo.cpp' + ], + 'jack_test': [ + 'jack_test.cpp' + ], } # -# Start building +# Build section # # build the tests testenv = env.Copy() -testenv.PrependUnique( LIBPATH=env['build_base'] ) -testenv.PrependUnique( LIBS="jackmp" ) +testenv.PrependUnique(LIBPATH=env['build_base']) +testenv.PrependUnique(LIBS='jackmp') -for test_program in test_programs.keys(): - testenv.Program(target=test_program, - source=env.Split( test_programs[test_program] ) ) +for test_program, test_program_source in test_programs.items(): + testenv.Program(test_program, test_program_source)