root/trunk/libffado/SConstruct

Revision 1336, 22.2 kB (checked in by ppalmers, 16 years ago)

Bring trunk up to date with branches/libffado-2.0:

"""
svn merge -r 1254:1299 svn+ssh://ffadosvn@ffado.org/ffado/branches/libffado-2.0
svn merge -r 1301:1320 svn+ssh://ffadosvn@ffado.org/ffado/branches/libffado-2.0
svn merge -r 1322:1323 svn+ssh://ffadosvn@ffado.org/ffado/branches/libffado-2.0
svn merge -r 1329:HEAD svn+ssh://ffadosvn@ffado.org/ffado/branches/libffado-2.0
"""

Add getSupportedSamplingFrequencies() to DICE, RME and Metric Halo AvDevices?

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