root/trunk/libffado/SConstruct

Revision 718, 7.6 kB (checked in by arnonym, 16 years ago)

Disable the pyuic-test. its wrong.

And maybe try to create the sharedir. scons should to it automaticly but who knows. at least esox seemed to have problems with that...

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 if os.environ.has_key('LD_LIBRARY_PATH'):
65         buildenv['LD_LIBRARY_PATH']=os.environ['LD_LIBRARY_PATH']
66 else:
67         buildenv['LD_LIBRARY_PATH']=''
68
69
70 env = Environment( tools=['default','scanreplace','pyuic','dbus','doxygen','pkgconfig'], toolpath=['admin'], ENV = buildenv, options=opts )
71
72
73 Help( """
74 For building ffado you can set different options as listed below. You have to
75 specify them only once, scons will save the last value you used and re-use
76 that.
77 To really undo your settings and return to the factory defaults, remove the
78 "cache"-folder and the file ".sconsign.dblite" from this directory.
79 For example with: "rm -Rf .sconsign.dblite cache"
80
81 Currently it seems as if only the BEBOB is kind-of-working, thats why only BEBOB
82 is enabled by default.
83
84 Note that this is a development version! Don't complain if its not working!
85 See www.ffado.org for stable releases.
86 """ )
87 Help( opts.GenerateHelpText( env ) )
88
89 # make sure the necessary dirs exist
90 if not os.path.isdir( "cache/" + build_base ):
91         os.makedirs( "cache/" + build_base )
92 if not os.path.isdir( 'cache/objects' ):
93         os.makedirs( 'cache/objects' )
94
95 CacheDir( 'cache/objects' )
96
97 opts.Save( 'cache/' + build_base + "options.cache", env )
98
99
100 tests = {}
101 tests.update( env['PKGCONFIG_TESTS'] )
102
103 if not env.GetOption('clean'):
104         conf = Configure( env,
105                 custom_tests = tests,
106                 conf_dir = "cache/" + build_base,
107                 log_file = "cache/" + build_base + 'config.log' )
108
109         #
110         # Check if the environment can actually compile c-files by checking for a
111         # header shipped with gcc.
112         #
113         if not conf.CheckHeader( "stdio.h" ):
114                 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."
115                 Exit( 1 )
116
117         #
118         # The following checks are for headers and libs and packages we need.
119         #
120         allpresent = 1;
121         allpresent &= conf.CheckHeader( "expat.h" )
122         allpresent &= conf.CheckLib( 'expat', 'XML_ExpatVersion', '#include <expat.h>' )
123        
124         allpresent &= conf.CheckForPKGConfig();
125
126         pkgs = {
127                 'libraw1394' : '1.3.0',
128                 'libavc1394' : '0.5.3',
129                 'libiec61883' : '1.1.0',
130                 'alsa' : '1.0.0',
131                 'libxml++-2.6' : '2.13.0',
132                 'liblo' : '0.22',
133                 'dbus-1' : '1.0',
134                 }
135         for pkg in pkgs:
136                 name2 = pkg.replace("+","").replace(".","").replace("-","").upper()
137                 env['%s_FLAGS' % name2] = conf.GetPKGFlags( pkg, pkgs[pkg] )
138                 if env['%s_FLAGS'%name2] == 0:
139                         allpresent &= 0
140
141         if not allpresent:
142                 print """
143 (At least) One of the dependencies is missing. I can't go on without it, please
144 install the needed packages (remember to also install the *-devel packages)
145 """
146                 Exit( 1 )
147
148         #
149         # Optional checks follow:
150         #
151         env['ALSA_SEQ_OUTPUT'] = conf.CheckLib( 'asound', symbol='snd_seq_event_output_direct', autoadd=0 )
152
153         env = conf.Finish()
154
155 if env['DEBUG']:
156         print "Doing a DEBUG build"
157         # -Werror could be added to, which would force the devs to really remove all the warnings :-)
158         env.AppendUnique( CCFLAGS=["-DDEBUG","-Wall","-g"] )
159 else:
160         env.AppendUnique( CCFLAGS=["-O2"] )
161
162 # this is required to indicate that the DBUS version we use has support
163 # for platform dependent threading init functions
164 # this is true for DBUS >= 0.96 or so. Since we require >= 1.0 it is
165 # always true
166 env.AppendUnique( CCFLAGS=["-DDBUS_HAS_THREADS_INIT_DEFAULT"] )
167
168 if env['ENABLE_ALL']:
169         env['ENABLE_BEBOB'] = True
170         env['ENABLE_FIREWORKS'] = True
171         env['ENABLE_MOTU'] = True
172         env['ENABLE_DICE'] = True
173         env['ENABLE_METRIC_HALO'] = True
174         env['ENABLE_RME'] = True
175         env['ENABLE_BOUNCE'] = True
176
177 if env['ENABLE_BEBOB'] or env['ENABLE_DICE'] or env['ENABLE_BOUNCE'] or env['ENABLE_FIREWORKS']:
178         env['ENABLE_GENERICAVC'] = True
179
180 if build_base:
181         env['build_base']="#/"+build_base
182 else:
183         env['build_base']="#/"
184
185 #
186 # XXX: Maybe we can even drop these lower-case variables and only use the uppercase ones?
187 #
188 env['bindir'] = Template( os.path.join( env['BINDIR'] ) ).safe_substitute( env )
189 env['libdir'] = Template( os.path.join( env['LIBDIR'] ) ).safe_substitute( env )
190 env['includedir'] = Template( os.path.join( env['INCLUDEDIR'] ) ).safe_substitute( env )
191 env['sharedir'] = Template( os.path.join( env['SHAREDIR'] ) ).safe_substitute( env )
192
193 env.Command( target=env['sharedir'], source="", action=Mkdir( env['sharedir'] ) )
194
195 env.Alias( "install", env['libdir'] )
196 env.Alias( "install", env['includedir'] )
197 env.Alias( "install", env['sharedir'] )
198 env.Alias( "install", env['bindir'] )
199
200 env['PACKAGE'] = "libffado"
201 env['VERSION'] = "1.999.6"
202 env['LIBVERSION'] = "1.0.0"
203
204 #
205 # To have the top_srcdir as the doxygen-script is used from auto*
206 #
207 env['top_srcdir'] = env.Dir( "." ).abspath
208
209 #
210 # Start building
211 #
212
213 env.ScanReplace( "config.h.in" )
214
215 pkgconfig = env.ScanReplace( "libffado.pc.in" )
216 env.Install( env['libdir'] + '/pkgconfig', pkgconfig )
217
218 subdirs=['external','src','libffado','tests','support','doc']
219 if build_base:
220         env.SConscript( dirs=subdirs, exports="env", build_dir=build_base+subdir )
221 else:
222         env.SConscript( dirs=subdirs, exports="env" )
223
224
225 # By default only src is built but all is cleaned
226 if not env.GetOption('clean'):
227     Default( 'external' )
228     Default( 'src' )
229     Default( 'support' )
230     if env['BUILD_TESTS']:
231         Default( 'tests' )
232
Note: See TracBrowser for help on using the browser.