root/branches/libffado-2.0/SConstruct

Revision 1455, 21.0 kB (checked in by arnonym, 12 years ago)

Import more env variables. This allows packagers (and from-source-optimizers) to break things but now we know whom to blame. ;-)

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