1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
|
#! /usr/bin/env python
# encoding: utf-8
import os
import Utils
import Options
import commands
g_maxlen = 40
import shutil
import Task
import re
import Logs
VERSION='1.9.4'
APPNAME='jack'
JACK_API_VERSION = '0.1.0'
# these variables are mandatory ('/' are converted automatically)
srcdir = '.'
blddir = 'build'
def display_msg(msg, status = None, color = None):
sr = msg
global g_maxlen
g_maxlen = max(g_maxlen, len(msg))
if status:
print "%s :" % msg.ljust(g_maxlen),
Utils.pprint(color, status)
else:
print "%s" % msg.ljust(g_maxlen)
def display_feature(msg, build):
if build:
display_msg(msg, "yes", 'GREEN')
else:
display_msg(msg, "no", 'YELLOW')
def create_svnversion_task(bld, header='svnversion.h', define=None):
import Constants, Build
cmd = '../svnversion_regenerate.sh ${TGT}'
if define:
cmd += " " + define
cls = Task.simple_task_type('svnversion', cmd, color='BLUE', before='cc')
cls.runnable_status = lambda self: Constants.RUN_ME
def post_run(self):
sg = Utils.h_file(self.outputs[0].abspath(self.env))
#print sg.encode('hex')
Build.bld.node_sigs[self.env.variant()][self.outputs[0].id] = sg
cls.post_run = post_run
tsk = cls(bld.env.copy())
tsk.inputs = []
tsk.outputs = [bld.path.find_or_declare(header)]
def set_options(opt):
# options provided by the modules
opt.tool_options('compiler_cxx')
opt.tool_options('compiler_cc')
opt.add_option('--libdir', type='string', help="Library directory [Default: <prefix>/lib]")
opt.add_option('--libdir32', type='string', help="32bit Library directory [Default: <prefix>/lib32]")
opt.add_option('--dbus', action='store_true', default=False, help='Enable D-Bus JACK (jackdbus)')
opt.add_option('--classic', action='store_true', default=False, help='Force enable standard JACK (jackd) even if D-Bus JACK (jackdbus) is enabled too')
opt.add_option('--doxygen', action='store_true', default=False, help='Enable build of doxygen documentation')
opt.add_option('--profile', action='store_true', default=False, help='Build with engine profiling')
opt.add_option('--mixed', action='store_true', default=False, help='Build with 32/64 bits mixed mode')
opt.add_option('--clients', default=64, type="int", dest="clients", help='Maximum number of JACK clients')
opt.add_option('--ports-per-application', default=768, type="int", dest="application_ports", help='Maximum number of ports per application')
opt.add_option('--debug', action='store_true', default=False, dest='debug', help="Build debuggable binaries")
opt.sub_options('dbus')
def configure(conf):
platform = Utils.detect_platform()
conf.env['IS_MACOSX'] = platform == 'darwin'
conf.env['IS_LINUX'] = platform == 'linux'
conf.env['IS_SUN'] = platform == 'sunos'
if conf.env['IS_LINUX']:
Utils.pprint('CYAN', "Linux detected")
if conf.env['IS_MACOSX']:
Utils.pprint('CYAN', "MacOS X detected")
if conf.env['IS_SUN']:
Utils.pprint('CYAN', "SunOS detected")
if conf.env['IS_LINUX']:
conf.check_tool('compiler_cxx')
conf.check_tool('compiler_cc')
if conf.env['IS_MACOSX']:
conf.check_tool('compiler_cxx')
conf.check_tool('compiler_cc')
# waf 1.5 : check_tool('compiler_cxx') and check_tool('compiler_cc') do not work correctly, so explicit use of gcc and g++
if conf.env['IS_SUN']:
conf.check_tool('g++')
conf.check_tool('gcc')
#if conf.env['IS_SUN']:
# conf.check_tool('compiler_cxx')
# conf.check_tool('compiler_cc')
conf.env.append_unique('CXXFLAGS', '-O3 -Wall')
conf.env.append_unique('CCFLAGS', '-O3 -Wall')
conf.sub_config('common')
if conf.env['IS_LINUX']:
conf.sub_config('linux')
if Options.options.dbus:
conf.sub_config('dbus')
conf.sub_config('example-clients')
if conf.check_cfg(package='celt', atleast_version='0.7.0', args='--cflags --libs'):
conf.define('HAVE_CELT', 1)
conf.define('HAVE_CELT_API_0_7', 1)
conf.define('HAVE_CELT_API_0_5', 0)
elif conf.check_cfg(package='celt', atleast_version='0.5.0', args='--cflags --libs', required=True):
conf.define('HAVE_CELT', 1)
conf.define('HAVE_CELT_API_0_5', 1)
conf.define('HAVE_CELT_API_0_7', 0)
else:
conf.define('HAVE_CELT', 0)
conf.define('HAVE_CELT_API_0_5', 0)
conf.define('HAVE_CELT_API_0_7', 0)
conf.env['LIB_PTHREAD'] = ['pthread']
conf.env['LIB_DL'] = ['dl']
conf.env['LIB_RT'] = ['rt']
conf.env['JACK_API_VERSION'] = JACK_API_VERSION
conf.env['JACK_VERSION'] = VERSION
conf.env['BUILD_DOXYGEN_DOCS'] = Options.options.doxygen
conf.env['BUILD_WITH_PROFILE'] = Options.options.profile
conf.env['BUILD_WITH_32_64'] = Options.options.mixed
conf.env['BUILD_JACKDBUS'] = Options.options.dbus
conf.env['BUILD_CLASSIC'] = Options.options.classic
conf.env['BUILD_DEBUG'] = Options.options.debug
if conf.env['BUILD_JACKDBUS']:
conf.env['BUILD_JACKD'] = conf.env['BUILD_CLASSIC']
else:
conf.env['BUILD_JACKD'] = True
if Options.options.libdir:
conf.env['LIBDIR'] = conf.env['PREFIX'] + Options.options.libdir
else:
conf.env['LIBDIR'] = conf.env['PREFIX'] + '/lib'
if conf.env['BUILD_DEBUG']:
conf.env.append_unique('CXXFLAGS', '-g')
conf.env.append_unique('CCFLAGS', '-g')
conf.env.append_unique('LINKFLAGS', '-g')
conf.define('CLIENT_NUM', Options.options.clients)
conf.define('PORT_NUM_FOR_CLIENT', Options.options.application_ports)
conf.define('ADDON_DIR', os.path.normpath(os.path.join(conf.env['LIBDIR'], 'jack')))
conf.define('JACK_LOCATION', os.path.normpath(os.path.join(conf.env['PREFIX'], 'bin')))
conf.define('USE_POSIX_SHM', 1)
conf.define('JACKMP', 1)
if conf.env['BUILD_JACKDBUS'] == True:
conf.define('JACK_DBUS', 1)
if conf.env['BUILD_JACKD'] == False:
conf.define('USE_LIBDBUS_AUTOLAUNCH', 1)
if conf.env['BUILD_WITH_PROFILE'] == True:
conf.define('JACK_MONITOR', 1)
if conf.env['BUILD_WITH_32_64'] == True:
conf.define('JACK_32_64', 1)
conf.write_config_header('config.h')
svnrev = None
if os.access('svnversion.h', os.R_OK):
data = file('svnversion.h').read()
m = re.match(r'^#define SVN_VERSION "([^"]*)"$', data)
if m != None:
svnrev = m.group(1)
print
display_msg("==================")
version_msg = "JACK " + VERSION
if svnrev:
version_msg += " exported from r" + svnrev
else:
version_msg += " svn revision will checked and eventually updated during build"
print version_msg
print "Build with a maximum of %d JACK clients" % conf.env['CLIENT_NUM']
print "Build with a maximum of %d ports per application" % conf.env['PORT_NUM_FOR_CLIENT']
display_msg("Install prefix", conf.env['PREFIX'], 'CYAN')
display_msg("Library directory", conf.env['LIBDIR'], 'CYAN')
display_msg("Drivers directory", conf.env['ADDON_DIR'], 'CYAN')
display_feature('Build debuggable binaries', conf.env['BUILD_DEBUG'])
display_feature('Build doxygen documentation', conf.env['BUILD_DOXYGEN_DOCS'])
display_feature('Build with engine profiling', conf.env['BUILD_WITH_PROFILE'])
display_feature('Build with 32/64 bits mixed mode', conf.env['BUILD_WITH_32_64'])
display_feature('Build standard JACK (jackd)', conf.env['BUILD_JACKD'])
display_feature('Build D-Bus JACK (jackdbus)', conf.env['BUILD_JACKDBUS'])
if conf.env['BUILD_JACKDBUS'] and conf.env['BUILD_JACKD']:
print Logs.colors.RED + 'WARNING !! mixing both jackd and jackdbus may cause issues!' + Logs.colors.NORMAL
if conf.env['IS_LINUX']:
display_feature('Build with ALSA support', conf.env['BUILD_DRIVER_ALSA'] == True)
display_feature('Build with FireWire (FreeBob) support', conf.env['BUILD_DRIVER_FREEBOB'] == True)
display_feature('Build with FireWire (FFADO) support', conf.env['BUILD_DRIVER_FFADO'] == True)
if conf.env['BUILD_JACKDBUS'] == True:
display_msg('D-Bus service install directory', conf.env['DBUS_SERVICES_DIR'], 'CYAN')
#display_msg('Settings persistence', xxx)
if conf.env['DBUS_SERVICES_DIR'] != conf.env['DBUS_SERVICES_DIR_REAL']:
print
print Logs.colors.RED + "WARNING: D-Bus session services directory as reported by pkg-config is"
print Logs.colors.RED + "WARNING:",
print Logs.colors.CYAN + conf.env['DBUS_SERVICES_DIR_REAL']
print Logs.colors.RED + 'WARNING: but service file will be installed in'
print Logs.colors.RED + "WARNING:",
print Logs.colors.CYAN + conf.env['DBUS_SERVICES_DIR']
print Logs.colors.RED + 'WARNING: You may need to adjust your D-Bus configuration after installing jackdbus'
print 'WARNING: You can override dbus service install directory'
print 'WARNING: with --enable-pkg-config-dbus-service-dir option to this script'
print Logs.colors.NORMAL,
print
if Options.options.mixed == True:
env_variant2 = conf.env.copy()
conf.set_env_name('lib32', env_variant2)
env_variant2.set_variant('lib32')
conf.setenv('lib32')
conf.env.append_unique('CXXFLAGS', '-m32')
conf.env.append_unique('CCFLAGS', '-m32')
conf.env.append_unique('LINKFLAGS', '-m32')
if Options.options.libdir32:
conf.env['LIBDIR'] = conf.env['PREFIX'] + Options.options.libdir32
else:
conf.env['LIBDIR'] = conf.env['PREFIX'] + '/lib32'
conf.write_config_header('config.h')
def build(bld):
print ("make[1]: Entering directory `" + os.getcwd() + "/" + blddir + "'" )
if not os.access('svnversion.h', os.R_OK):
create_svnversion_task(bld)
# process subfolders from here
bld.add_subdirs('common')
if bld.env['IS_LINUX']:
bld.add_subdirs('linux')
bld.add_subdirs('example-clients')
bld.add_subdirs('tests')
if bld.env['BUILD_JACKDBUS'] == True:
bld.add_subdirs('dbus')
if bld.env['IS_MACOSX']:
bld.add_subdirs('macosx')
bld.add_subdirs('example-clients')
bld.add_subdirs('tests')
if bld.env['BUILD_JACKDBUS'] == True:
bld.add_subdirs('dbus')
if bld.env['IS_SUN']:
bld.add_subdirs('solaris')
bld.add_subdirs('example-clients')
bld.add_subdirs('tests')
if bld.env['BUILD_JACKDBUS'] == True:
bld.add_subdirs('dbus')
if bld.env['BUILD_DOXYGEN_DOCS'] == True:
share_dir = bld.env.get_destdir() + bld.env['PREFIX'] + '/share/jack-audio-connection-kit'
html_docs_source_dir = "build/default/html"
html_docs_install_dir = share_dir + '/reference/html/'
if Options.commands['install']:
if os.path.isdir(html_docs_install_dir):
Utils.pprint('CYAN', "Removing old doxygen documentation installation...")
shutil.rmtree(html_docs_install_dir)
Utils.pprint('CYAN', "Removing old doxygen documentation installation done.")
Utils.pprint('CYAN', "Installing doxygen documentation...")
shutil.copytree(html_docs_source_dir, html_docs_install_dir)
Utils.pprint('CYAN', "Installing doxygen documentation done.")
elif Options.commands['uninstall']:
Utils.pprint('CYAN', "Uninstalling doxygen documentation...")
if os.path.isdir(share_dir):
shutil.rmtree(share_dir)
Utils.pprint('CYAN', "Uninstalling doxygen documentation done.")
elif Options.commands['clean']:
if os.access(html_docs_source_dir, os.R_OK):
Utils.pprint('CYAN', "Removing doxygen generated documentation...")
shutil.rmtree(html_docs_source_dir)
Utils.pprint('CYAN', "Removing doxygen generated documentation done.")
elif Options.commands['build']:
if not os.access(html_docs_source_dir, os.R_OK):
os.popen("doxygen").read()
else:
Utils.pprint('CYAN', "doxygen documentation already built.")
def dist_hook():
os.remove('svnversion_regenerate.sh')
os.system('../svnversion_regenerate.sh svnversion.h')
|