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.

140 lines
5.4KB

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