root/branches/libffado-scons_porting_work/SConstruct

Revision 553, 5.4 kB (checked in by arnonym, 15 years ago)

make ENABLE_ALL work...

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