root/branches/libffado-2.0/SConstruct

Revision 1389, 20.4 kB (checked in by arnonym, 12 years ago)

This should be the nail on #69's coffin.

Somehow the compile doesn't fail when there is no compiler found... Trying to execute the generated app and failing seems to do the trick.

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