root/branches/libffado-scons_porting_work/SConstruct

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

Add some more config options.

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_BEBOB'] or env['ENABLE_ALL']:
90         env.AppendUnique( CCFLAGS=["-DENABLE_BEBOB"] )
91 if env['ENABLE_MOTU'] or env['ENABLE_ALL']:
92         env.AppendUnique( CCFLAGS=["-DENABLE_MOTU"] )
93 if env['ENABLE_DICE'] or env['ENABLE_ALL']:
94         env.AppendUnique( CCFLAGS=["-DENABLE_DICE"] )
95 if env['ENABLE_METRIC_HALO'] or env['ENABLE_ALL']:
96         env.AppendUnique( CCFLAGS=["-DENABLE_METRIC_HALO"] )
97 if env['ENABLE_RME'] or env['ENABLE_ALL']:
98         env.AppendUnique( CCFLAGS=["-DENABLE_RME"] )
99 if env['ENABLE_BOUNCE'] or env['ENABLE_ALL']:
100         env.AppendUnique( CCFLAGS=["-DENABLE_BOUNCE"] )
101
102 env.MergeFlags( ["!pkg-config --cflags --libs libraw1394"] )
103 env.MergeFlags( ["!pkg-config --cflags --libs libavc1394"] )
104 env.MergeFlags( ["!pkg-config --cflags --libs libiec61883"] )
105 env.MergeFlags( ["!pkg-config --cflags --libs alsa"] )
106 env.MergeFlags( ["!pkg-config --cflags --libs libxml++-2.6"] )
107 env.MergeFlags( ["!pkg-config --cflags --libs liblo"] )
108
109
110 #
111 # Some includes in src/*/ are full path (src/*), that should be fixed?
112 env.AppendUnique( CPPPATH=["#/"] )
113
114 env['bindir'] = os.path.join( env['PREFIX'], "bin" )
115 env['libdir'] = os.path.join( env['PREFIX'], "lib" )
116 env['includedir'] = os.path.join( env['PREFIX'], "include" )
117 env['sharedir'] = os.path.join( env['PREFIX'], "share/libffado" )
118 env['cachedir'] = os.path.join( env['PREFIX'], "var/cache/libffado" )
119
120 env.Alias( "install", env['libdir'] )
121 env.Alias( "install", env['includedir'] )
122
123 env['PACKAGE'] = "libffado"
124 env['VERSION'] = "1.999.5"
125 env['LIBVERSION'] = "1.0.0"
126
127 #
128 # Start building
129 #
130
131 env.ScanReplace( "config.h.in" )
132 pkgconfig = env.ScanReplace( "libffado.pc.in" )
133 env.Alias( "install", env.Install( env['libdir'] + '/pkgconfig', pkgconfig ) )
134
135
136 env.SConscript( dirs=['src','libffado','tests','support'], exports="env" )
137
138 # By default only src is built but all is cleaned
139 if not env.GetOption('clean'):
140         Default( 'src' )
141         if env['BUILD_TESTS']:
142                 Default( 'tests' )
143         #env.Alias( "install", env["cachedir"], os.makedirs( env["cachedir"] ) )
144         env.Alias( "install", env.Install( env["cachedir"], "" ) ) #os.makedirs( env["cachedir"] ) )
145
146
Note: See TracBrowser for help on using the browser.