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