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.

170 lines
6.8KB

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