7 from Configure
import g_maxlen
15 JACK_API_VERSION
= '0.1.0'
17 # these variables are mandatory ('/' are converted automatically)
21 def display_msg(msg
, status
= None, color
= None):
24 g_maxlen
= max(g_maxlen
, len(msg
))
26 print "%s :" % msg
.ljust(g_maxlen
),
27 Params
.pprint(color
, status
)
29 print "%s" % msg
.ljust(g_maxlen
)
31 def display_feature(msg
, build
):
33 display_msg(msg
, "yes", 'GREEN')
35 display_msg(msg
, "no", 'YELLOW')
37 def create_svnversion_gen(bld
, header
='svnversion.h', define
=None):
38 cmd
= '../svnversion_regenerate.sh ${TGT}'
41 cls
= Task
.simple_task_type('svnversion', cmd
, color
='BLUE')
42 cls
.must_run
= lambda self
: True
46 rt
= Params
.h_file(self
.m_outputs
[0].abspath(self
.env()))
52 # return (r, r, r, r, r)
53 #cls.cache_sig = property(sg, None)
56 tsk
= cls('svnversion', bld
.env().copy())
58 tsk
.m_outputs
= [bld
.path
.find_or_declare(header
)]
59 tsk
.prio
= 1 # execute this task first
62 # options provided by the modules
63 opt
.tool_options('compiler_cxx')
64 opt
.tool_options('compiler_cc')
66 opt
.add_option('--dbus', action
='store_true', default
=False, help='Enable D-Bus JACK (jackdbus)')
67 opt
.add_option('--doxygen', action
='store_true', default
=False, help='Enable build of doxygen documentation')
68 opt
.add_option('--monitor', action
='store_true', default
=False, help='Build with monitoring records')
69 opt
.add_option('--clients', default
=64, type="int", dest
="clients", help='Maximum number of JACK clients')
70 opt
.add_option('--ports', default
=512, type="int", dest
="ports", help='Maximum number of ports')
71 opt
.sub_options('dbus')
74 platform
= conf
.detect_platform()
75 conf
.env
['IS_MACOSX'] = platform
== 'darwin'
76 conf
.env
['IS_LINUX'] = platform
== 'linux'
78 if conf
.env
['IS_LINUX']:
79 Params
.pprint('CYAN', "Linux detected")
81 if conf
.env
['IS_MACOSX']:
82 Params
.pprint('CYAN', "MacOS X detected")
84 conf
.check_tool('compiler_cxx')
85 conf
.check_tool('compiler_cc')
87 conf
.sub_config('common')
88 if conf
.env
['IS_LINUX']:
89 conf
.sub_config('linux')
90 if Params
.g_options
.dbus
:
91 conf
.sub_config('dbus')
92 conf
.sub_config('example-clients')
94 conf
.env
['LIB_PTHREAD'] = ['pthread']
95 conf
.env
['LIB_DL'] = ['dl']
96 conf
.env
['LIB_RT'] = ['rt']
97 conf
.env
['JACK_API_VERSION'] = JACK_API_VERSION
98 conf
.env
['JACK_VERSION'] = VERSION
100 conf
.env
['BUILD_DOXYGEN_DOCS'] = Params
.g_options
.doxygen
101 conf
.env
['BUILD_WITH_MONITOR'] = Params
.g_options
.monitor
103 conf
.define('CLIENT_NUM', Params
.g_options
.clients
)
104 conf
.define('PORT_NUM', Params
.g_options
. ports
)
106 conf
.define('ADDON_DIR', os
.path
.normpath(conf
.env
['PREFIX'] + '/lib/jack'))
107 conf
.define('JACK_LOCATION', os
.path
.normpath(conf
.env
['PREFIX'] + '/bin'))
108 conf
.define('USE_POSIX_SHM', 1)
109 conf
.define('JACKMP', 1)
110 if conf
.env
['BUILD_JACKDBUS'] == True:
111 conf
.define('JACK_DBUS', 1)
112 if conf
.env
['BUILD_WITH_MONITOR'] == True:
113 conf
.define('JACK_MONITOR', 1)
114 conf
.write_config_header('config.h')
117 if os
.access('svnversion.h', os
.R_OK
):
118 data
= file('svnversion.h').read()
119 m
= re
.match(r
'^#define SVN_VERSION "([^"]*)"$', data
)
124 display_msg("==================")
125 version_msg
= "JACK " + VERSION
127 version_msg
+= " exported from r" + svnrev
129 version_msg
+= " svn revision will checked and eventually updated during build"
132 print "Build with a maximum of %d JACK clients" % conf
.env
['CLIENT_NUM']
133 print "Build with a maximum of %d ports" % conf
.env
['PORT_NUM']
135 display_msg("Install prefix", conf
.env
['PREFIX'], 'CYAN')
136 display_msg("Drivers directory", conf
.env
['ADDON_DIR'], 'CYAN')
137 display_feature('Build doxygen documentation', conf
.env
['BUILD_DOXYGEN_DOCS'])
138 display_feature('Build with monitoring records', conf
.env
['BUILD_WITH_MONITOR'])
140 if conf
.env
['IS_LINUX']:
141 display_feature('Build with ALSA support', conf
.env
['BUILD_DRIVER_ALSA'] == True)
142 display_feature('Build with FireWire (FreeBob) support', conf
.env
['BUILD_DRIVER_FREEBOB'] == True)
143 display_feature('Build with FireWire (FFADO) support', conf
.env
['BUILD_DRIVER_FFADO'] == True)
144 display_feature('Build D-Bus JACK (jackdbus)', conf
.env
['BUILD_JACKDBUS'] == True)
145 if conf
.env
['BUILD_JACKDBUS'] == True:
146 display_msg('D-Bus service install directory', conf
.env
['DBUS_SERVICES_DIR'], 'CYAN')
147 #display_msg('Settings persistence', xxx)
149 if conf
.env
['DBUS_SERVICES_DIR'] != conf
.env
['DBUS-1_SESSION_BUS_SERVICES_DIR'][0]:
151 print Params
.g_colors
['RED'] + "WARNING: D-Bus session services directory as reported by pkg-config is"
152 print Params
.g_colors
['RED'] + "WARNING:",
153 print Params
.g_colors
['CYAN'] + conf
.env
['DBUS-1_SESSION_BUS_SERVICES_DIR'][0]
154 print Params
.g_colors
['RED'] + 'WARNING: but service file will be installed in'
155 print Params
.g_colors
['RED'] + "WARNING:",
156 print Params
.g_colors
['CYAN'] + conf
.env
['DBUS_SERVICES_DIR']
157 print Params
.g_colors
['RED'] + 'WARNING: You may need to adjust your D-Bus configuration after installing jackdbus'
158 print 'WARNING: You can override dbus service install directory'
159 print 'WARNING: with --enable-pkg-config-dbus-service-dir option to this script'
160 print Params
.g_colors
['NORMAL'],
164 if not os
.access('svnversion.h', os
.R_OK
):
165 create_svnversion_gen(bld
)
167 # process subfolders from here
168 bld
.add_subdirs('common')
169 if bld
.env()['IS_LINUX']:
170 bld
.add_subdirs('linux')
171 if bld
.env()['BUILD_JACKDBUS'] == True:
172 bld
.add_subdirs('dbus')
173 bld
.add_subdirs('example-clients')
174 bld
.add_subdirs('tests')
175 if bld
.env()['IS_MACOSX']:
176 bld
.add_subdirs('macosx')
177 bld
.add_subdirs('example-clients')
178 bld
.add_subdirs('tests')
179 if bld
.env()['BUILD_JACKDBUS'] == True:
180 bld
.add_subdirs('dbus')
182 if bld
.env()['BUILD_DOXYGEN_DOCS'] == True:
183 share_dir
= bld
.env().get_destdir() + Params
.g_build
.env()['PREFIX'] + '/share/jack-audio-connection-kit'
184 html_docs_source_dir
= "build/default/html"
185 html_docs_install_dir
= share_dir
+ '/reference/html/'
186 if Params
.g_commands
['install']:
187 if os
.path
.isdir(html_docs_install_dir
):
188 Params
.pprint('CYAN', "Removing old doxygen documentation installation...")
189 shutil
.rmtree(html_docs_install_dir
)
190 Params
.pprint('CYAN', "Removing old doxygen documentation installation done.")
191 Params
.pprint('CYAN', "Installing doxygen documentation...")
192 shutil
.copytree(html_docs_source_dir
, html_docs_install_dir
)
193 Params
.pprint('CYAN', "Installing doxygen documentation done.")
194 elif Params
.g_commands
['uninstall']:
195 Params
.pprint('CYAN', "Uninstalling doxygen documentation...")
196 if os
.path
.isdir(share_dir
):
197 shutil
.rmtree(share_dir
)
198 Params
.pprint('CYAN', "Uninstalling doxygen documentation done.")
199 elif Params
.g_commands
['clean']:
200 if os
.access(html_docs_source_dir
, os
.R_OK
):
201 Params
.pprint('CYAN', "Removing doxygen generated documentation...")
202 shutil
.rmtree(html_docs_source_dir
)
203 Params
.pprint('CYAN', "Removing doxygen generated documentation done.")
204 elif Params
.g_commands
['build']:
205 if not os
.access(html_docs_source_dir
, os
.R_OK
):
206 os
.popen("doxygen").read()
208 Params
.pprint('CYAN', "doxygen documentation already built.")
211 os
.remove('svnversion_regenerate.sh')
212 os
.system('../svnversion_regenerate.sh svnversion.h')