root/trunk/libffado/SConstruct

Revision 561, 5.7 kB (checked in by arnonym, 14 years ago)

Merge the scons-branch to trunk.

This basicly adds scons as a buildsystem. This does not mean that auto* is dropped instantly (the added files should not collide) but allows for some testing in the transition-process. The auto*-files are deleted later on...

Due to this, the config.h.in (which gets built by autogen.sh) is copied from config.h.in.scons using scons. When dropping make this file should be moved to config.h.in.

The scons-system is probably missing a lot of things you are used to in make. But at least here it does build a usable libffado. :-)

To use scons, simply do a "scons". If you want to know about configuration, "scons -h" allows you to view and set parameters, which are saved from there on. What do I mean with this? "scons -h PREFIX=$HOME" sets the install-prefix to $HOME and shows the helptext that already incorporates the changed option. Another "scons -h" will show the same help-text and scons remembers the changed prefix. "scons" now builds the libs and apps and "scons install" installs everything into the prefix. "scons -c install" cleans the local dir and uninstalls the package while "scons -c" just cleans the local dir.

BTW: I also set several more ignores, I am just to lazy to split these two commits. ;-)

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