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.

142 lines
5.7KB

  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. conf.check_tool('compiler_cxx')
  43. conf.check_tool('compiler_cc')
  44. conf.sub_config('common')
  45. conf.sub_config('linux')
  46. if Params.g_options.dbus:
  47. conf.sub_config('linux/dbus')
  48. conf.sub_config('example-clients')
  49. conf.env['LIB_PTHREAD'] = ['pthread']
  50. conf.env['LIB_DL'] = ['dl']
  51. conf.env['LIB_RT'] = ['rt']
  52. conf.env['JACK_API_VERSION'] = JACK_API_VERSION
  53. conf.env['JACK_VERSION'] = VERSION
  54. conf.env['BUILD_DOXYGEN_DOCS'] = Params.g_options.doxygen
  55. conf.define('ADDON_DIR', os.path.normpath(conf.env['PREFIX'] + '/lib/jack'))
  56. conf.define('JACK_LOCATION', os.path.normpath(conf.env['PREFIX'] + '/bin'))
  57. conf.define('SOCKET_RPC_FIFO_SEMA', 1)
  58. conf.define('__SMP__', 1)
  59. conf.define('USE_POSIX_SHM', 1)
  60. conf.define('JACK_SVNREVISION', fetch_svn_revision('.'))
  61. conf.define('JACKMP', 1)
  62. if conf.env['BUILD_JACKDBUS'] == True:
  63. conf.define('JACK_DBUS', 1)
  64. conf.write_config_header('config.h')
  65. display_msg("\n==================")
  66. display_msg("JACK %s %s" % (VERSION, conf.get_define('JACK_SVNREVISION')))
  67. print
  68. display_msg("Install prefix", conf.env['PREFIX'], 'CYAN')
  69. display_msg("Drivers directory", conf.env['ADDON_DIR'], 'CYAN')
  70. display_feature('Build doxygen documentation', conf.env['BUILD_DOXYGEN_DOCS'])
  71. display_feature('Build with ALSA support', conf.env['BUILD_DRIVER_ALSA'] == True)
  72. display_feature('Build with FireWire (FreeBob) support', conf.env['BUILD_DRIVER_FREEBOB'] == True)
  73. display_feature('Build with FireWire (FFADO) support', conf.env['BUILD_DRIVER_FFADO'] == True)
  74. display_feature('Build D-Bus JACK (jackdbus)', conf.env['BUILD_JACKDBUS'] == True)
  75. if conf.env['BUILD_JACKDBUS'] == True:
  76. display_msg('D-Bus service install directory', conf.env['DBUS_SERVICES_DIR'], 'CYAN')
  77. #display_msg('Settings persistence', xxx)
  78. if conf.env['DBUS_SERVICES_DIR'] != conf.env['DBUS-1_SESSION_BUS_SERVICES_DIR'][0]:
  79. print
  80. print Params.g_colors['RED'] + "WARNING: D-Bus session services directory as reported by pkg-config is"
  81. print Params.g_colors['RED'] + "WARNING:",
  82. print Params.g_colors['CYAN'] + conf.env['DBUS-1_SESSION_BUS_SERVICES_DIR'][0]
  83. print Params.g_colors['RED'] + 'WARNING: but service file will be installed in'
  84. print Params.g_colors['RED'] + "WARNING:",
  85. print Params.g_colors['CYAN'] + conf.env['DBUS_SERVICES_DIR']
  86. print Params.g_colors['RED'] + 'WARNING: You may need to adjust your D-Bus configuration after installing jackdbus'
  87. print 'WARNING: You can override dbus service install directory'
  88. print 'WARNING: with --enable-pkg-config-dbus-service-dir option to this script'
  89. print Params.g_colors['NORMAL'],
  90. print
  91. def build(bld):
  92. # process subfolders from here
  93. bld.add_subdirs('common')
  94. bld.add_subdirs('linux')
  95. if bld.env()['BUILD_JACKDBUS'] == True:
  96. bld.add_subdirs('linux/dbus')
  97. bld.add_subdirs('example-clients')
  98. bld.add_subdirs('tests')
  99. if bld.env()['BUILD_DOXYGEN_DOCS'] == True:
  100. share_dir = Params.g_build.env()['PREFIX'] + '/share/jack-audio-connection-kit'
  101. html_docs_dir = share_dir + '/reference/html/'
  102. if Params.g_commands['install']:
  103. if os.path.isdir(html_docs_dir):
  104. Params.pprint('CYAN', "Removing old doxygen documentation installation...")
  105. shutil.rmtree(html_docs_dir)
  106. Params.pprint('CYAN', "Removing old doxygen documentation installation done.")
  107. Params.pprint('CYAN', "Installing doxygen documentation...")
  108. shutil.copytree('html', html_docs_dir)
  109. Params.pprint('CYAN', "Installing doxygen documentation done.")
  110. elif Params.g_commands['uninstall']:
  111. Params.pprint('CYAN', "Uninstalling doxygen documentation...")
  112. if os.path.isdir(share_dir):
  113. shutil.rmtree(share_dir)
  114. Params.pprint('CYAN', "Uninstalling doxygen documentation done.")
  115. elif Params.g_commands['clean']:
  116. if os.access('html', os.R_OK):
  117. Params.pprint('CYAN', "Removing doxygen generated documentation...")
  118. shutil.rmtree('html')
  119. Params.pprint('CYAN', "Removing doxygen generated documentation done.")
  120. elif Params.g_commands['build']:
  121. if not os.access('html', os.R_OK):
  122. os.popen("doxygen").read()
  123. else:
  124. Params.pprint('CYAN', "doxygen documentation already built.")