jack2 codebase
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

835 lines
29KB

  1. #! /usr/bin/env python
  2. # encoding: utf-8
  3. from __future__ import print_function
  4. import os
  5. import subprocess
  6. import shutil
  7. import re
  8. import sys
  9. from waflib import Logs, Options, Task, Utils
  10. from waflib.Build import BuildContext, CleanContext, InstallContext, UninstallContext
  11. VERSION='1.9.12'
  12. APPNAME='jack'
  13. JACK_API_VERSION = '0.1.0'
  14. # these variables are mandatory ('/' are converted automatically)
  15. top = '.'
  16. out = 'build'
  17. # lib32 variant name used when building in mixed mode
  18. lib32 = 'lib32'
  19. def display_feature(conf, msg, build):
  20. if build:
  21. conf.msg(msg, 'yes', color='GREEN')
  22. else:
  23. conf.msg(msg, 'no', color='YELLOW')
  24. def check_for_celt(conf):
  25. found = False
  26. for version in ['11', '8', '7', '5']:
  27. define = 'HAVE_CELT_API_0_' + version
  28. if not found:
  29. try:
  30. conf.check_cfg(
  31. package='celt >= 0.%s.0' % version,
  32. args='--cflags --libs')
  33. found = True
  34. conf.define(define, 1)
  35. continue
  36. except conf.errors.ConfigurationError:
  37. pass
  38. conf.define(define, 0)
  39. if not found:
  40. raise conf.errors.ConfigurationError
  41. def options(opt):
  42. # options provided by the modules
  43. opt.load('compiler_cxx')
  44. opt.load('compiler_c')
  45. opt.load('autooptions');
  46. opt.load('xcode6')
  47. # install directories
  48. opt.add_option('--htmldir', type='string', default=None, help='HTML documentation directory [Default: <prefix>/share/jack-audio-connection-kit/reference/html/')
  49. opt.add_option('--libdir', type='string', help='Library directory [Default: <prefix>/lib]')
  50. opt.add_option('--libdir32', type='string', help='32bit Library directory [Default: <prefix>/lib32]')
  51. opt.add_option('--mandir', type='string', help='Manpage directory [Default: <prefix>/share/man/man1]')
  52. # options affecting binaries
  53. opt.add_option('--platform', type='string', default=sys.platform, help='Target platform for cross-compiling, e.g. cygwin or win32')
  54. opt.add_option('--mixed', action='store_true', default=False, help='Build with 32/64 bits mixed mode')
  55. opt.add_option('--debug', action='store_true', default=False, dest='debug', help='Build debuggable binaries')
  56. # options affecting general jack functionality
  57. opt.add_option('--classic', action='store_true', default=False, help='Force enable standard JACK (jackd) even if D-Bus JACK (jackdbus) is enabled too')
  58. opt.add_option('--dbus', action='store_true', default=False, help='Enable D-Bus JACK (jackdbus)')
  59. opt.add_option('--autostart', type='string', default='default', help='Autostart method. Possible values: "default", "classic", "dbus", "none"')
  60. opt.add_option('--profile', action='store_true', default=False, help='Build with engine profiling')
  61. opt.add_option('--clients', default=64, type='int', dest='clients', help='Maximum number of JACK clients')
  62. opt.add_option('--ports-per-application', default=768, type='int', dest='application_ports', help='Maximum number of ports per application')
  63. opt.set_auto_options_define('HAVE_%s')
  64. opt.set_auto_options_style('yesno_and_hack')
  65. # options with third party dependencies
  66. doxygen = opt.add_auto_option(
  67. 'doxygen',
  68. help='Build doxygen documentation',
  69. conf_dest='BUILD_DOXYGEN_DOCS',
  70. default=False)
  71. doxygen.find_program('doxygen')
  72. alsa = opt.add_auto_option(
  73. 'alsa',
  74. help='Enable ALSA driver',
  75. conf_dest='BUILD_DRIVER_ALSA')
  76. alsa.check_cfg(
  77. package='alsa >= 1.0.18',
  78. args='--cflags --libs')
  79. firewire = opt.add_auto_option(
  80. 'firewire',
  81. help='Enable FireWire driver (FFADO)',
  82. conf_dest='BUILD_DRIVER_FFADO')
  83. firewire.check_cfg(
  84. package='libffado >= 1.999.17',
  85. args='--cflags --libs')
  86. freebob = opt.add_auto_option(
  87. 'freebob',
  88. help='Enable FreeBob driver')
  89. freebob.check_cfg(
  90. package='libfreebob >= 1.0.0',
  91. args='--cflags --libs')
  92. iio = opt.add_auto_option(
  93. 'iio',
  94. help='Enable IIO driver',
  95. conf_dest='BUILD_DRIVER_IIO')
  96. iio.check_cfg(
  97. package='gtkIOStream >= 1.4.0',
  98. args='--cflags --libs')
  99. iio.check_cfg(
  100. package='eigen3 >= 3.1.2',
  101. args='--cflags --libs')
  102. portaudio = opt.add_auto_option(
  103. 'portaudio',
  104. help='Enable Portaudio driver',
  105. conf_dest='BUILD_DRIVER_PORTAUDIO')
  106. portaudio.check(header_name='windows.h') # only build portaudio on windows
  107. portaudio.check_cfg(
  108. package='portaudio-2.0 >= 19',
  109. uselib_store='PORTAUDIO',
  110. args='--cflags --libs')
  111. winmme = opt.add_auto_option(
  112. 'winmme',
  113. help='Enable WinMME driver',
  114. conf_dest='BUILD_DRIVER_WINMME')
  115. winmme.check(
  116. header_name=['windows.h', 'mmsystem.h'],
  117. msg='Checking for header mmsystem.h')
  118. celt = opt.add_auto_option(
  119. 'celt',
  120. help='Build with CELT')
  121. celt.add_function(check_for_celt)
  122. # Suffix _PKG to not collide with HAVE_OPUS defined by the option.
  123. opus = opt.add_auto_option(
  124. 'opus',
  125. help='Build Opus netjack2')
  126. opus.check(header_name='opus/opus_custom.h')
  127. opus.check_cfg(
  128. package='opus >= 0.9.0',
  129. args='--cflags --libs',
  130. define_name='HAVE_OPUS_PKG')
  131. samplerate = opt.add_auto_option(
  132. 'samplerate',
  133. help='Build with libsamplerate')
  134. samplerate.check_cfg(
  135. package='samplerate',
  136. args='--cflags --libs')
  137. sndfile = opt.add_auto_option(
  138. 'sndfile',
  139. help='Build with libsndfile')
  140. sndfile.check_cfg(
  141. package='sndfile',
  142. args='--cflags --libs')
  143. readline = opt.add_auto_option(
  144. 'readline',
  145. help='Build with readline')
  146. readline.check(lib='readline')
  147. readline.check(
  148. header_name=['stdio.h', 'readline/readline.h'],
  149. msg='Checking for header readline/readline.h')
  150. sd = opt.add_auto_option(
  151. 'systemd',
  152. help='Use systemd notify')
  153. sd.check(header_name='systemd/sd-daemon.h')
  154. sd.check(lib='systemd')
  155. # dbus options
  156. opt.recurse('dbus')
  157. # this must be called before the configure phase
  158. opt.apply_auto_options_hack()
  159. def detect_platform(conf):
  160. # GNU/kFreeBSD and GNU/Hurd are treated as Linux
  161. platforms = [
  162. # ('KEY, 'Human readable name', ['strings', 'to', 'check', 'for'])
  163. ('IS_LINUX', 'Linux', ['gnu0', 'gnukfreebsd', 'linux', 'posix']),
  164. ('IS_MACOSX', 'MacOS X', ['darwin']),
  165. ('IS_SUN', 'SunOS', ['sunos']),
  166. ('IS_WINDOWS', 'Windows', ['cygwin', 'msys', 'win32'])
  167. ]
  168. for key,name,strings in platforms:
  169. conf.env[key] = False
  170. conf.start_msg('Checking platform')
  171. platform = Options.options.platform
  172. for key,name,strings in platforms:
  173. for s in strings:
  174. if platform.startswith(s):
  175. conf.env[key] = True
  176. conf.end_msg(name, color='CYAN')
  177. break
  178. def configure(conf):
  179. conf.load('compiler_cxx')
  180. conf.load('compiler_c')
  181. detect_platform(conf)
  182. if conf.env['IS_WINDOWS']:
  183. conf.env.append_unique('CCDEFINES', '_POSIX')
  184. conf.env.append_unique('CXXDEFINES', '_POSIX')
  185. conf.env.append_unique('CXXFLAGS', '-Wall')
  186. conf.env.append_unique('CFLAGS', '-Wall')
  187. if conf.env['IS_MACOSX']:
  188. conf.check(lib='aften', uselib='AFTEN', define_name='AFTEN')
  189. conf.load('autooptions')
  190. # Check for functions.
  191. conf.check(
  192. fragment=''
  193. + '#define _GNU_SOURCE\n'
  194. + '#include <poll.h>\n'
  195. + '#include <signal.h>\n'
  196. + '#include <stddef.h>\n'
  197. + 'int\n'
  198. + 'main(void)\n'
  199. + '{\n'
  200. + ' ppoll(NULL, 0, NULL, NULL);\n'
  201. + '}\n',
  202. msg='Checking for ppoll',
  203. define_name='HAVE_PPOLL',
  204. mandatory=False)
  205. # Check for backtrace support
  206. conf.check(
  207. header_name='execinfo.h',
  208. define_name='HAVE_EXECINFO_H',
  209. mandatory=False)
  210. conf.recurse('common')
  211. if Options.options.dbus:
  212. conf.recurse('dbus')
  213. if conf.env['BUILD_JACKDBUS'] != True:
  214. conf.fatal('jackdbus was explicitly requested but cannot be built')
  215. conf.recurse('example-clients')
  216. # test for the availability of ucontext, and how it should be used
  217. for t in ['gp_regs', 'uc_regs', 'mc_gregs', 'gregs']:
  218. fragment = '#include <ucontext.h>\n'
  219. fragment += 'int main() { ucontext_t *ucontext; return (int) ucontext->uc_mcontext.%s[0]; }' % t
  220. confvar = 'HAVE_UCONTEXT_%s' % t.upper()
  221. conf.check_cc(fragment=fragment, define_name=confvar, mandatory=False,
  222. msg='Checking for ucontext->uc_mcontext.%s' % t)
  223. if conf.is_defined(confvar):
  224. conf.define('HAVE_UCONTEXT', 1)
  225. fragment = '#include <ucontext.h>\n'
  226. fragment += 'int main() { return NGREG; }'
  227. conf.check_cc(fragment=fragment, define_name='HAVE_NGREG', mandatory=False,
  228. msg='Checking for NGREG')
  229. conf.env['LIB_PTHREAD'] = ['pthread']
  230. conf.env['LIB_DL'] = ['dl']
  231. conf.env['LIB_RT'] = ['rt']
  232. conf.env['LIB_M'] = ['m']
  233. conf.env['LIB_STDC++'] = ['stdc++']
  234. conf.env['JACK_API_VERSION'] = JACK_API_VERSION
  235. conf.env['JACK_VERSION'] = VERSION
  236. conf.env['BUILD_WITH_PROFILE'] = Options.options.profile
  237. conf.env['BUILD_WITH_32_64'] = Options.options.mixed
  238. conf.env['BUILD_CLASSIC'] = Options.options.classic
  239. conf.env['BUILD_DEBUG'] = Options.options.debug
  240. if conf.env['BUILD_JACKDBUS']:
  241. conf.env['BUILD_JACKD'] = conf.env['BUILD_CLASSIC']
  242. else:
  243. conf.env['BUILD_JACKD'] = True
  244. conf.env['BINDIR'] = conf.env['PREFIX'] + '/bin'
  245. if Options.options.htmldir:
  246. conf.env['HTMLDIR'] = Options.options.htmldir
  247. else:
  248. # set to None here so that the doxygen code can find out the highest
  249. # directory to remove upon install
  250. conf.env['HTMLDIR'] = None
  251. if Options.options.libdir:
  252. conf.env['LIBDIR'] = Options.options.libdir
  253. else:
  254. conf.env['LIBDIR'] = conf.env['PREFIX'] + '/lib'
  255. if Options.options.mandir:
  256. conf.env['MANDIR'] = Options.options.mandir
  257. else:
  258. conf.env['MANDIR'] = conf.env['PREFIX'] + '/share/man/man1'
  259. if conf.env['BUILD_DEBUG']:
  260. conf.env.append_unique('CXXFLAGS', '-g')
  261. conf.env.append_unique('CFLAGS', '-g')
  262. conf.env.append_unique('LINKFLAGS', '-g')
  263. if not Options.options.autostart in ['default', 'classic', 'dbus', 'none']:
  264. conf.fatal('Invalid autostart value "' + Options.options.autostart + '"')
  265. if Options.options.autostart == 'default':
  266. if conf.env['BUILD_JACKD']:
  267. conf.env['AUTOSTART_METHOD'] = 'classic'
  268. else:
  269. conf.env['AUTOSTART_METHOD'] = 'dbus'
  270. else:
  271. conf.env['AUTOSTART_METHOD'] = Options.options.autostart
  272. if conf.env['AUTOSTART_METHOD'] == 'dbus' and not conf.env['BUILD_JACKDBUS']:
  273. conf.fatal('D-Bus autostart mode was specified but jackdbus will not be built')
  274. if conf.env['AUTOSTART_METHOD'] == 'classic' and not conf.env['BUILD_JACKD']:
  275. conf.fatal('Classic autostart mode was specified but jackd will not be built')
  276. if conf.env['AUTOSTART_METHOD'] == 'dbus':
  277. conf.define('USE_LIBDBUS_AUTOLAUNCH', 1)
  278. elif conf.env['AUTOSTART_METHOD'] == 'classic':
  279. conf.define('USE_CLASSIC_AUTOLAUNCH', 1)
  280. conf.define('CLIENT_NUM', Options.options.clients)
  281. conf.define('PORT_NUM_FOR_CLIENT', Options.options.application_ports)
  282. if conf.env['IS_WINDOWS']:
  283. # we define this in the environment to maintain compatability with
  284. # existing install paths that use ADDON_DIR rather than have to
  285. # have special cases for windows each time.
  286. conf.env['ADDON_DIR'] = conf.env['BINDIR'] + '/jack'
  287. # don't define ADDON_DIR in config.h, use the default 'jack' defined in
  288. # windows/JackPlatformPlug_os.h
  289. else:
  290. conf.env['ADDON_DIR'] = os.path.normpath(os.path.join(conf.env['LIBDIR'], 'jack'))
  291. conf.define('ADDON_DIR', conf.env['ADDON_DIR'])
  292. conf.define('JACK_LOCATION', os.path.normpath(os.path.join(conf.env['PREFIX'], 'bin')))
  293. if not conf.env['IS_WINDOWS']:
  294. conf.define('USE_POSIX_SHM', 1)
  295. conf.define('JACKMP', 1)
  296. if conf.env['BUILD_JACKDBUS']:
  297. conf.define('JACK_DBUS', 1)
  298. if conf.env['BUILD_WITH_PROFILE']:
  299. conf.define('JACK_MONITOR', 1)
  300. conf.write_config_header('config.h', remove=False)
  301. svnrev = None
  302. try:
  303. f = open('svnversion.h')
  304. data = f.read()
  305. m = re.match(r'^#define SVN_VERSION "([^"]*)"$', data)
  306. if m != None:
  307. svnrev = m.group(1)
  308. f.close()
  309. except IOError:
  310. pass
  311. if Options.options.mixed:
  312. conf.setenv(lib32, env=conf.env.derive())
  313. conf.env.append_unique('CXXFLAGS', '-m32')
  314. conf.env.append_unique('CFLAGS', '-m32')
  315. conf.env.append_unique('LINKFLAGS', '-m32')
  316. if Options.options.libdir32:
  317. conf.env['LIBDIR'] = Options.options.libdir32
  318. else:
  319. conf.env['LIBDIR'] = conf.env['PREFIX'] + '/lib32'
  320. conf.write_config_header('config.h')
  321. print()
  322. print('==================')
  323. version_msg = 'JACK ' + VERSION
  324. if svnrev:
  325. version_msg += ' exported from r' + svnrev
  326. else:
  327. version_msg += ' svn revision will checked and eventually updated during build'
  328. print(version_msg)
  329. conf.msg('Maximum JACK clients', Options.options.clients, color='NORMAL')
  330. conf.msg('Maximum ports per application', Options.options.application_ports, color='NORMAL')
  331. conf.msg('Install prefix', conf.env['PREFIX'], color='CYAN')
  332. conf.msg('Library directory', conf.all_envs['']['LIBDIR'], color='CYAN')
  333. if conf.env['BUILD_WITH_32_64']:
  334. conf.msg('32-bit library directory', conf.all_envs[lib32]['LIBDIR'], color='CYAN')
  335. conf.msg('Drivers directory', conf.env['ADDON_DIR'], color='CYAN')
  336. display_feature(conf, 'Build debuggable binaries', conf.env['BUILD_DEBUG'])
  337. tool_flags = [
  338. ('C compiler flags', ['CFLAGS', 'CPPFLAGS']),
  339. ('C++ compiler flags', ['CXXFLAGS', 'CPPFLAGS']),
  340. ('Linker flags', ['LINKFLAGS', 'LDFLAGS'])
  341. ]
  342. for name,vars in tool_flags:
  343. flags = []
  344. for var in vars:
  345. flags += conf.all_envs[''][var]
  346. conf.msg(name, repr(flags), color='NORMAL')
  347. if conf.env['BUILD_WITH_32_64']:
  348. conf.msg('32-bit C compiler flags', repr(conf.all_envs[lib32]['CFLAGS']))
  349. conf.msg('32-bit C++ compiler flags', repr(conf.all_envs[lib32]['CXXFLAGS']))
  350. conf.msg('32-bit linker flags', repr(conf.all_envs[lib32]['LINKFLAGS']))
  351. display_feature(conf, 'Build with engine profiling', conf.env['BUILD_WITH_PROFILE'])
  352. display_feature(conf, 'Build with 32/64 bits mixed mode', conf.env['BUILD_WITH_32_64'])
  353. display_feature(conf, 'Build standard JACK (jackd)', conf.env['BUILD_JACKD'])
  354. display_feature(conf, 'Build D-Bus JACK (jackdbus)', conf.env['BUILD_JACKDBUS'])
  355. conf.msg('Autostart method', conf.env['AUTOSTART_METHOD'])
  356. if conf.env['BUILD_JACKDBUS'] and conf.env['BUILD_JACKD']:
  357. print(Logs.colors.RED + 'WARNING !! mixing both jackd and jackdbus may cause issues:' + Logs.colors.NORMAL)
  358. print(Logs.colors.RED + 'WARNING !! jackdbus does not use .jackdrc nor qjackctl settings' + Logs.colors.NORMAL)
  359. conf.summarize_auto_options()
  360. if conf.env['BUILD_JACKDBUS']:
  361. conf.msg('D-Bus service install directory', conf.env['DBUS_SERVICES_DIR'], color='CYAN')
  362. if conf.env['DBUS_SERVICES_DIR'] != conf.env['DBUS_SERVICES_DIR_REAL']:
  363. print()
  364. print(Logs.colors.RED + 'WARNING: D-Bus session services directory as reported by pkg-config is')
  365. print(Logs.colors.RED + 'WARNING:', end=' ')
  366. print(Logs.colors.CYAN + conf.env['DBUS_SERVICES_DIR_REAL'])
  367. print(Logs.colors.RED + 'WARNING: but service file will be installed in')
  368. print(Logs.colors.RED + 'WARNING:', end=' ')
  369. print(Logs.colors.CYAN + conf.env['DBUS_SERVICES_DIR'])
  370. print(Logs.colors.RED + 'WARNING: You may need to adjust your D-Bus configuration after installing jackdbus')
  371. print('WARNING: You can override dbus service install directory')
  372. print('WARNING: with --enable-pkg-config-dbus-service-dir option to this script')
  373. print(Logs.colors.NORMAL, end=' ')
  374. print()
  375. def init(ctx):
  376. for y in (BuildContext, CleanContext, InstallContext, UninstallContext):
  377. name = y.__name__.replace('Context','').lower()
  378. class tmp(y):
  379. cmd = name + '_' + lib32
  380. variant = lib32
  381. def obj_add_includes(bld, obj):
  382. if bld.env['BUILD_JACKDBUS']:
  383. obj.includes += ['dbus']
  384. if bld.env['IS_LINUX']:
  385. obj.includes += ['linux', 'posix']
  386. if bld.env['IS_MACOSX']:
  387. obj.includes += ['macosx', 'posix']
  388. if bld.env['IS_SUN']:
  389. obj.includes += ['posix', 'solaris']
  390. if bld.env['IS_WINDOWS']:
  391. obj.includes += ['windows']
  392. # FIXME: Is SERVER_SIDE needed?
  393. def build_jackd(bld):
  394. jackd = bld(
  395. features = ['cxx', 'cxxprogram'],
  396. defines = ['HAVE_CONFIG_H','SERVER_SIDE'],
  397. includes = ['.', 'common', 'common/jack'],
  398. target = 'jackd',
  399. source = ['common/Jackdmp.cpp'],
  400. use = ['serverlib', 'SYSTEMD']
  401. )
  402. if bld.env['BUILD_JACKDBUS']:
  403. jackd.source += ['dbus/audio_reserve.c', 'dbus/reserve.c']
  404. jackd.use += ['DBUS-1']
  405. if bld.env['IS_LINUX']:
  406. jackd.use += ['DL', 'M', 'PTHREAD', 'RT', 'STDC++']
  407. if bld.env['IS_MACOSX']:
  408. jackd.use += ['DL', 'PTHREAD']
  409. jackd.framework = ['CoreFoundation']
  410. if bld.env['IS_SUN']:
  411. jackd.use += ['DL', 'PTHREAD']
  412. obj_add_includes(bld, jackd)
  413. return jackd
  414. # FIXME: Is SERVER_SIDE needed?
  415. def create_driver_obj(bld, **kw):
  416. if bld.env['IS_MACOSX'] or bld.env['IS_WINDOWS']:
  417. # On MacOSX this is necessary.
  418. # I do not know if this is necessary on Windows.
  419. # Note added on 2015-12-13 by karllinden.
  420. if 'use' in kw:
  421. kw['use'] += ['serverlib']
  422. else:
  423. kw['use'] = ['serverlib']
  424. driver = bld(
  425. features = ['c', 'cxx', 'cshlib', 'cxxshlib'],
  426. defines = ['HAVE_CONFIG_H', 'SERVER_SIDE'],
  427. includes = ['.', 'common', 'common/jack'],
  428. install_path = '${ADDON_DIR}/',
  429. **kw)
  430. if bld.env['IS_WINDOWS']:
  431. driver.env['cxxshlib_PATTERN'] = 'jack_%s.dll'
  432. else:
  433. driver.env['cxxshlib_PATTERN'] = 'jack_%s.so'
  434. obj_add_includes(bld, driver)
  435. return driver
  436. def build_drivers(bld):
  437. # Non-hardware driver sources. Lexically sorted.
  438. dummy_src = [
  439. 'common/JackDummyDriver.cpp'
  440. ]
  441. loopback_src = [
  442. 'common/JackLoopbackDriver.cpp'
  443. ]
  444. net_src = [
  445. 'common/JackNetDriver.cpp'
  446. ]
  447. netone_src = [
  448. 'common/JackNetOneDriver.cpp',
  449. 'common/netjack.c',
  450. 'common/netjack_packet.c'
  451. ]
  452. proxy_src = [
  453. 'common/JackProxyDriver.cpp'
  454. ]
  455. # Hardware driver sources. Lexically sorted.
  456. alsa_src = [
  457. 'common/memops.c',
  458. 'linux/alsa/JackAlsaDriver.cpp',
  459. 'linux/alsa/alsa_rawmidi.c',
  460. 'linux/alsa/alsa_seqmidi.c',
  461. 'linux/alsa/alsa_midi_jackmp.cpp',
  462. 'linux/alsa/generic_hw.c',
  463. 'linux/alsa/hdsp.c',
  464. 'linux/alsa/alsa_driver.c',
  465. 'linux/alsa/hammerfall.c',
  466. 'linux/alsa/ice1712.c'
  467. ]
  468. alsarawmidi_src = [
  469. 'linux/alsarawmidi/JackALSARawMidiDriver.cpp',
  470. 'linux/alsarawmidi/JackALSARawMidiInputPort.cpp',
  471. 'linux/alsarawmidi/JackALSARawMidiOutputPort.cpp',
  472. 'linux/alsarawmidi/JackALSARawMidiPort.cpp',
  473. 'linux/alsarawmidi/JackALSARawMidiReceiveQueue.cpp',
  474. 'linux/alsarawmidi/JackALSARawMidiSendQueue.cpp',
  475. 'linux/alsarawmidi/JackALSARawMidiUtil.cpp'
  476. ]
  477. boomer_src = [
  478. 'common/memops.c',
  479. 'solaris/oss/JackBoomerDriver.cpp'
  480. ]
  481. coreaudio_src = [
  482. 'macosx/coreaudio/JackCoreAudioDriver.mm',
  483. 'common/JackAC3Encoder.cpp'
  484. ]
  485. coremidi_src = [
  486. 'macosx/coremidi/JackCoreMidiInputPort.mm',
  487. 'macosx/coremidi/JackCoreMidiOutputPort.mm',
  488. 'macosx/coremidi/JackCoreMidiPhysicalInputPort.mm',
  489. 'macosx/coremidi/JackCoreMidiPhysicalOutputPort.mm',
  490. 'macosx/coremidi/JackCoreMidiVirtualInputPort.mm',
  491. 'macosx/coremidi/JackCoreMidiVirtualOutputPort.mm',
  492. 'macosx/coremidi/JackCoreMidiPort.mm',
  493. 'macosx/coremidi/JackCoreMidiUtil.mm',
  494. 'macosx/coremidi/JackCoreMidiDriver.mm'
  495. ]
  496. ffado_src = [
  497. 'linux/firewire/JackFFADODriver.cpp',
  498. 'linux/firewire/JackFFADOMidiInputPort.cpp',
  499. 'linux/firewire/JackFFADOMidiOutputPort.cpp',
  500. 'linux/firewire/JackFFADOMidiReceiveQueue.cpp',
  501. 'linux/firewire/JackFFADOMidiSendQueue.cpp'
  502. ]
  503. freebob_src = [
  504. 'linux/freebob/JackFreebobDriver.cpp'
  505. ]
  506. iio_driver_src = [
  507. 'linux/iio/JackIIODriver.cpp'
  508. ]
  509. oss_src = [
  510. 'common/memops.c',
  511. 'solaris/oss/JackOSSDriver.cpp'
  512. ]
  513. portaudio_src = [
  514. 'windows/portaudio/JackPortAudioDevices.cpp',
  515. 'windows/portaudio/JackPortAudioDriver.cpp',
  516. ]
  517. winmme_src = [
  518. 'windows/winmme/JackWinMMEDriver.cpp',
  519. 'windows/winmme/JackWinMMEInputPort.cpp',
  520. 'windows/winmme/JackWinMMEOutputPort.cpp',
  521. 'windows/winmme/JackWinMMEPort.cpp',
  522. ]
  523. # Create non-hardware driver objects. Lexically sorted.
  524. create_driver_obj(
  525. bld,
  526. target = 'dummy',
  527. source = dummy_src)
  528. create_driver_obj(
  529. bld,
  530. target = 'loopback',
  531. source = loopback_src)
  532. create_driver_obj(
  533. bld,
  534. target = 'net',
  535. source = net_src)
  536. create_driver_obj(
  537. bld,
  538. target = 'netone',
  539. source = netone_src,
  540. use = ['SAMPLERATE', 'CELT'])
  541. create_driver_obj(
  542. bld,
  543. target = 'proxy',
  544. source = proxy_src)
  545. # Create hardware driver objects. Lexically sorted after the conditional,
  546. # e.g. BUILD_DRIVER_ALSA.
  547. if bld.env['BUILD_DRIVER_ALSA']:
  548. create_driver_obj(
  549. bld,
  550. target = 'alsa',
  551. source = alsa_src,
  552. use = ['ALSA'])
  553. create_driver_obj(
  554. bld,
  555. target = 'alsarawmidi',
  556. source = alsarawmidi_src,
  557. use = ['ALSA'])
  558. if bld.env['BUILD_DRIVER_FREEBOB']:
  559. create_driver_obj(
  560. bld,
  561. target = 'freebob',
  562. source = freebob_src,
  563. use = ['LIBFREEBOB'])
  564. if bld.env['BUILD_DRIVER_FFADO']:
  565. create_driver_obj(
  566. bld,
  567. target = 'firewire',
  568. source = ffado_src,
  569. use = ['LIBFFADO'])
  570. if bld.env['BUILD_DRIVER_IIO']:
  571. create_driver_obj(
  572. bld,
  573. target = 'iio',
  574. source = iio_src,
  575. use = ['GTKIOSTREAM', 'EIGEN3'])
  576. if bld.env['BUILD_DRIVER_PORTAUDIO']:
  577. create_driver_obj(
  578. bld,
  579. target = 'portaudio',
  580. source = portaudio_src,
  581. use = ['PORTAUDIO'])
  582. if bld.env['BUILD_DRIVER_WINMME']:
  583. create_driver_obj(
  584. bld,
  585. target = 'winmme',
  586. source = winmme_src,
  587. use = ['WINMME'])
  588. if bld.env['IS_MACOSX']:
  589. create_driver_obj(
  590. bld,
  591. target = 'coreaudio',
  592. source = coreaudio_src,
  593. use = ['AFTEN'],
  594. framework = ['AudioUnit', 'CoreAudio', 'CoreServices'])
  595. create_driver_obj(
  596. bld,
  597. target = 'coremidi',
  598. source = coremidi_src,
  599. use = ['serverlib'], # FIXME: Is this needed?
  600. framework = ['AudioUnit', 'CoreMIDI', 'CoreServices', 'Foundation'])
  601. if bld.env['IS_SUN']:
  602. create_driver_obj(
  603. bld,
  604. target = 'boomer',
  605. source = boomer_src)
  606. create_driver_obj(
  607. bld,
  608. target = 'oss',
  609. source = oss_src)
  610. def build(bld):
  611. if not bld.variant and bld.env['BUILD_WITH_32_64']:
  612. Options.commands.append(bld.cmd + '_' + lib32)
  613. # process subfolders from here
  614. bld.recurse('common')
  615. if bld.variant:
  616. # only the wscript in common/ knows how to handle variants
  617. return
  618. if not os.access('svnversion.h', os.R_OK):
  619. def post_run(self):
  620. sg = Utils.h_file(self.outputs[0].abspath(self.env))
  621. #print sg.encode('hex')
  622. Build.bld.node_sigs[self.env.variant()][self.outputs[0].id] = sg
  623. script = bld.path.find_resource('svnversion_regenerate.sh')
  624. script = script.abspath()
  625. bld(
  626. rule = '%s ${TGT}' % script,
  627. name = 'svnversion',
  628. runnable_status = Task.RUN_ME,
  629. before = 'c cxx',
  630. color = 'BLUE',
  631. post_run = post_run,
  632. source = ['svnversion_regenerate.sh'],
  633. target = [bld.path.find_or_declare('svnversion.h')]
  634. )
  635. if bld.env['BUILD_JACKD']:
  636. build_jackd(bld)
  637. build_drivers(bld)
  638. bld.recurse('example-clients')
  639. if bld.env['IS_LINUX']:
  640. bld.recurse('man')
  641. if not bld.env['IS_WINDOWS']:
  642. bld.recurse('tests')
  643. if bld.env['BUILD_JACKDBUS']:
  644. bld.recurse('dbus')
  645. if bld.env['BUILD_DOXYGEN_DOCS']:
  646. html_build_dir = bld.path.find_or_declare('html').abspath()
  647. bld(
  648. features = 'subst',
  649. source = 'doxyfile.in',
  650. target = 'doxyfile',
  651. HTML_BUILD_DIR = html_build_dir,
  652. SRCDIR = bld.srcnode.abspath(),
  653. VERSION = VERSION
  654. )
  655. # There are two reasons for logging to doxygen.log and using it as
  656. # target in the build rule (rather than html_build_dir):
  657. # (1) reduce the noise when running the build
  658. # (2) waf has a regular file to check for a timestamp. If the directory
  659. # is used instead waf will rebuild the doxygen target (even upon
  660. # install).
  661. def doxygen(task):
  662. doxyfile = task.inputs[0].abspath()
  663. logfile = task.outputs[0].abspath()
  664. cmd = '%s %s &> %s' % (task.env['DOXYGEN'][0], doxyfile, logfile)
  665. return task.exec_command(cmd)
  666. bld(
  667. rule = doxygen,
  668. source = 'doxyfile',
  669. target = 'doxygen.log'
  670. )
  671. # Determine where to install HTML documentation. Since share_dir is the
  672. # highest directory the uninstall routine should remove, there is no
  673. # better candidate for share_dir, but the requested HTML directory if
  674. # --htmldir is given.
  675. if bld.env['HTMLDIR']:
  676. html_install_dir = bld.options.destdir + bld.env['HTMLDIR']
  677. share_dir = html_install_dir
  678. else:
  679. share_dir = bld.options.destdir + bld.env['PREFIX'] + '/share/jack-audio-connection-kit'
  680. html_install_dir = share_dir + '/reference/html/'
  681. if bld.cmd == 'install':
  682. if os.path.isdir(html_install_dir):
  683. Logs.pprint('CYAN', 'Removing old doxygen documentation installation...')
  684. shutil.rmtree(html_install_dir)
  685. Logs.pprint('CYAN', 'Removing old doxygen documentation installation done.')
  686. Logs.pprint('CYAN', 'Installing doxygen documentation...')
  687. shutil.copytree(html_build_dir, html_install_dir)
  688. Logs.pprint('CYAN', 'Installing doxygen documentation done.')
  689. elif bld.cmd =='uninstall':
  690. Logs.pprint('CYAN', 'Uninstalling doxygen documentation...')
  691. if os.path.isdir(share_dir):
  692. shutil.rmtree(share_dir)
  693. Logs.pprint('CYAN', 'Uninstalling doxygen documentation done.')
  694. elif bld.cmd =='clean':
  695. if os.access(html_build_dir, os.R_OK):
  696. Logs.pprint('CYAN', 'Removing doxygen generated documentation...')
  697. shutil.rmtree(html_build_dir)
  698. Logs.pprint('CYAN', 'Removing doxygen generated documentation done.')
  699. def dist(ctx):
  700. # This code blindly assumes it is working in the toplevel source directory.
  701. if not os.path.exists('svnversion.h'):
  702. os.system('./svnversion_regenerate.sh svnversion.h')
  703. from waflib import TaskGen
  704. @TaskGen.extension('.mm')
  705. def mm_hook(self, node):
  706. """Alias .mm files to be compiled the same as .cpp files, gcc will do the right thing."""
  707. return self.create_compiled_task('cxx', node)