root/branches/ppalmers-streaming/SConstruct

Revision 688, 7.7 kB (checked in by ppalmers, 16 years ago)

- Remove bebob sync tool, since this is now generalized into the FFADODevice API.

the sync source can be set with tests/test-ffado

- introduce a new directory for firmware tools: support/firmware
- Move the bridgeco firmware downloader to the support/firmware directory
- initial code for echo firmware downloading

Line 
1 #! /usr/bin/env python
2
3 import os
4 from string import Template
5
6 build_dir = ARGUMENTS.get('BUILDDIR', "")
7 if build_dir:
8         build_base=build_dir+'/'
9         if not os.path.isdir( build_base ):
10                 os.makedirs( build_base )
11         print "Building into: " + build_base
12 else:
13         build_base=''
14
15 if not os.path.isdir( "cache" ):
16         os.makedirs( "cache" )
17
18 opts = Options( "cache/"+build_base+"options.cache" )
19
20 #
21 # If this is just to display a help-text for the variable used via ARGUMENTS, then its wrong...
22 opts.Add( "BUILDDIR", "Path to place the built files in", "")
23
24 opts.AddOptions(
25         BoolOption( "DEBUG", """\
26 Toggle debug-build. DEBUG means \"-g -Wall\" and more, otherwise we will use
27   \"-O2\" to optimise.""", True ),
28         PathOption( "PREFIX", "The prefix where ffado will be installed to.", "/usr/local", PathOption.PathAccept ),
29         PathOption( "BINDIR", "Overwrite the directory where apps are installed to.", "$PREFIX/bin", PathOption.PathAccept ),
30         PathOption( "LIBDIR", "Overwrite the directory where libs are installed to.", "$PREFIX/lib", PathOption.PathAccept ),
31         PathOption( "INCLUDEDIR", "Overwrite the directory where headers are installed to.", "$PREFIX/include", PathOption.PathAccept ),
32         PathOption( "SHAREDIR", "Overwrite the directory where misc shared files are installed to.", "$PREFIX/share/libffado", PathOption.PathAccept ),
33         BoolOption( "ENABLE_BEBOB", "Enable/Disable the bebob part.", True ),
34         BoolOption( "ENABLE_FIREWORKS", "Enable/Disable the ECHO Audio FireWorks avc part.", True ),
35         BoolOption( "ENABLE_MOTU", "Enable/Disable the Motu part.", False ),
36         BoolOption( "ENABLE_DICE", "Enable/Disable the DICE part.", False ),
37         BoolOption( "ENABLE_METRIC_HALO", "Enable/Disable the Metric Halo part.", False ),
38         BoolOption( "ENABLE_RME", "Enable/Disable the RME part.", False ),
39         BoolOption( "ENABLE_BOUNCE", "Enable/Disable the BOUNCE part.", False ),
40         BoolOption( "ENABLE_GENERICAVC", """\
41 Enable/Disable the the generic avc part (mainly used by apple).
42   Note that disabling this option might be overwritten by other devices needing
43   this code.""", False ),
44         BoolOption( "ENABLE_ALL", "Enable/Disable support for all devices.", False ),
45         BoolOption( "BUILD_TESTS", """\
46 Build the tests in their directory. As some contain quite some functionality,
47   this is on by default.
48   If you just want to use ffado with jack without the tools, you can disable this.\
49 """, True ),
50         )
51
52 ## Load the builders in config
53 buildenv={}
54 if os.environ.has_key('PATH'):
55         buildenv['PATH']=os.environ['PATH']
56 else:
57         buildenv['PATH']=''
58
59 if os.environ.has_key('PKG_CONFIG_PATH'):
60         buildenv['PKG_CONFIG_PATH']=os.environ['PKG_CONFIG_PATH']
61 else:
62         buildenv['PKG_CONFIG_PATH']=''
63
64
65 env = Environment( tools=['default','scanreplace','pyuic','dbus','doxygen','pkgconfig'], toolpath=['admin'], ENV = buildenv, options=opts )
66
67
68 Help( """
69 For building ffado you can set different options as listed below. You have to
70 specify them only once, scons will save the last value you used and re-use
71 that.
72 To really undo your settings and return to the factory defaults, remove the
73 "cache"-folder and the file ".sconsign.dblite" from this directory.
74 For example with: "rm -Rf .sconsign.dblite cache"
75
76 Currently it seems as if only the BEBOB is kind-of-working, thats why only BEBOB
77 is enabled by default.
78
79 Note that this is a development version! Don't complain if its not working!
80 See www.ffado.org for stable releases.
81 """ )
82 Help( opts.GenerateHelpText( env ) )
83
84 # make sure the necessary dirs exist
85 if not os.path.isdir( "cache/" + build_base ):
86         os.makedirs( "cache/" + build_base )
87 if not os.path.isdir( 'cache/objects' ):
88         os.makedirs( 'cache/objects' )
89
90 CacheDir( 'cache/objects' )
91
92 opts.Save( 'cache/' + build_base + "options.cache", env )
93
94 #
95 # Check for apps...
96 #
97 def CheckForApp( context, app ):
98         context.Message( "Checking if '%s' executes... " % app )
99         ret = context.env.WhereIs( app )
100         if ret != "":
101                 context.Result( True )
102         else:
103                 context.Result( False )
104         return ret
105
106 tests = { 'CheckForApp' : CheckForApp }
107 tests.update( env['PKGCONFIG_TESTS'] )
108
109 if not env.GetOption('clean'):
110         conf = Configure( env,
111                 custom_tests = tests,
112                 conf_dir = "cache/" + build_base,
113                 log_file = "cache/" + build_base + 'config.log' )
114
115         #
116         # Check if the environment can actually compile c-files by checking for a
117         # header shipped with gcc.
118         #
119         if not conf.CheckHeader( "stdio.h" ):
120                 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."
121                 Exit( 1 )
122
123         #
124         # The following checks are for headers and libs and packages we need.
125         #
126         allpresent = 1;
127         allpresent &= conf.CheckHeader( "expat.h" )
128         allpresent &= conf.CheckLib( 'expat', 'XML_ExpatVersion', '#include <expat.h>' )
129        
130         allpresent &= conf.CheckForPKGConfig();
131
132         pkgs = {
133                 'libraw1394' : '1.3.0',
134                 'libavc1394' : '0.5.3',
135                 'libiec61883' : '1.1.0',
136                 'alsa' : '1.0.0',
137                 'libxml++-2.6' : '2.13.0',
138                 'liblo' : '0.22',
139                 'dbus-1' : '1.0',
140                 }
141         for pkg in pkgs:
142                 name2 = pkg.replace("+","").replace(".","").replace("-","").upper()
143                 env['%s_FLAGS' % name2] = conf.GetPKGFlags( pkg, pkgs[pkg] )
144                 if env['%s_FLAGS'%name2] == 0:
145                         allpresent &= 0
146
147         if not allpresent:
148                 print """
149 (At least) One of the dependencies is missing. I can't go on without it, please
150 install the needed packages (remember to also install the *-devel packages)
151 """
152                 Exit( 1 )
153
154         #
155         # Optional checks follow:
156         #
157         env['PYUIC'] = conf.CheckForApp( 'pyuic' )
158         env['ALSA_SEQ_OUTPUT'] = conf.CheckLib( 'asound', symbol='snd_seq_event_output_direct', autoadd=0 )
159
160         env = conf.Finish()
161
162 if env['DEBUG']:
163         print "Doing a DEBUG build"
164         # -Werror could be added to, which would force the devs to really remove all the warnings :-)
165         env.AppendUnique( CCFLAGS=["-DDEBUG","-Wall","-g"] )
166 else:
167         env.AppendUnique( CCFLAGS=["-O2"] )
168
169 # this is required to indicate that the DBUS version we use has support
170 # for platform dependent threading init functions
171 # this is true for DBUS >= 0.96 or so. Since we require >= 1.0 it is
172 # always true
173 env.AppendUnique( CCFLAGS=["-DDBUS_HAS_THREADS_INIT_DEFAULT"] )
174
175 if env['ENABLE_ALL']:
176         env['ENABLE_BEBOB'] = True
177         env['ENABLE_FIREWORKS'] = True
178         env['ENABLE_MOTU'] = True
179         env['ENABLE_DICE'] = True
180         env['ENABLE_METRIC_HALO'] = True
181         env['ENABLE_RME'] = True
182         env['ENABLE_BOUNCE'] = True
183
184 if env['ENABLE_BEBOB'] or env['ENABLE_DICE'] or env['ENABLE_BOUNCE'] or env['ENABLE_FIREWORKS']:
185         env['ENABLE_GENERICAVC'] = True
186
187 if build_base:
188         env['build_base']="#/"+build_base
189 else:
190         env['build_base']="#/"
191
192 #
193 # XXX: Maybe we can even drop these lower-case variables and only use the uppercase ones?
194 #
195 env['bindir'] = Template( os.path.join( env['BINDIR'] ) ).safe_substitute( env )
196 env['libdir'] = Template( os.path.join( env['LIBDIR'] ) ).safe_substitute( env )
197 env['includedir'] = Template( os.path.join( env['INCLUDEDIR'] ) ).safe_substitute( env )
198 env['sharedir'] = Template( os.path.join( env['SHAREDIR'] ) ).safe_substitute( env )
199
200 env.Alias( "install", env['libdir'] )
201 env.Alias( "install", env['includedir'] )
202 env.Alias( "install", env['sharedir'] )
203 env.Alias( "install", env['bindir'] )
204
205 env['PACKAGE'] = "libffado"
206 env['VERSION'] = "1.999.6"
207 env['LIBVERSION'] = "1.0.0"
208
209 #
210 # To have the top_srcdir as the doxygen-script is used from auto*
211 #
212 env['top_srcdir'] = env.Dir( "." ).abspath
213
214 #
215 # Start building
216 #
217
218 env.ScanReplace( "config.h.in" )
219
220 pkgconfig = env.ScanReplace( "libffado.pc.in" )
221 env.Install( env['libdir'] + '/pkgconfig', pkgconfig )
222
223 subdirs=['external','src','libffado','tests','support','doc']
224 if build_base:
225         env.SConscript( dirs=subdirs, exports="env", build_dir=build_base+subdir )
226 else:
227         env.SConscript( dirs=subdirs, exports="env" )
228
229
230 # By default only src is built but all is cleaned
231 if not env.GetOption('clean'):
232     Default( 'external' )
233     Default( 'src' )
234     Default( 'support' )
235     if env['BUILD_TESTS']:
236         Default( 'tests' )
237
Note: See TracBrowser for help on using the browser.