3 from __future__ import print_function
11 from waflib import Logs, Options, Task, Utils
12 from waflib.Build import BuildContext, CleanContext, InstallContext, UninstallContext
16 JACK_API_VERSION = '0.1.0'
18 # these variables are mandatory ('/' are converted automatically)
22 # lib32 variant name used when building in mixed mode
25 def display_feature(conf, msg, build):
27 conf.msg(msg, 'yes', color='GREEN')
29 conf.msg(msg, 'no', color='YELLOW')
31 def check_for_celt(conf):
33 for version in ['11', '8', '7', '5']:
34 define = 'HAVE_CELT_API_0_' + version
38 package='celt >= 0.%s.0' % version,
39 args='--cflags --libs')
41 conf.define(define, 1)
43 except conf.errors.ConfigurationError:
45 conf.define(define, 0)
48 raise conf.errors.ConfigurationError
51 # options provided by the modules
52 opt.load('compiler_cxx')
53 opt.load('compiler_c')
54 opt.load('autooptions');
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('--pkgconfigdir', type='string', help='pkg-config file directory [Default: <libdir>/pkgconfig]')
65 opt.add_option('--mandir', type='string', help='Manpage directory [Default: <prefix>/share/man/man1]')
67 # options affecting binaries
68 opt.add_option('--platform', type='string', default=sys.platform, help='Target platform for cross-compiling, e.g. cygwin or win32')
69 opt.add_option('--mixed', action='store_true', default=False, help='Build with 32/64 bits mixed mode')
70 opt.add_option('--debug', action='store_true', default=False, dest='debug', help='Build debuggable binaries')
71 opt.add_option('--static', action='store_true', default=False, dest='static', help='Build static binaries (Windows only)')
73 # options affecting general jack functionality
74 opt.add_option('--classic', action='store_true', default=False, help='Force enable standard JACK (jackd) even if D-Bus JACK (jackdbus) is enabled too')
75 opt.add_option('--dbus', action='store_true', default=False, help='Enable D-Bus JACK (jackdbus)')
76 opt.add_option('--autostart', type='string', default='default', help='Autostart method. Possible values: "default", "classic", "dbus", "none"')
77 opt.add_option('--profile', action='store_true', default=False, help='Build with engine profiling')
78 opt.add_option('--clients', default=256, type='int', dest='clients', help='Maximum number of JACK clients')
79 opt.add_option('--ports-per-application', default=2048, type='int', dest='application_ports', help='Maximum number of ports per application')
80 opt.add_option('--systemd-unit', action='store_true', default=False, help='Install systemd units.')
82 opt.set_auto_options_define('HAVE_%s')
83 opt.set_auto_options_style('yesno_and_hack')
85 # options with third party dependencies
86 doxygen = opt.add_auto_option(
88 help='Build doxygen documentation',
89 conf_dest='BUILD_DOXYGEN_DOCS',
91 doxygen.find_program('doxygen')
92 alsa = opt.add_auto_option(
94 help='Enable ALSA driver',
95 conf_dest='BUILD_DRIVER_ALSA')
97 package='alsa >= 1.0.18',
98 args='--cflags --libs')
99 firewire = opt.add_auto_option(
101 help='Enable FireWire driver (FFADO)',
102 conf_dest='BUILD_DRIVER_FFADO')
104 package='libffado >= 1.999.17',
105 args='--cflags --libs')
106 iio = opt.add_auto_option(
108 help='Enable IIO driver',
109 conf_dest='BUILD_DRIVER_IIO')
111 package='gtkIOStream >= 1.4.0',
112 args='--cflags --libs')
114 package='eigen3 >= 3.1.2',
115 args='--cflags --libs')
116 portaudio = opt.add_auto_option(
118 help='Enable Portaudio driver',
119 conf_dest='BUILD_DRIVER_PORTAUDIO')
120 portaudio.check(header_name='windows.h') # only build portaudio on windows
122 package='portaudio-2.0 >= 19',
123 uselib_store='PORTAUDIO',
124 args='--cflags --libs')
125 winmme = opt.add_auto_option(
127 help='Enable WinMME driver',
128 conf_dest='BUILD_DRIVER_WINMME')
130 header_name=['windows.h', 'mmsystem.h'],
131 msg='Checking for header mmsystem.h')
133 celt = opt.add_auto_option(
135 help='Build with CELT')
136 celt.add_function(check_for_celt)
138 # Suffix _PKG to not collide with HAVE_OPUS defined by the option.
139 opus = opt.add_auto_option(
141 help='Build Opus netjack2')
142 opus.check(header_name='opus/opus_custom.h')
144 package='opus >= 0.9.0',
145 args='--cflags --libs',
146 define_name='HAVE_OPUS_PKG')
148 samplerate = opt.add_auto_option(
150 help='Build with libsamplerate')
151 samplerate.check_cfg(
152 package='samplerate',
153 args='--cflags --libs')
154 sndfile = opt.add_auto_option(
156 help='Build with libsndfile')
159 args='--cflags --libs')
160 readline = opt.add_auto_option(
162 help='Build with readline')
163 readline.check(lib='readline')
165 header_name=['stdio.h', 'readline/readline.h'],
166 msg='Checking for header readline/readline.h')
167 sd = opt.add_auto_option(
169 help='Use systemd notify')
170 sd.check(header_name='systemd/sd-daemon.h')
171 sd.check(lib='systemd')
172 db = opt.add_auto_option(
174 help='Use Berkeley DB (metadata)')
175 db.check(header_name='db.h')
177 zalsa = opt.add_auto_option(
179 help='Build internal zita-a2j/j2a client')
180 zalsa.check(lib='zita-alsa-pcmi')
181 zalsa.check(lib='zita-resampler')
186 # this must be called before the configure phase
187 opt.apply_auto_options_hack()
189 def detect_platform(conf):
190 # GNU/kFreeBSD and GNU/Hurd are treated as Linux
192 # ('KEY, 'Human readable name', ['strings', 'to', 'check', 'for'])
193 ('IS_LINUX', 'Linux', ['gnu0', 'gnukfreebsd', 'linux', 'posix']),
194 ('IS_MACOSX', 'MacOS X', ['darwin']),
195 ('IS_SUN', 'SunOS', ['sunos']),
196 ('IS_WINDOWS', 'Windows', ['cygwin', 'msys', 'win32'])
199 for key,name,strings in platforms:
200 conf.env[key] = False
202 conf.start_msg('Checking platform')
203 platform = Options.options.platform
204 for key,name,strings in platforms:
206 if platform.startswith(s):
208 conf.end_msg(name, color='CYAN')
213 conf.load('compiler_cxx')
214 conf.load('compiler_c')
216 detect_platform(conf)
218 if conf.env['IS_WINDOWS']:
219 conf.env.append_unique('CCDEFINES', '_POSIX')
220 conf.env.append_unique('CXXDEFINES', '_POSIX')
221 if Options.options.platform == 'msys':
222 conf.env.append_value('INCLUDES', ['/mingw64/include'])
224 header_name='asio.h',
225 includes='/opt/asiosdk/common',
226 msg='Checking for ASIO SDK',
227 define_name='HAVE_ASIO',
230 conf.env.append_unique('CFLAGS', '-Wall')
231 conf.env.append_unique('CXXFLAGS', '-Wall')
232 conf.env.append_unique('CXXFLAGS', '-std=gnu++11')
234 if not conf.env['IS_MACOSX']:
235 conf.env.append_unique('LDFLAGS', '-Wl,--no-undefined')
237 conf.check(lib='aften', uselib='AFTEN', define_name='AFTEN')
240 + '#include <aften/aften.h>\n'
244 + 'AftenContext fAftenContext;\n'
245 + 'aften_set_defaults(&fAftenContext);\n'
246 + 'unsigned char *fb;\n'
247 + 'float *buf=new float[10];\n'
248 + 'int res = aften_encode_frame(&fAftenContext, fb, buf, 1);\n'
251 msg='Checking for aften_encode_frame()',
252 define_name='HAVE_AFTEN_NEW_API',
256 conf.env.append_unique('CXXFLAGS', '-Wno-deprecated-register')
258 conf.load('autooptions')
260 conf.recurse('compat')
262 # Check for functions.
265 + '#define _GNU_SOURCE\n'
266 + '#include <poll.h>\n'
267 + '#include <signal.h>\n'
268 + '#include <stddef.h>\n'
272 + ' ppoll(NULL, 0, NULL, NULL);\n'
274 msg='Checking for ppoll',
275 define_name='HAVE_PPOLL',
278 # Check for backtrace support
280 header_name='execinfo.h',
281 define_name='HAVE_EXECINFO_H',
284 conf.recurse('common')
285 if Options.options.dbus:
287 if conf.env['BUILD_JACKDBUS'] != True:
288 conf.fatal('jackdbus was explicitly requested but cannot be built')
289 if conf.env['IS_LINUX']:
290 if Options.options.systemd_unit:
291 conf.recurse('systemd')
293 conf.env['SYSTEMD_USER_UNIT_DIR'] = None
296 conf.recurse('example-clients')
297 conf.recurse('tools')
299 # test for the availability of ucontext, and how it should be used
300 for t in ['gp_regs', 'uc_regs', 'mc_gregs', 'gregs']:
301 fragment = '#include <ucontext.h>\n'
302 fragment += 'int main() { ucontext_t *ucontext; return (int) ucontext->uc_mcontext.%s[0]; }' % t
303 confvar = 'HAVE_UCONTEXT_%s' % t.upper()
304 conf.check_cc(fragment=fragment, define_name=confvar, mandatory=False,
305 msg='Checking for ucontext->uc_mcontext.%s' % t)
306 if conf.is_defined(confvar):
307 conf.define('HAVE_UCONTEXT', 1)
309 fragment = '#include <ucontext.h>\n'
310 fragment += 'int main() { return NGREG; }'
311 conf.check_cc(fragment=fragment, define_name='HAVE_NGREG', mandatory=False,
312 msg='Checking for NGREG')
314 conf.env['LIB_PTHREAD'] = ['pthread']
315 conf.env['LIB_DL'] = ['dl']
316 conf.env['LIB_RT'] = ['rt']
317 conf.env['LIB_M'] = ['m']
318 conf.env['LIB_STDC++'] = ['stdc++']
319 conf.env['JACK_API_VERSION'] = JACK_API_VERSION
320 conf.env['JACK_VERSION'] = VERSION
322 conf.env['BUILD_WITH_PROFILE'] = Options.options.profile
323 conf.env['BUILD_WITH_32_64'] = Options.options.mixed
324 conf.env['BUILD_CLASSIC'] = Options.options.classic
325 conf.env['BUILD_DEBUG'] = Options.options.debug
326 conf.env['BUILD_STATIC'] = Options.options.static
328 if conf.env['BUILD_JACKDBUS']:
329 conf.env['BUILD_JACKD'] = conf.env['BUILD_CLASSIC']
331 conf.env['BUILD_JACKD'] = True
333 conf.env['BINDIR'] = conf.env['PREFIX'] + '/bin'
335 if Options.options.htmldir:
336 conf.env['HTMLDIR'] = Options.options.htmldir
338 # set to None here so that the doxygen code can find out the highest
339 # directory to remove upon install
340 conf.env['HTMLDIR'] = None
342 if Options.options.libdir:
343 conf.env['LIBDIR'] = Options.options.libdir
345 conf.env['LIBDIR'] = conf.env['PREFIX'] + '/lib'
347 if Options.options.pkgconfigdir:
348 conf.env['PKGCONFDIR'] = Options.options.pkgconfigdir
350 conf.env['PKGCONFDIR'] = conf.env['LIBDIR'] + '/pkgconfig'
352 if Options.options.mandir:
353 conf.env['MANDIR'] = Options.options.mandir
355 conf.env['MANDIR'] = conf.env['PREFIX'] + '/share/man/man1'
357 if conf.env['BUILD_DEBUG']:
358 conf.env.append_unique('CXXFLAGS', '-g')
359 conf.env.append_unique('CFLAGS', '-g')
360 conf.env.append_unique('LINKFLAGS', '-g')
362 if not Options.options.autostart in ['default', 'classic', 'dbus', 'none']:
363 conf.fatal('Invalid autostart value "' + Options.options.autostart + '"')
365 if Options.options.autostart == 'default':
366 if conf.env['BUILD_JACKD']:
367 conf.env['AUTOSTART_METHOD'] = 'classic'
369 conf.env['AUTOSTART_METHOD'] = 'dbus'
371 conf.env['AUTOSTART_METHOD'] = Options.options.autostart
373 if conf.env['AUTOSTART_METHOD'] == 'dbus' and not conf.env['BUILD_JACKDBUS']:
374 conf.fatal('D-Bus autostart mode was specified but jackdbus will not be built')
375 if conf.env['AUTOSTART_METHOD'] == 'classic' and not conf.env['BUILD_JACKD']:
376 conf.fatal('Classic autostart mode was specified but jackd will not be built')
378 if conf.env['AUTOSTART_METHOD'] == 'dbus':
379 conf.define('USE_LIBDBUS_AUTOLAUNCH', 1)
380 elif conf.env['AUTOSTART_METHOD'] == 'classic':
381 conf.define('USE_CLASSIC_AUTOLAUNCH', 1)
383 conf.define('CLIENT_NUM', Options.options.clients)
384 conf.define('PORT_NUM_FOR_CLIENT', Options.options.application_ports)
386 if conf.env['IS_WINDOWS']:
387 # we define this in the environment to maintain compatibility with
388 # existing install paths that use ADDON_DIR rather than have to
389 # have special cases for windows each time.
390 conf.env['ADDON_DIR'] = conf.env['LIBDIR'] + '/jack'
391 if Options.options.platform == 'msys':
392 conf.define('ADDON_DIR', 'jack')
393 conf.define('__STDC_FORMAT_MACROS', 1) # for PRIu64
395 # don't define ADDON_DIR in config.h, use the default 'jack' defined in
396 # windows/JackPlatformPlug_os.h
399 conf.env['ADDON_DIR'] = os.path.normpath(os.path.join(conf.env['LIBDIR'], 'jack'))
400 conf.define('ADDON_DIR', conf.env['ADDON_DIR'])
401 conf.define('JACK_LOCATION', os.path.normpath(os.path.join(conf.env['PREFIX'], 'bin')))
403 if not conf.env['IS_WINDOWS']:
404 conf.define('USE_POSIX_SHM', 1)
405 conf.define('JACKMP', 1)
406 if conf.env['BUILD_JACKDBUS']:
407 conf.define('JACK_DBUS', 1)
408 if conf.env['BUILD_WITH_PROFILE']:
409 conf.define('JACK_MONITOR', 1)
410 conf.write_config_header('config.h', remove=False)
414 f = open('svnversion.h')
416 m = re.match(r'^#define SVN_VERSION "([^"]*)"$', data)
423 if Options.options.mixed:
424 conf.setenv(lib32, env=conf.env.derive())
425 conf.env.append_unique('CFLAGS', '-m32')
426 conf.env.append_unique('CXXFLAGS', '-m32')
427 conf.env.append_unique('CXXFLAGS', '-DBUILD_WITH_32_64')
428 conf.env.append_unique('LINKFLAGS', '-m32')
429 if Options.options.libdir32:
430 conf.env['LIBDIR'] = Options.options.libdir32
432 conf.env['LIBDIR'] = conf.env['PREFIX'] + '/lib32'
434 if conf.env['IS_WINDOWS'] and conf.env['BUILD_STATIC']:
435 def replaceFor32bit(env):
436 for e in env: yield e.replace('x86_64', 'i686', 1)
437 for env in ('AR', 'CC', 'CXX', 'LINK_CC', 'LINK_CXX'):
438 conf.all_envs[lib32][env] = list(replaceFor32bit(conf.all_envs[lib32][env]))
439 conf.all_envs[lib32]['LIB_REGEX'] = ['tre32']
441 # libdb does not work in mixed mode
442 conf.all_envs[lib32]['HAVE_DB'] = 0
443 conf.all_envs[lib32]['HAVE_DB_H'] = 0
444 conf.all_envs[lib32]['LIB_DB'] = []
445 # no need for opus in 32bit mixed mode clients
446 conf.all_envs[lib32]['LIB_OPUS'] = []
447 # someone tell me where this file gets written please..
448 conf.write_config_header('config.h')
451 print('==================')
452 version_msg = 'JACK ' + VERSION
454 version_msg += ' exported from r' + svnrev
456 version_msg += ' svn revision will checked and eventually updated during build'
459 conf.msg('Maximum JACK clients', Options.options.clients, color='NORMAL')
460 conf.msg('Maximum ports per application', Options.options.application_ports, color='NORMAL')
462 conf.msg('Install prefix', conf.env['PREFIX'], color='CYAN')
463 conf.msg('Library directory', conf.all_envs['']['LIBDIR'], color='CYAN')
464 if conf.env['BUILD_WITH_32_64']:
465 conf.msg('32-bit library directory', conf.all_envs[lib32]['LIBDIR'], color='CYAN')
466 conf.msg('Drivers directory', conf.env['ADDON_DIR'], color='CYAN')
467 display_feature(conf, 'Build debuggable binaries', conf.env['BUILD_DEBUG'])
470 ('C compiler flags', ['CFLAGS', 'CPPFLAGS']),
471 ('C++ compiler flags', ['CXXFLAGS', 'CPPFLAGS']),
472 ('Linker flags', ['LINKFLAGS', 'LDFLAGS'])
474 for name,vars in tool_flags:
477 flags += conf.all_envs[''][var]
478 conf.msg(name, repr(flags), color='NORMAL')
480 if conf.env['BUILD_WITH_32_64']:
481 conf.msg('32-bit C compiler flags', repr(conf.all_envs[lib32]['CFLAGS']))
482 conf.msg('32-bit C++ compiler flags', repr(conf.all_envs[lib32]['CXXFLAGS']))
483 conf.msg('32-bit linker flags', repr(conf.all_envs[lib32]['LINKFLAGS']))
484 display_feature(conf, 'Build with engine profiling', conf.env['BUILD_WITH_PROFILE'])
485 display_feature(conf, 'Build with 32/64 bits mixed mode', conf.env['BUILD_WITH_32_64'])
487 display_feature(conf, 'Build standard JACK (jackd)', conf.env['BUILD_JACKD'])
488 display_feature(conf, 'Build D-Bus JACK (jackdbus)', conf.env['BUILD_JACKDBUS'])
489 conf.msg('Autostart method', conf.env['AUTOSTART_METHOD'])
491 if conf.env['BUILD_JACKDBUS'] and conf.env['BUILD_JACKD']:
492 print(Logs.colors.RED + 'WARNING !! mixing both jackd and jackdbus may cause issues:' + Logs.colors.NORMAL)
493 print(Logs.colors.RED + 'WARNING !! jackdbus does not use .jackdrc nor qjackctl settings' + Logs.colors.NORMAL)
495 conf.summarize_auto_options()
497 if conf.env['BUILD_JACKDBUS']:
498 conf.msg('D-Bus service install directory', conf.env['DBUS_SERVICES_DIR'], color='CYAN')
500 if conf.env['DBUS_SERVICES_DIR'] != conf.env['DBUS_SERVICES_DIR_REAL']:
502 print(Logs.colors.RED + 'WARNING: D-Bus session services directory as reported by pkg-config is')
503 print(Logs.colors.RED + 'WARNING:', end=' ')
504 print(Logs.colors.CYAN + conf.env['DBUS_SERVICES_DIR_REAL'])
505 print(Logs.colors.RED + 'WARNING: but service file will be installed in')
506 print(Logs.colors.RED + 'WARNING:', end=' ')
507 print(Logs.colors.CYAN + conf.env['DBUS_SERVICES_DIR'])
508 print(Logs.colors.RED + 'WARNING: You may need to adjust your D-Bus configuration after installing jackdbus')
509 print('WARNING: You can override dbus service install directory')
510 print('WARNING: with --enable-pkg-config-dbus-service-dir option to this script')
511 print(Logs.colors.NORMAL, end=' ')
515 for y in (BuildContext, CleanContext, InstallContext, UninstallContext):
516 name = y.__name__.replace('Context','').lower()
518 cmd = name + '_' + lib32
521 def obj_add_includes(bld, obj):
522 if bld.env['BUILD_JACKDBUS']:
523 obj.includes += ['dbus']
525 if bld.env['IS_LINUX']:
526 obj.includes += ['linux', 'posix']
528 if bld.env['IS_MACOSX']:
529 obj.includes += ['macosx', 'posix']
531 if bld.env['IS_SUN']:
532 obj.includes += ['posix', 'solaris']
534 if bld.env['IS_WINDOWS']:
535 obj.includes += ['windows']
537 # FIXME: Is SERVER_SIDE needed?
538 def build_jackd(bld):
540 features = ['cxx', 'cxxprogram'],
541 defines = ['HAVE_CONFIG_H','SERVER_SIDE'],
542 includes = ['.', 'common', 'common/jack'],
544 source = ['common/Jackdmp.cpp'],
545 use = ['serverlib', 'SYSTEMD']
548 if bld.env['BUILD_JACKDBUS']:
549 jackd.source += ['dbus/audio_reserve.c', 'dbus/reserve.c']
550 jackd.use += ['DBUS-1']
552 if bld.env['IS_LINUX']:
553 jackd.use += ['DL', 'M', 'PTHREAD', 'RT', 'STDC++']
555 if bld.env['IS_MACOSX']:
556 jackd.use += ['DL', 'PTHREAD']
557 jackd.framework = ['CoreFoundation']
559 if bld.env['IS_SUN']:
560 jackd.use += ['DL', 'PTHREAD']
562 obj_add_includes(bld, jackd)
566 # FIXME: Is SERVER_SIDE needed?
567 def create_driver_obj(bld, **kw):
569 kw['use'] += ['serverlib']
571 kw['use'] = ['serverlib']
574 features = ['c', 'cxx', 'cshlib', 'cxxshlib'],
575 defines = ['HAVE_CONFIG_H', 'SERVER_SIDE'],
576 includes = ['.', 'common', 'common/jack'],
577 install_path = '${ADDON_DIR}/',
580 if bld.env['IS_WINDOWS']:
581 driver.env['cxxshlib_PATTERN'] = 'jack_%s.dll'
583 driver.env['cxxshlib_PATTERN'] = 'jack_%s.so'
585 obj_add_includes(bld, driver)
589 def build_drivers(bld):
590 # Non-hardware driver sources. Lexically sorted.
592 'common/JackDummyDriver.cpp'
596 'common/JackLoopbackDriver.cpp'
600 'common/JackNetDriver.cpp'
604 'common/JackNetOneDriver.cpp',
606 'common/netjack_packet.c'
610 'common/JackProxyDriver.cpp'
613 # Hardware driver sources. Lexically sorted.
616 'linux/alsa/JackAlsaDriver.cpp',
617 'linux/alsa/alsa_rawmidi.c',
618 'linux/alsa/alsa_seqmidi.c',
619 'linux/alsa/alsa_midi_jackmp.cpp',
620 'linux/alsa/generic_hw.c',
622 'linux/alsa/alsa_driver.c',
623 'linux/alsa/hammerfall.c',
624 'linux/alsa/ice1712.c'
628 'linux/alsarawmidi/JackALSARawMidiDriver.cpp',
629 'linux/alsarawmidi/JackALSARawMidiInputPort.cpp',
630 'linux/alsarawmidi/JackALSARawMidiOutputPort.cpp',
631 'linux/alsarawmidi/JackALSARawMidiPort.cpp',
632 'linux/alsarawmidi/JackALSARawMidiReceiveQueue.cpp',
633 'linux/alsarawmidi/JackALSARawMidiSendQueue.cpp',
634 'linux/alsarawmidi/JackALSARawMidiUtil.cpp'
639 'solaris/oss/JackBoomerDriver.cpp'
643 'macosx/coreaudio/JackCoreAudioDriver.mm',
644 'common/JackAC3Encoder.cpp'
648 'macosx/coremidi/JackCoreMidiInputPort.mm',
649 'macosx/coremidi/JackCoreMidiOutputPort.mm',
650 'macosx/coremidi/JackCoreMidiPhysicalInputPort.mm',
651 'macosx/coremidi/JackCoreMidiPhysicalOutputPort.mm',
652 'macosx/coremidi/JackCoreMidiVirtualInputPort.mm',
653 'macosx/coremidi/JackCoreMidiVirtualOutputPort.mm',
654 'macosx/coremidi/JackCoreMidiPort.mm',
655 'macosx/coremidi/JackCoreMidiUtil.mm',
656 'macosx/coremidi/JackCoreMidiDriver.mm'
660 'linux/firewire/JackFFADODriver.cpp',
661 'linux/firewire/JackFFADOMidiInputPort.cpp',
662 'linux/firewire/JackFFADOMidiOutputPort.cpp',
663 'linux/firewire/JackFFADOMidiReceiveQueue.cpp',
664 'linux/firewire/JackFFADOMidiSendQueue.cpp'
668 'linux/iio/JackIIODriver.cpp'
673 'solaris/oss/JackOSSDriver.cpp'
677 'windows/portaudio/JackPortAudioDevices.cpp',
678 'windows/portaudio/JackPortAudioDriver.cpp',
682 'windows/winmme/JackWinMMEDriver.cpp',
683 'windows/winmme/JackWinMMEInputPort.cpp',
684 'windows/winmme/JackWinMMEOutputPort.cpp',
685 'windows/winmme/JackWinMMEPort.cpp',
688 # Create non-hardware driver objects. Lexically sorted.
697 source = loopback_src)
708 use = ['SAMPLERATE', 'CELT'])
715 # Create hardware driver objects. Lexically sorted after the conditional,
716 # e.g. BUILD_DRIVER_ALSA.
717 if bld.env['BUILD_DRIVER_ALSA']:
725 target = 'alsarawmidi',
726 source = alsarawmidi_src,
729 if bld.env['BUILD_DRIVER_FFADO']:
736 if bld.env['BUILD_DRIVER_IIO']:
741 use = ['GTKIOSTREAM', 'EIGEN3'])
743 if bld.env['BUILD_DRIVER_PORTAUDIO']:
746 target = 'portaudio',
747 source = portaudio_src,
750 if bld.env['BUILD_DRIVER_WINMME']:
757 if bld.env['IS_MACOSX']:
760 target = 'coreaudio',
761 source = coreaudio_src,
763 framework = ['AudioUnit', 'CoreAudio', 'CoreServices'])
768 source = coremidi_src,
769 use = ['serverlib'], # FIXME: Is this needed?
770 framework = ['AudioUnit', 'CoreMIDI', 'CoreServices', 'Foundation'])
772 if bld.env['IS_SUN']:
783 if not bld.variant and bld.env['BUILD_WITH_32_64']:
784 Options.commands.append(bld.cmd + '_' + lib32)
786 # process subfolders from here
787 bld.recurse('common')
790 # only the wscript in common/ knows how to handle variants
793 bld.recurse('compat')
795 if not os.access('svnversion.h', os.R_OK):
797 sg = Utils.h_file(self.outputs[0].abspath(self.env))
798 #print sg.encode('hex')
799 Build.bld.node_sigs[self.env.variant()][self.outputs[0].id] = sg
801 script = bld.path.find_resource('svnversion_regenerate.sh')
802 script = script.abspath()
805 rule = '%s ${TGT}' % script,
807 runnable_status = Task.RUN_ME,
811 source = ['svnversion_regenerate.sh'],
812 target = [bld.path.find_or_declare('svnversion.h')]
815 if bld.env['BUILD_JACKD']:
820 bld.recurse('example-clients')
823 if bld.env['IS_LINUX']:
825 bld.recurse('systemd')
826 if not bld.env['IS_WINDOWS']:
828 if bld.env['BUILD_JACKDBUS']:
831 if bld.env['BUILD_DOXYGEN_DOCS']:
832 html_build_dir = bld.path.find_or_declare('html').abspath()
836 source = 'doxyfile.in',
838 HTML_BUILD_DIR = html_build_dir,
839 SRCDIR = bld.srcnode.abspath(),
843 # There are two reasons for logging to doxygen.log and using it as
844 # target in the build rule (rather than html_build_dir):
845 # (1) reduce the noise when running the build
846 # (2) waf has a regular file to check for a timestamp. If the directory
847 # is used instead waf will rebuild the doxygen target (even upon
850 doxyfile = task.inputs[0].abspath()
851 logfile = task.outputs[0].abspath()
852 cmd = '%s %s &> %s' % (task.env['DOXYGEN'][0], doxyfile, logfile)
853 return task.exec_command(cmd)
858 target = 'doxygen.log'
861 # Determine where to install HTML documentation. Since share_dir is the
862 # highest directory the uninstall routine should remove, there is no
863 # better candidate for share_dir, but the requested HTML directory if
864 # --htmldir is given.
865 if bld.env['HTMLDIR']:
866 html_install_dir = bld.options.destdir + bld.env['HTMLDIR']
867 share_dir = html_install_dir
869 share_dir = bld.options.destdir + bld.env['PREFIX'] + '/share/jack-audio-connection-kit'
870 html_install_dir = share_dir + '/reference/html/'
872 if bld.cmd == 'install':
873 if os.path.isdir(html_install_dir):
874 Logs.pprint('CYAN', 'Removing old doxygen documentation installation...')
875 shutil.rmtree(html_install_dir)
876 Logs.pprint('CYAN', 'Removing old doxygen documentation installation done.')
877 Logs.pprint('CYAN', 'Installing doxygen documentation...')
878 shutil.copytree(html_build_dir, html_install_dir)
879 Logs.pprint('CYAN', 'Installing doxygen documentation done.')
880 elif bld.cmd =='uninstall':
881 Logs.pprint('CYAN', 'Uninstalling doxygen documentation...')
882 if os.path.isdir(share_dir):
883 shutil.rmtree(share_dir)
884 Logs.pprint('CYAN', 'Uninstalling doxygen documentation done.')
885 elif bld.cmd =='clean':
886 if os.access(html_build_dir, os.R_OK):
887 Logs.pprint('CYAN', 'Removing doxygen generated documentation...')
888 shutil.rmtree(html_build_dir)
889 Logs.pprint('CYAN', 'Removing doxygen generated documentation done.')
892 # This code blindly assumes it is working in the toplevel source directory.
893 if not os.path.exists('svnversion.h'):
894 os.system('./svnversion_regenerate.sh svnversion.h')
896 from waflib import TaskGen
897 @TaskGen.extension('.mm')
898 def mm_hook(self, node):
899 """Alias .mm files to be compiled the same as .cpp files, gcc will do the right thing."""
900 return self.create_compiled_task('cxx', node)