Start of 1.9.14 development
[jack2.git] / wscript
blob55508fee9fa563ebca0cf5b297015be43fcda674
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.14'
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')
78 opt.add_option('--systemd-unit', action='store_true', default=False, help='Install systemd units.')
80 opt.set_auto_options_define('HAVE_%s')
81 opt.set_auto_options_style('yesno_and_hack')
83 # options with third party dependencies
84 doxygen = opt.add_auto_option(
85 'doxygen',
86 help='Build doxygen documentation',
87 conf_dest='BUILD_DOXYGEN_DOCS',
88 default=False)
89 doxygen.find_program('doxygen')
90 alsa = opt.add_auto_option(
91 'alsa',
92 help='Enable ALSA driver',
93 conf_dest='BUILD_DRIVER_ALSA')
94 alsa.check_cfg(
95 package='alsa >= 1.0.18',
96 args='--cflags --libs')
97 firewire = opt.add_auto_option(
98 'firewire',
99 help='Enable FireWire driver (FFADO)',
100 conf_dest='BUILD_DRIVER_FFADO')
101 firewire.check_cfg(
102 package='libffado >= 1.999.17',
103 args='--cflags --libs')
104 iio = opt.add_auto_option(
105 'iio',
106 help='Enable IIO driver',
107 conf_dest='BUILD_DRIVER_IIO')
108 iio.check_cfg(
109 package='gtkIOStream >= 1.4.0',
110 args='--cflags --libs')
111 iio.check_cfg(
112 package='eigen3 >= 3.1.2',
113 args='--cflags --libs')
114 portaudio = opt.add_auto_option(
115 'portaudio',
116 help='Enable Portaudio driver',
117 conf_dest='BUILD_DRIVER_PORTAUDIO')
118 portaudio.check(header_name='windows.h') # only build portaudio on windows
119 portaudio.check_cfg(
120 package='portaudio-2.0 >= 19',
121 uselib_store='PORTAUDIO',
122 args='--cflags --libs')
123 winmme = opt.add_auto_option(
124 'winmme',
125 help='Enable WinMME driver',
126 conf_dest='BUILD_DRIVER_WINMME')
127 winmme.check(
128 header_name=['windows.h', 'mmsystem.h'],
129 msg='Checking for header mmsystem.h')
131 celt = opt.add_auto_option(
132 'celt',
133 help='Build with CELT')
134 celt.add_function(check_for_celt)
136 # Suffix _PKG to not collide with HAVE_OPUS defined by the option.
137 opus = opt.add_auto_option(
138 'opus',
139 help='Build Opus netjack2')
140 opus.check(header_name='opus/opus_custom.h')
141 opus.check_cfg(
142 package='opus >= 0.9.0',
143 args='--cflags --libs',
144 define_name='HAVE_OPUS_PKG')
146 samplerate = opt.add_auto_option(
147 'samplerate',
148 help='Build with libsamplerate')
149 samplerate.check_cfg(
150 package='samplerate',
151 args='--cflags --libs')
152 sndfile = opt.add_auto_option(
153 'sndfile',
154 help='Build with libsndfile')
155 sndfile.check_cfg(
156 package='sndfile',
157 args='--cflags --libs')
158 readline = opt.add_auto_option(
159 'readline',
160 help='Build with readline')
161 readline.check(lib='readline')
162 readline.check(
163 header_name=['stdio.h', 'readline/readline.h'],
164 msg='Checking for header readline/readline.h')
165 sd = opt.add_auto_option(
166 'systemd',
167 help='Use systemd notify')
168 sd.check(header_name='systemd/sd-daemon.h')
169 sd.check(lib='systemd')
170 db = opt.add_auto_option(
171 'db',
172 help='Use Berkeley DB (metadata)')
173 db.check(header_name='db.h')
174 db.check(lib='db')
176 # dbus options
177 opt.recurse('dbus')
179 # this must be called before the configure phase
180 opt.apply_auto_options_hack()
182 def detect_platform(conf):
183 # GNU/kFreeBSD and GNU/Hurd are treated as Linux
184 platforms = [
185 # ('KEY, 'Human readable name', ['strings', 'to', 'check', 'for'])
186 ('IS_LINUX', 'Linux', ['gnu0', 'gnukfreebsd', 'linux', 'posix']),
187 ('IS_MACOSX', 'MacOS X', ['darwin']),
188 ('IS_SUN', 'SunOS', ['sunos']),
189 ('IS_WINDOWS', 'Windows', ['cygwin', 'msys', 'win32'])
192 for key,name,strings in platforms:
193 conf.env[key] = False
195 conf.start_msg('Checking platform')
196 platform = Options.options.platform
197 for key,name,strings in platforms:
198 for s in strings:
199 if platform.startswith(s):
200 conf.env[key] = True
201 conf.end_msg(name, color='CYAN')
202 break
205 def configure(conf):
206 conf.load('compiler_cxx')
207 conf.load('compiler_c')
209 detect_platform(conf)
211 if conf.env['IS_WINDOWS']:
212 conf.env.append_unique('CCDEFINES', '_POSIX')
213 conf.env.append_unique('CXXDEFINES', '_POSIX')
215 conf.env.append_unique('CXXFLAGS', '-Wall')
216 conf.env.append_unique('CXXFLAGS', '-std=gnu++11')
217 conf.env.append_unique('CFLAGS', '-Wall')
219 if conf.env['IS_MACOSX']:
220 conf.check(lib='aften', uselib='AFTEN', define_name='AFTEN')
221 conf.check_cxx(
222 fragment=''
223 + '#include <aften/aften.h>\n'
224 + 'int\n'
225 + 'main(void)\n'
226 + '{\n'
227 + 'AftenContext fAftenContext;\n'
228 + 'aften_set_defaults(&fAftenContext);\n'
229 + 'unsigned char *fb;\n'
230 + 'float *buf=new float[10];\n'
231 + 'int res = aften_encode_frame(&fAftenContext, fb, buf, 1);\n'
232 + '}\n',
233 lib='aften',
234 msg='Checking for aften_encode_frame()',
235 define_name='HAVE_AFTEN_NEW_API',
236 mandatory=False)
238 conf.load('autooptions')
240 conf.recurse('compat')
242 # Check for functions.
243 conf.check(
244 fragment=''
245 + '#define _GNU_SOURCE\n'
246 + '#include <poll.h>\n'
247 + '#include <signal.h>\n'
248 + '#include <stddef.h>\n'
249 + 'int\n'
250 + 'main(void)\n'
251 + '{\n'
252 + ' ppoll(NULL, 0, NULL, NULL);\n'
253 + '}\n',
254 msg='Checking for ppoll',
255 define_name='HAVE_PPOLL',
256 mandatory=False)
258 # Check for backtrace support
259 conf.check(
260 header_name='execinfo.h',
261 define_name='HAVE_EXECINFO_H',
262 mandatory=False)
264 conf.recurse('common')
265 if Options.options.dbus:
266 conf.recurse('dbus')
267 if conf.env['BUILD_JACKDBUS'] != True:
268 conf.fatal('jackdbus was explicitly requested but cannot be built')
269 if conf.env['IS_LINUX']:
270 if Options.options.systemd_unit:
271 conf.recurse('systemd')
272 else:
273 conf.env['SYSTEMD_USER_UNIT_DIR'] = None
276 conf.recurse('example-clients')
278 # test for the availability of ucontext, and how it should be used
279 for t in ['gp_regs', 'uc_regs', 'mc_gregs', 'gregs']:
280 fragment = '#include <ucontext.h>\n'
281 fragment += 'int main() { ucontext_t *ucontext; return (int) ucontext->uc_mcontext.%s[0]; }' % t
282 confvar = 'HAVE_UCONTEXT_%s' % t.upper()
283 conf.check_cc(fragment=fragment, define_name=confvar, mandatory=False,
284 msg='Checking for ucontext->uc_mcontext.%s' % t)
285 if conf.is_defined(confvar):
286 conf.define('HAVE_UCONTEXT', 1)
288 fragment = '#include <ucontext.h>\n'
289 fragment += 'int main() { return NGREG; }'
290 conf.check_cc(fragment=fragment, define_name='HAVE_NGREG', mandatory=False,
291 msg='Checking for NGREG')
293 conf.env['LIB_PTHREAD'] = ['pthread']
294 conf.env['LIB_DL'] = ['dl']
295 conf.env['LIB_RT'] = ['rt']
296 conf.env['LIB_M'] = ['m']
297 conf.env['LIB_STDC++'] = ['stdc++']
298 conf.env['JACK_API_VERSION'] = JACK_API_VERSION
299 conf.env['JACK_VERSION'] = VERSION
301 conf.env['BUILD_WITH_PROFILE'] = Options.options.profile
302 conf.env['BUILD_WITH_32_64'] = Options.options.mixed
303 conf.env['BUILD_CLASSIC'] = Options.options.classic
304 conf.env['BUILD_DEBUG'] = Options.options.debug
306 if conf.env['BUILD_JACKDBUS']:
307 conf.env['BUILD_JACKD'] = conf.env['BUILD_CLASSIC']
308 else:
309 conf.env['BUILD_JACKD'] = True
311 conf.env['BINDIR'] = conf.env['PREFIX'] + '/bin'
313 if Options.options.htmldir:
314 conf.env['HTMLDIR'] = Options.options.htmldir
315 else:
316 # set to None here so that the doxygen code can find out the highest
317 # directory to remove upon install
318 conf.env['HTMLDIR'] = None
320 if Options.options.libdir:
321 conf.env['LIBDIR'] = Options.options.libdir
322 else:
323 conf.env['LIBDIR'] = conf.env['PREFIX'] + '/lib'
325 if Options.options.mandir:
326 conf.env['MANDIR'] = Options.options.mandir
327 else:
328 conf.env['MANDIR'] = conf.env['PREFIX'] + '/share/man/man1'
330 if conf.env['BUILD_DEBUG']:
331 conf.env.append_unique('CXXFLAGS', '-g')
332 conf.env.append_unique('CFLAGS', '-g')
333 conf.env.append_unique('LINKFLAGS', '-g')
335 if not Options.options.autostart in ['default', 'classic', 'dbus', 'none']:
336 conf.fatal('Invalid autostart value "' + Options.options.autostart + '"')
338 if Options.options.autostart == 'default':
339 if conf.env['BUILD_JACKD']:
340 conf.env['AUTOSTART_METHOD'] = 'classic'
341 else:
342 conf.env['AUTOSTART_METHOD'] = 'dbus'
343 else:
344 conf.env['AUTOSTART_METHOD'] = Options.options.autostart
346 if conf.env['AUTOSTART_METHOD'] == 'dbus' and not conf.env['BUILD_JACKDBUS']:
347 conf.fatal('D-Bus autostart mode was specified but jackdbus will not be built')
348 if conf.env['AUTOSTART_METHOD'] == 'classic' and not conf.env['BUILD_JACKD']:
349 conf.fatal('Classic autostart mode was specified but jackd will not be built')
351 if conf.env['AUTOSTART_METHOD'] == 'dbus':
352 conf.define('USE_LIBDBUS_AUTOLAUNCH', 1)
353 elif conf.env['AUTOSTART_METHOD'] == 'classic':
354 conf.define('USE_CLASSIC_AUTOLAUNCH', 1)
356 conf.define('CLIENT_NUM', Options.options.clients)
357 conf.define('PORT_NUM_FOR_CLIENT', Options.options.application_ports)
359 if conf.env['IS_WINDOWS']:
360 # we define this in the environment to maintain compatibility with
361 # existing install paths that use ADDON_DIR rather than have to
362 # have special cases for windows each time.
363 conf.env['ADDON_DIR'] = conf.env['BINDIR'] + '/jack'
364 # don't define ADDON_DIR in config.h, use the default 'jack' defined in
365 # windows/JackPlatformPlug_os.h
366 else:
367 conf.env['ADDON_DIR'] = os.path.normpath(os.path.join(conf.env['LIBDIR'], 'jack'))
368 conf.define('ADDON_DIR', conf.env['ADDON_DIR'])
369 conf.define('JACK_LOCATION', os.path.normpath(os.path.join(conf.env['PREFIX'], 'bin')))
371 if not conf.env['IS_WINDOWS']:
372 conf.define('USE_POSIX_SHM', 1)
373 conf.define('JACKMP', 1)
374 if conf.env['BUILD_JACKDBUS']:
375 conf.define('JACK_DBUS', 1)
376 if conf.env['BUILD_WITH_PROFILE']:
377 conf.define('JACK_MONITOR', 1)
378 conf.write_config_header('config.h', remove=False)
380 svnrev = None
381 try:
382 f = open('svnversion.h')
383 data = f.read()
384 m = re.match(r'^#define SVN_VERSION "([^"]*)"$', data)
385 if m != None:
386 svnrev = m.group(1)
387 f.close()
388 except IOError:
389 pass
391 if Options.options.mixed:
392 conf.setenv(lib32, env=conf.env.derive())
393 conf.env.append_unique('CXXFLAGS', '-m32')
394 conf.env.append_unique('CFLAGS', '-m32')
395 conf.env.append_unique('LINKFLAGS', '-m32')
396 if Options.options.libdir32:
397 conf.env['LIBDIR'] = Options.options.libdir32
398 else:
399 conf.env['LIBDIR'] = conf.env['PREFIX'] + '/lib32'
400 conf.write_config_header('config.h')
402 print()
403 print('==================')
404 version_msg = 'JACK ' + VERSION
405 if svnrev:
406 version_msg += ' exported from r' + svnrev
407 else:
408 version_msg += ' svn revision will checked and eventually updated during build'
409 print(version_msg)
411 conf.msg('Maximum JACK clients', Options.options.clients, color='NORMAL')
412 conf.msg('Maximum ports per application', Options.options.application_ports, color='NORMAL')
414 conf.msg('Install prefix', conf.env['PREFIX'], color='CYAN')
415 conf.msg('Library directory', conf.all_envs['']['LIBDIR'], color='CYAN')
416 if conf.env['BUILD_WITH_32_64']:
417 conf.msg('32-bit library directory', conf.all_envs[lib32]['LIBDIR'], color='CYAN')
418 conf.msg('Drivers directory', conf.env['ADDON_DIR'], color='CYAN')
419 display_feature(conf, 'Build debuggable binaries', conf.env['BUILD_DEBUG'])
421 tool_flags = [
422 ('C compiler flags', ['CFLAGS', 'CPPFLAGS']),
423 ('C++ compiler flags', ['CXXFLAGS', 'CPPFLAGS']),
424 ('Linker flags', ['LINKFLAGS', 'LDFLAGS'])
426 for name,vars in tool_flags:
427 flags = []
428 for var in vars:
429 flags += conf.all_envs[''][var]
430 conf.msg(name, repr(flags), color='NORMAL')
432 if conf.env['BUILD_WITH_32_64']:
433 conf.msg('32-bit C compiler flags', repr(conf.all_envs[lib32]['CFLAGS']))
434 conf.msg('32-bit C++ compiler flags', repr(conf.all_envs[lib32]['CXXFLAGS']))
435 conf.msg('32-bit linker flags', repr(conf.all_envs[lib32]['LINKFLAGS']))
436 display_feature(conf, 'Build with engine profiling', conf.env['BUILD_WITH_PROFILE'])
437 display_feature(conf, 'Build with 32/64 bits mixed mode', conf.env['BUILD_WITH_32_64'])
439 display_feature(conf, 'Build standard JACK (jackd)', conf.env['BUILD_JACKD'])
440 display_feature(conf, 'Build D-Bus JACK (jackdbus)', conf.env['BUILD_JACKDBUS'])
441 conf.msg('Autostart method', conf.env['AUTOSTART_METHOD'])
443 if conf.env['BUILD_JACKDBUS'] and conf.env['BUILD_JACKD']:
444 print(Logs.colors.RED + 'WARNING !! mixing both jackd and jackdbus may cause issues:' + Logs.colors.NORMAL)
445 print(Logs.colors.RED + 'WARNING !! jackdbus does not use .jackdrc nor qjackctl settings' + Logs.colors.NORMAL)
447 conf.summarize_auto_options()
449 if conf.env['BUILD_JACKDBUS']:
450 conf.msg('D-Bus service install directory', conf.env['DBUS_SERVICES_DIR'], color='CYAN')
452 if conf.env['DBUS_SERVICES_DIR'] != conf.env['DBUS_SERVICES_DIR_REAL']:
453 print()
454 print(Logs.colors.RED + 'WARNING: D-Bus session services directory as reported by pkg-config is')
455 print(Logs.colors.RED + 'WARNING:', end=' ')
456 print(Logs.colors.CYAN + conf.env['DBUS_SERVICES_DIR_REAL'])
457 print(Logs.colors.RED + 'WARNING: but service file will be installed in')
458 print(Logs.colors.RED + 'WARNING:', end=' ')
459 print(Logs.colors.CYAN + conf.env['DBUS_SERVICES_DIR'])
460 print(Logs.colors.RED + 'WARNING: You may need to adjust your D-Bus configuration after installing jackdbus')
461 print('WARNING: You can override dbus service install directory')
462 print('WARNING: with --enable-pkg-config-dbus-service-dir option to this script')
463 print(Logs.colors.NORMAL, end=' ')
464 print()
466 def init(ctx):
467 for y in (BuildContext, CleanContext, InstallContext, UninstallContext):
468 name = y.__name__.replace('Context','').lower()
469 class tmp(y):
470 cmd = name + '_' + lib32
471 variant = lib32
473 def obj_add_includes(bld, obj):
474 if bld.env['BUILD_JACKDBUS']:
475 obj.includes += ['dbus']
477 if bld.env['IS_LINUX']:
478 obj.includes += ['linux', 'posix']
480 if bld.env['IS_MACOSX']:
481 obj.includes += ['macosx', 'posix']
483 if bld.env['IS_SUN']:
484 obj.includes += ['posix', 'solaris']
486 if bld.env['IS_WINDOWS']:
487 obj.includes += ['windows']
489 # FIXME: Is SERVER_SIDE needed?
490 def build_jackd(bld):
491 jackd = bld(
492 features = ['cxx', 'cxxprogram'],
493 defines = ['HAVE_CONFIG_H','SERVER_SIDE'],
494 includes = ['.', 'common', 'common/jack'],
495 target = 'jackd',
496 source = ['common/Jackdmp.cpp'],
497 use = ['serverlib', 'SYSTEMD']
500 if bld.env['BUILD_JACKDBUS']:
501 jackd.source += ['dbus/audio_reserve.c', 'dbus/reserve.c']
502 jackd.use += ['DBUS-1']
504 if bld.env['IS_LINUX']:
505 jackd.use += ['DL', 'M', 'PTHREAD', 'RT', 'STDC++']
507 if bld.env['IS_MACOSX']:
508 jackd.use += ['DL', 'PTHREAD']
509 jackd.framework = ['CoreFoundation']
511 if bld.env['IS_SUN']:
512 jackd.use += ['DL', 'PTHREAD']
514 obj_add_includes(bld, jackd)
516 return jackd
518 # FIXME: Is SERVER_SIDE needed?
519 def create_driver_obj(bld, **kw):
520 if bld.env['IS_MACOSX'] or bld.env['IS_WINDOWS']:
521 # On MacOSX this is necessary.
522 # I do not know if this is necessary on Windows.
523 # Note added on 2015-12-13 by karllinden.
524 if 'use' in kw:
525 kw['use'] += ['serverlib']
526 else:
527 kw['use'] = ['serverlib']
529 driver = bld(
530 features = ['c', 'cxx', 'cshlib', 'cxxshlib'],
531 defines = ['HAVE_CONFIG_H', 'SERVER_SIDE'],
532 includes = ['.', 'common', 'common/jack'],
533 install_path = '${ADDON_DIR}/',
534 **kw)
536 if bld.env['IS_WINDOWS']:
537 driver.env['cxxshlib_PATTERN'] = 'jack_%s.dll'
538 else:
539 driver.env['cxxshlib_PATTERN'] = 'jack_%s.so'
541 obj_add_includes(bld, driver)
543 return driver
545 def build_drivers(bld):
546 # Non-hardware driver sources. Lexically sorted.
547 dummy_src = [
548 'common/JackDummyDriver.cpp'
551 loopback_src = [
552 'common/JackLoopbackDriver.cpp'
555 net_src = [
556 'common/JackNetDriver.cpp'
559 netone_src = [
560 'common/JackNetOneDriver.cpp',
561 'common/netjack.c',
562 'common/netjack_packet.c'
565 proxy_src = [
566 'common/JackProxyDriver.cpp'
569 # Hardware driver sources. Lexically sorted.
570 alsa_src = [
571 'common/memops.c',
572 'linux/alsa/JackAlsaDriver.cpp',
573 'linux/alsa/alsa_rawmidi.c',
574 'linux/alsa/alsa_seqmidi.c',
575 'linux/alsa/alsa_midi_jackmp.cpp',
576 'linux/alsa/generic_hw.c',
577 'linux/alsa/hdsp.c',
578 'linux/alsa/alsa_driver.c',
579 'linux/alsa/hammerfall.c',
580 'linux/alsa/ice1712.c'
583 alsarawmidi_src = [
584 'linux/alsarawmidi/JackALSARawMidiDriver.cpp',
585 'linux/alsarawmidi/JackALSARawMidiInputPort.cpp',
586 'linux/alsarawmidi/JackALSARawMidiOutputPort.cpp',
587 'linux/alsarawmidi/JackALSARawMidiPort.cpp',
588 'linux/alsarawmidi/JackALSARawMidiReceiveQueue.cpp',
589 'linux/alsarawmidi/JackALSARawMidiSendQueue.cpp',
590 'linux/alsarawmidi/JackALSARawMidiUtil.cpp'
593 boomer_src = [
594 'common/memops.c',
595 'solaris/oss/JackBoomerDriver.cpp'
598 coreaudio_src = [
599 'macosx/coreaudio/JackCoreAudioDriver.mm',
600 'common/JackAC3Encoder.cpp'
603 coremidi_src = [
604 'macosx/coremidi/JackCoreMidiInputPort.mm',
605 'macosx/coremidi/JackCoreMidiOutputPort.mm',
606 'macosx/coremidi/JackCoreMidiPhysicalInputPort.mm',
607 'macosx/coremidi/JackCoreMidiPhysicalOutputPort.mm',
608 'macosx/coremidi/JackCoreMidiVirtualInputPort.mm',
609 'macosx/coremidi/JackCoreMidiVirtualOutputPort.mm',
610 'macosx/coremidi/JackCoreMidiPort.mm',
611 'macosx/coremidi/JackCoreMidiUtil.mm',
612 'macosx/coremidi/JackCoreMidiDriver.mm'
615 ffado_src = [
616 'linux/firewire/JackFFADODriver.cpp',
617 'linux/firewire/JackFFADOMidiInputPort.cpp',
618 'linux/firewire/JackFFADOMidiOutputPort.cpp',
619 'linux/firewire/JackFFADOMidiReceiveQueue.cpp',
620 'linux/firewire/JackFFADOMidiSendQueue.cpp'
623 iio_driver_src = [
624 'linux/iio/JackIIODriver.cpp'
627 oss_src = [
628 'common/memops.c',
629 'solaris/oss/JackOSSDriver.cpp'
632 portaudio_src = [
633 'windows/portaudio/JackPortAudioDevices.cpp',
634 'windows/portaudio/JackPortAudioDriver.cpp',
637 winmme_src = [
638 'windows/winmme/JackWinMMEDriver.cpp',
639 'windows/winmme/JackWinMMEInputPort.cpp',
640 'windows/winmme/JackWinMMEOutputPort.cpp',
641 'windows/winmme/JackWinMMEPort.cpp',
644 # Create non-hardware driver objects. Lexically sorted.
645 create_driver_obj(
646 bld,
647 target = 'dummy',
648 source = dummy_src)
650 create_driver_obj(
651 bld,
652 target = 'loopback',
653 source = loopback_src)
655 create_driver_obj(
656 bld,
657 target = 'net',
658 source = net_src)
660 create_driver_obj(
661 bld,
662 target = 'netone',
663 source = netone_src,
664 use = ['SAMPLERATE', 'CELT'])
666 create_driver_obj(
667 bld,
668 target = 'proxy',
669 source = proxy_src)
671 # Create hardware driver objects. Lexically sorted after the conditional,
672 # e.g. BUILD_DRIVER_ALSA.
673 if bld.env['BUILD_DRIVER_ALSA']:
674 create_driver_obj(
675 bld,
676 target = 'alsa',
677 source = alsa_src,
678 use = ['ALSA'])
679 create_driver_obj(
680 bld,
681 target = 'alsarawmidi',
682 source = alsarawmidi_src,
683 use = ['ALSA'])
685 if bld.env['BUILD_DRIVER_FFADO']:
686 create_driver_obj(
687 bld,
688 target = 'firewire',
689 source = ffado_src,
690 use = ['LIBFFADO'])
692 if bld.env['BUILD_DRIVER_IIO']:
693 create_driver_obj(
694 bld,
695 target = 'iio',
696 source = iio_src,
697 use = ['GTKIOSTREAM', 'EIGEN3'])
699 if bld.env['BUILD_DRIVER_PORTAUDIO']:
700 create_driver_obj(
701 bld,
702 target = 'portaudio',
703 source = portaudio_src,
704 use = ['PORTAUDIO'])
706 if bld.env['BUILD_DRIVER_WINMME']:
707 create_driver_obj(
708 bld,
709 target = 'winmme',
710 source = winmme_src,
711 use = ['WINMME'])
713 if bld.env['IS_MACOSX']:
714 create_driver_obj(
715 bld,
716 target = 'coreaudio',
717 source = coreaudio_src,
718 use = ['AFTEN'],
719 framework = ['AudioUnit', 'CoreAudio', 'CoreServices'])
721 create_driver_obj(
722 bld,
723 target = 'coremidi',
724 source = coremidi_src,
725 use = ['serverlib'], # FIXME: Is this needed?
726 framework = ['AudioUnit', 'CoreMIDI', 'CoreServices', 'Foundation'])
728 if bld.env['IS_SUN']:
729 create_driver_obj(
730 bld,
731 target = 'boomer',
732 source = boomer_src)
733 create_driver_obj(
734 bld,
735 target = 'oss',
736 source = oss_src)
738 def build(bld):
739 if not bld.variant and bld.env['BUILD_WITH_32_64']:
740 Options.commands.append(bld.cmd + '_' + lib32)
742 # process subfolders from here
743 bld.recurse('common')
745 if bld.variant:
746 # only the wscript in common/ knows how to handle variants
747 return
749 bld.recurse('compat')
751 if not os.access('svnversion.h', os.R_OK):
752 def post_run(self):
753 sg = Utils.h_file(self.outputs[0].abspath(self.env))
754 #print sg.encode('hex')
755 Build.bld.node_sigs[self.env.variant()][self.outputs[0].id] = sg
757 script = bld.path.find_resource('svnversion_regenerate.sh')
758 script = script.abspath()
760 bld(
761 rule = '%s ${TGT}' % script,
762 name = 'svnversion',
763 runnable_status = Task.RUN_ME,
764 before = 'c cxx',
765 color = 'BLUE',
766 post_run = post_run,
767 source = ['svnversion_regenerate.sh'],
768 target = [bld.path.find_or_declare('svnversion.h')]
771 if bld.env['BUILD_JACKD']:
772 build_jackd(bld)
774 build_drivers(bld)
776 bld.recurse('example-clients')
777 if bld.env['IS_LINUX']:
778 bld.recurse('man')
779 bld.recurse('systemd')
780 if not bld.env['IS_WINDOWS']:
781 bld.recurse('tests')
782 if bld.env['BUILD_JACKDBUS']:
783 bld.recurse('dbus')
785 if bld.env['BUILD_DOXYGEN_DOCS']:
786 html_build_dir = bld.path.find_or_declare('html').abspath()
788 bld(
789 features = 'subst',
790 source = 'doxyfile.in',
791 target = 'doxyfile',
792 HTML_BUILD_DIR = html_build_dir,
793 SRCDIR = bld.srcnode.abspath(),
794 VERSION = VERSION
797 # There are two reasons for logging to doxygen.log and using it as
798 # target in the build rule (rather than html_build_dir):
799 # (1) reduce the noise when running the build
800 # (2) waf has a regular file to check for a timestamp. If the directory
801 # is used instead waf will rebuild the doxygen target (even upon
802 # install).
803 def doxygen(task):
804 doxyfile = task.inputs[0].abspath()
805 logfile = task.outputs[0].abspath()
806 cmd = '%s %s &> %s' % (task.env['DOXYGEN'][0], doxyfile, logfile)
807 return task.exec_command(cmd)
809 bld(
810 rule = doxygen,
811 source = 'doxyfile',
812 target = 'doxygen.log'
815 # Determine where to install HTML documentation. Since share_dir is the
816 # highest directory the uninstall routine should remove, there is no
817 # better candidate for share_dir, but the requested HTML directory if
818 # --htmldir is given.
819 if bld.env['HTMLDIR']:
820 html_install_dir = bld.options.destdir + bld.env['HTMLDIR']
821 share_dir = html_install_dir
822 else:
823 share_dir = bld.options.destdir + bld.env['PREFIX'] + '/share/jack-audio-connection-kit'
824 html_install_dir = share_dir + '/reference/html/'
826 if bld.cmd == 'install':
827 if os.path.isdir(html_install_dir):
828 Logs.pprint('CYAN', 'Removing old doxygen documentation installation...')
829 shutil.rmtree(html_install_dir)
830 Logs.pprint('CYAN', 'Removing old doxygen documentation installation done.')
831 Logs.pprint('CYAN', 'Installing doxygen documentation...')
832 shutil.copytree(html_build_dir, html_install_dir)
833 Logs.pprint('CYAN', 'Installing doxygen documentation done.')
834 elif bld.cmd =='uninstall':
835 Logs.pprint('CYAN', 'Uninstalling doxygen documentation...')
836 if os.path.isdir(share_dir):
837 shutil.rmtree(share_dir)
838 Logs.pprint('CYAN', 'Uninstalling doxygen documentation done.')
839 elif bld.cmd =='clean':
840 if os.access(html_build_dir, os.R_OK):
841 Logs.pprint('CYAN', 'Removing doxygen generated documentation...')
842 shutil.rmtree(html_build_dir)
843 Logs.pprint('CYAN', 'Removing doxygen generated documentation done.')
845 def dist(ctx):
846 # This code blindly assumes it is working in the toplevel source directory.
847 if not os.path.exists('svnversion.h'):
848 os.system('./svnversion_regenerate.sh svnversion.h')
850 from waflib import TaskGen
851 @TaskGen.extension('.mm')
852 def mm_hook(self, node):
853 """Alias .mm files to be compiled the same as .cpp files, gcc will do the right thing."""
854 return self.create_compiled_task('cxx', node)