root/trunk/libffado/SConstruct

Revision 1491, 21.3 kB (checked in by arnonym, 12 years ago)

multiple things:

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