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')
72 # options affecting general jack functionality
73 opt.add_option('--classic', action='store_true', default=False, help='Force enable standard JACK (jackd) even if D-Bus JACK (jackdbus) is enabled too')
74 opt.add_option('--dbus', action='store_true', default=False, help='Enable D-Bus JACK (jackdbus)')
75 opt.add_option('--autostart', type='string', default='default', help='Autostart method. Possible values: "default", "classic", "dbus", "none"')
76 opt.add_option('--profile', action='store_true', default=False, help='Build with engine profiling')
77 opt.add_option('--clients', default=256, type='int', dest='clients', help='Maximum number of JACK clients')
78 opt.add_option('--ports-per-application', default=2048, type='int', dest='application_ports', help='Maximum number of ports per application')
79 opt.add_option('--systemd-unit', action='store_true', default=False, help='Install systemd units.')
81 opt.set_auto_options_define('HAVE_%s')
82 opt.set_auto_options_style('yesno_and_hack')
84 # options with third party dependencies
85 doxygen = opt.add_auto_option(
87 help='Build doxygen documentation',
88 conf_dest='BUILD_DOXYGEN_DOCS',
90 doxygen.find_program('doxygen')
91 alsa = opt.add_auto_option(
93 help='Enable ALSA driver',
94 conf_dest='BUILD_DRIVER_ALSA')
96 package='alsa >= 1.0.18',
97 args='--cflags --libs')
98 firewire = opt.add_auto_option(
100 help='Enable FireWire driver (FFADO)',
101 conf_dest='BUILD_DRIVER_FFADO')
103 package='libffado >= 1.999.17',
104 args='--cflags --libs')
105 iio = opt.add_auto_option(
107 help='Enable IIO driver',
108 conf_dest='BUILD_DRIVER_IIO')
110 package='gtkIOStream >= 1.4.0',
111 args='--cflags --libs')
113 package='eigen3 >= 3.1.2',
114 args='--cflags --libs')
115 portaudio = opt.add_auto_option(
117 help='Enable Portaudio driver',
118 conf_dest='BUILD_DRIVER_PORTAUDIO')
119 portaudio.check(header_name='windows.h') # only build portaudio on windows
121 package='portaudio-2.0 >= 19',
122 uselib_store='PORTAUDIO',
123 args='--cflags --libs')
124 winmme = opt.add_auto_option(
126 help='Enable WinMME driver',
127 conf_dest='BUILD_DRIVER_WINMME')
129 header_name=['windows.h', 'mmsystem.h'],
130 msg='Checking for header mmsystem.h')
132 celt = opt.add_auto_option(
134 help='Build with CELT')
135 celt.add_function(check_for_celt)
137 # Suffix _PKG to not collide with HAVE_OPUS defined by the option.
138 opus = opt.add_auto_option(
140 help='Build Opus netjack2')
141 opus.check(header_name='opus/opus_custom.h')
143 package='opus >= 0.9.0',
144 args='--cflags --libs',
145 define_name='HAVE_OPUS_PKG')
147 samplerate = opt.add_auto_option(
149 help='Build with libsamplerate')
150 samplerate.check_cfg(
151 package='samplerate',
152 args='--cflags --libs')
153 sndfile = opt.add_auto_option(
155 help='Build with libsndfile')
158 args='--cflags --libs')
159 readline = opt.add_auto_option(
161 help='Build with readline')
162 readline.check(lib='readline')
164 header_name=['stdio.h', 'readline/readline.h'],
165 msg='Checking for header readline/readline.h')
166 sd = opt.add_auto_option(
168 help='Use systemd notify')
169 sd.check(header_name='systemd/sd-daemon.h')
170 sd.check(lib='systemd')
171 db = opt.add_auto_option(
173 help='Use Berkeley DB (metadata)')
174 db.check(header_name='db.h')
180 # this must be called before the configure phase
181 opt.apply_auto_options_hack()
183 def detect_platform(conf):
184 # GNU/kFreeBSD and GNU/Hurd are treated as Linux
186 # ('KEY, 'Human readable name', ['strings', 'to', 'check', 'for'])
187 ('IS_LINUX', 'Linux', ['gnu0', 'gnukfreebsd', 'linux', 'posix']),
188 ('IS_MACOSX', 'MacOS X', ['darwin']),
189 ('IS_SUN', 'SunOS', ['sunos']),
190 ('IS_WINDOWS', 'Windows', ['cygwin', 'msys', 'win32'])
193 for key,name,strings in platforms:
194 conf.env[key] = False
196 conf.start_msg('Checking platform')
197 platform = Options.options.platform
198 for key,name,strings in platforms:
200 if platform.startswith(s):
202 conf.end_msg(name, color='CYAN')
207 conf.load('compiler_cxx')
208 conf.load('compiler_c')
210 detect_platform(conf)
212 if conf.env['IS_WINDOWS']:
213 conf.env.append_unique('CCDEFINES', '_POSIX')
214 conf.env.append_unique('CXXDEFINES', '_POSIX')
216 conf.env.append_unique('CFLAGS', '-Wall')
217 conf.env.append_unique('CXXFLAGS', '-Wall')
218 conf.env.append_unique('CXXFLAGS', '-std=gnu++11')
220 if not conf.env['IS_MACOSX']:
221 conf.env.append_unique('LDFLAGS', '-Wl,--no-undefined')
223 conf.check(lib='aften', uselib='AFTEN', define_name='AFTEN')
226 + '#include <aften/aften.h>\n'
230 + 'AftenContext fAftenContext;\n'
231 + 'aften_set_defaults(&fAftenContext);\n'
232 + 'unsigned char *fb;\n'
233 + 'float *buf=new float[10];\n'
234 + 'int res = aften_encode_frame(&fAftenContext, fb, buf, 1);\n'
237 msg='Checking for aften_encode_frame()',
238 define_name='HAVE_AFTEN_NEW_API',
241 conf.load('autooptions')
243 conf.recurse('compat')
245 # Check for functions.
248 + '#define _GNU_SOURCE\n'
249 + '#include <poll.h>\n'
250 + '#include <signal.h>\n'
251 + '#include <stddef.h>\n'
255 + ' ppoll(NULL, 0, NULL, NULL);\n'
257 msg='Checking for ppoll',
258 define_name='HAVE_PPOLL',
261 # Check for backtrace support
263 header_name='execinfo.h',
264 define_name='HAVE_EXECINFO_H',
267 conf.recurse('common')
268 if Options.options.dbus:
270 if conf.env['BUILD_JACKDBUS'] != True:
271 conf.fatal('jackdbus was explicitly requested but cannot be built')
272 if conf.env['IS_LINUX']:
273 if Options.options.systemd_unit:
274 conf.recurse('systemd')
276 conf.env['SYSTEMD_USER_UNIT_DIR'] = None
279 conf.recurse('example-clients')
281 # test for the availability of ucontext, and how it should be used
282 for t in ['gp_regs', 'uc_regs', 'mc_gregs', 'gregs']:
283 fragment = '#include <ucontext.h>\n'
284 fragment += 'int main() { ucontext_t *ucontext; return (int) ucontext->uc_mcontext.%s[0]; }' % t
285 confvar = 'HAVE_UCONTEXT_%s' % t.upper()
286 conf.check_cc(fragment=fragment, define_name=confvar, mandatory=False,
287 msg='Checking for ucontext->uc_mcontext.%s' % t)
288 if conf.is_defined(confvar):
289 conf.define('HAVE_UCONTEXT', 1)
291 fragment = '#include <ucontext.h>\n'
292 fragment += 'int main() { return NGREG; }'
293 conf.check_cc(fragment=fragment, define_name='HAVE_NGREG', mandatory=False,
294 msg='Checking for NGREG')
296 conf.env['LIB_PTHREAD'] = ['pthread']
297 conf.env['LIB_DL'] = ['dl']
298 conf.env['LIB_RT'] = ['rt']
299 conf.env['LIB_M'] = ['m']
300 conf.env['LIB_STDC++'] = ['stdc++']
301 conf.env['JACK_API_VERSION'] = JACK_API_VERSION
302 conf.env['JACK_VERSION'] = VERSION
304 conf.env['BUILD_WITH_PROFILE'] = Options.options.profile
305 conf.env['BUILD_WITH_32_64'] = Options.options.mixed
306 conf.env['BUILD_CLASSIC'] = Options.options.classic
307 conf.env['BUILD_DEBUG'] = Options.options.debug
309 if conf.env['BUILD_JACKDBUS']:
310 conf.env['BUILD_JACKD'] = conf.env['BUILD_CLASSIC']
312 conf.env['BUILD_JACKD'] = True
314 conf.env['BINDIR'] = conf.env['PREFIX'] + '/bin'
316 if Options.options.htmldir:
317 conf.env['HTMLDIR'] = Options.options.htmldir
319 # set to None here so that the doxygen code can find out the highest
320 # directory to remove upon install
321 conf.env['HTMLDIR'] = None
323 if Options.options.libdir:
324 conf.env['LIBDIR'] = Options.options.libdir
326 conf.env['LIBDIR'] = conf.env['PREFIX'] + '/lib'
328 if Options.options.pkgconfigdir:
329 conf.env['PKGCONFDIR'] = Options.options.pkgconfigdir
331 conf.env['PKGCONFDIR'] = conf.env['LIBDIR'] + '/pkgconfig'
333 if Options.options.mandir:
334 conf.env['MANDIR'] = Options.options.mandir
336 conf.env['MANDIR'] = conf.env['PREFIX'] + '/share/man/man1'
338 if conf.env['BUILD_DEBUG']:
339 conf.env.append_unique('CXXFLAGS', '-g')
340 conf.env.append_unique('CFLAGS', '-g')
341 conf.env.append_unique('LINKFLAGS', '-g')
343 if not Options.options.autostart in ['default', 'classic', 'dbus', 'none']:
344 conf.fatal('Invalid autostart value "' + Options.options.autostart + '"')
346 if Options.options.autostart == 'default':
347 if conf.env['BUILD_JACKD']:
348 conf.env['AUTOSTART_METHOD'] = 'classic'
350 conf.env['AUTOSTART_METHOD'] = 'dbus'
352 conf.env['AUTOSTART_METHOD'] = Options.options.autostart
354 if conf.env['AUTOSTART_METHOD'] == 'dbus' and not conf.env['BUILD_JACKDBUS']:
355 conf.fatal('D-Bus autostart mode was specified but jackdbus will not be built')
356 if conf.env['AUTOSTART_METHOD'] == 'classic' and not conf.env['BUILD_JACKD']:
357 conf.fatal('Classic autostart mode was specified but jackd will not be built')
359 if conf.env['AUTOSTART_METHOD'] == 'dbus':
360 conf.define('USE_LIBDBUS_AUTOLAUNCH', 1)
361 elif conf.env['AUTOSTART_METHOD'] == 'classic':
362 conf.define('USE_CLASSIC_AUTOLAUNCH', 1)
364 conf.define('CLIENT_NUM', Options.options.clients)
365 conf.define('PORT_NUM_FOR_CLIENT', Options.options.application_ports)
367 if conf.env['IS_WINDOWS']:
368 # we define this in the environment to maintain compatibility with
369 # existing install paths that use ADDON_DIR rather than have to
370 # have special cases for windows each time.
371 conf.env['ADDON_DIR'] = conf.env['BINDIR'] + '/jack'
372 # don't define ADDON_DIR in config.h, use the default 'jack' defined in
373 # windows/JackPlatformPlug_os.h
375 conf.env['ADDON_DIR'] = os.path.normpath(os.path.join(conf.env['LIBDIR'], 'jack'))
376 conf.define('ADDON_DIR', conf.env['ADDON_DIR'])
377 conf.define('JACK_LOCATION', os.path.normpath(os.path.join(conf.env['PREFIX'], 'bin')))
379 if not conf.env['IS_WINDOWS']:
380 conf.define('USE_POSIX_SHM', 1)
381 conf.define('JACKMP', 1)
382 if conf.env['BUILD_JACKDBUS']:
383 conf.define('JACK_DBUS', 1)
384 if conf.env['BUILD_WITH_PROFILE']:
385 conf.define('JACK_MONITOR', 1)
386 conf.write_config_header('config.h', remove=False)
390 f = open('svnversion.h')
392 m = re.match(r'^#define SVN_VERSION "([^"]*)"$', data)
399 if Options.options.mixed:
400 conf.setenv(lib32, env=conf.env.derive())
401 conf.env.append_unique('CFLAGS', '-m32')
402 conf.env.append_unique('CXXFLAGS', '-m32')
403 conf.env.append_unique('CXXFLAGS', '-DBUILD_WITH_32_64')
404 conf.env.append_unique('LINKFLAGS', '-m32')
405 if Options.options.libdir32:
406 conf.env['LIBDIR'] = Options.options.libdir32
408 conf.env['LIBDIR'] = conf.env['PREFIX'] + '/lib32'
409 # libdb does not work in mixed mode
410 conf.all_envs[lib32]['HAVE_DB'] = 0
411 conf.all_envs[lib32]['HAVE_DB_H'] = 0
412 conf.all_envs[lib32]['LIB_DB'] = []
413 # no need for opus in 32bit mixed mode clients
414 conf.all_envs[lib32]['LIB_OPUS'] = []
415 # someone tell me where this file gets written please..
416 conf.write_config_header('config.h')
419 print('==================')
420 version_msg = 'JACK ' + VERSION
422 version_msg += ' exported from r' + svnrev
424 version_msg += ' svn revision will checked and eventually updated during build'
427 conf.msg('Maximum JACK clients', Options.options.clients, color='NORMAL')
428 conf.msg('Maximum ports per application', Options.options.application_ports, color='NORMAL')
430 conf.msg('Install prefix', conf.env['PREFIX'], color='CYAN')
431 conf.msg('Library directory', conf.all_envs['']['LIBDIR'], color='CYAN')
432 if conf.env['BUILD_WITH_32_64']:
433 conf.msg('32-bit library directory', conf.all_envs[lib32]['LIBDIR'], color='CYAN')
434 conf.msg('Drivers directory', conf.env['ADDON_DIR'], color='CYAN')
435 display_feature(conf, 'Build debuggable binaries', conf.env['BUILD_DEBUG'])
438 ('C compiler flags', ['CFLAGS', 'CPPFLAGS']),
439 ('C++ compiler flags', ['CXXFLAGS', 'CPPFLAGS']),
440 ('Linker flags', ['LINKFLAGS', 'LDFLAGS'])
442 for name,vars in tool_flags:
445 flags += conf.all_envs[''][var]
446 conf.msg(name, repr(flags), color='NORMAL')
448 if conf.env['BUILD_WITH_32_64']:
449 conf.msg('32-bit C compiler flags', repr(conf.all_envs[lib32]['CFLAGS']))
450 conf.msg('32-bit C++ compiler flags', repr(conf.all_envs[lib32]['CXXFLAGS']))
451 conf.msg('32-bit linker flags', repr(conf.all_envs[lib32]['LINKFLAGS']))
452 display_feature(conf, 'Build with engine profiling', conf.env['BUILD_WITH_PROFILE'])
453 display_feature(conf, 'Build with 32/64 bits mixed mode', conf.env['BUILD_WITH_32_64'])
455 display_feature(conf, 'Build standard JACK (jackd)', conf.env['BUILD_JACKD'])
456 display_feature(conf, 'Build D-Bus JACK (jackdbus)', conf.env['BUILD_JACKDBUS'])
457 conf.msg('Autostart method', conf.env['AUTOSTART_METHOD'])
459 if conf.env['BUILD_JACKDBUS'] and conf.env['BUILD_JACKD']:
460 print(Logs.colors.RED + 'WARNING !! mixing both jackd and jackdbus may cause issues:' + Logs.colors.NORMAL)
461 print(Logs.colors.RED + 'WARNING !! jackdbus does not use .jackdrc nor qjackctl settings' + Logs.colors.NORMAL)
463 conf.summarize_auto_options()
465 if conf.env['BUILD_JACKDBUS']:
466 conf.msg('D-Bus service install directory', conf.env['DBUS_SERVICES_DIR'], color='CYAN')
468 if conf.env['DBUS_SERVICES_DIR'] != conf.env['DBUS_SERVICES_DIR_REAL']:
470 print(Logs.colors.RED + 'WARNING: D-Bus session services directory as reported by pkg-config is')
471 print(Logs.colors.RED + 'WARNING:', end=' ')
472 print(Logs.colors.CYAN + conf.env['DBUS_SERVICES_DIR_REAL'])
473 print(Logs.colors.RED + 'WARNING: but service file will be installed in')
474 print(Logs.colors.RED + 'WARNING:', end=' ')
475 print(Logs.colors.CYAN + conf.env['DBUS_SERVICES_DIR'])
476 print(Logs.colors.RED + 'WARNING: You may need to adjust your D-Bus configuration after installing jackdbus')
477 print('WARNING: You can override dbus service install directory')
478 print('WARNING: with --enable-pkg-config-dbus-service-dir option to this script')
479 print(Logs.colors.NORMAL, end=' ')
483 for y in (BuildContext, CleanContext, InstallContext, UninstallContext):
484 name = y.__name__.replace('Context','').lower()
486 cmd = name + '_' + lib32
489 def obj_add_includes(bld, obj):
490 if bld.env['BUILD_JACKDBUS']:
491 obj.includes += ['dbus']
493 if bld.env['IS_LINUX']:
494 obj.includes += ['linux', 'posix']
496 if bld.env['IS_MACOSX']:
497 obj.includes += ['macosx', 'posix']
499 if bld.env['IS_SUN']:
500 obj.includes += ['posix', 'solaris']
502 if bld.env['IS_WINDOWS']:
503 obj.includes += ['windows']
505 # FIXME: Is SERVER_SIDE needed?
506 def build_jackd(bld):
508 features = ['cxx', 'cxxprogram'],
509 defines = ['HAVE_CONFIG_H','SERVER_SIDE'],
510 includes = ['.', 'common', 'common/jack'],
512 source = ['common/Jackdmp.cpp'],
513 use = ['serverlib', 'SYSTEMD']
516 if bld.env['BUILD_JACKDBUS']:
517 jackd.source += ['dbus/audio_reserve.c', 'dbus/reserve.c']
518 jackd.use += ['DBUS-1']
520 if bld.env['IS_LINUX']:
521 jackd.use += ['DL', 'M', 'PTHREAD', 'RT', 'STDC++']
523 if bld.env['IS_MACOSX']:
524 jackd.use += ['DL', 'PTHREAD']
525 jackd.framework = ['CoreFoundation']
527 if bld.env['IS_SUN']:
528 jackd.use += ['DL', 'PTHREAD']
530 obj_add_includes(bld, jackd)
534 # FIXME: Is SERVER_SIDE needed?
535 def create_driver_obj(bld, **kw):
537 kw['use'] += ['serverlib']
539 kw['use'] = ['serverlib']
542 features = ['c', 'cxx', 'cshlib', 'cxxshlib'],
543 defines = ['HAVE_CONFIG_H', 'SERVER_SIDE'],
544 includes = ['.', 'common', 'common/jack'],
545 install_path = '${ADDON_DIR}/',
548 if bld.env['IS_WINDOWS']:
549 driver.env['cxxshlib_PATTERN'] = 'jack_%s.dll'
551 driver.env['cxxshlib_PATTERN'] = 'jack_%s.so'
553 obj_add_includes(bld, driver)
557 def build_drivers(bld):
558 # Non-hardware driver sources. Lexically sorted.
560 'common/JackDummyDriver.cpp'
564 'common/JackLoopbackDriver.cpp'
568 'common/JackNetDriver.cpp'
572 'common/JackNetOneDriver.cpp',
574 'common/netjack_packet.c'
578 'common/JackProxyDriver.cpp'
581 # Hardware driver sources. Lexically sorted.
584 'linux/alsa/JackAlsaDriver.cpp',
585 'linux/alsa/alsa_rawmidi.c',
586 'linux/alsa/alsa_seqmidi.c',
587 'linux/alsa/alsa_midi_jackmp.cpp',
588 'linux/alsa/generic_hw.c',
590 'linux/alsa/alsa_driver.c',
591 'linux/alsa/hammerfall.c',
592 'linux/alsa/ice1712.c'
596 'linux/alsarawmidi/JackALSARawMidiDriver.cpp',
597 'linux/alsarawmidi/JackALSARawMidiInputPort.cpp',
598 'linux/alsarawmidi/JackALSARawMidiOutputPort.cpp',
599 'linux/alsarawmidi/JackALSARawMidiPort.cpp',
600 'linux/alsarawmidi/JackALSARawMidiReceiveQueue.cpp',
601 'linux/alsarawmidi/JackALSARawMidiSendQueue.cpp',
602 'linux/alsarawmidi/JackALSARawMidiUtil.cpp'
607 'solaris/oss/JackBoomerDriver.cpp'
611 'macosx/coreaudio/JackCoreAudioDriver.mm',
612 'common/JackAC3Encoder.cpp'
616 'macosx/coremidi/JackCoreMidiInputPort.mm',
617 'macosx/coremidi/JackCoreMidiOutputPort.mm',
618 'macosx/coremidi/JackCoreMidiPhysicalInputPort.mm',
619 'macosx/coremidi/JackCoreMidiPhysicalOutputPort.mm',
620 'macosx/coremidi/JackCoreMidiVirtualInputPort.mm',
621 'macosx/coremidi/JackCoreMidiVirtualOutputPort.mm',
622 'macosx/coremidi/JackCoreMidiPort.mm',
623 'macosx/coremidi/JackCoreMidiUtil.mm',
624 'macosx/coremidi/JackCoreMidiDriver.mm'
628 'linux/firewire/JackFFADODriver.cpp',
629 'linux/firewire/JackFFADOMidiInputPort.cpp',
630 'linux/firewire/JackFFADOMidiOutputPort.cpp',
631 'linux/firewire/JackFFADOMidiReceiveQueue.cpp',
632 'linux/firewire/JackFFADOMidiSendQueue.cpp'
636 'linux/iio/JackIIODriver.cpp'
641 'solaris/oss/JackOSSDriver.cpp'
645 'windows/portaudio/JackPortAudioDevices.cpp',
646 'windows/portaudio/JackPortAudioDriver.cpp',
650 'windows/winmme/JackWinMMEDriver.cpp',
651 'windows/winmme/JackWinMMEInputPort.cpp',
652 'windows/winmme/JackWinMMEOutputPort.cpp',
653 'windows/winmme/JackWinMMEPort.cpp',
656 # Create non-hardware driver objects. Lexically sorted.
665 source = loopback_src)
676 use = ['SAMPLERATE', 'CELT'])
683 # Create hardware driver objects. Lexically sorted after the conditional,
684 # e.g. BUILD_DRIVER_ALSA.
685 if bld.env['BUILD_DRIVER_ALSA']:
693 target = 'alsarawmidi',
694 source = alsarawmidi_src,
697 if bld.env['BUILD_DRIVER_FFADO']:
704 if bld.env['BUILD_DRIVER_IIO']:
709 use = ['GTKIOSTREAM', 'EIGEN3'])
711 if bld.env['BUILD_DRIVER_PORTAUDIO']:
714 target = 'portaudio',
715 source = portaudio_src,
718 if bld.env['BUILD_DRIVER_WINMME']:
725 if bld.env['IS_MACOSX']:
728 target = 'coreaudio',
729 source = coreaudio_src,
731 framework = ['AudioUnit', 'CoreAudio', 'CoreServices'])
736 source = coremidi_src,
737 use = ['serverlib'], # FIXME: Is this needed?
738 framework = ['AudioUnit', 'CoreMIDI', 'CoreServices', 'Foundation'])
740 if bld.env['IS_SUN']:
751 if not bld.variant and bld.env['BUILD_WITH_32_64']:
752 Options.commands.append(bld.cmd + '_' + lib32)
754 # process subfolders from here
755 bld.recurse('common')
758 # only the wscript in common/ knows how to handle variants
761 bld.recurse('compat')
763 if not os.access('svnversion.h', os.R_OK):
765 sg = Utils.h_file(self.outputs[0].abspath(self.env))
766 #print sg.encode('hex')
767 Build.bld.node_sigs[self.env.variant()][self.outputs[0].id] = sg
769 script = bld.path.find_resource('svnversion_regenerate.sh')
770 script = script.abspath()
773 rule = '%s ${TGT}' % script,
775 runnable_status = Task.RUN_ME,
779 source = ['svnversion_regenerate.sh'],
780 target = [bld.path.find_or_declare('svnversion.h')]
783 if bld.env['BUILD_JACKD']:
788 bld.recurse('example-clients')
789 if bld.env['IS_LINUX']:
791 bld.recurse('systemd')
792 if not bld.env['IS_WINDOWS']:
794 if bld.env['BUILD_JACKDBUS']:
797 if bld.env['BUILD_DOXYGEN_DOCS']:
798 html_build_dir = bld.path.find_or_declare('html').abspath()
802 source = 'doxyfile.in',
804 HTML_BUILD_DIR = html_build_dir,
805 SRCDIR = bld.srcnode.abspath(),
809 # There are two reasons for logging to doxygen.log and using it as
810 # target in the build rule (rather than html_build_dir):
811 # (1) reduce the noise when running the build
812 # (2) waf has a regular file to check for a timestamp. If the directory
813 # is used instead waf will rebuild the doxygen target (even upon
816 doxyfile = task.inputs[0].abspath()
817 logfile = task.outputs[0].abspath()
818 cmd = '%s %s &> %s' % (task.env['DOXYGEN'][0], doxyfile, logfile)
819 return task.exec_command(cmd)
824 target = 'doxygen.log'
827 # Determine where to install HTML documentation. Since share_dir is the
828 # highest directory the uninstall routine should remove, there is no
829 # better candidate for share_dir, but the requested HTML directory if
830 # --htmldir is given.
831 if bld.env['HTMLDIR']:
832 html_install_dir = bld.options.destdir + bld.env['HTMLDIR']
833 share_dir = html_install_dir
835 share_dir = bld.options.destdir + bld.env['PREFIX'] + '/share/jack-audio-connection-kit'
836 html_install_dir = share_dir + '/reference/html/'
838 if bld.cmd == 'install':
839 if os.path.isdir(html_install_dir):
840 Logs.pprint('CYAN', 'Removing old doxygen documentation installation...')
841 shutil.rmtree(html_install_dir)
842 Logs.pprint('CYAN', 'Removing old doxygen documentation installation done.')
843 Logs.pprint('CYAN', 'Installing doxygen documentation...')
844 shutil.copytree(html_build_dir, html_install_dir)
845 Logs.pprint('CYAN', 'Installing doxygen documentation done.')
846 elif bld.cmd =='uninstall':
847 Logs.pprint('CYAN', 'Uninstalling doxygen documentation...')
848 if os.path.isdir(share_dir):
849 shutil.rmtree(share_dir)
850 Logs.pprint('CYAN', 'Uninstalling doxygen documentation done.')
851 elif bld.cmd =='clean':
852 if os.access(html_build_dir, os.R_OK):
853 Logs.pprint('CYAN', 'Removing doxygen generated documentation...')
854 shutil.rmtree(html_build_dir)
855 Logs.pprint('CYAN', 'Removing doxygen generated documentation done.')
858 # This code blindly assumes it is working in the toplevel source directory.
859 if not os.path.exists('svnversion.h'):
860 os.system('./svnversion_regenerate.sh svnversion.h')
862 from waflib import TaskGen
863 @TaskGen.extension('.mm')
864 def mm_hook(self, node):
865 """Alias .mm files to be compiled the same as .cpp files, gcc will do the right thing."""
866 return self.create_compiled_task('cxx', node)