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.

97 lines
2.7KB

  1. #! /usr/bin/env python
  2. # encoding: utf-8
  3. import Params
  4. import os.path
  5. import re # subst_func
  6. def set_options(opt):
  7. opt.add_option('--enable-pkg-config-dbus-service-dir', action='store_true', default=False, help='force D-Bus service install dir to be one returned by pkg-config')
  8. def configure(conf):
  9. conf.check_pkg('dbus-1', pkgvars=['session_bus_services_dir'])
  10. if Params.g_options.enable_pkg_config_dbus_service_dir:
  11. conf.env['DBUS_SERVICES_DIR'] = conf.env['DBUS-1_SESSION_BUS_SERVICES_DIR'][0]
  12. else:
  13. conf.env['DBUS_SERVICES_DIR'] = os.path.normpath(conf.env['PREFIX'] + '/share/dbus-1/services')
  14. conf.check_tool('misc')
  15. e = conf.create_header_configurator()
  16. e.name = 'expat.h'
  17. e.define = 'HAVE_EXPAT'
  18. e.run()
  19. if conf.is_defined('HAVE_EXPAT'):
  20. conf.env['LIB_EXPAT'] = ['expat']
  21. conf.env['BUILD_JACKDBUS'] = conf.is_defined('HAVE_EXPAT') and conf.is_defined('HAVE_DBUS_1')
  22. # by default waf subst tool uses @VAR@ while scons legacy is ${VAR}
  23. # so we use same template as scons for now
  24. def subst_func(tsk):
  25. "Substitutes variables in a .in file"
  26. print "subsituting!"
  27. m4_re = re.compile('\$\{(\w+)\}', re.M)
  28. env = tsk.env()
  29. infile = tsk.m_inputs[0].abspath(env)
  30. outfile = tsk.m_outputs[0].abspath(env)
  31. file = open(infile, 'r')
  32. code = file.read()
  33. file.close()
  34. s = m4_re.sub(r'%(\1)s', code)
  35. dict = tsk.dict
  36. if not dict:
  37. names = m4_re.findall(code)
  38. for i in names:
  39. if env[i] and type(env[i]) is types.ListType :
  40. dict[i] = " ".join(env[i])
  41. else: dict[i] = env[i]
  42. file = open(outfile, 'w')
  43. file.write(s % dict)
  44. file.close()
  45. return 0
  46. def build(bld):
  47. if bld.env()["BUILD_JACKDBUS"] != True:
  48. return
  49. obj = bld.create_obj('cc', 'program')
  50. obj.includes = ['.', '../../common', '../../common/jack']
  51. obj.source = [
  52. 'jackdbus.c',
  53. 'controller.c',
  54. 'controller_iface_configure.c',
  55. 'controller_iface_control.c',
  56. 'controller_iface_introspectable.c',
  57. 'controller_iface_patchbay.c',
  58. 'controller_iface_transport.c',
  59. 'xml.c',
  60. 'xml_expat.c',
  61. #'xml_libxml.c',
  62. #'xml_nop.c',
  63. 'xml_write_raw.c',
  64. 'sigsegv.c',
  65. ]
  66. obj.uselib = 'PTHREAD DL RT DBUS-1 EXPAT'
  67. obj.uselib_local = 'serverlib'
  68. obj.target = 'jackdbus'
  69. # process org.jackaudio.service.in -> org.jackaudio.service
  70. obj = bld.create_obj('subst')
  71. obj.source = 'org.jackaudio.service.in'
  72. obj.target = 'org.jackaudio.service'
  73. obj.dict = {'BINDIR': bld.env()['PREFIX'] + '/bin'}
  74. obj.inst_var = bld.env()['DBUS_SERVICES_DIR']
  75. obj.inst_dir = '/'
  76. obj.fun = subst_func # @VAR@ -> ${VAR}