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.

748 lines
30KB

  1. #! /usr/bin/env python
  2. # encoding: utf-8
  3. from __future__ import print_function
  4. import os
  5. import Utils
  6. import Options
  7. import subprocess
  8. g_maxlen = 40
  9. import shutil
  10. import Task
  11. import re
  12. import Logs
  13. import sys
  14. import waflib.Options
  15. from waflib.Build import BuildContext, CleanContext, InstallContext, UninstallContext
  16. VERSION='1.9.11'
  17. APPNAME='jack'
  18. JACK_API_VERSION = '0.1.0'
  19. # these variables are mandatory ('/' are converted automatically)
  20. top = '.'
  21. out = 'build'
  22. # lib32 variant name used when building in mixed mode
  23. lib32 = 'lib32'
  24. auto_options = []
  25. def display_msg(msg, status = None, color = None):
  26. sr = msg
  27. global g_maxlen
  28. g_maxlen = max(g_maxlen, len(msg))
  29. if status:
  30. Logs.pprint('NORMAL', "%s :" % msg.ljust(g_maxlen), sep=' ')
  31. Logs.pprint(color, status)
  32. else:
  33. print("%s" % msg.ljust(g_maxlen))
  34. def display_feature(msg, build):
  35. if build:
  36. display_msg(msg, "yes", 'GREEN')
  37. else:
  38. display_msg(msg, "no", 'YELLOW')
  39. def print_error(msg):
  40. """
  41. This function prints an error without stopping waf. The reason waf should
  42. not be stopped is to be able to list all missing dependencies in one chunk.
  43. """
  44. print(Logs.colors.RED + msg + Logs.colors.NORMAL)
  45. def create_svnversion_task(bld, header='svnversion.h', define=None):
  46. cmd = '../svnversion_regenerate.sh ${TGT}'
  47. if define:
  48. cmd += " " + define
  49. def post_run(self):
  50. sg = Utils.h_file(self.outputs[0].abspath(self.env))
  51. #print sg.encode('hex')
  52. Build.bld.node_sigs[self.env.variant()][self.outputs[0].id] = sg
  53. bld(
  54. rule = cmd,
  55. name = 'svnversion',
  56. runnable_status = Task.RUN_ME,
  57. before = 'c',
  58. color = 'BLUE',
  59. post_run = post_run,
  60. target = [bld.path.find_or_declare(header)]
  61. )
  62. class AutoOption:
  63. """
  64. This class is the foundation for the auto options. It adds an option
  65. --foo=no|yes to the list of options and deals with all logic and checks for
  66. these options.
  67. Each option can have different dependencies that will be checked. If all
  68. dependencies are available and the user has not done any request the option
  69. will be enabled. If the user has requested to enable the option the class
  70. ensures that all dependencies are available and prints an error message
  71. otherwise. If the user disables the option, i.e. --foo=no, no checks are
  72. made.
  73. For each option it is possible to add packages that are required for the
  74. option using the add_package function. For dependency programs add_program
  75. should be used. For libraries (without pkg-config support) the add_library
  76. function should be used. For headers the add_header function exists. If
  77. there is another type of requirement or dependency the check hook (an
  78. external function called when configuring) can be used.
  79. When all checks have been made and the class has made a decision the result
  80. is saved in conf.env['NAME'] where 'NAME' by default is the uppercase of the
  81. name argument to __init__, but it can be changed with the conf_dest argument
  82. to __init__.
  83. The class will define a preprocessor symbol with the result. The default
  84. name is HAVE_NAME, but it can be changed using the define argument to
  85. __init__.
  86. """
  87. def __init__(self, opt, name, help, conf_dest=None, define=None):
  88. # check hook to call upon configuration
  89. self.check_hook = None
  90. self.check_hook_error = None
  91. self.check_hook_found = True
  92. # required libraries
  93. self.libs = [] # elements on the form [lib,uselib_store]
  94. self.libs_not_found = [] # elements on the form lib
  95. # required headers
  96. self.headers = []
  97. self.headers_not_found = []
  98. # required packages (checked with pkg-config)
  99. self.packages = [] # elements on the form [package,uselib_store,atleast_version]
  100. self.packages_not_found = [] # elements on the form [package,atleast_version]
  101. # required programs
  102. self.programs = [] # elements on the form [program,var]
  103. self.programs_not_found = [] # elements on the form program
  104. # the result of the configuration (should the option be enabled or not?)
  105. self.result = False
  106. self.help = help
  107. self.option = '--' + name
  108. self.dest = 'auto_option_' + name
  109. if conf_dest:
  110. self.conf_dest = conf_dest
  111. else:
  112. self.conf_dest = name.upper()
  113. if not define:
  114. self.define = 'HAVE_' + name.upper()
  115. else:
  116. self.define = define
  117. opt.add_option(self.option, type='string', default='auto', dest=self.dest, help=self.help+' (enabled by default if possible)', metavar='no|yes')
  118. def add_library(self, library, uselib_store=None):
  119. """
  120. Add a required library that should be checked during configuration. The
  121. library will be checked using the conf.check_cc function. If the
  122. uselib_store arugment is not given it defaults to LIBRARY (the uppercase
  123. of the library argument). The uselib_store argument will be passed to
  124. check_cc which means LIB_LIBRARY, CFLAGS_LIBRARY and DEFINES_LIBRARY,
  125. etc. will be defined if the option is enabled.
  126. """
  127. if not uselib_store:
  128. uselib_store = library.upper().replace('-', '_')
  129. self.libs.append([library, uselib_store])
  130. def add_header(self, header):
  131. """
  132. Add a required header that should be checked during configuration. The
  133. header will be checked using the conf.check_cc function which means
  134. HAVE_HEADER_H will be defined if found.
  135. """
  136. self.headers.append(header)
  137. def add_package(self, package, uselib_store=None, atleast_version=None):
  138. """
  139. Add a required package that should be checked using pkg-config during
  140. configuration. The package will be checked using the conf.check_cfg
  141. function and the uselib_store and atleast_version will be passed to
  142. check_cfg. If uselib_store is None it defaults to PACKAGE (uppercase of
  143. the package argument) with hyphens and dots replaced with underscores.
  144. If atleast_version is None it defaults to '0'.
  145. """
  146. if not uselib_store:
  147. uselib_store = package.upper().replace('-', '_').replace('.', '_')
  148. if not atleast_version:
  149. atleast_version = '0'
  150. self.packages.append([package, uselib_store, atleast_version])
  151. def add_program(self, program, var=None):
  152. """
  153. Add a required program that should be checked during configuration. If
  154. var is not given it defaults to PROGRAM (the uppercase of the program
  155. argument). If the option is enabled the program is saved in
  156. conf.env.PROGRAM.
  157. """
  158. if not var:
  159. var = program.upper().replace('-', '_')
  160. self.programs.append([program, var])
  161. def set_check_hook(self, check_hook, check_hook_error):
  162. """
  163. Set the check hook and the corresponding error printing function to the
  164. configure step. The check_hook argument is a function that should return
  165. True if the extra prerequisites were found and False if not. The
  166. check_hook_error argument is an error printing function that should
  167. print an error message telling the user that --foo was explicitly
  168. requested but cannot be built since the extra prerequisites were not
  169. found. Both function should take a single argument that is the waf
  170. configuration context.
  171. """
  172. self.check_hook = check_hook
  173. self.check_hook_error = check_hook_error
  174. def _check(self, conf):
  175. """
  176. This is an internal function that runs all necessary configure checks.
  177. It checks all dependencies (even if some dependency was not found) so
  178. that the user can install all missing dependencies in one go, instead
  179. of playing the infamous hit-configure-hit-configure game.
  180. This function returns True if all dependencies were found and False if
  181. not.
  182. """
  183. all_found = True
  184. # check for libraries
  185. for lib,uselib_store in self.libs:
  186. try:
  187. conf.check_cc(lib=lib, uselib_store=uselib_store)
  188. except conf.errors.ConfigurationError:
  189. all_found = False
  190. self.libs_not_found.append(lib)
  191. # check for headers
  192. for header in self.headers:
  193. try:
  194. conf.check_cc(header_name=header)
  195. except conf.errors.ConfigurationError:
  196. all_found = False
  197. self.headers_not_found.append(header)
  198. # check for packages
  199. for package,uselib_store,atleast_version in self.packages:
  200. try:
  201. conf.check_cfg(package=package, uselib_store=uselib_store, atleast_version=atleast_version, args='--cflags --libs')
  202. except conf.errors.ConfigurationError:
  203. all_found = False
  204. self.packages_not_found.append([package,atleast_version])
  205. # check for programs
  206. for program,var in self.programs:
  207. try:
  208. conf.find_program(program, var=var)
  209. except conf.errors.ConfigurationError:
  210. all_found = False
  211. self.programs_not_found.append(program)
  212. # call hook (if specified)
  213. if self.check_hook:
  214. self.check_hook_found = self.check_hook(conf)
  215. if not self.check_hook_found:
  216. all_found = False
  217. return all_found
  218. def _configure_error(self, conf):
  219. """
  220. This is an internal function that prints errors for each missing
  221. dependency. The error messages tell the user that this option required
  222. some dependency, but it cannot be found.
  223. """
  224. for lib in self.libs_not_found:
  225. print_error('%s requires the %s library, but it cannot be found.' % (self.option, lib))
  226. for header in self.headers_not_found:
  227. print_error('%s requires the %s header, but it cannot be found.' % (self.option, header))
  228. for package,atleast_version in self.packages_not_found:
  229. string = package
  230. if atleast_version:
  231. string += ' >= ' + atleast_version
  232. print_error('%s requires the package %s, but it cannot be found.' % (self.option, string))
  233. for program in self.programs_not_found:
  234. print_error('%s requires the %s program, but it cannot be found.' % (self.option, program))
  235. if not self.check_hook_found:
  236. self.check_hook_error(conf)
  237. def configure(self, conf):
  238. """
  239. This function configures the option examining the argument given too
  240. --foo (where foo is this option). This function sets self.result to the
  241. result of the configuration; True if the option should be enabled or
  242. False if not. If not all dependencies were found self.result will shall
  243. be False. conf.env['NAME'] will be set to the same value aswell as a
  244. preprocessor symbol will be defined according to the result.
  245. If --foo[=yes] was given, but some dependency was not found an error
  246. message is printed (foreach missing dependency).
  247. This function returns True on success and False on error.
  248. """
  249. argument = getattr(Options.options, self.dest)
  250. if argument == 'no':
  251. self.result = False
  252. retvalue = True
  253. elif argument == 'yes':
  254. if self._check(conf):
  255. self.result = True
  256. retvalue = True
  257. else:
  258. self.result = False
  259. retvalue = False
  260. self._configure_error(conf)
  261. elif argument == 'auto':
  262. self.result = self._check(conf)
  263. retvalue = True
  264. else:
  265. print_error('Invalid argument "' + argument + '" to ' + self.option)
  266. self.result = False
  267. retvalue = False
  268. conf.env[self.conf_dest] = self.result
  269. if self.result:
  270. conf.define(self.define, 1)
  271. else:
  272. conf.define(self.define, 0)
  273. return retvalue
  274. def display_message(self):
  275. """
  276. This function displays a result message with the help text and the
  277. result of the configuration.
  278. """
  279. display_feature(self.help, self.result)
  280. def add_auto_option(opt, name, help, conf_dest=None, define=None):
  281. """
  282. Adds an option to the list of auto options and returns the newly created
  283. option.
  284. """
  285. option = AutoOption(opt, name, help, conf_dest=conf_dest, define=define)
  286. auto_options.append(option)
  287. return option
  288. def auto_options_argv_hack():
  289. """
  290. This function applies a hack that for each auto option --foo=no|yes replaces
  291. any occurence --foo in argv with --foo=yes, in effect interpreting --foo as
  292. --foo=yes. The function has to be called before waf issues the option
  293. parser, i.e. before the configure phase.
  294. """
  295. for option in auto_options:
  296. for x in range(1, len(sys.argv)):
  297. if sys.argv[x] == option.option:
  298. sys.argv[x] += '=yes'
  299. def configure_auto_options(conf):
  300. """
  301. This function configures all auto options. It stops waf and prints an error
  302. message if there were unsatisfied requirements.
  303. """
  304. ok = True
  305. for option in auto_options:
  306. if not option.configure(conf):
  307. ok = False
  308. if not ok:
  309. conf.fatal('There were unsatisfied requirements.')
  310. def display_auto_options_messages():
  311. """This function displays all options and the configuration result."""
  312. for option in auto_options:
  313. option.display_message()
  314. def check_for_celt(conf):
  315. found = False
  316. for version in ['11', '8', '7', '5']:
  317. define = 'HAVE_CELT_API_0_' + version
  318. if not found:
  319. try:
  320. conf.check_cfg(package='celt', atleast_version='0.' + version + '.0', args='--cflags --libs')
  321. found = True
  322. conf.define(define, 1)
  323. continue
  324. except conf.errors.ConfigurationError:
  325. pass
  326. conf.define(define, 0)
  327. return found
  328. def check_for_celt_error(conf):
  329. print_error('--celt requires the package celt, but it could not be found.')
  330. def options(opt):
  331. # options provided by the modules
  332. opt.tool_options('compiler_cxx')
  333. opt.tool_options('compiler_cc')
  334. # install directories
  335. opt.add_option('--libdir', type='string', help="Library directory [Default: <prefix>/lib]")
  336. opt.add_option('--libdir32', type='string', help="32bit Library directory [Default: <prefix>/lib32]")
  337. opt.add_option('--mandir', type='string', help="Manpage directory [Default: <prefix>/share/man/man1]")
  338. # options affecting binaries
  339. opt.add_option('--dist-target', type='string', default='auto', help='Specify the target for cross-compiling [auto,mingw]')
  340. opt.add_option('--mixed', action='store_true', default=False, help='Build with 32/64 bits mixed mode')
  341. opt.add_option('--debug', action='store_true', default=False, dest='debug', help='Build debuggable binaries')
  342. # options affecting general jack functionality
  343. opt.add_option('--classic', action='store_true', default=False, help='Force enable standard JACK (jackd) even if D-Bus JACK (jackdbus) is enabled too')
  344. opt.add_option('--dbus', action='store_true', default=False, help='Enable D-Bus JACK (jackdbus)')
  345. opt.add_option('--autostart', type='string', default="default", help='Autostart method. Possible values: "default", "classic", "dbus", "none"')
  346. opt.add_option('--profile', action='store_true', default=False, help='Build with engine profiling')
  347. opt.add_option('--clients', default=64, type="int", dest="clients", help='Maximum number of JACK clients')
  348. opt.add_option('--ports-per-application', default=768, type="int", dest="application_ports", help='Maximum number of ports per application')
  349. # options with third party dependencies
  350. doxygen = add_auto_option(opt, 'doxygen', help='Build doxygen documentation', conf_dest='BUILD_DOXYGEN_DOCS')
  351. doxygen.add_program('doxygen')
  352. alsa = add_auto_option(opt, 'alsa', help='Enable ALSA driver', conf_dest='BUILD_DRIVER_ALSA')
  353. alsa.add_package('alsa', atleast_version='1.0.18')
  354. firewire = add_auto_option(opt, 'firewire', help='Enable FireWire driver (FFADO)', conf_dest='BUILD_DRIVER_FFADO')
  355. firewire.add_package('libffado', atleast_version='1.999.17')
  356. freebob = add_auto_option(opt, 'freebob', help='Enable FreeBob driver')
  357. freebob.add_package('libfreebob', atleast_version='1.0.0')
  358. iio = add_auto_option(opt, 'iio', help='Enable IIO driver', conf_dest='BUILD_DRIVER_IIO')
  359. iio.add_package('gtkIOStream', atleast_version='1.4.0')
  360. iio.add_package('eigen3', atleast_version='3.1.2')
  361. portaudio = add_auto_option(opt, 'portaudio', help='Enable Portaudio driver', conf_dest='BUILD_DRIVER_PORTAUDIO')
  362. portaudio.add_header('windows.h') # only build portaudio on windows
  363. portaudio.add_package('portaudio-2.0', uselib_store='PORTAUDIO', atleast_version='19')
  364. winmme = add_auto_option(opt, 'winmme', help='Enable WinMME driver', conf_dest='BUILD_DRIVER_WINMME')
  365. winmme.add_header('mmsystem.h')
  366. winmme.add_header('windows.h')
  367. celt = add_auto_option(opt, 'celt', help='Build with CELT')
  368. celt.set_check_hook(check_for_celt, check_for_celt_error)
  369. opus = add_auto_option(opt, 'opus', help='Build Opus netjack2')
  370. opus.add_header('opus/opus_custom.h')
  371. opus.add_package('opus', atleast_version='0.9.0')
  372. samplerate = add_auto_option(opt, 'samplerate', help='Build with libsamplerate')
  373. samplerate.add_package('samplerate')
  374. sndfile = add_auto_option(opt, 'sndfile', help='Build with libsndfile')
  375. sndfile.add_package('sndfile')
  376. # dbus options
  377. opt.sub_options('dbus')
  378. # this must be called before the configure phase
  379. auto_options_argv_hack()
  380. def configure(conf):
  381. conf.load('compiler_cxx')
  382. conf.load('compiler_cc')
  383. if Options.options.dist_target == 'auto':
  384. platform = sys.platform
  385. conf.env['IS_MACOSX'] = platform == 'darwin'
  386. conf.env['IS_LINUX'] = platform == 'linux' or platform == 'linux2' or platform == 'linux3' or platform == 'posix'
  387. conf.env['IS_SUN'] = platform == 'sunos'
  388. # GNU/kFreeBSD and GNU/Hurd are treated as Linux
  389. if platform.startswith('gnu0') or platform.startswith('gnukfreebsd'):
  390. conf.env['IS_LINUX'] = True
  391. elif Options.options.dist_target == 'mingw':
  392. conf.env['IS_WINDOWS'] = True
  393. if conf.env['IS_LINUX']:
  394. Logs.pprint('CYAN', "Linux detected")
  395. if conf.env['IS_MACOSX']:
  396. Logs.pprint('CYAN', "MacOS X detected")
  397. if conf.env['IS_SUN']:
  398. Logs.pprint('CYAN', "SunOS detected")
  399. if conf.env['IS_WINDOWS']:
  400. Logs.pprint('CYAN', "Windows detected")
  401. if conf.env['IS_LINUX']:
  402. conf.check_tool('compiler_cxx')
  403. conf.check_tool('compiler_cc')
  404. if conf.env['IS_MACOSX']:
  405. conf.check_tool('compiler_cxx')
  406. conf.check_tool('compiler_cc')
  407. # waf 1.5 : check_tool('compiler_cxx') and check_tool('compiler_cc') do not work correctly, so explicit use of gcc and g++
  408. if conf.env['IS_SUN']:
  409. conf.check_tool('g++')
  410. conf.check_tool('gcc')
  411. #if conf.env['IS_SUN']:
  412. # conf.check_tool('compiler_cxx')
  413. # conf.check_tool('compiler_cc')
  414. if conf.env['IS_WINDOWS']:
  415. conf.check_tool('compiler_cxx')
  416. conf.check_tool('compiler_cc')
  417. conf.env.append_unique('CCDEFINES', '_POSIX')
  418. conf.env.append_unique('CXXDEFINES', '_POSIX')
  419. conf.env.append_unique('CXXFLAGS', '-Wall')
  420. conf.env.append_unique('CFLAGS', '-Wall')
  421. # configure all auto options
  422. configure_auto_options(conf)
  423. conf.sub_config('common')
  424. if conf.env['IS_LINUX']:
  425. conf.sub_config('linux')
  426. if Options.options.dbus:
  427. conf.sub_config('dbus')
  428. if conf.env['BUILD_JACKDBUS'] != True:
  429. conf.fatal('jackdbus was explicitly requested but cannot be built')
  430. conf.sub_config('example-clients')
  431. conf.env['LIB_PTHREAD'] = ['pthread']
  432. conf.env['LIB_DL'] = ['dl']
  433. conf.env['LIB_RT'] = ['rt']
  434. conf.env['LIB_M'] = ['m']
  435. conf.env['LIB_STDC++'] = ['stdc++']
  436. conf.env['JACK_API_VERSION'] = JACK_API_VERSION
  437. conf.env['JACK_VERSION'] = VERSION
  438. conf.env['BUILD_WITH_PROFILE'] = Options.options.profile
  439. conf.env['BUILD_WITH_32_64'] = Options.options.mixed
  440. conf.env['BUILD_CLASSIC'] = Options.options.classic
  441. conf.env['BUILD_DEBUG'] = Options.options.debug
  442. if conf.env['BUILD_JACKDBUS']:
  443. conf.env['BUILD_JACKD'] = conf.env['BUILD_CLASSIC']
  444. else:
  445. conf.env['BUILD_JACKD'] = True
  446. conf.env['BINDIR'] = conf.env['PREFIX'] + '/bin'
  447. if Options.options.libdir:
  448. conf.env['LIBDIR'] = Options.options.libdir
  449. else:
  450. conf.env['LIBDIR'] = conf.env['PREFIX'] + '/lib'
  451. if Options.options.mandir:
  452. conf.env['MANDIR'] = Options.options.mandir
  453. else:
  454. conf.env['MANDIR'] = conf.env['PREFIX'] + '/share/man/man1'
  455. if conf.env['BUILD_DEBUG']:
  456. conf.env.append_unique('CXXFLAGS', '-g')
  457. conf.env.append_unique('CFLAGS', '-g')
  458. conf.env.append_unique('LINKFLAGS', '-g')
  459. if not Options.options.autostart in ["default", "classic", "dbus", "none"]:
  460. conf.fatal("Invalid autostart value \"" + Options.options.autostart + "\"")
  461. if Options.options.autostart == "default":
  462. if conf.env['BUILD_JACKDBUS'] == True and conf.env['BUILD_JACKD'] == False:
  463. conf.env['AUTOSTART_METHOD'] = "dbus"
  464. else:
  465. conf.env['AUTOSTART_METHOD'] = "classic"
  466. else:
  467. conf.env['AUTOSTART_METHOD'] = Options.options.autostart
  468. if conf.env['AUTOSTART_METHOD'] == "dbus" and not conf.env['BUILD_JACKDBUS']:
  469. conf.fatal("D-Bus autostart mode was specified but jackdbus will not be built")
  470. if conf.env['AUTOSTART_METHOD'] == "classic" and not conf.env['BUILD_JACKD']:
  471. conf.fatal("Classic autostart mode was specified but jackd will not be built")
  472. if conf.env['AUTOSTART_METHOD'] == "dbus":
  473. conf.define('USE_LIBDBUS_AUTOLAUNCH', 1)
  474. elif conf.env['AUTOSTART_METHOD'] == "classic":
  475. conf.define('USE_CLASSIC_AUTOLAUNCH', 1)
  476. conf.define('CLIENT_NUM', Options.options.clients)
  477. conf.define('PORT_NUM_FOR_CLIENT', Options.options.application_ports)
  478. if conf.env['IS_WINDOWS']:
  479. # we define this in the environment to maintain compatability with
  480. # existing install paths that use ADDON_DIR rather than have to
  481. # have special cases for windows each time.
  482. conf.env['ADDON_DIR'] = conf.env['BINDIR'] + '/jack'
  483. # don't define ADDON_DIR in config.h, use the default 'jack' defined in
  484. # windows/JackPlatformPlug_os.h
  485. else:
  486. conf.env['ADDON_DIR'] = os.path.normpath(os.path.join(conf.env['LIBDIR'], 'jack'))
  487. conf.define('ADDON_DIR', conf.env['ADDON_DIR'])
  488. conf.define('JACK_LOCATION', os.path.normpath(os.path.join(conf.env['PREFIX'], 'bin')))
  489. if not conf.env['IS_WINDOWS']:
  490. conf.define('USE_POSIX_SHM', 1)
  491. conf.define('JACKMP', 1)
  492. if conf.env['BUILD_JACKDBUS'] == True:
  493. conf.define('JACK_DBUS', 1)
  494. if conf.env['BUILD_WITH_PROFILE'] == True:
  495. conf.define('JACK_MONITOR', 1)
  496. conf.write_config_header('config.h', remove=False)
  497. svnrev = None
  498. if os.access('svnversion.h', os.R_OK):
  499. data = file('svnversion.h').read()
  500. m = re.match(r'^#define SVN_VERSION "([^"]*)"$', data)
  501. if m != None:
  502. svnrev = m.group(1)
  503. if Options.options.mixed == True:
  504. conf.setenv(lib32, env=conf.env.derive())
  505. conf.env.append_unique('CXXFLAGS', '-m32')
  506. conf.env.append_unique('CFLAGS', '-m32')
  507. conf.env.append_unique('LINKFLAGS', '-m32')
  508. if Options.options.libdir32:
  509. conf.env['LIBDIR'] = Options.options.libdir32
  510. else:
  511. conf.env['LIBDIR'] = conf.env['PREFIX'] + '/lib32'
  512. conf.write_config_header('config.h')
  513. print()
  514. display_msg("==================")
  515. version_msg = "JACK " + VERSION
  516. if svnrev:
  517. version_msg += " exported from r" + svnrev
  518. else:
  519. version_msg += " svn revision will checked and eventually updated during build"
  520. print(version_msg)
  521. print("Build with a maximum of %d JACK clients" % Options.options.clients)
  522. print("Build with a maximum of %d ports per application" % Options.options.application_ports)
  523. display_msg("Install prefix", conf.env['PREFIX'], 'CYAN')
  524. display_msg("Library directory", conf.all_envs[""]['LIBDIR'], 'CYAN')
  525. if conf.env['BUILD_WITH_32_64'] == True:
  526. display_msg("32-bit library directory", conf.all_envs[lib32]['LIBDIR'], 'CYAN')
  527. display_msg("Drivers directory", conf.env['ADDON_DIR'], 'CYAN')
  528. display_feature('Build debuggable binaries', conf.env['BUILD_DEBUG'])
  529. display_msg('C compiler flags', repr(conf.all_envs[""]['CFLAGS']))
  530. display_msg('C++ compiler flags', repr(conf.all_envs[""]['CXXFLAGS']))
  531. display_msg('Linker flags', repr(conf.all_envs[""]['LINKFLAGS']))
  532. if conf.env['BUILD_WITH_32_64'] == True:
  533. display_msg('32-bit C compiler flags', repr(conf.all_envs[lib32]['CFLAGS']))
  534. display_msg('32-bit C++ compiler flags', repr(conf.all_envs[lib32]['CXXFLAGS']))
  535. display_msg('32-bit linker flags', repr(conf.all_envs[lib32]['LINKFLAGS']))
  536. display_feature('Build with engine profiling', conf.env['BUILD_WITH_PROFILE'])
  537. display_feature('Build with 32/64 bits mixed mode', conf.env['BUILD_WITH_32_64'])
  538. display_feature('Build standard JACK (jackd)', conf.env['BUILD_JACKD'])
  539. display_feature('Build D-Bus JACK (jackdbus)', conf.env['BUILD_JACKDBUS'])
  540. display_msg('Autostart method', conf.env['AUTOSTART_METHOD'])
  541. if conf.env['BUILD_JACKDBUS'] and conf.env['BUILD_JACKD']:
  542. print(Logs.colors.RED + 'WARNING !! mixing both jackd and jackdbus may cause issues:' + Logs.colors.NORMAL)
  543. print(Logs.colors.RED + 'WARNING !! jackdbus does not use .jackdrc nor qjackctl settings' + Logs.colors.NORMAL)
  544. # display configuration result messages for auto options
  545. display_auto_options_messages()
  546. if conf.env['BUILD_JACKDBUS'] == True:
  547. display_msg('D-Bus service install directory', conf.env['DBUS_SERVICES_DIR'], 'CYAN')
  548. #display_msg('Settings persistence', xxx)
  549. if conf.env['DBUS_SERVICES_DIR'] != conf.env['DBUS_SERVICES_DIR_REAL']:
  550. print()
  551. print(Logs.colors.RED + "WARNING: D-Bus session services directory as reported by pkg-config is")
  552. print(Logs.colors.RED + "WARNING:", end=' ')
  553. print(Logs.colors.CYAN + conf.env['DBUS_SERVICES_DIR_REAL'])
  554. print(Logs.colors.RED + 'WARNING: but service file will be installed in')
  555. print(Logs.colors.RED + "WARNING:", end=' ')
  556. print(Logs.colors.CYAN + conf.env['DBUS_SERVICES_DIR'])
  557. print(Logs.colors.RED + 'WARNING: You may need to adjust your D-Bus configuration after installing jackdbus')
  558. print('WARNING: You can override dbus service install directory')
  559. print('WARNING: with --enable-pkg-config-dbus-service-dir option to this script')
  560. print(Logs.colors.NORMAL, end=' ')
  561. print()
  562. def init(ctx):
  563. for y in (BuildContext, CleanContext, InstallContext, UninstallContext):
  564. name = y.__name__.replace('Context','').lower()
  565. class tmp(y):
  566. cmd = name + '_' + lib32
  567. variant = lib32
  568. def build(bld):
  569. if not bld.variant:
  570. out2 = out
  571. else:
  572. out2 = out + "/" + bld.variant
  573. print("make[1]: Entering directory `" + os.getcwd() + "/" + out2 + "'")
  574. if not bld.variant:
  575. if not os.access('svnversion.h', os.R_OK):
  576. create_svnversion_task(bld)
  577. if bld.env['BUILD_WITH_32_64'] == True:
  578. waflib.Options.commands.append(bld.cmd + '_' + lib32)
  579. # process subfolders from here
  580. bld.add_subdirs('common')
  581. if bld.variant:
  582. # only the wscript in common/ knows how to handle variants
  583. return
  584. if bld.env['IS_LINUX']:
  585. bld.add_subdirs('linux')
  586. bld.add_subdirs('example-clients')
  587. bld.add_subdirs('tests')
  588. bld.add_subdirs('man')
  589. if bld.env['BUILD_JACKDBUS'] == True:
  590. bld.add_subdirs('dbus')
  591. if bld.env['IS_MACOSX']:
  592. bld.add_subdirs('macosx')
  593. bld.add_subdirs('example-clients')
  594. bld.add_subdirs('tests')
  595. if bld.env['BUILD_JACKDBUS'] == True:
  596. bld.add_subdirs('dbus')
  597. if bld.env['IS_SUN']:
  598. bld.add_subdirs('solaris')
  599. bld.add_subdirs('example-clients')
  600. bld.add_subdirs('tests')
  601. if bld.env['BUILD_JACKDBUS'] == True:
  602. bld.add_subdirs('dbus')
  603. if bld.env['IS_WINDOWS']:
  604. bld.add_subdirs('windows')
  605. bld.add_subdirs('example-clients')
  606. #bld.add_subdirs('tests')
  607. if bld.env['BUILD_DOXYGEN_DOCS'] == True:
  608. html_docs_source_dir = "build/default/html"
  609. if bld.cmd == 'install':
  610. share_dir = bld.options.destdir + bld.env['PREFIX'] + '/share/jack-audio-connection-kit'
  611. html_docs_install_dir = share_dir + '/reference/html/'
  612. if os.path.isdir(html_docs_install_dir):
  613. Logs.pprint('CYAN', "Removing old doxygen documentation installation...")
  614. shutil.rmtree(html_docs_install_dir)
  615. Logs.pprint('CYAN', "Removing old doxygen documentation installation done.")
  616. Logs.pprint('CYAN', "Installing doxygen documentation...")
  617. shutil.copytree(html_docs_source_dir, html_docs_install_dir)
  618. Logs.pprint('CYAN', "Installing doxygen documentation done.")
  619. elif bld.cmd =='uninstall':
  620. Logs.pprint('CYAN', "Uninstalling doxygen documentation...")
  621. if os.path.isdir(share_dir):
  622. shutil.rmtree(share_dir)
  623. Logs.pprint('CYAN', "Uninstalling doxygen documentation done.")
  624. elif bld.cmd =='clean':
  625. if os.access(html_docs_source_dir, os.R_OK):
  626. Logs.pprint('CYAN', "Removing doxygen generated documentation...")
  627. shutil.rmtree(html_docs_source_dir)
  628. Logs.pprint('CYAN', "Removing doxygen generated documentation done.")
  629. elif bld.cmd =='build':
  630. if not os.access(html_docs_source_dir, os.R_OK):
  631. os.popen(bld.env.DOXYGEN).read()
  632. else:
  633. Logs.pprint('CYAN', "doxygen documentation already built.")
  634. def dist_hook():
  635. os.remove('svnversion_regenerate.sh')
  636. os.system('../svnversion_regenerate.sh svnversion.h')