root/trunk/libffado/SConstruct

Revision 1623, 21.8 kB (checked in by arnonym, 14 years ago)

Build-system patrol is back on duty :-)

Line 
1 #! /usr/bin/python
2 #
3 # Copyright (C) 2007-2008 Arnold Krille
4 # Copyright (C) 2007-2008 Pieter Palmers
5 # Copyright (C) 2008 Jonathan Woithe
6 #
7 # This file is part of FFADO
8 # FFADO = Free Firewire (pro-)audio drivers for linux
9 #
10 # FFADO is based upon FreeBoB.
11 #
12 # This program is free software: you can redistribute it and/or modify
13 # it under the terms of the GNU General Public License as published by
14 # the Free Software Foundation, either version 2 of the License, or
15 # (at your option) version 3 of the License.
16 #
17 # This program is distributed in the hope that it will be useful,
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20 # GNU General Public License for more details.
21 #
22 # You should have received a copy of the GNU General Public License
23 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
24 #
25
26 FFADO_API_VERSION="8"
27 FFADO_VERSION="2.999.0"
28
29 import os
30 import re
31 from string import Template
32 import imp
33
34 build_dir = ARGUMENTS.get('BUILDDIR', "")
35 if build_dir:
36         build_base=build_dir+'/'
37         if not os.path.isdir( build_base ):
38                 os.makedirs( build_base )
39         print "Building into: " + build_base
40 else:
41         build_base=''
42
43 if not os.path.isdir( "cache" ):
44         os.makedirs( "cache" )
45
46 opts = Options( "cache/"+build_base+"options.cache" )
47
48 #
49 # If this is just to display a help-text for the variable used via ARGUMENTS, then its wrong...
50 opts.Add( "BUILDDIR", "Path to place the built files in", "")
51
52 opts.AddOptions(
53         BoolOption( "DEBUG", """\
54 Toggle debug-build. DEBUG means \"-g -Wall\" and more, otherwise we will use
55   \"-O2\" to optimize.""", True ),
56         BoolOption( "PROFILE", "Build with symbols and other profiling info", False ),
57         PathOption( "PREFIX", "The prefix where ffado will be installed to.", "/usr/local", PathOption.PathAccept ),
58         PathOption( "BINDIR", "Overwrite the directory where apps are installed to.", "$PREFIX/bin", PathOption.PathAccept ),
59         PathOption( "LIBDIR", "Overwrite the directory where libs are installed to.", "$PREFIX/lib", PathOption.PathAccept ),
60         PathOption( "INCLUDEDIR", "Overwrite the directory where headers are installed to.", "$PREFIX/include", PathOption.PathAccept ),
61         PathOption( "SHAREDIR", "Overwrite the directory where misc shared files are installed to.", "$PREFIX/share/libffado", PathOption.PathAccept ),
62         BoolOption( "ENABLE_BEBOB", "Enable/Disable support for the BeBoB platform.", True ),
63         BoolOption( "ENABLE_FIREWORKS", "Enable/Disable support for the ECHO Audio FireWorks platform.", True ),
64         BoolOption( "ENABLE_OXFORD", "Enable/Disable support for the Oxford Semiconductor FW platform.", True ),
65         BoolOption( "ENABLE_MOTU", "Enable/Disable support for the MOTU platform.", True ),
66         BoolOption( "ENABLE_DICE", "Enable/Disable support for the TCAT DICE platform.", True ),
67         BoolOption( "ENABLE_METRIC_HALO", "Enable/Disable support for the Metric Halo platform.", False ),
68         BoolOption( "ENABLE_RME", "Enable/Disable support for the RME platform.", False ),
69         BoolOption( "ENABLE_MAUDIO", "Enable/Disable support for the M-Audio custom BeBoB devices.", False ),
70         BoolOption( "ENABLE_BOUNCE", "Enable/Disable the BOUNCE device.", False ),
71         BoolOption( "ENABLE_GENERICAVC", """\
72 Enable/Disable the the generic avc part (mainly used by apple).
73   Note that disabling this option might be overwritten by other devices needing
74   this code.""", False ),
75         BoolOption( "ENABLE_ALL", "Enable/Disable support for all devices.", False ),
76         BoolOption( "SERIALIZE_USE_EXPAT", "Use libexpat for XML serialization.", False ),
77         BoolOption( "BUILD_TESTS", """\
78 Build the tests in their directory. As some contain quite some functionality,
79   this is on by default.
80   If you just want to use ffado with jack without the tools, you can disable this.\
81 """, True ),
82     BoolOption( "BUILD_STATIC_TOOLS", "Build a statically linked version of the FFADO tools.", False ),
83     EnumOption('DIST_TARGET', 'Build target for cross compiling packagers', 'auto', allowed_values=('auto', 'i386', 'i686', 'x86_64', 'powerpc', 'powerpc64', 'none' ), ignorecase=2),
84     BoolOption( "ENABLE_OPTIMIZATIONS", "Enable optimizations and the use of processor specific extentions (MMX/SSE/...).", False ),
85         BoolOption( "PEDANTIC", "Enable -Werror and more pedantic options during compile.", False ),
86
87         )
88
89 ## Load the builders in config
90 buildenv=os.environ
91 vars_to_check = [
92         'PATH',
93         'PKG_CONFIG_PATH',
94         'LD_LIBRARY_PATH',
95         'XDG_CONFIG_DIRS',
96         'XDG_DATA_DIRS',
97         'HOME',
98         'CC',
99         'CFLAGS',
100         'CXX',
101         'CXXFLAGS',
102         'CPPFLAGS',
103 ]
104 for var in vars_to_check:
105         if os.environ.has_key(var):
106                 buildenv[var]=os.environ[var]
107         else:
108                 buildenv[var]=''
109
110 env = Environment( tools=['default','scanreplace','pyuic','pyuic4','dbus','doxygen','pkgconfig'], toolpath=['admin'], ENV = buildenv, options=opts )
111
112 if os.environ.has_key('LDFLAGS'):
113         env['LINKFLAGS'] = os.environ['LDFLAGS']
114
115 # grab OS CFLAGS / CCFLAGS
116 env['OS_CFLAGS']=[]
117 if os.environ.has_key('CFLAGS'):
118         env['OS_CFLAGS'] = os.environ['CFLAGS']
119 env['OS_CCFLAGS']=[]
120 if os.environ.has_key('CCFLAGS'):
121         env['OS_CCFLAGS'] = os.environ['CCFLAGS']
122
123 Help( """
124 For building ffado you can set different options as listed below. You have to
125 specify them only once, scons will save the last value you used and re-use
126 that.
127 To really undo your settings and return to the factory defaults, remove the
128 "cache"-folder and the file ".sconsign.dblite" from this directory.
129 For example with: "rm -Rf .sconsign.dblite cache"
130
131 Note that this is a development version! Don't complain if its not working!
132 See www.ffado.org for stable releases.
133 """ )
134 Help( opts.GenerateHelpText( env ) )
135
136 # make sure the necessary dirs exist
137 if not os.path.isdir( "cache/" + build_base ):
138         os.makedirs( "cache/" + build_base )
139 if not os.path.isdir( 'cache/objects' ):
140         os.makedirs( 'cache/objects' )
141
142 CacheDir( 'cache/objects' )
143
144 opts.Save( 'cache/' + build_base + "options.cache", env )
145
146 def ConfigGuess( context ):
147         context.Message( "Trying to find the system triple: " )
148         ret = os.popen( "admin/config.guess" ).read()[:-1]
149         context.Result( ret )
150         return ret
151
152 def CheckForApp( context, app ):
153         context.Message( "Checking whether '" + app + "' executes " )
154         ret = context.TryAction( app )
155         context.Result( ret[0] )
156         return ret[0]
157
158 def CheckForPyModule( context, module ):
159         context.Message( "Checking for the python module '" + module + "' " )
160         ret = context.TryAction( "python $SOURCE", "import %s" % module, ".py" )
161         context.Result( ret[0] )
162         return ret[0]
163
164 def CompilerCheck( context ):
165         context.Message( "Checking for a working C-compiler " )
166         ret = context.TryRun( """
167 #include <stdlib.h>
168
169 int main() {
170         printf( "Hello World!" );
171         return 0;
172 }""", '.c' )[0]
173         context.Result( ret )
174         if ret == 0:
175                 return False;
176         context.Message( "Checking for a working C++-compiler " )
177         ret = context.TryRun( """
178 #include <iostream>
179
180 int main() {
181         std::cout << "Hello World!" << std::endl;
182         return 0;
183 }""", ".cpp" )[0]
184         context.Result( ret )
185         return ret
186
187 tests = {
188         "ConfigGuess" : ConfigGuess,
189         "CheckForApp" : CheckForApp,
190         "CheckForPyModule": CheckForPyModule,
191         "CompilerCheck" : CompilerCheck,
192 }
193 tests.update( env['PKGCONFIG_TESTS'] )
194 tests.update( env['PYUIC_TESTS'] )
195 tests.update( env['PYUIC4_TESTS'] )
196
197 conf = Configure( env,
198         custom_tests = tests,
199         conf_dir = "cache/" + build_base,
200         log_file = "cache/" + build_base + 'config.log' )
201
202 if env['SERIALIZE_USE_EXPAT']:
203         env['SERIALIZE_USE_EXPAT']=1
204 else:
205         env['SERIALIZE_USE_EXPAT']=0
206
207 if env['ENABLE_BOUNCE'] or env['ENABLE_ALL']:
208         env['REQUIRE_LIBAVC']=1
209 else:
210         env['REQUIRE_LIBAVC']=0
211
212 if not env.GetOption('clean'):
213         #
214         # Check for working gcc and g++ compilers and their environment.
215         #
216         if not conf.CompilerCheck():
217                 print "\nIt seems as if your system isn't even able to compile any C-/C++-programs. Probably you don't have gcc and g++ installed. Compiling a package from source without a working compiler is very hard to do, please install the needed packages.\nHint: on *ubuntu you need both gcc- and g++-packages installed, easiest solution is to install build-essential which depends on gcc and g++."
218                 Exit( 1 )
219
220         # Check for pkg-config before using pkg-config to check for other dependencies.
221         if not conf.CheckForPKGConfig():
222                 print "\nThe program 'pkg-config' could not be found.\nEither you have to install the corresponding package first or make sure that PATH points to the right directions."
223                 Exit( 1 )
224
225         #
226         # The following checks are for headers and libs and packages we need.
227         #
228         allpresent = 1;
229         # for DBUS C++ bindings
230         allpresent &= conf.CheckHeader( "expat.h" )
231         allpresent &= conf.CheckLib( 'expat', 'XML_ExpatVersion', '#include <expat.h>' )
232        
233         pkgs = {
234                 'libraw1394' : '1.3.0',
235                 'libiec61883' : '1.1.0',
236                 'dbus-1' : '1.0',
237                 }
238
239         if env['REQUIRE_LIBAVC']:
240                 pkgs['libavc1394'] = '0.5.3'
241
242         if not env['SERIALIZE_USE_EXPAT']:
243                 pkgs['libxml++-2.6'] = '2.13.0'
244
245         for pkg in pkgs:
246                 name2 = pkg.replace("+","").replace(".","").replace("-","").upper()
247                 env['%s_FLAGS' % name2] = conf.GetPKGFlags( pkg, pkgs[pkg] )
248                 #print '%s_FLAGS' % name2
249                 if env['%s_FLAGS'%name2] == 0:
250                         allpresent &= 0
251
252         if not allpresent:
253                 print """
254 (At least) One of the dependencies is missing. I can't go on without it, please
255 install the needed packages for each of the lines saying "no".
256 (Remember to also install the *-devel packages!)
257
258 And remember to remove the cache with "rm -Rf .sconsign.dblite cache" so the
259 results above get rechecked.
260 """
261                 Exit( 1 )
262
263         # Check for C99 lrint() and lrintf() functions used to convert from
264         # float to integer more efficiently via float_cast.h.  If not
265         # present the standard slower methods will be used instead.  This
266         # might not be the best way of testing for these but it's the only
267         # way which seems to work properly.  CheckFunc() fails due to
268         # argument count problems.
269         if env.has_key( 'CFLAGS' ):
270                 oldcf = env['CFLAGS']
271         else:
272                 oldcf = ""
273         oldcf = env.Append(CFLAGS = '-std=c99')
274         if conf.CheckLibWithHeader( "m", "math.h", "c", "lrint(3.2);" ):
275                 HAVE_LRINT = 1
276         else:
277                 HAVE_LRINT = 0
278         if conf.CheckLibWithHeader( "m", "math.h", "c", "lrintf(3.2);" ):
279                 HAVE_LRINTF = 1
280         else:
281                 HAVE_LRINTF = 0
282         env['HAVE_LRINT'] = HAVE_LRINT;
283         env['HAVE_LRINTF'] = HAVE_LRINTF;
284         env.Replace(CFLAGS=oldcf)
285
286 #
287 # Optional checks follow:
288 #
289
290 # PyQT checks
291 build_mixer = False
292 if conf.CheckForApp( 'which pyuic4' ) and conf.CheckForPyModule( 'dbus' ) and conf.CheckForPyModule( 'PyQt4' ) and conf.CheckForPyModule( 'dbus.mainloop.qt' ):
293         env['PYUIC4'] = True
294         build_mixer = True
295
296 if conf.CheckForApp( 'which pyuic' ) and conf.CheckForPyModule( 'dbus' ) and conf.CheckForPyModule( 'qt' ):
297         env['PYUIC'] = True
298         build_mixer = True
299
300 if conf.CheckForApp( 'xdg-desktop-menu --help' ):
301         env['XDG_TOOLS'] = True
302 else:
303         print """
304 I couldn't find the program 'xdg-desktop-menu'. Together with xdg-icon-resource
305 this is needed to add the fancy entry to your menu. But the mixer will be installed, you can start it by executing "ffado-mixer".
306 """
307
308 if not build_mixer and not env.GetOption('clean'):
309         print """
310 I couldn't find all the prerequisites ('pyuic' / 'pyuic4' and the python-modules 'dbus' and
311 'qt' / 'PyQt4', the packages could be named like dbus-python and PyQt) to build the mixer.
312 Therefor neither the qt3 nor the qt4 mixer will get installed.
313 """
314
315 # ALSA checks
316 pkg = 'alsa'
317 name2 = pkg.replace("+","").replace(".","").replace("-","").upper()
318 env['%s_FLAGS' % name2] = conf.GetPKGFlags( pkg, '1.0.0' )
319
320 #
321 # Get the directory where dbus stores the service-files
322 #
323 env['dbus_service_dir'] = conf.GetPKGVariable( 'dbus-1', 'session_bus_services_dir' ).strip()
324
325 config_guess = conf.ConfigGuess()
326
327 env = conf.Finish()
328
329 if env['DEBUG']:
330         print "Doing a DEBUG build"
331         env.MergeFlags( "-DDEBUG -Wall -g" )
332 else:
333         env.MergeFlags( "-O2 -DNDEBUG" )
334
335 if env['PROFILE']:
336         print "Doing a PROFILE build"
337         env.MergeFlags( "-Wall -g" )
338
339 if env['PEDANTIC']:
340         env.MergeFlags( "-Werror" )
341
342
343 # this is required to indicate that the DBUS version we use has support
344 # for platform dependent threading init functions
345 # this is true for DBUS >= 0.96 or so. Since we require >= 1.0 it is
346 # always true
347 env.MergeFlags( "-DDBUS_HAS_THREADS_INIT_DEFAULT" )
348
349 if env['ENABLE_ALL']:
350         env['ENABLE_BEBOB'] = True
351         env['ENABLE_FIREWORKS'] = True
352         env['ENABLE_OXFORD'] = True
353         env['ENABLE_MOTU'] = True
354         env['ENABLE_DICE'] = True
355         env['ENABLE_METRIC_HALO'] = True
356         env['ENABLE_RME'] = True
357         env['ENABLE_BOUNCE'] = True
358         env['ENABLE_MAUDIO'] = True
359
360 if env['ENABLE_BEBOB'] or env['ENABLE_DICE'] \
361    or env['ENABLE_BOUNCE'] or env['ENABLE_FIREWORKS'] \
362    or env['ENABLE_OXFORD'] or env['ENABLE_MAUDIO']:
363         env['ENABLE_GENERICAVC'] = True
364
365 env['BUILD_STATIC_LIB'] = False
366 if env['BUILD_STATIC_TOOLS']:
367     print "Building static versions of the tools..."
368     env['BUILD_STATIC_LIB'] = True
369
370 if build_base:
371         env['build_base']="#/"+build_base
372 else:
373         env['build_base']="#/"
374
375 #
376 # Get the DESTDIR (if wanted) from the commandline
377 #
378 env.destdir = ARGUMENTS.get( 'DESTDIR', "" )
379
380 #
381 # Uppercase variables are for usage in code, lowercase versions for usage in
382 # scons-files for installing.
383 #
384 env['BINDIR'] = Template( env['BINDIR'] ).safe_substitute( env )
385 env['LIBDIR'] = Template( env['LIBDIR'] ).safe_substitute( env )
386 env['INCLUDEDIR'] = Template( env['INCLUDEDIR'] ).safe_substitute( env )
387 env['SHAREDIR'] = Template( env['SHAREDIR'] ).safe_substitute( env )
388 env['bindir'] = Template( env.destdir + env['BINDIR'] ).safe_substitute( env )
389 env['libdir'] = Template( env.destdir + env['LIBDIR'] ).safe_substitute( env )
390 env['includedir'] = Template( env.destdir + env['INCLUDEDIR'] ).safe_substitute( env )
391 env['sharedir'] = Template( env.destdir + env['SHAREDIR'] ).safe_substitute( env )
392
393 env.Command( target=env['sharedir'], source="", action=Mkdir( env['sharedir'] ) )
394
395 env.Alias( "install", env['libdir'] )
396 env.Alias( "install", env['includedir'] )
397 env.Alias( "install", env['sharedir'] )
398 env.Alias( "install", env['bindir'] )
399
400 #
401 # shamelessly copied from the Ardour scons file
402 #
403
404 opt_flags = []
405 env['USE_SSE'] = 0
406
407 # guess at the platform, used to define compiler flags
408
409 config_cpu = 0
410 config_arch = 1
411 config_kernel = 2
412 config_os = 3
413 config = config_guess.split ("-")
414
415 needs_fPIC = False
416
417 # Autodetect
418 if env['DIST_TARGET'] == 'auto':
419     if re.search ("x86_64", config[config_cpu]) != None:
420         env['DIST_TARGET'] = 'x86_64'
421     elif re.search("i[0-5]86", config[config_cpu]) != None:
422         env['DIST_TARGET'] = 'i386'
423     elif re.search("powerpc64", config[config_cpu]) != None:
424         env['DIST_TARGET'] = 'powerpc64'
425     elif re.search("powerpc", config[config_cpu]) != None:
426         env['DIST_TARGET'] = 'powerpc'
427     else:
428         env['DIST_TARGET'] = 'i686'
429     print "Detected DIST_TARGET = " + env['DIST_TARGET']
430
431 if ((re.search ("i[0-9]86", config[config_cpu]) != None) or (re.search ("x86_64", config[config_cpu]) != None) or (re.search ("powerpc", config[config_cpu]) != None)):
432    
433     build_host_supports_sse = 0
434     build_host_supports_sse2 = 0
435     build_host_supports_sse3 = 0
436
437     if config[config_kernel] == 'linux' :
438        
439         if (env['DIST_TARGET'] == 'i686') or (env['DIST_TARGET'] == 'x86_64'):
440            
441             flag_line = os.popen ("cat /proc/cpuinfo | grep '^flags'").read()[:-1]
442             x86_flags = flag_line.split (": ")[1:][0].split ()
443            
444             if "mmx" in x86_flags:
445                 opt_flags.append ("-mmmx")
446             if "sse" in x86_flags:
447                 build_host_supports_sse = 1
448             if "sse2" in x86_flags:
449                 build_host_supports_sse2 = 1
450             #if "sse3" in x86_flags:
451                 #build_host_supports_sse3 = 1
452             if "3dnow" in x86_flags:
453                 opt_flags.append ("-m3dnow")
454            
455             if config[config_cpu] == "i586":
456                 opt_flags.append ("-march=i586")
457             elif config[config_cpu] == "i686":
458                 opt_flags.append ("-march=i686")
459
460         elif (env['DIST_TARGET'] == 'powerpc') or (env['DIST_TARGET'] == 'powerpc64'):
461
462             cpu_line = os.popen ("cat /proc/cpuinfo | grep '^cpu'").read()[:-1]
463
464             ppc_type = cpu_line.split (": ")[1]
465             if re.search ("altivec", ppc_type) != None:
466                 opt_flags.append ("-maltivec")
467                 opt_flags.append ("-mabi=altivec")
468
469             ppc_type = ppc_type.split (", ")[0]
470             if re.match ("74[0145][0578]A?", ppc_type) != None:
471                 opt_flags.append ("-mcpu=7400")
472                 opt_flags.append ("-mtune=7400")
473             elif re.match ("750", ppc_type) != None:
474                 opt_flags.append ("-mcpu=750")
475                 opt_flags.append ("-mtune=750")
476             elif re.match ("PPC970", ppc_type) != None:
477                 opt_flags.append ("-mcpu=970")
478                 opt_flags.append ("-mtune=970")
479             elif re.match ("Cell Broadband Engine", ppc_type) != None:
480                 opt_flags.append ("-mcpu=cell")
481                 opt_flags.append ("-mtune=cell")
482
483     if ((env['DIST_TARGET'] == 'i686') or (env['DIST_TARGET'] == 'x86_64')) \
484        and build_host_supports_sse and env['ENABLE_OPTIMIZATIONS']:
485         opt_flags.extend (["-msse", "-mfpmath=sse"])
486         env['USE_SSE'] = 1
487
488     if ((env['DIST_TARGET'] == 'i686') or (env['DIST_TARGET'] == 'x86_64')) \
489        and build_host_supports_sse2 and env['ENABLE_OPTIMIZATIONS']:
490         opt_flags.extend (["-msse2"])
491         env['USE_SSE2'] = 1
492
493     #if ((env['DIST_TARGET'] == 'i686') or (env['DIST_TARGET'] == 'x86_64')) \
494        #and build_host_supports_sse2 and env['ENABLE_OPTIMIZATIONS']:
495         #opt_flags.extend (["-msse3"])
496         #env['USE_SSE3'] = 1
497
498     # build for 64-bit userland?
499     if env['DIST_TARGET'] == "powerpc64":
500         print "Doing a 64-bit PowerPC build"
501         env.MergeFlags( "-m64" )
502     elif env['DIST_TARGET'] == "x86_64":
503         print "Doing a 64-bit x86 build"
504         env.MergeFlags( "-m64" )
505         needs_fPIC = True
506     else:
507         print "Doing a 32-bit build"
508         env.MergeFlags( "-m32" )
509
510 if needs_fPIC or '-fPIC' in env['OS_CFLAGS'] or "-fPIC" in env['OS_CCFLAGS']:
511     env.MergeFlags( "-fPIC" )
512
513 # end of processor-specific section
514 if env['ENABLE_OPTIMIZATIONS']:
515     opt_flags.extend (["-fomit-frame-pointer","-ffast-math","-funroll-loops"])
516     env.MergeFlags( opt_flags )
517     print "Doing an optimized build..."
518
519 env['REVISION'] = os.popen('svnversion .').read()[:-1]
520 # This may be as simple as '89' or as complex as '4123:4184M'.
521 # We'll just use the last bit.
522 env['REVISION'] = env['REVISION'].split(':')[-1]
523
524 # try to circumvent localized versions
525 if len(env['REVISION']) >= 5 and env['REVISION'][0:6] == 'export':
526         env['REVISION'] = ''
527
528 env['FFADO_API_VERSION']=FFADO_API_VERSION
529
530 env['PACKAGE'] = "libffado"
531 env['VERSION'] = FFADO_VERSION
532 env['LIBVERSION'] = "1.0.0"
533
534 env['CONFIGDIR'] = "~/.ffado"
535 env['CACHEDIR'] = "~/.ffado"
536
537 env['USER_CONFIG_FILE'] = env['CONFIGDIR'] + "/configuration"
538 env['SYSTEM_CONFIG_FILE'] = env['SHAREDIR'] + "/configuration"
539
540 env['REGISTRATION_URL'] = "http://ffado.org/deviceregistration/register.php?action=register"
541
542 #
543 # To have the top_srcdir as the doxygen-script is used from auto*
544 #
545 env['top_srcdir'] = env.Dir( "." ).abspath
546
547 #
548 # Start building
549 #
550 env.ScanReplace( "config.h.in" )
551 env.ScanReplace( "config_debug.h.in" )
552 env.ScanReplace( "version.h.in" )
553
554 # ensure that the config.h is updated
555 env.Depends( "config.h", "SConstruct" )
556 env.Depends( "config.h", 'cache/' + build_base + "options.cache" )
557
558 # update version.h whenever the version or SVN revision changes
559 env.Depends( "version.h", env.Value(env['REVISION']))
560 env.Depends( "version.h", env.Value(env['VERSION']))
561
562 env.Depends( "libffado.pc", "SConstruct" )
563 pkgconfig = env.ScanReplace( "libffado.pc.in" )
564 env.Install( env['libdir'] + '/pkgconfig', pkgconfig )
565
566 env.Install( env['sharedir'], 'configuration' )
567
568 subdirs=['external','src','libffado','support','doc']
569 if env['BUILD_TESTS']:
570         subdirs.append('tests')
571
572 if build_base:
573         #env.SConscript( dirs=subdirs, exports="env", build_dir=build_base )
574         builddirs = list()
575         for dir in subdirs:
576                 builddirs.append( build_base + dir )
577         env.SConscript( dirs=subdirs, exports="env", build_dir=builddirs )
578 else:
579         env.SConscript( dirs=subdirs, exports="env" )
580
581 if 'debian' in COMMAND_LINE_TARGETS:
582         env.SConscript("deb/SConscript", exports="env")
583
584 # By default only src is built but all is cleaned
585 if not env.GetOption('clean'):
586     Default( 'src' )
587     Default( 'support' )
588     if env['BUILD_TESTS']:
589         Default( 'tests' )
590
591 #
592 # Deal with the DESTDIR vs. xdg-tools conflict (which is basicely that the
593 # xdg-tools can't deal with DESTDIR, so the packagers have to deal with this
594 # their own :-/
595 #
596 if len(env.destdir) > 0:
597         if not len( ARGUMENTS.get( "WILL_DEAL_WITH_XDG_MYSELF", "" ) ) > 0:
598                 print """
599 WARNING!
600 You are using the (packagers) option DESTDIR to install this package to a
601 different place than the real prefix. As the xdg-tools can't cope with
602 that, the .desktop-files are not installed by this build, you have to
603 deal with them your own.
604 (And you have to look into the SConstruct to learn how to disable this
605 message.)
606 """
607 else:
608
609         def CleanAction( action ):
610                 if env.GetOption( "clean" ):
611                         env.Execute( action )
612
613         if env.has_key( 'XDG_TOOLS' ) and env.has_key( 'PYUIC4' ):
614                 if not env.GetOption("clean"):
615                         action = "install"
616                 else:
617                         action = "uninstall"
618                 mixerdesktopaction = env.Action( "xdg-desktop-menu %s support/xdg/ffado.org-ffadomixer.desktop" % action )
619                 mixericonaction = env.Action( "xdg-icon-resource %s --size 64 --novendor --context apps support/xdg/hi64-apps-ffado.png ffado" % action )
620                 env.Command( "__xdgstuff1", None, mixerdesktopaction )
621                 env.Command( "__xdgstuff2", None, mixericonaction )
622                 env.Alias( "install", ["__xdgstuff1", "__xdgstuff2" ] )
623                 CleanAction( mixerdesktopaction )
624                 CleanAction( mixericonaction )
625
626 #
627 # Create a tags-file for easier emacs/vim-source-browsing
628 #  I don't know if the dependency is right...
629 #
630 findcommand = "find . \( -path \"*.h\" -o -path \"*.cpp\" -o -path \"*.c\" \) \! -path \"*.svn*\" \! -path \"./doc*\" \! -path \"./cache*\""
631 env.Command( "tags", "", findcommand + " |xargs ctags" )
632 env.Command( "TAGS", "", findcommand + " |xargs etags" )
633 env.AlwaysBuild( "tags", "TAGS" )
634 if 'NoCache' in dir(env):
635     env.NoCache( "tags", "TAGS" )
636
637 # Another convinience target
638 if env.GetOption( "clean" ):
639         env.Execute( "rm cache/objects -Rf" )
640
Note: See TracBrowser for help on using the browser.