root/trunk/libffado/SConstruct

Revision 1638, 22.1 kB (checked in by arnonym, 12 years ago)

Remove the old qt3 mixer. Only ports from 2.0 branch where happening here. And the new work in trunk is in the qt4 mixer. And Qt3 is unsupported since quite some time already. ppalmers okayed it...

I added a temporary code-segment to sconscript to remove the qt3 mixer stuff from the installation on the devs machines. Hopefully I remember to remove that code in two or three weeks.

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