1 |
#! /usr/bin/env python |
---|
2 |
|
---|
3 |
import os |
---|
4 |
import sys |
---|
5 |
sys.path.append( "./admin" ) |
---|
6 |
from pkgconfig import * |
---|
7 |
|
---|
8 |
build_dir = ARGUMENTS.get('BUILDDIR', "") |
---|
9 |
if build_dir: |
---|
10 |
build_base=build_dir+'/' |
---|
11 |
if not os.path.isdir( build_base ): |
---|
12 |
os.makedirs( build_base ) |
---|
13 |
print "Building into: " + build_base |
---|
14 |
else: |
---|
15 |
build_base='' |
---|
16 |
|
---|
17 |
if not os.path.isdir( "cache" ): |
---|
18 |
os.makedirs( "cache" ) |
---|
19 |
|
---|
20 |
opts = Options( "cache/"+build_base+"options.cache" ) |
---|
21 |
|
---|
22 |
# |
---|
23 |
# If this is just to display a help-text for the variable used via ARGUMENTS, then its wrong... |
---|
24 |
opts.Add( "BUILDDIR", "Path to place the built files in", "") |
---|
25 |
|
---|
26 |
opts.AddOptions( |
---|
27 |
BoolOption( "DEBUG", """\ |
---|
28 |
Toggle debug-build. DEBUG means \"-g -Wall\" and more, otherwise we will use |
---|
29 |
\"-O2\" to optimise.""", True ), |
---|
30 |
PathOption( "PREFIX", "The prefix where ffado will be installed to.", "/usr/local" ), |
---|
31 |
BoolOption( "ENABLE_BEBOB", "Enable/Disable the bebob part.", True ), |
---|
32 |
BoolOption( "ENABLE_FIREWORKS", "Enable/Disable the ECHO Audio FireWorks avc part.", True ), |
---|
33 |
BoolOption( "ENABLE_MOTU", "Enable/Disable the Motu part.", False ), |
---|
34 |
BoolOption( "ENABLE_DICE", "Enable/Disable the DICE part.", False ), |
---|
35 |
BoolOption( "ENABLE_METRIC_HALO", "Enable/Disable the Metric Halo part.", False ), |
---|
36 |
BoolOption( "ENABLE_RME", "Enable/Disable the RME part.", False ), |
---|
37 |
BoolOption( "ENABLE_BOUNCE", "Enable/Disable the BOUNCE part.", False ), |
---|
38 |
BoolOption( "ENABLE_GENERICAVC", """\ |
---|
39 |
Enable/Disable the the generic avc part (mainly used by apple). |
---|
40 |
Note that disabling this option might be overwritten by other devices needing |
---|
41 |
this code.""", False ), |
---|
42 |
BoolOption( "ENABLE_ALL", "Enable/Disable support for all devices.", False ), |
---|
43 |
BoolOption( "BUILD_TESTS", """\ |
---|
44 |
Build the tests in their directory. As some contain quite some functionality, |
---|
45 |
this is on by default. |
---|
46 |
If you just want to use ffado with jack without the tools, you can disable this.\ |
---|
47 |
""", True ), |
---|
48 |
) |
---|
49 |
|
---|
50 |
## Load the builders in config |
---|
51 |
buildenv={} |
---|
52 |
if os.environ.has_key('PATH'): |
---|
53 |
buildenv['PATH']=os.environ['PATH'] |
---|
54 |
else: |
---|
55 |
buildenv['PATH']='' |
---|
56 |
|
---|
57 |
if os.environ.has_key('PKG_CONFIG_PATH'): |
---|
58 |
buildenv['PKG_CONFIG_PATH']=os.environ['PKG_CONFIG_PATH'] |
---|
59 |
else: |
---|
60 |
buildenv['PKG_CONFIG_PATH']='' |
---|
61 |
|
---|
62 |
env = Environment( tools=['default','scanreplace','pyuic','dbus'], toolpath=['admin'], ENV = buildenv, options=opts ) |
---|
63 |
|
---|
64 |
Help( """ |
---|
65 |
For building ffado you can set different options as listed below. You have to |
---|
66 |
specify them only once, scons will save the last value you used and re-use |
---|
67 |
that. |
---|
68 |
To really undo your settings and return to the factory defaults, remove the |
---|
69 |
"cache"-folder and the file ".sconsign.dblite" from this directory. |
---|
70 |
For example with: "rm -Rf .sconsign.dblite cache" |
---|
71 |
|
---|
72 |
Currently it seems as if only the BEBOB is kind-of-working, thats why only BEBOB |
---|
73 |
is enabled by default. |
---|
74 |
|
---|
75 |
Note that this is a development version! Don't complain if its not working! |
---|
76 |
See www.ffado.org for stable releases. |
---|
77 |
""" ) |
---|
78 |
Help( opts.GenerateHelpText( env ) ) |
---|
79 |
|
---|
80 |
# make sure the necessary dirs exist |
---|
81 |
if not os.path.isdir( "cache/" + build_base ): |
---|
82 |
os.makedirs( "cache/" + build_base ) |
---|
83 |
if not os.path.isdir( 'cache/objects' ): |
---|
84 |
os.makedirs( 'cache/objects' ) |
---|
85 |
|
---|
86 |
CacheDir( 'cache/objects' ) |
---|
87 |
|
---|
88 |
opts.Save( 'cache/' + build_base + "options.cache", env ) |
---|
89 |
|
---|
90 |
# |
---|
91 |
# Check for apps... |
---|
92 |
# |
---|
93 |
def CheckForApp( context, app ): |
---|
94 |
context.Message( "Checking if '%s' executes... " % app ) |
---|
95 |
ret = context.env.WhereIs( app ) |
---|
96 |
if ret != "": |
---|
97 |
context.Result( True ) |
---|
98 |
else: |
---|
99 |
context.Result( False ) |
---|
100 |
return ret |
---|
101 |
|
---|
102 |
|
---|
103 |
if not env.GetOption('clean'): |
---|
104 |
conf = Configure( env, |
---|
105 |
custom_tests={ 'CheckForPKGConfig' : CheckForPKGConfig, 'CheckForPKG' : CheckForPKG, 'CheckForApp' : CheckForApp }, |
---|
106 |
conf_dir="cache/" + build_base, |
---|
107 |
log_file="cache/" + build_base + 'config.log' ) |
---|
108 |
|
---|
109 |
if not conf.CheckHeader( "stdio.h" ): |
---|
110 |
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." |
---|
111 |
Exit( 1 ) |
---|
112 |
|
---|
113 |
allpresent = 1; |
---|
114 |
allpresent &= conf.CheckForPKGConfig(); |
---|
115 |
allpresent &= conf.CheckForPKG( 'libraw1394', "1.3.0" ) |
---|
116 |
allpresent &= conf.CheckForPKG( 'libavc1394', "0.5.3" ) |
---|
117 |
allpresent &= conf.CheckForPKG( 'libiec61883', "1.1.0" ) |
---|
118 |
allpresent &= conf.CheckForPKG( 'alsa', "1.0.0" ) |
---|
119 |
allpresent &= conf.CheckForPKG( 'libxml++-2.6', "2.13.0" ) |
---|
120 |
allpresent &= conf.CheckForPKG( 'liblo', "0.22" ) |
---|
121 |
allpresent &= conf.CheckForPKG( 'dbus-1', "1.0" ) |
---|
122 |
allpresent &= conf.CheckHeader( "expat.h" ) |
---|
123 |
allpresent &= conf.CheckLib( 'expat', 'XML_ExpatVersion', '#include <expat.h>' ) |
---|
124 |
|
---|
125 |
if not allpresent: |
---|
126 |
print """ |
---|
127 |
(At least) One of the dependencies is missing. I can't go on without it, please |
---|
128 |
install the needed packages (remember to also install the *-devel packages) |
---|
129 |
""" |
---|
130 |
Exit( 1 ) |
---|
131 |
|
---|
132 |
# |
---|
133 |
env['PYUIC'] = conf.CheckForApp( 'pyuic' ) |
---|
134 |
|
---|
135 |
env = conf.Finish() |
---|
136 |
|
---|
137 |
if env['DEBUG']: |
---|
138 |
print "Doing a DEBUG build" |
---|
139 |
# -Werror could be added to, which would force the devs to really remove all the warnings :-) |
---|
140 |
env.AppendUnique( CCFLAGS=["-DDEBUG","-Wall","-g"] ) |
---|
141 |
else: |
---|
142 |
env.AppendUnique( CCFLAGS=["-O2"] ) |
---|
143 |
|
---|
144 |
# this is required to indicate that the DBUS version we use has support |
---|
145 |
# for platform dependent threading init functions |
---|
146 |
# this is true for DBUS >= 0.96 or so. Since we require >= 1.0 it is |
---|
147 |
# always true |
---|
148 |
env.AppendUnique( CCFLAGS=["-DDBUS_HAS_THREADS_INIT_DEFAULT"] ) |
---|
149 |
|
---|
150 |
if env['ENABLE_ALL']: |
---|
151 |
env['ENABLE_BEBOB'] = True |
---|
152 |
env['ENABLE_FIREWORKS'] = True |
---|
153 |
env['ENABLE_MOTU'] = True |
---|
154 |
env['ENABLE_DICE'] = True |
---|
155 |
env['ENABLE_METRIC_HALO'] = True |
---|
156 |
env['ENABLE_RME'] = True |
---|
157 |
env['ENABLE_BOUNCE'] = True |
---|
158 |
|
---|
159 |
if env['ENABLE_BEBOB'] or env['ENABLE_DICE'] or env['ENABLE_BOUNCE'] or env['ENABLE_FIREWORKS']: |
---|
160 |
env['ENABLE_GENERICAVC'] = True |
---|
161 |
|
---|
162 |
if build_base: |
---|
163 |
env['build_base']="#/"+build_base |
---|
164 |
else: |
---|
165 |
env['build_base']="#/" |
---|
166 |
|
---|
167 |
# |
---|
168 |
# XXX: Some includes in src/*/ are full path (src/*), that should be fixed? |
---|
169 |
env.AppendUnique( CPPPATH=["#/"] ) |
---|
170 |
|
---|
171 |
env['bindir'] = os.path.join( env['PREFIX'], "bin" ) |
---|
172 |
env['libdir'] = os.path.join( env['PREFIX'], "lib" ) |
---|
173 |
env['includedir'] = os.path.join( env['PREFIX'], "include" ) |
---|
174 |
env['sharedir'] = os.path.join( env['PREFIX'], "share/libffado" ) |
---|
175 |
env['cachedir'] = os.path.join( env['PREFIX'], "var/cache/libffado" ) |
---|
176 |
|
---|
177 |
env.Alias( "install", env['libdir'] ) |
---|
178 |
env.Alias( "install", env['includedir'] ) |
---|
179 |
|
---|
180 |
env['PACKAGE'] = "libffado" |
---|
181 |
env['VERSION'] = "1.999.6" |
---|
182 |
env['LIBVERSION'] = "1.0.0" |
---|
183 |
|
---|
184 |
# |
---|
185 |
# Start building |
---|
186 |
# |
---|
187 |
|
---|
188 |
env.ScanReplace( "config.h.in" ) |
---|
189 |
|
---|
190 |
pkgconfig = env.ScanReplace( "libffado.pc.in" ) |
---|
191 |
env.Alias( "install", env.Install( env['libdir'] + '/pkgconfig', pkgconfig ) ) |
---|
192 |
|
---|
193 |
subdirs=['external','src','libffado','tests','support'] |
---|
194 |
if build_base: |
---|
195 |
env.SConscript( dirs=subdirs, exports="env", build_dir=build_base+subdir ) |
---|
196 |
else: |
---|
197 |
env.SConscript( dirs=subdirs, exports="env" ) |
---|
198 |
|
---|
199 |
|
---|
200 |
# By default only src is built but all is cleaned |
---|
201 |
if not env.GetOption('clean'): |
---|
202 |
Default( 'external' ) |
---|
203 |
Default( 'src' ) |
---|
204 |
if env['BUILD_TESTS']: |
---|
205 |
Default( 'tests' ) |
---|
206 |
# Cachedir has to be fixed... |
---|
207 |
#env.Alias( "install", env["cachedir"], os.makedirs( env["cachedir"] ) ) |
---|
208 |
#env.Alias( "install", env.Install( env["cachedir"], "" ) ) #os.makedirs( env["cachedir"] ) ) |
---|