root/trunk/libffado/SConstruct

Revision 1493, 21.5 kB (checked in by arnonym, 15 years ago)

Try to install a service-file for dbus if possible. This allows for dbus to start the ffado-dbus-server automaticly when someone wants to connect to org.ffado.Control.

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