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')
215 if Options.options.platform == 'msys':
216 conf.env.append_value('INCLUDES', ['/mingw64/include'])
218 header_name='asio.h',
219 includes='/opt/asiosdk/common',
220 msg='Checking for ASIO SDK',
221 define_name='HAVE_ASIO',
224 conf.env.append_unique('CFLAGS', '-Wall')
225 conf.env.append_unique('CXXFLAGS', '-Wall')
226 conf.env.append_unique('CXXFLAGS', '-std=gnu++11')
228 if not conf.env['IS_MACOSX']:
229 conf.env.append_unique('LDFLAGS', '-Wl,--no-undefined')
231 conf.check(lib='aften', uselib='AFTEN', define_name='AFTEN')
234 + '#include <aften/aften.h>\n'
238 + 'AftenContext fAftenContext;\n'
239 + 'aften_set_defaults(&fAftenContext);\n'
240 + 'unsigned char *fb;\n'
241 + 'float *buf=new float[10];\n'
242 + 'int res = aften_encode_frame(&fAftenContext, fb, buf, 1);\n'
245 msg='Checking for aften_encode_frame()',
246 define_name='HAVE_AFTEN_NEW_API',
250 conf.env.append_unique('CXXFLAGS', '-Wno-deprecated-register')
252 conf.load('autooptions')
254 conf.recurse('compat')
256 # Check for functions.
259 + '#define _GNU_SOURCE\n'
260 + '#include <poll.h>\n'
261 + '#include <signal.h>\n'
262 + '#include <stddef.h>\n'
266 + ' ppoll(NULL, 0, NULL, NULL);\n'
268 msg='Checking for ppoll',
269 define_name='HAVE_PPOLL',
272 # Check for backtrace support
274 header_name='execinfo.h',
275 define_name='HAVE_EXECINFO_H',
278 conf.recurse('common')
279 if Options.options.dbus:
281 if conf.env['BUILD_JACKDBUS'] != True:
282 conf.fatal('jackdbus was explicitly requested but cannot be built')
283 if conf.env['IS_LINUX']:
284 if Options.options.systemd_unit:
285 conf.recurse('systemd')
287 conf.env['SYSTEMD_USER_UNIT_DIR'] = None
290 conf.recurse('example-clients')
292 # test for the availability of ucontext, and how it should be used
293 for t in ['gp_regs', 'uc_regs', 'mc_gregs', 'gregs']:
294 fragment = '#include <ucontext.h>\n'
295 fragment += 'int main() { ucontext_t *ucontext; return (int) ucontext->uc_mcontext.%s[0]; }' % t
296 confvar = 'HAVE_UCONTEXT_%s' % t.upper()
297 conf.check_cc(fragment=fragment, define_name=confvar, mandatory=False,
298 msg='Checking for ucontext->uc_mcontext.%s' % t)
299 if conf.is_defined(confvar):
300 conf.define('HAVE_UCONTEXT', 1)
302 fragment = '#include <ucontext.h>\n'
303 fragment += 'int main() { return NGREG; }'
304 conf.check_cc(fragment=fragment, define_name='HAVE_NGREG', mandatory=False,
305 msg='Checking for NGREG')
307 conf.env['LIB_PTHREAD'] = ['pthread']
308 conf.env['LIB_DL'] = ['dl']
309 conf.env['LIB_RT'] = ['rt']
310 conf.env['LIB_M'] = ['m']
311 conf.env['LIB_STDC++'] = ['stdc++']
312 conf.env['JACK_API_VERSION'] = JACK_API_VERSION
313 conf.env['JACK_VERSION'] = VERSION
315 conf.env['BUILD_WITH_PROFILE'] = Options.options.profile
316 conf.env['BUILD_WITH_32_64'] = Options.options.mixed
317 conf.env['BUILD_CLASSIC'] = Options.options.classic
318 conf.env['BUILD_DEBUG'] = Options.options.debug
320 if conf.env['BUILD_JACKDBUS']:
321 conf.env['BUILD_JACKD'] = conf.env['BUILD_CLASSIC']
323 conf.env['BUILD_JACKD'] = True
325 conf.env['BINDIR'] = conf.env['PREFIX'] + '/bin'
327 if Options.options.htmldir:
328 conf.env['HTMLDIR'] = Options.options.htmldir
330 # set to None here so that the doxygen code can find out the highest
331 # directory to remove upon install
332 conf.env['HTMLDIR'] = None
334 if Options.options.libdir:
335 conf.env['LIBDIR'] = Options.options.libdir
337 conf.env['LIBDIR'] = conf.env['PREFIX'] + '/lib'
339 if Options.options.pkgconfigdir:
340 conf.env['PKGCONFDIR'] = Options.options.pkgconfigdir
342 conf.env['PKGCONFDIR'] = conf.env['LIBDIR'] + '/pkgconfig'
344 if Options.options.mandir:
345 conf.env['MANDIR'] = Options.options.mandir
347 conf.env['MANDIR'] = conf.env['PREFIX'] + '/share/man/man1'
349 if conf.env['BUILD_DEBUG']:
350 conf.env.append_unique('CXXFLAGS', '-g')
351 conf.env.append_unique('CFLAGS', '-g')
352 conf.env.append_unique('LINKFLAGS', '-g')
354 if not Options.options.autostart in ['default', 'classic', 'dbus', 'none']:
355 conf.fatal('Invalid autostart value "' + Options.options.autostart + '"')
357 if Options.options.autostart == 'default':
358 if conf.env['BUILD_JACKD']:
359 conf.env['AUTOSTART_METHOD'] = 'classic'
361 conf.env['AUTOSTART_METHOD'] = 'dbus'
363 conf.env['AUTOSTART_METHOD'] = Options.options.autostart
365 if conf.env['AUTOSTART_METHOD'] == 'dbus' and not conf.env['BUILD_JACKDBUS']:
366 conf.fatal('D-Bus autostart mode was specified but jackdbus will not be built')
367 if conf.env['AUTOSTART_METHOD'] == 'classic' and not conf.env['BUILD_JACKD']:
368 conf.fatal('Classic autostart mode was specified but jackd will not be built')
370 if conf.env['AUTOSTART_METHOD'] == 'dbus':
371 conf.define('USE_LIBDBUS_AUTOLAUNCH', 1)
372 elif conf.env['AUTOSTART_METHOD'] == 'classic':
373 conf.define('USE_CLASSIC_AUTOLAUNCH', 1)
375 conf.define('CLIENT_NUM', Options.options.clients)
376 conf.define('PORT_NUM_FOR_CLIENT', Options.options.application_ports)
378 if conf.env['IS_WINDOWS']:
379 # we define this in the environment to maintain compatibility with
380 # existing install paths that use ADDON_DIR rather than have to
381 # have special cases for windows each time.
382 conf.env['ADDON_DIR'] = conf.env['LIBDIR'] + '/jack'
383 if Options.options.platform == 'msys':
384 conf.define('ADDON_DIR', 'jack')
385 conf.define('__STDC_FORMAT_MACROS', 1) # for PRIu64
387 # don't define ADDON_DIR in config.h, use the default 'jack' defined in
388 # windows/JackPlatformPlug_os.h
391 conf.env['ADDON_DIR'] = os.path.normpath(os.path.join(conf.env['LIBDIR'], 'jack'))
392 conf.define('ADDON_DIR', conf.env['ADDON_DIR'])
393 conf.define('JACK_LOCATION', os.path.normpath(os.path.join(conf.env['PREFIX'], 'bin')))
395 if not conf.env['IS_WINDOWS']:
396 conf.define('USE_POSIX_SHM', 1)
397 conf.define('JACKMP', 1)
398 if conf.env['BUILD_JACKDBUS']:
399 conf.define('JACK_DBUS', 1)
400 if conf.env['BUILD_WITH_PROFILE']:
401 conf.define('JACK_MONITOR', 1)
402 conf.write_config_header('config.h', remove=False)
406 f = open('svnversion.h')
408 m = re.match(r'^#define SVN_VERSION "([^"]*)"$', data)
415 if Options.options.mixed:
416 conf.setenv(lib32, env=conf.env.derive())
417 conf.env.append_unique('CFLAGS', '-m32')
418 conf.env.append_unique('CXXFLAGS', '-m32')
419 conf.env.append_unique('CXXFLAGS', '-DBUILD_WITH_32_64')
420 conf.env.append_unique('LINKFLAGS', '-m32')
421 if Options.options.libdir32:
422 conf.env['LIBDIR'] = Options.options.libdir32
424 conf.env['LIBDIR'] = conf.env['PREFIX'] + '/lib32'
425 # libdb does not work in mixed mode
426 conf.all_envs[lib32]['HAVE_DB'] = 0
427 conf.all_envs[lib32]['HAVE_DB_H'] = 0
428 conf.all_envs[lib32]['LIB_DB'] = []
429 # no need for opus in 32bit mixed mode clients
430 conf.all_envs[lib32]['LIB_OPUS'] = []
431 # someone tell me where this file gets written please..
432 conf.write_config_header('config.h')
435 print('==================')
436 version_msg = 'JACK ' + VERSION
438 version_msg += ' exported from r' + svnrev
440 version_msg += ' svn revision will checked and eventually updated during build'
443 conf.msg('Maximum JACK clients', Options.options.clients, color='NORMAL')
444 conf.msg('Maximum ports per application', Options.options.application_ports, color='NORMAL')
446 conf.msg('Install prefix', conf.env['PREFIX'], color='CYAN')
447 conf.msg('Library directory', conf.all_envs['']['LIBDIR'], color='CYAN')
448 if conf.env['BUILD_WITH_32_64']:
449 conf.msg('32-bit library directory', conf.all_envs[lib32]['LIBDIR'], color='CYAN')
450 conf.msg('Drivers directory', conf.env['ADDON_DIR'], color='CYAN')
451 display_feature(conf, 'Build debuggable binaries', conf.env['BUILD_DEBUG'])
454 ('C compiler flags', ['CFLAGS', 'CPPFLAGS']),
455 ('C++ compiler flags', ['CXXFLAGS', 'CPPFLAGS']),
456 ('Linker flags', ['LINKFLAGS', 'LDFLAGS'])
458 for name,vars in tool_flags:
461 flags += conf.all_envs[''][var]
462 conf.msg(name, repr(flags), color='NORMAL')
464 if conf.env['BUILD_WITH_32_64']:
465 conf.msg('32-bit C compiler flags', repr(conf.all_envs[lib32]['CFLAGS']))
466 conf.msg('32-bit C++ compiler flags', repr(conf.all_envs[lib32]['CXXFLAGS']))
467 conf.msg('32-bit linker flags', repr(conf.all_envs[lib32]['LINKFLAGS']))
468 display_feature(conf, 'Build with engine profiling', conf.env['BUILD_WITH_PROFILE'])
469 display_feature(conf, 'Build with 32/64 bits mixed mode', conf.env['BUILD_WITH_32_64'])
471 display_feature(conf, 'Build standard JACK (jackd)', conf.env['BUILD_JACKD'])
472 display_feature(conf, 'Build D-Bus JACK (jackdbus)', conf.env['BUILD_JACKDBUS'])
473 conf.msg('Autostart method', conf.env['AUTOSTART_METHOD'])
475 if conf.env['BUILD_JACKDBUS'] and conf.env['BUILD_JACKD']:
476 print(Logs.colors.RED + 'WARNING !! mixing both jackd and jackdbus may cause issues:' + Logs.colors.NORMAL)
477 print(Logs.colors.RED + 'WARNING !! jackdbus does not use .jackdrc nor qjackctl settings' + Logs.colors.NORMAL)
479 conf.summarize_auto_options()
481 if conf.env['BUILD_JACKDBUS']:
482 conf.msg('D-Bus service install directory', conf.env['DBUS_SERVICES_DIR'], color='CYAN')
484 if conf.env['DBUS_SERVICES_DIR'] != conf.env['DBUS_SERVICES_DIR_REAL']:
486 print(Logs.colors.RED + 'WARNING: D-Bus session services directory as reported by pkg-config is')
487 print(Logs.colors.RED + 'WARNING:', end=' ')
488 print(Logs.colors.CYAN + conf.env['DBUS_SERVICES_DIR_REAL'])
489 print(Logs.colors.RED + 'WARNING: but service file will be installed in')
490 print(Logs.colors.RED + 'WARNING:', end=' ')
491 print(Logs.colors.CYAN + conf.env['DBUS_SERVICES_DIR'])
492 print(Logs.colors.RED + 'WARNING: You may need to adjust your D-Bus configuration after installing jackdbus')
493 print('WARNING: You can override dbus service install directory')
494 print('WARNING: with --enable-pkg-config-dbus-service-dir option to this script')
495 print(Logs.colors.NORMAL, end=' ')
499 for y in (BuildContext, CleanContext, InstallContext, UninstallContext):
500 name = y.__name__.replace('Context','').lower()
502 cmd = name + '_' + lib32
505 def obj_add_includes(bld, obj):
506 if bld.env['BUILD_JACKDBUS']:
507 obj.includes += ['dbus']
509 if bld.env['IS_LINUX']:
510 obj.includes += ['linux', 'posix']
512 if bld.env['IS_MACOSX']:
513 obj.includes += ['macosx', 'posix']
515 if bld.env['IS_SUN']:
516 obj.includes += ['posix', 'solaris']
518 if bld.env['IS_WINDOWS']:
519 obj.includes += ['windows']
521 # FIXME: Is SERVER_SIDE needed?
522 def build_jackd(bld):
524 features = ['cxx', 'cxxprogram'],
525 defines = ['HAVE_CONFIG_H','SERVER_SIDE'],
526 includes = ['.', 'common', 'common/jack'],
528 source = ['common/Jackdmp.cpp'],
529 use = ['serverlib', 'SYSTEMD']
532 if bld.env['BUILD_JACKDBUS']:
533 jackd.source += ['dbus/audio_reserve.c', 'dbus/reserve.c']
534 jackd.use += ['DBUS-1']
536 if bld.env['IS_LINUX']:
537 jackd.use += ['DL', 'M', 'PTHREAD', 'RT', 'STDC++']
539 if bld.env['IS_MACOSX']:
540 jackd.use += ['DL', 'PTHREAD']
541 jackd.framework = ['CoreFoundation']
543 if bld.env['IS_SUN']:
544 jackd.use += ['DL', 'PTHREAD']
546 obj_add_includes(bld, jackd)
550 # FIXME: Is SERVER_SIDE needed?
551 def create_driver_obj(bld, **kw):
553 kw['use'] += ['serverlib']
555 kw['use'] = ['serverlib']
558 features = ['c', 'cxx', 'cshlib', 'cxxshlib'],
559 defines = ['HAVE_CONFIG_H', 'SERVER_SIDE'],
560 includes = ['.', 'common', 'common/jack'],
561 install_path = '${ADDON_DIR}/',
564 if bld.env['IS_WINDOWS']:
565 driver.env['cxxshlib_PATTERN'] = 'jack_%s.dll'
567 driver.env['cxxshlib_PATTERN'] = 'jack_%s.so'
569 obj_add_includes(bld, driver)
573 def build_drivers(bld):
574 # Non-hardware driver sources. Lexically sorted.
576 'common/JackDummyDriver.cpp'
580 'common/JackLoopbackDriver.cpp'
584 'common/JackNetDriver.cpp'
588 'common/JackNetOneDriver.cpp',
590 'common/netjack_packet.c'
594 'common/JackProxyDriver.cpp'
597 # Hardware driver sources. Lexically sorted.
600 'linux/alsa/JackAlsaDriver.cpp',
601 'linux/alsa/alsa_rawmidi.c',
602 'linux/alsa/alsa_seqmidi.c',
603 'linux/alsa/alsa_midi_jackmp.cpp',
604 'linux/alsa/generic_hw.c',
606 'linux/alsa/alsa_driver.c',
607 'linux/alsa/hammerfall.c',
608 'linux/alsa/ice1712.c'
612 'linux/alsarawmidi/JackALSARawMidiDriver.cpp',
613 'linux/alsarawmidi/JackALSARawMidiInputPort.cpp',
614 'linux/alsarawmidi/JackALSARawMidiOutputPort.cpp',
615 'linux/alsarawmidi/JackALSARawMidiPort.cpp',
616 'linux/alsarawmidi/JackALSARawMidiReceiveQueue.cpp',
617 'linux/alsarawmidi/JackALSARawMidiSendQueue.cpp',
618 'linux/alsarawmidi/JackALSARawMidiUtil.cpp'
623 'solaris/oss/JackBoomerDriver.cpp'
627 'macosx/coreaudio/JackCoreAudioDriver.mm',
628 'common/JackAC3Encoder.cpp'
632 'macosx/coremidi/JackCoreMidiInputPort.mm',
633 'macosx/coremidi/JackCoreMidiOutputPort.mm',
634 'macosx/coremidi/JackCoreMidiPhysicalInputPort.mm',
635 'macosx/coremidi/JackCoreMidiPhysicalOutputPort.mm',
636 'macosx/coremidi/JackCoreMidiVirtualInputPort.mm',
637 'macosx/coremidi/JackCoreMidiVirtualOutputPort.mm',
638 'macosx/coremidi/JackCoreMidiPort.mm',
639 'macosx/coremidi/JackCoreMidiUtil.mm',
640 'macosx/coremidi/JackCoreMidiDriver.mm'
644 'linux/firewire/JackFFADODriver.cpp',
645 'linux/firewire/JackFFADOMidiInputPort.cpp',
646 'linux/firewire/JackFFADOMidiOutputPort.cpp',
647 'linux/firewire/JackFFADOMidiReceiveQueue.cpp',
648 'linux/firewire/JackFFADOMidiSendQueue.cpp'
652 'linux/iio/JackIIODriver.cpp'
657 'solaris/oss/JackOSSDriver.cpp'
661 'windows/portaudio/JackPortAudioDevices.cpp',
662 'windows/portaudio/JackPortAudioDriver.cpp',
666 'windows/winmme/JackWinMMEDriver.cpp',
667 'windows/winmme/JackWinMMEInputPort.cpp',
668 'windows/winmme/JackWinMMEOutputPort.cpp',
669 'windows/winmme/JackWinMMEPort.cpp',
672 # Create non-hardware driver objects. Lexically sorted.
681 source = loopback_src)
692 use = ['SAMPLERATE', 'CELT'])
699 # Create hardware driver objects. Lexically sorted after the conditional,
700 # e.g. BUILD_DRIVER_ALSA.
701 if bld.env['BUILD_DRIVER_ALSA']:
709 target = 'alsarawmidi',
710 source = alsarawmidi_src,
713 if bld.env['BUILD_DRIVER_FFADO']:
720 if bld.env['BUILD_DRIVER_IIO']:
725 use = ['GTKIOSTREAM', 'EIGEN3'])
727 if bld.env['BUILD_DRIVER_PORTAUDIO']:
730 target = 'portaudio',
731 source = portaudio_src,
734 if bld.env['BUILD_DRIVER_WINMME']:
741 if bld.env['IS_MACOSX']:
744 target = 'coreaudio',
745 source = coreaudio_src,
747 framework = ['AudioUnit', 'CoreAudio', 'CoreServices'])
752 source = coremidi_src,
753 use = ['serverlib'], # FIXME: Is this needed?
754 framework = ['AudioUnit', 'CoreMIDI', 'CoreServices', 'Foundation'])
756 if bld.env['IS_SUN']:
767 if not bld.variant and bld.env['BUILD_WITH_32_64']:
768 Options.commands.append(bld.cmd + '_' + lib32)
770 # process subfolders from here
771 bld.recurse('common')
774 # only the wscript in common/ knows how to handle variants
777 bld.recurse('compat')
779 if not os.access('svnversion.h', os.R_OK):
781 sg = Utils.h_file(self.outputs[0].abspath(self.env))
782 #print sg.encode('hex')
783 Build.bld.node_sigs[self.env.variant()][self.outputs[0].id] = sg
785 script = bld.path.find_resource('svnversion_regenerate.sh')
786 script = script.abspath()
789 rule = '%s ${TGT}' % script,
791 runnable_status = Task.RUN_ME,
795 source = ['svnversion_regenerate.sh'],
796 target = [bld.path.find_or_declare('svnversion.h')]
799 if bld.env['BUILD_JACKD']:
804 bld.recurse('example-clients')
805 if bld.env['IS_LINUX']:
807 bld.recurse('systemd')
808 if not bld.env['IS_WINDOWS']:
810 if bld.env['BUILD_JACKDBUS']:
813 if bld.env['BUILD_DOXYGEN_DOCS']:
814 html_build_dir = bld.path.find_or_declare('html').abspath()
818 source = 'doxyfile.in',
820 HTML_BUILD_DIR = html_build_dir,
821 SRCDIR = bld.srcnode.abspath(),
825 # There are two reasons for logging to doxygen.log and using it as
826 # target in the build rule (rather than html_build_dir):
827 # (1) reduce the noise when running the build
828 # (2) waf has a regular file to check for a timestamp. If the directory
829 # is used instead waf will rebuild the doxygen target (even upon
832 doxyfile = task.inputs[0].abspath()
833 logfile = task.outputs[0].abspath()
834 cmd = '%s %s &> %s' % (task.env['DOXYGEN'][0], doxyfile, logfile)
835 return task.exec_command(cmd)
840 target = 'doxygen.log'
843 # Determine where to install HTML documentation. Since share_dir is the
844 # highest directory the uninstall routine should remove, there is no
845 # better candidate for share_dir, but the requested HTML directory if
846 # --htmldir is given.
847 if bld.env['HTMLDIR']:
848 html_install_dir = bld.options.destdir + bld.env['HTMLDIR']
849 share_dir = html_install_dir
851 share_dir = bld.options.destdir + bld.env['PREFIX'] + '/share/jack-audio-connection-kit'
852 html_install_dir = share_dir + '/reference/html/'
854 if bld.cmd == 'install':
855 if os.path.isdir(html_install_dir):
856 Logs.pprint('CYAN', 'Removing old doxygen documentation installation...')
857 shutil.rmtree(html_install_dir)
858 Logs.pprint('CYAN', 'Removing old doxygen documentation installation done.')
859 Logs.pprint('CYAN', 'Installing doxygen documentation...')
860 shutil.copytree(html_build_dir, html_install_dir)
861 Logs.pprint('CYAN', 'Installing doxygen documentation done.')
862 elif bld.cmd =='uninstall':
863 Logs.pprint('CYAN', 'Uninstalling doxygen documentation...')
864 if os.path.isdir(share_dir):
865 shutil.rmtree(share_dir)
866 Logs.pprint('CYAN', 'Uninstalling doxygen documentation done.')
867 elif bld.cmd =='clean':
868 if os.access(html_build_dir, os.R_OK):
869 Logs.pprint('CYAN', 'Removing doxygen generated documentation...')
870 shutil.rmtree(html_build_dir)
871 Logs.pprint('CYAN', 'Removing doxygen generated documentation done.')
874 # This code blindly assumes it is working in the toplevel source directory.
875 if not os.path.exists('svnversion.h'):
876 os.system('./svnversion_regenerate.sh svnversion.h')
878 from waflib import TaskGen
879 @TaskGen.extension('.mm')
880 def mm_hook(self, node):
881 """Alias .mm files to be compiled the same as .cpp files, gcc will do the right thing."""
882 return self.create_compiled_task('cxx', node)