root/trunk/libffado/SConstruct

Revision 742, 8.8 kB (checked in by ppalmers, 13 years ago)

- Remove some obsolete support files and dirs

- Clean up the license statements in the source files. Everything is

GPL version 3 now.

- Add license and copyright notices to scons scripts

- Clean up some other text files

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