DOC: Update docs for jack_get_properties()
[jack2.git] / wscript
blob5bac424193fcffed9cc43c3155a19f7fdfdf0685
1 #! /usr/bin/env python
2 # encoding: utf-8
3 from __future__ import print_function
5 import os
6 import subprocess
7 import shutil
8 import re
9 import sys
11 from waflib import Logs, Options, Task, Utils
12 from waflib.Build import BuildContext, CleanContext, InstallContext, UninstallContext
14 VERSION='1.9.12'
15 APPNAME='jack'
16 JACK_API_VERSION = '0.1.0'
18 # these variables are mandatory ('/' are converted automatically)
19 top = '.'
20 out = 'build'
22 # lib32 variant name used when building in mixed mode
23 lib32 = 'lib32'
25 def display_feature(conf, msg, build):
26 if build:
27 conf.msg(msg, 'yes', color='GREEN')
28 else:
29 conf.msg(msg, 'no', color='YELLOW')
31 def check_for_celt(conf):
32 found = False
33 for version in ['11', '8', '7', '5']:
34 define = 'HAVE_CELT_API_0_' + version
35 if not found:
36 try:
37 conf.check_cfg(
38 package='celt >= 0.%s.0' % version,
39 args='--cflags --libs')
40 found = True
41 conf.define(define, 1)
42 continue
43 except conf.errors.ConfigurationError:
44 pass
45 conf.define(define, 0)
47 if not found:
48 raise conf.errors.ConfigurationError
50 def options(opt):
51 # options provided by the modules
52 opt.load('compiler_cxx')
53 opt.load('compiler_c')
54 opt.load('autooptions');
56 opt.load('xcode6')
58 opt.recurse('compat')
60 # install directories
61 opt.add_option('--htmldir', type='string', default=None, help='HTML documentation directory [Default: <prefix>/share/jack-audio-connection-kit/reference/html/')
62 opt.add_option('--libdir', type='string', help='Library directory [Default: <prefix>/lib]')
63 opt.add_option('--libdir32', type='string', help='32bit Library directory [Default: <prefix>/lib32]')
64 opt.add_option('--mandir', type='string', help='Manpage directory [Default: <prefix>/share/man/man1]')
66 # options affecting binaries
67 opt.add_option('--platform', type='string', default=sys.platform, help='Target platform for cross-compiling, e.g. cygwin or win32')
68 opt.add_option('--mixed', action='store_true', default=False, help='Build with 32/64 bits mixed mode')
69 opt.add_option('--debug', action='store_true', default=False, dest='debug', help='Build debuggable binaries')
71 # options affecting general jack functionality
72 opt.add_option('--classic', action='store_true', default=False, help='Force enable standard JACK (jackd) even if D-Bus JACK (jackdbus) is enabled too')
73 opt.add_option('--dbus', action='store_true', default=False, help='Enable D-Bus JACK (jackdbus)')
74 opt.add_option('--autostart', type='string', default='default', help='Autostart method. Possible values: "default", "classic", "dbus", "none"')
75 opt.add_option('--profile', action='store_true', default=False, help='Build with engine profiling')
76 opt.add_option('--clients', default=64, type='int', dest='clients', help='Maximum number of JACK clients')
77 opt.add_option('--ports-per-application', default=768, type='int', dest='application_ports', help='Maximum number of ports per application')
79 opt.set_auto_options_define('HAVE_%s')
80 opt.set_auto_options_style('yesno_and_hack')
82 # options with third party dependencies
83 doxygen = opt.add_auto_option(
84 'doxygen',
85 help='Build doxygen documentation',
86 conf_dest='BUILD_DOXYGEN_DOCS',
87 default=False)
88 doxygen.find_program('doxygen')
89 alsa = opt.add_auto_option(
90 'alsa',
91 help='Enable ALSA driver',
92 conf_dest='BUILD_DRIVER_ALSA')
93 alsa.check_cfg(
94 package='alsa >= 1.0.18',
95 args='--cflags --libs')
96 firewire = opt.add_auto_option(
97 'firewire',
98 help='Enable FireWire driver (FFADO)',
99 conf_dest='BUILD_DRIVER_FFADO')
100 firewire.check_cfg(
101 package='libffado >= 1.999.17',
102 args='--cflags --libs')
103 iio = opt.add_auto_option(
104 'iio',
105 help='Enable IIO driver',
106 conf_dest='BUILD_DRIVER_IIO')
107 iio.check_cfg(
108 package='gtkIOStream >= 1.4.0',
109 args='--cflags --libs')
110 iio.check_cfg(
111 package='eigen3 >= 3.1.2',
112 args='--cflags --libs')
113 portaudio = opt.add_auto_option(
114 'portaudio',
115 help='Enable Portaudio driver',
116 conf_dest='BUILD_DRIVER_PORTAUDIO')
117 portaudio.check(header_name='windows.h') # only build portaudio on windows
118 portaudio.check_cfg(
119 package='portaudio-2.0 >= 19',
120 uselib_store='PORTAUDIO',
121 args='--cflags --libs')
122 winmme = opt.add_auto_option(
123 'winmme',
124 help='Enable WinMME driver',
125 conf_dest='BUILD_DRIVER_WINMME')
126 winmme.check(
127 header_name=['windows.h', 'mmsystem.h'],
128 msg='Checking for header mmsystem.h')
130 celt = opt.add_auto_option(
131 'celt',
132 help='Build with CELT')
133 celt.add_function(check_for_celt)
135 # Suffix _PKG to not collide with HAVE_OPUS defined by the option.
136 opus = opt.add_auto_option(
137 'opus',
138 help='Build Opus netjack2')
139 opus.check(header_name='opus/opus_custom.h')
140 opus.check_cfg(
141 package='opus >= 0.9.0',
142 args='--cflags --libs',
143 define_name='HAVE_OPUS_PKG')
145 samplerate = opt.add_auto_option(
146 'samplerate',
147 help='Build with libsamplerate')
148 samplerate.check_cfg(
149 package='samplerate',
150 args='--cflags --libs')
151 sndfile = opt.add_auto_option(
152 'sndfile',
153 help='Build with libsndfile')
154 sndfile.check_cfg(
155 package='sndfile',
156 args='--cflags --libs')
157 readline = opt.add_auto_option(
158 'readline',
159 help='Build with readline')
160 readline.check(lib='readline')
161 readline.check(
162 header_name=['stdio.h', 'readline/readline.h'],
163 msg='Checking for header readline/readline.h')
164 sd = opt.add_auto_option(
165 'systemd',
166 help='Use systemd notify')
167 sd.check(header_name='systemd/sd-daemon.h')
168 sd.check(lib='systemd')
169 db = opt.add_auto_option(
170 'db',
171 help='Use Berkeley DB (metadata)')
172 db.check(header_name='db.h')
173 db.check(lib='db')
175 # dbus options
176 opt.recurse('dbus')
178 # this must be called before the configure phase
179 opt.apply_auto_options_hack()
181 def detect_platform(conf):
182 # GNU/kFreeBSD and GNU/Hurd are treated as Linux
183 platforms = [
184 # ('KEY, 'Human readable name', ['strings', 'to', 'check', 'for'])
185 ('IS_LINUX', 'Linux', ['gnu0', 'gnukfreebsd', 'linux', 'posix']),
186 ('IS_MACOSX', 'MacOS X', ['darwin']),
187 ('IS_SUN', 'SunOS', ['sunos']),
188 ('IS_WINDOWS', 'Windows', ['cygwin', 'msys', 'win32'])
191 for key,name,strings in platforms:
192 conf.env[key] = False
194 conf.start_msg('Checking platform')
195 platform = Options.options.platform
196 for key,name,strings in platforms:
197 for s in strings:
198 if platform.startswith(s):
199 conf.env[key] = True
200 conf.end_msg(name, color='CYAN')
201 break
203 def configure(conf):
204 conf.load('compiler_cxx')
205 conf.load('compiler_c')
207 detect_platform(conf)
209 if conf.env['IS_WINDOWS']:
210 conf.env.append_unique('CCDEFINES', '_POSIX')
211 conf.env.append_unique('CXXDEFINES', '_POSIX')
213 conf.env.append_unique('CXXFLAGS', '-Wall')
214 conf.env.append_unique('CXXFLAGS', '-std=gnu++11')
215 conf.env.append_unique('CFLAGS', '-Wall')
217 if conf.env['IS_MACOSX']:
218 conf.check(lib='aften', uselib='AFTEN', define_name='AFTEN')
219 conf.check_cxx(
220 fragment=''
221 + '#include <aften/aften.h>\n'
222 + 'int\n'
223 + 'main(void)\n'
224 + '{\n'
225 + 'AftenContext fAftenContext;\n'
226 + 'aften_set_defaults(&fAftenContext);\n'
227 + 'unsigned char *fb;\n'
228 + 'float *buf=new float[10];\n'
229 + 'int res = aften_encode_frame(&fAftenContext, fb, buf, 1);\n'
230 + '}\n',
231 lib='aften',
232 msg='Checking for aften_encode_frame()',
233 define_name='HAVE_AFTEN_NEW_API',
234 mandatory=False)
236 conf.load('autooptions')
238 conf.recurse('compat')
240 # Check for functions.
241 conf.check(
242 fragment=''
243 + '#define _GNU_SOURCE\n'
244 + '#include <poll.h>\n'
245 + '#include <signal.h>\n'
246 + '#include <stddef.h>\n'
247 + 'int\n'
248 + 'main(void)\n'
249 + '{\n'
250 + ' ppoll(NULL, 0, NULL, NULL);\n'
251 + '}\n',
252 msg='Checking for ppoll',
253 define_name='HAVE_PPOLL',
254 mandatory=False)
256 # Check for backtrace support
257 conf.check(
258 header_name='execinfo.h',
259 define_name='HAVE_EXECINFO_H',
260 mandatory=False)
262 conf.recurse('common')
263 if Options.options.dbus:
264 conf.recurse('dbus')
265 if conf.env['BUILD_JACKDBUS'] != True:
266 conf.fatal('jackdbus was explicitly requested but cannot be built')
268 conf.recurse('example-clients')
270 # test for the availability of ucontext, and how it should be used
271 for t in ['gp_regs', 'uc_regs', 'mc_gregs', 'gregs']:
272 fragment = '#include <ucontext.h>\n'
273 fragment += 'int main() { ucontext_t *ucontext; return (int) ucontext->uc_mcontext.%s[0]; }' % t
274 confvar = 'HAVE_UCONTEXT_%s' % t.upper()
275 conf.check_cc(fragment=fragment, define_name=confvar, mandatory=False,
276 msg='Checking for ucontext->uc_mcontext.%s' % t)
277 if conf.is_defined(confvar):
278 conf.define('HAVE_UCONTEXT', 1)
280 fragment = '#include <ucontext.h>\n'
281 fragment += 'int main() { return NGREG; }'
282 conf.check_cc(fragment=fragment, define_name='HAVE_NGREG', mandatory=False,
283 msg='Checking for NGREG')
285 conf.env['LIB_PTHREAD'] = ['pthread']
286 conf.env['LIB_DL'] = ['dl']
287 conf.env['LIB_RT'] = ['rt']
288 conf.env['LIB_M'] = ['m']
289 conf.env['LIB_STDC++'] = ['stdc++']
290 conf.env['JACK_API_VERSION'] = JACK_API_VERSION
291 conf.env['JACK_VERSION'] = VERSION
293 conf.env['BUILD_WITH_PROFILE'] = Options.options.profile
294 conf.env['BUILD_WITH_32_64'] = Options.options.mixed
295 conf.env['BUILD_CLASSIC'] = Options.options.classic
296 conf.env['BUILD_DEBUG'] = Options.options.debug
298 if conf.env['BUILD_JACKDBUS']:
299 conf.env['BUILD_JACKD'] = conf.env['BUILD_CLASSIC']
300 else:
301 conf.env['BUILD_JACKD'] = True
303 conf.env['BINDIR'] = conf.env['PREFIX'] + '/bin'
305 if Options.options.htmldir:
306 conf.env['HTMLDIR'] = Options.options.htmldir
307 else:
308 # set to None here so that the doxygen code can find out the highest
309 # directory to remove upon install
310 conf.env['HTMLDIR'] = None
312 if Options.options.libdir:
313 conf.env['LIBDIR'] = Options.options.libdir
314 else:
315 conf.env['LIBDIR'] = conf.env['PREFIX'] + '/lib'
317 if Options.options.mandir:
318 conf.env['MANDIR'] = Options.options.mandir
319 else:
320 conf.env['MANDIR'] = conf.env['PREFIX'] + '/share/man/man1'
322 if conf.env['BUILD_DEBUG']:
323 conf.env.append_unique('CXXFLAGS', '-g')
324 conf.env.append_unique('CFLAGS', '-g')
325 conf.env.append_unique('LINKFLAGS', '-g')
327 if not Options.options.autostart in ['default', 'classic', 'dbus', 'none']:
328 conf.fatal('Invalid autostart value "' + Options.options.autostart + '"')
330 if Options.options.autostart == 'default':
331 if conf.env['BUILD_JACKD']:
332 conf.env['AUTOSTART_METHOD'] = 'classic'
333 else:
334 conf.env['AUTOSTART_METHOD'] = 'dbus'
335 else:
336 conf.env['AUTOSTART_METHOD'] = Options.options.autostart
338 if conf.env['AUTOSTART_METHOD'] == 'dbus' and not conf.env['BUILD_JACKDBUS']:
339 conf.fatal('D-Bus autostart mode was specified but jackdbus will not be built')
340 if conf.env['AUTOSTART_METHOD'] == 'classic' and not conf.env['BUILD_JACKD']:
341 conf.fatal('Classic autostart mode was specified but jackd will not be built')
343 if conf.env['AUTOSTART_METHOD'] == 'dbus':
344 conf.define('USE_LIBDBUS_AUTOLAUNCH', 1)
345 elif conf.env['AUTOSTART_METHOD'] == 'classic':
346 conf.define('USE_CLASSIC_AUTOLAUNCH', 1)
348 conf.define('CLIENT_NUM', Options.options.clients)
349 conf.define('PORT_NUM_FOR_CLIENT', Options.options.application_ports)
351 if conf.env['IS_WINDOWS']:
352 # we define this in the environment to maintain compatability with
353 # existing install paths that use ADDON_DIR rather than have to
354 # have special cases for windows each time.
355 conf.env['ADDON_DIR'] = conf.env['BINDIR'] + '/jack'
356 # don't define ADDON_DIR in config.h, use the default 'jack' defined in
357 # windows/JackPlatformPlug_os.h
358 else:
359 conf.env['ADDON_DIR'] = os.path.normpath(os.path.join(conf.env['LIBDIR'], 'jack'))
360 conf.define('ADDON_DIR', conf.env['ADDON_DIR'])
361 conf.define('JACK_LOCATION', os.path.normpath(os.path.join(conf.env['PREFIX'], 'bin')))
363 if not conf.env['IS_WINDOWS']:
364 conf.define('USE_POSIX_SHM', 1)
365 conf.define('JACKMP', 1)
366 if conf.env['BUILD_JACKDBUS']:
367 conf.define('JACK_DBUS', 1)
368 if conf.env['BUILD_WITH_PROFILE']:
369 conf.define('JACK_MONITOR', 1)
370 conf.write_config_header('config.h', remove=False)
372 svnrev = None
373 try:
374 f = open('svnversion.h')
375 data = f.read()
376 m = re.match(r'^#define SVN_VERSION "([^"]*)"$', data)
377 if m != None:
378 svnrev = m.group(1)
379 f.close()
380 except IOError:
381 pass
383 if Options.options.mixed:
384 conf.setenv(lib32, env=conf.env.derive())
385 conf.env.append_unique('CXXFLAGS', '-m32')
386 conf.env.append_unique('CFLAGS', '-m32')
387 conf.env.append_unique('LINKFLAGS', '-m32')
388 if Options.options.libdir32:
389 conf.env['LIBDIR'] = Options.options.libdir32
390 else:
391 conf.env['LIBDIR'] = conf.env['PREFIX'] + '/lib32'
392 conf.write_config_header('config.h')
394 print()
395 print('==================')
396 version_msg = 'JACK ' + VERSION
397 if svnrev:
398 version_msg += ' exported from r' + svnrev
399 else:
400 version_msg += ' svn revision will checked and eventually updated during build'
401 print(version_msg)
403 conf.msg('Maximum JACK clients', Options.options.clients, color='NORMAL')
404 conf.msg('Maximum ports per application', Options.options.application_ports, color='NORMAL')
406 conf.msg('Install prefix', conf.env['PREFIX'], color='CYAN')
407 conf.msg('Library directory', conf.all_envs['']['LIBDIR'], color='CYAN')
408 if conf.env['BUILD_WITH_32_64']:
409 conf.msg('32-bit library directory', conf.all_envs[lib32]['LIBDIR'], color='CYAN')
410 conf.msg('Drivers directory', conf.env['ADDON_DIR'], color='CYAN')
411 display_feature(conf, 'Build debuggable binaries', conf.env['BUILD_DEBUG'])
413 tool_flags = [
414 ('C compiler flags', ['CFLAGS', 'CPPFLAGS']),
415 ('C++ compiler flags', ['CXXFLAGS', 'CPPFLAGS']),
416 ('Linker flags', ['LINKFLAGS', 'LDFLAGS'])
418 for name,vars in tool_flags:
419 flags = []
420 for var in vars:
421 flags += conf.all_envs[''][var]
422 conf.msg(name, repr(flags), color='NORMAL')
424 if conf.env['BUILD_WITH_32_64']:
425 conf.msg('32-bit C compiler flags', repr(conf.all_envs[lib32]['CFLAGS']))
426 conf.msg('32-bit C++ compiler flags', repr(conf.all_envs[lib32]['CXXFLAGS']))
427 conf.msg('32-bit linker flags', repr(conf.all_envs[lib32]['LINKFLAGS']))
428 display_feature(conf, 'Build with engine profiling', conf.env['BUILD_WITH_PROFILE'])
429 display_feature(conf, 'Build with 32/64 bits mixed mode', conf.env['BUILD_WITH_32_64'])
431 display_feature(conf, 'Build standard JACK (jackd)', conf.env['BUILD_JACKD'])
432 display_feature(conf, 'Build D-Bus JACK (jackdbus)', conf.env['BUILD_JACKDBUS'])
433 conf.msg('Autostart method', conf.env['AUTOSTART_METHOD'])
435 if conf.env['BUILD_JACKDBUS'] and conf.env['BUILD_JACKD']:
436 print(Logs.colors.RED + 'WARNING !! mixing both jackd and jackdbus may cause issues:' + Logs.colors.NORMAL)
437 print(Logs.colors.RED + 'WARNING !! jackdbus does not use .jackdrc nor qjackctl settings' + Logs.colors.NORMAL)
439 conf.summarize_auto_options()
441 if conf.env['BUILD_JACKDBUS']:
442 conf.msg('D-Bus service install directory', conf.env['DBUS_SERVICES_DIR'], color='CYAN')
444 if conf.env['DBUS_SERVICES_DIR'] != conf.env['DBUS_SERVICES_DIR_REAL']:
445 print()
446 print(Logs.colors.RED + 'WARNING: D-Bus session services directory as reported by pkg-config is')
447 print(Logs.colors.RED + 'WARNING:', end=' ')
448 print(Logs.colors.CYAN + conf.env['DBUS_SERVICES_DIR_REAL'])
449 print(Logs.colors.RED + 'WARNING: but service file will be installed in')
450 print(Logs.colors.RED + 'WARNING:', end=' ')
451 print(Logs.colors.CYAN + conf.env['DBUS_SERVICES_DIR'])
452 print(Logs.colors.RED + 'WARNING: You may need to adjust your D-Bus configuration after installing jackdbus')
453 print('WARNING: You can override dbus service install directory')
454 print('WARNING: with --enable-pkg-config-dbus-service-dir option to this script')
455 print(Logs.colors.NORMAL, end=' ')
456 print()
458 def init(ctx):
459 for y in (BuildContext, CleanContext, InstallContext, UninstallContext):
460 name = y.__name__.replace('Context','').lower()
461 class tmp(y):
462 cmd = name + '_' + lib32
463 variant = lib32
465 def obj_add_includes(bld, obj):
466 if bld.env['BUILD_JACKDBUS']:
467 obj.includes += ['dbus']
469 if bld.env['IS_LINUX']:
470 obj.includes += ['linux', 'posix']
472 if bld.env['IS_MACOSX']:
473 obj.includes += ['macosx', 'posix']
475 if bld.env['IS_SUN']:
476 obj.includes += ['posix', 'solaris']
478 if bld.env['IS_WINDOWS']:
479 obj.includes += ['windows']
481 # FIXME: Is SERVER_SIDE needed?
482 def build_jackd(bld):
483 jackd = bld(
484 features = ['cxx', 'cxxprogram'],
485 defines = ['HAVE_CONFIG_H','SERVER_SIDE'],
486 includes = ['.', 'common', 'common/jack'],
487 target = 'jackd',
488 source = ['common/Jackdmp.cpp'],
489 use = ['serverlib', 'SYSTEMD']
492 if bld.env['BUILD_JACKDBUS']:
493 jackd.source += ['dbus/audio_reserve.c', 'dbus/reserve.c']
494 jackd.use += ['DBUS-1']
496 if bld.env['IS_LINUX']:
497 jackd.use += ['DL', 'M', 'PTHREAD', 'RT', 'STDC++']
499 if bld.env['IS_MACOSX']:
500 jackd.use += ['DL', 'PTHREAD']
501 jackd.framework = ['CoreFoundation']
503 if bld.env['IS_SUN']:
504 jackd.use += ['DL', 'PTHREAD']
506 obj_add_includes(bld, jackd)
508 return jackd
510 # FIXME: Is SERVER_SIDE needed?
511 def create_driver_obj(bld, **kw):
512 if bld.env['IS_MACOSX'] or bld.env['IS_WINDOWS']:
513 # On MacOSX this is necessary.
514 # I do not know if this is necessary on Windows.
515 # Note added on 2015-12-13 by karllinden.
516 if 'use' in kw:
517 kw['use'] += ['serverlib']
518 else:
519 kw['use'] = ['serverlib']
521 driver = bld(
522 features = ['c', 'cxx', 'cshlib', 'cxxshlib'],
523 defines = ['HAVE_CONFIG_H', 'SERVER_SIDE'],
524 includes = ['.', 'common', 'common/jack'],
525 install_path = '${ADDON_DIR}/',
526 **kw)
528 if bld.env['IS_WINDOWS']:
529 driver.env['cxxshlib_PATTERN'] = 'jack_%s.dll'
530 else:
531 driver.env['cxxshlib_PATTERN'] = 'jack_%s.so'
533 obj_add_includes(bld, driver)
535 return driver
537 def build_drivers(bld):
538 # Non-hardware driver sources. Lexically sorted.
539 dummy_src = [
540 'common/JackDummyDriver.cpp'
543 loopback_src = [
544 'common/JackLoopbackDriver.cpp'
547 net_src = [
548 'common/JackNetDriver.cpp'
551 netone_src = [
552 'common/JackNetOneDriver.cpp',
553 'common/netjack.c',
554 'common/netjack_packet.c'
557 proxy_src = [
558 'common/JackProxyDriver.cpp'
561 # Hardware driver sources. Lexically sorted.
562 alsa_src = [
563 'common/memops.c',
564 'linux/alsa/JackAlsaDriver.cpp',
565 'linux/alsa/alsa_rawmidi.c',
566 'linux/alsa/alsa_seqmidi.c',
567 'linux/alsa/alsa_midi_jackmp.cpp',
568 'linux/alsa/generic_hw.c',
569 'linux/alsa/hdsp.c',
570 'linux/alsa/alsa_driver.c',
571 'linux/alsa/hammerfall.c',
572 'linux/alsa/ice1712.c'
575 alsarawmidi_src = [
576 'linux/alsarawmidi/JackALSARawMidiDriver.cpp',
577 'linux/alsarawmidi/JackALSARawMidiInputPort.cpp',
578 'linux/alsarawmidi/JackALSARawMidiOutputPort.cpp',
579 'linux/alsarawmidi/JackALSARawMidiPort.cpp',
580 'linux/alsarawmidi/JackALSARawMidiReceiveQueue.cpp',
581 'linux/alsarawmidi/JackALSARawMidiSendQueue.cpp',
582 'linux/alsarawmidi/JackALSARawMidiUtil.cpp'
585 boomer_src = [
586 'common/memops.c',
587 'solaris/oss/JackBoomerDriver.cpp'
590 coreaudio_src = [
591 'macosx/coreaudio/JackCoreAudioDriver.mm',
592 'common/JackAC3Encoder.cpp'
595 coremidi_src = [
596 'macosx/coremidi/JackCoreMidiInputPort.mm',
597 'macosx/coremidi/JackCoreMidiOutputPort.mm',
598 'macosx/coremidi/JackCoreMidiPhysicalInputPort.mm',
599 'macosx/coremidi/JackCoreMidiPhysicalOutputPort.mm',
600 'macosx/coremidi/JackCoreMidiVirtualInputPort.mm',
601 'macosx/coremidi/JackCoreMidiVirtualOutputPort.mm',
602 'macosx/coremidi/JackCoreMidiPort.mm',
603 'macosx/coremidi/JackCoreMidiUtil.mm',
604 'macosx/coremidi/JackCoreMidiDriver.mm'
607 ffado_src = [
608 'linux/firewire/JackFFADODriver.cpp',
609 'linux/firewire/JackFFADOMidiInputPort.cpp',
610 'linux/firewire/JackFFADOMidiOutputPort.cpp',
611 'linux/firewire/JackFFADOMidiReceiveQueue.cpp',
612 'linux/firewire/JackFFADOMidiSendQueue.cpp'
615 iio_driver_src = [
616 'linux/iio/JackIIODriver.cpp'
619 oss_src = [
620 'common/memops.c',
621 'solaris/oss/JackOSSDriver.cpp'
624 portaudio_src = [
625 'windows/portaudio/JackPortAudioDevices.cpp',
626 'windows/portaudio/JackPortAudioDriver.cpp',
629 winmme_src = [
630 'windows/winmme/JackWinMMEDriver.cpp',
631 'windows/winmme/JackWinMMEInputPort.cpp',
632 'windows/winmme/JackWinMMEOutputPort.cpp',
633 'windows/winmme/JackWinMMEPort.cpp',
636 # Create non-hardware driver objects. Lexically sorted.
637 create_driver_obj(
638 bld,
639 target = 'dummy',
640 source = dummy_src)
642 create_driver_obj(
643 bld,
644 target = 'loopback',
645 source = loopback_src)
647 create_driver_obj(
648 bld,
649 target = 'net',
650 source = net_src)
652 create_driver_obj(
653 bld,
654 target = 'netone',
655 source = netone_src,
656 use = ['SAMPLERATE', 'CELT'])
658 create_driver_obj(
659 bld,
660 target = 'proxy',
661 source = proxy_src)
663 # Create hardware driver objects. Lexically sorted after the conditional,
664 # e.g. BUILD_DRIVER_ALSA.
665 if bld.env['BUILD_DRIVER_ALSA']:
666 create_driver_obj(
667 bld,
668 target = 'alsa',
669 source = alsa_src,
670 use = ['ALSA'])
671 create_driver_obj(
672 bld,
673 target = 'alsarawmidi',
674 source = alsarawmidi_src,
675 use = ['ALSA'])
677 if bld.env['BUILD_DRIVER_FFADO']:
678 create_driver_obj(
679 bld,
680 target = 'firewire',
681 source = ffado_src,
682 use = ['LIBFFADO'])
684 if bld.env['BUILD_DRIVER_IIO']:
685 create_driver_obj(
686 bld,
687 target = 'iio',
688 source = iio_src,
689 use = ['GTKIOSTREAM', 'EIGEN3'])
691 if bld.env['BUILD_DRIVER_PORTAUDIO']:
692 create_driver_obj(
693 bld,
694 target = 'portaudio',
695 source = portaudio_src,
696 use = ['PORTAUDIO'])
698 if bld.env['BUILD_DRIVER_WINMME']:
699 create_driver_obj(
700 bld,
701 target = 'winmme',
702 source = winmme_src,
703 use = ['WINMME'])
705 if bld.env['IS_MACOSX']:
706 create_driver_obj(
707 bld,
708 target = 'coreaudio',
709 source = coreaudio_src,
710 use = ['AFTEN'],
711 framework = ['AudioUnit', 'CoreAudio', 'CoreServices'])
713 create_driver_obj(
714 bld,
715 target = 'coremidi',
716 source = coremidi_src,
717 use = ['serverlib'], # FIXME: Is this needed?
718 framework = ['AudioUnit', 'CoreMIDI', 'CoreServices', 'Foundation'])
720 if bld.env['IS_SUN']:
721 create_driver_obj(
722 bld,
723 target = 'boomer',
724 source = boomer_src)
725 create_driver_obj(
726 bld,
727 target = 'oss',
728 source = oss_src)
730 def build(bld):
731 if not bld.variant and bld.env['BUILD_WITH_32_64']:
732 Options.commands.append(bld.cmd + '_' + lib32)
734 # process subfolders from here
735 bld.recurse('common')
737 if bld.variant:
738 # only the wscript in common/ knows how to handle variants
739 return
741 bld.recurse('compat')
743 if not os.access('svnversion.h', os.R_OK):
744 def post_run(self):
745 sg = Utils.h_file(self.outputs[0].abspath(self.env))
746 #print sg.encode('hex')
747 Build.bld.node_sigs[self.env.variant()][self.outputs[0].id] = sg
749 script = bld.path.find_resource('svnversion_regenerate.sh')
750 script = script.abspath()
752 bld(
753 rule = '%s ${TGT}' % script,
754 name = 'svnversion',
755 runnable_status = Task.RUN_ME,
756 before = 'c cxx',
757 color = 'BLUE',
758 post_run = post_run,
759 source = ['svnversion_regenerate.sh'],
760 target = [bld.path.find_or_declare('svnversion.h')]
763 if bld.env['BUILD_JACKD']:
764 build_jackd(bld)
766 build_drivers(bld)
768 bld.recurse('example-clients')
769 if bld.env['IS_LINUX']:
770 bld.recurse('man')
771 if not bld.env['IS_WINDOWS']:
772 bld.recurse('tests')
773 if bld.env['BUILD_JACKDBUS']:
774 bld.recurse('dbus')
776 if bld.env['BUILD_DOXYGEN_DOCS']:
777 html_build_dir = bld.path.find_or_declare('html').abspath()
779 bld(
780 features = 'subst',
781 source = 'doxyfile.in',
782 target = 'doxyfile',
783 HTML_BUILD_DIR = html_build_dir,
784 SRCDIR = bld.srcnode.abspath(),
785 VERSION = VERSION
788 # There are two reasons for logging to doxygen.log and using it as
789 # target in the build rule (rather than html_build_dir):
790 # (1) reduce the noise when running the build
791 # (2) waf has a regular file to check for a timestamp. If the directory
792 # is used instead waf will rebuild the doxygen target (even upon
793 # install).
794 def doxygen(task):
795 doxyfile = task.inputs[0].abspath()
796 logfile = task.outputs[0].abspath()
797 cmd = '%s %s &> %s' % (task.env['DOXYGEN'][0], doxyfile, logfile)
798 return task.exec_command(cmd)
800 bld(
801 rule = doxygen,
802 source = 'doxyfile',
803 target = 'doxygen.log'
806 # Determine where to install HTML documentation. Since share_dir is the
807 # highest directory the uninstall routine should remove, there is no
808 # better candidate for share_dir, but the requested HTML directory if
809 # --htmldir is given.
810 if bld.env['HTMLDIR']:
811 html_install_dir = bld.options.destdir + bld.env['HTMLDIR']
812 share_dir = html_install_dir
813 else:
814 share_dir = bld.options.destdir + bld.env['PREFIX'] + '/share/jack-audio-connection-kit'
815 html_install_dir = share_dir + '/reference/html/'
817 if bld.cmd == 'install':
818 if os.path.isdir(html_install_dir):
819 Logs.pprint('CYAN', 'Removing old doxygen documentation installation...')
820 shutil.rmtree(html_install_dir)
821 Logs.pprint('CYAN', 'Removing old doxygen documentation installation done.')
822 Logs.pprint('CYAN', 'Installing doxygen documentation...')
823 shutil.copytree(html_build_dir, html_install_dir)
824 Logs.pprint('CYAN', 'Installing doxygen documentation done.')
825 elif bld.cmd =='uninstall':
826 Logs.pprint('CYAN', 'Uninstalling doxygen documentation...')
827 if os.path.isdir(share_dir):
828 shutil.rmtree(share_dir)
829 Logs.pprint('CYAN', 'Uninstalling doxygen documentation done.')
830 elif bld.cmd =='clean':
831 if os.access(html_build_dir, os.R_OK):
832 Logs.pprint('CYAN', 'Removing doxygen generated documentation...')
833 shutil.rmtree(html_build_dir)
834 Logs.pprint('CYAN', 'Removing doxygen generated documentation done.')
836 def dist(ctx):
837 # This code blindly assumes it is working in the toplevel source directory.
838 if not os.path.exists('svnversion.h'):
839 os.system('./svnversion_regenerate.sh svnversion.h')
841 from waflib import TaskGen
842 @TaskGen.extension('.mm')
843 def mm_hook(self, node):
844 """Alias .mm files to be compiled the same as .cpp files, gcc will do the right thing."""
845 return self.create_compiled_task('cxx', node)