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.

164 lines
6.5KB

  1. #! /usr/bin/env python
  2. # encoding: utf-8
  3. import os
  4. import Params
  5. import commands
  6. from Configure import g_maxlen
  7. #g_maxlen = 40
  8. import shutil
  9. VERSION='1.9.0'
  10. APPNAME='jack'
  11. JACK_API_VERSION = '0.1.0'
  12. # these variables are mandatory ('/' are converted automatically)
  13. srcdir = '.'
  14. blddir = 'build'
  15. def display_msg(msg, status = None, color = None):
  16. sr = msg
  17. global g_maxlen
  18. g_maxlen = max(g_maxlen, len(msg))
  19. if status:
  20. print "%s :" % msg.ljust(g_maxlen),
  21. Params.pprint(color, status)
  22. else:
  23. print "%s" % msg.ljust(g_maxlen)
  24. def display_feature(msg, build):
  25. if build:
  26. display_msg(msg, "yes", 'GREEN')
  27. else:
  28. display_msg(msg, "no", 'YELLOW')
  29. def fetch_svn_revision(path):
  30. cmd = "LANG= "
  31. cmd += "svnversion "
  32. cmd += path
  33. return commands.getoutput(cmd)
  34. def set_options(opt):
  35. # options provided by the modules
  36. opt.tool_options('compiler_cxx')
  37. opt.tool_options('compiler_cc')
  38. opt.add_option('--dbus', action='store_true', default=False, help='Enable D-Bus JACK (jackdbus)')
  39. opt.add_option('--doxygen', action='store_true', default=False, help='Enable build of doxygen documentation')
  40. opt.sub_options('linux/dbus')
  41. def configure(conf):
  42. platform = conf.detect_platform()
  43. conf.env['IS_MACOSX'] = platform == 'darwin'
  44. conf.env['IS_LINUX'] = platform == 'linux'
  45. if conf.env['IS_LINUX']:
  46. Params.pprint('CYAN', "Linux detected")
  47. if conf.env['IS_MACOSX']:
  48. Params.pprint('CYAN', "MacOS X detected")
  49. conf.check_tool('compiler_cxx')
  50. conf.check_tool('compiler_cc')
  51. conf.sub_config('common')
  52. if conf.env['IS_LINUX']:
  53. conf.sub_config('linux')
  54. if Params.g_options.dbus:
  55. conf.sub_config('linux/dbus')
  56. conf.sub_config('example-clients')
  57. conf.env['LIB_PTHREAD'] = ['pthread']
  58. conf.env['LIB_DL'] = ['dl']
  59. conf.env['LIB_RT'] = ['rt']
  60. conf.env['JACK_API_VERSION'] = JACK_API_VERSION
  61. conf.env['JACK_VERSION'] = VERSION
  62. conf.env['BUILD_DOXYGEN_DOCS'] = Params.g_options.doxygen
  63. conf.define('ADDON_DIR', os.path.normpath(conf.env['PREFIX'] + '/lib/jack'))
  64. conf.define('JACK_LOCATION', os.path.normpath(conf.env['PREFIX'] + '/bin'))
  65. if conf.env['IS_LINUX']:
  66. conf.define('SOCKET_RPC_FIFO_SEMA', 1)
  67. if conf.env['IS_MACOSX']:
  68. conf.define('MACH_RPC_MACH_SEMA', 1)
  69. conf.define('__SMP__', 1)
  70. conf.define('USE_POSIX_SHM', 1)
  71. conf.define('JACK_SVNREVISION', fetch_svn_revision('.'))
  72. conf.define('JACKMP', 1)
  73. if conf.env['BUILD_JACKDBUS'] == True:
  74. conf.define('JACK_DBUS', 1)
  75. conf.write_config_header('config.h')
  76. display_msg("\n==================")
  77. display_msg("JACK %s %s" % (VERSION, conf.get_define('JACK_SVNREVISION')))
  78. print
  79. display_msg("Install prefix", conf.env['PREFIX'], 'CYAN')
  80. display_msg("Drivers directory", conf.env['ADDON_DIR'], 'CYAN')
  81. display_feature('Build doxygen documentation', conf.env['BUILD_DOXYGEN_DOCS'])
  82. if conf.env['IS_LINUX']:
  83. display_feature('Build with ALSA support', conf.env['BUILD_DRIVER_ALSA'] == True)
  84. display_feature('Build with FireWire (FreeBob) support', conf.env['BUILD_DRIVER_FREEBOB'] == True)
  85. display_feature('Build with FireWire (FFADO) support', conf.env['BUILD_DRIVER_FFADO'] == True)
  86. display_feature('Build D-Bus JACK (jackdbus)', conf.env['BUILD_JACKDBUS'] == True)
  87. if conf.env['BUILD_JACKDBUS'] == True:
  88. display_msg('D-Bus service install directory', conf.env['DBUS_SERVICES_DIR'], 'CYAN')
  89. #display_msg('Settings persistence', xxx)
  90. if conf.env['DBUS_SERVICES_DIR'] != conf.env['DBUS-1_SESSION_BUS_SERVICES_DIR'][0]:
  91. print
  92. print Params.g_colors['RED'] + "WARNING: D-Bus session services directory as reported by pkg-config is"
  93. print Params.g_colors['RED'] + "WARNING:",
  94. print Params.g_colors['CYAN'] + conf.env['DBUS-1_SESSION_BUS_SERVICES_DIR'][0]
  95. print Params.g_colors['RED'] + 'WARNING: but service file will be installed in'
  96. print Params.g_colors['RED'] + "WARNING:",
  97. print Params.g_colors['CYAN'] + conf.env['DBUS_SERVICES_DIR']
  98. print Params.g_colors['RED'] + 'WARNING: You may need to adjust your D-Bus configuration after installing jackdbus'
  99. print 'WARNING: You can override dbus service install directory'
  100. print 'WARNING: with --enable-pkg-config-dbus-service-dir option to this script'
  101. print Params.g_colors['NORMAL'],
  102. print
  103. def build(bld):
  104. # process subfolders from here
  105. bld.add_subdirs('common')
  106. if bld.env()['IS_LINUX']:
  107. bld.add_subdirs('linux')
  108. if bld.env()['BUILD_JACKDBUS'] == True:
  109. bld.add_subdirs('linux/dbus')
  110. bld.add_subdirs('example-clients')
  111. bld.add_subdirs('tests')
  112. if bld.env()['IS_MACOSX']:
  113. bld.add_subdirs('macosx')
  114. bld.add_subdirs('example-clients')
  115. bld.add_subdirs('tests')
  116. if bld.env()['BUILD_JACKDBUS'] == True:
  117. bld.add_subdirs('linux/dbus')
  118. if bld.env()['BUILD_DOXYGEN_DOCS'] == True:
  119. share_dir = Params.g_build.env()['PREFIX'] + '/share/jack-audio-connection-kit'
  120. html_docs_dir = share_dir + '/reference/html/'
  121. if Params.g_commands['install']:
  122. if os.path.isdir(html_docs_dir):
  123. Params.pprint('CYAN', "Removing old doxygen documentation installation...")
  124. shutil.rmtree(html_docs_dir)
  125. Params.pprint('CYAN', "Removing old doxygen documentation installation done.")
  126. Params.pprint('CYAN', "Installing doxygen documentation...")
  127. shutil.copytree('html', html_docs_dir)
  128. Params.pprint('CYAN', "Installing doxygen documentation done.")
  129. elif Params.g_commands['uninstall']:
  130. Params.pprint('CYAN', "Uninstalling doxygen documentation...")
  131. if os.path.isdir(share_dir):
  132. shutil.rmtree(share_dir)
  133. Params.pprint('CYAN', "Uninstalling doxygen documentation done.")
  134. elif Params.g_commands['clean']:
  135. if os.access('html', os.R_OK):
  136. Params.pprint('CYAN', "Removing doxygen generated documentation...")
  137. shutil.rmtree('html')
  138. Params.pprint('CYAN', "Removing doxygen generated documentation done.")
  139. elif Params.g_commands['build']:
  140. if not os.access('html', os.R_OK):
  141. os.popen("doxygen").read()
  142. else:
  143. Params.pprint('CYAN', "doxygen documentation already built.")