root/branches/libffado-2.0/SConstruct

Revision 1428, 20.9 kB (checked in by arnonym, 12 years ago)

Fix #171: Correctly search for python-modules with hierarchy (bla.blub.X). And search for dbus.mainloop.qt...

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