root/branches/libffado-scons_porting_work/SConstruct

Revision 534, 4.8 kB (checked in by arnonym, 17 years ago)

Cache the built files.

And add "-O2" to the gcc-options if not in debug mode...

Line 
1 #! /usr/bin/env python
2
3 import os
4 import sys
5 sys.path.append( "./admin" )
6 from pkgconfig import *
7
8 if not os.path.isdir( "cache" ):
9         os.mkdir( "cache" )
10         os.mkdir( "cache/objects" )
11
12 opts = Options( "cache/options.cache" )
13
14 opts.Add( BoolOption( "DEBUG", "Toggle debug-build.", True ) )
15 opts.AddOptions(
16         BoolOption( "ENABLE_BEBOB", "Enable/Disable the bebob part.", True ),
17         BoolOption( "ENABLE_MOTU", "Enable/Disable the Motu part.", False ),
18         BoolOption( "ENABLE_DICE", "Enable/Disable the DICE part.", False ),
19         BoolOption( "ENABLE_METRIC_HALO", "Enable/Disable the Metric Halo part.", False ),
20         BoolOption( "ENABLE_RME", "Enable/Disable the RME part.", False ),
21         BoolOption( "ENABLE_BOUNCE", "Enable/Disable the BOUNCE part.", False ),
22         PathOption( "PREFIX", "The prefix where ffado will be installed to.", "/usr/local" ),
23         )
24
25 ## Load the builders in config
26 env = Environment( tools=['default','scanreplace','pyuic'], toolpath=['admin'], ENV = { 'PATH' : os.environ['PATH'], 'PKG_CONFIG_PATH' : os.environ['PKG_CONFIG_PATH'] }, options=opts )
27
28 Help( """
29 For building ffado you can set different options as listed below. You have to
30 specify them only once, scons will save the last value you used and re-use
31 that.
32 To really undo your settings and return to the factory defaults, remove the
33 "cache"-folder and the file ".sconsign.dblite" from this directory.
34 For example with: "rm -Rf .sconsign.dblite cache"
35
36 Currently it seems as if only the BEBOB and the MOTU drivers are
37 kind-of-working, thats why only BEBOB is enabled by default.
38
39 Note that this is a development version! Don't complain if its not working!
40 See www.ffado.org for stable releases.
41 """ )
42 Help( opts.GenerateHelpText( env ) )
43
44 opts.Save( "cache/options.cache", env )
45
46 CacheDir( 'cache/objects' )
47
48 if not env.GetOption('clean'):
49         conf = Configure( env, custom_tests={ 'CheckForPKGConfig' : CheckForPKGConfig, 'CheckForPKG' : CheckForPKG }, conf_dir='cache', log_file='cache/config.log' )
50
51         if not conf.CheckHeader( "stdio.h" ):
52                 print "It seems as if stdio.h is missing. This probably means that your build environment is broken, please make sure you have a working c-compiler and libstdc installed and usable."
53                 Exit( 1 )
54
55         allpresent = 1;
56         allpresent &= conf.CheckForPKGConfig();
57         allpresent &= conf.CheckForPKG( 'libraw1394', "1.3.0" )
58         allpresent &= conf.CheckForPKG( 'libavc1394', "0.5.3" )
59         allpresent &= conf.CheckForPKG( 'libiec61883', "1.1.0" )
60         allpresent &= conf.CheckForPKG( 'alsa', "1.0.0" )
61         allpresent &= conf.CheckForPKG( 'libxml++-2.6', "2.13.0" )
62         allpresent &= conf.CheckForPKG( 'liblo', "0.22" )
63
64         if not allpresent:
65                 print """
66 (At least) One of the dependencies is missing. I can't go on without it, please
67 install the needed packages (remember to also install the *-devel packages)
68 """
69                 Exit( 1 )
70
71         env = conf.Finish()
72
73
74 if env['DEBUG']:
75         print "Doing a debug build"
76         # -Werror could be added to, which would force the devs to really remove all the warnings :-)
77         env.AppendUnique( CCFLAGS=["-DDEBUG","-Wall","-g"] )
78 else:
79         env.AppendUnique( CCFLAGS=["-O2"] )
80
81
82 if env['ENABLE_BEBOB']:
83         env.AppendUnique( CCFLAGS=["-DENABLE_BEBOB"] )
84 if env['ENABLE_MOTU']:
85         env.AppendUnique( CCFLAGS=["-DENABLE_MOTU"] )
86 if env['ENABLE_DICE']:
87         env.AppendUnique( CCFLAGS=["-DENABLE_DICE"] )
88 if env['ENABLE_METRIC_HALO']:
89         env.AppendUnique( CCFLAGS=["-DENABLE_METRIC_HALO"] )
90 if env['ENABLE_RME']:
91         env.AppendUnique( CCFLAGS=["-DENABLE_RME"] )
92 if env['ENABLE_BOUNCE']:
93         env.AppendUnique( CCFLAGS=["-DENABLE_BOUNCE"] )
94
95 env.MergeFlags( ["!pkg-config --cflags --libs libraw1394"] )
96 env.MergeFlags( ["!pkg-config --cflags --libs libavc1394"] )
97 env.MergeFlags( ["!pkg-config --cflags --libs libiec61883"] )
98 env.MergeFlags( ["!pkg-config --cflags --libs alsa"] )
99 env.MergeFlags( ["!pkg-config --cflags --libs libxml++-2.6"] )
100 env.MergeFlags( ["!pkg-config --cflags --libs liblo"] )
101
102
103 #
104 # Some includes in src/*/ are full path (src/*), that should be fixed?
105 env.AppendUnique( CPPPATH=["#/"] )
106
107 env['bindir'] = os.path.join( env['PREFIX'], "bin" )
108 env['libdir'] = os.path.join( env['PREFIX'], "lib" )
109 env['includedir'] = os.path.join( env['PREFIX'], "include" )
110 env['sharedir'] = os.path.join( env['PREFIX'], "share/libffado" )
111 env['cachedir'] = os.path.join( env['PREFIX'], "var/cache/libffado" )
112
113 env.Alias( "install", env['libdir'] )
114 env.Alias( "install", env['includedir'] )
115
116 env['PACKAGE'] = "libffado"
117 env['VERSION'] = "1.999.5"
118 env['LIBVERSION'] = "1.0.0"
119
120 #
121 # Start building
122 #
123
124 env.ScanReplace( "config.h.in" )
125 pkgconfig = env.ScanReplace( "libffado.pc.in" )
126 env.Alias( "install", env.Install( env['libdir'] + '/pkgconfig', pkgconfig ) )
127
128
129 env.SConscript( dirs=['src','libffado','tests','support'], exports="env" )
130
131 # By default only src is built but all is cleaned
132 if not env.GetOption('clean'):
133         Default( 'src' )
134         #env.Alias( "install", env["cachedir"], os.makedirs( env["cachedir"] ) )
135         env.Alias( "install", env.Install( env["cachedir"], "" ) ) #os.makedirs( env["cachedir"] ) )
136
137
Note: See TracBrowser for help on using the browser.