root/trunk/libffado/SConstruct

Revision 1535, 21.3 kB (checked in by ppalmers, 15 years ago)

add support for the FCA-202, and possibly other Oxford FW-92x devices

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