Merge branch 'master' into newer-midi-with-winmme-driver
[jack2.git] / dbus / wscript
bloba4066b57c77eda2093d3345b62c990ab2919c522
1 #! /usr/bin/env python
2 # encoding: utf-8
4 import os.path
5 import Options
6 import re # subst_func
7 import Logs
9 def set_options(opt):
10 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')
12 def configure(conf):
13 conf.env['BUILD_JACKDBUS'] = False
15 if not conf.check_cfg(package='dbus-1', atleast_version='1.0.0', args='--cflags --libs') or not conf.is_defined('HAVE_DBUS_1'):
16 print Logs.colors.RED + 'WARNING !! jackdbus will not be built because libdbus-dev is missing' + Logs.colors.NORMAL
17 return
19 dbus_dir = conf.check_cfg(package='dbus-1', args='--variable=session_bus_services_dir')
20 if not dbus_dir:
21 print Logs.colors.RED + 'WARNING !! jackdbus will not be built because service dir is unknown' + Logs.colors.NORMAL
22 return
24 dbus_dir = dbus_dir.strip()
25 conf.env['DBUS_SERVICES_DIR_REAL'] = dbus_dir
27 if Options.options.enable_pkg_config_dbus_service_dir:
28 conf.env['DBUS_SERVICES_DIR'] = dbus_dir
29 else:
30 conf.env['DBUS_SERVICES_DIR'] = os.path.normpath(conf.env['PREFIX'] + '/share/dbus-1/services')
32 conf.check_tool('misc')
34 conf.check(header_name='expat.h', define_name="HAVE_EXPAT")
36 if conf.is_defined('HAVE_EXPAT'):
37 conf.env['LIB_EXPAT'] = ['expat']
38 else:
39 print Logs.colors.RED + 'WARNING !! jackdbus will not be built because of expat is missing' + Logs.colors.NORMAL
40 return
42 conf.env['BUILD_JACKDBUS'] = True
44 def build(bld):
45 obj = bld.new_task_gen('cc', 'program')
46 if bld.env['IS_LINUX']:
47 sysdeps_dbus_include = ['../linux', '../posix']
48 if bld.env['IS_MACOSX']:
49 sysdeps_dbus_include = ['../macosx', '../posix']
51 obj.includes = sysdeps_dbus_include + ['.', '../', '../common', '../common/jack']
52 obj.source = [
53 'jackdbus.c',
54 'controller.c',
55 'controller_iface_configure.c',
56 'controller_iface_control.c',
57 'controller_iface_introspectable.c',
58 'controller_iface_patchbay.c',
59 'controller_iface_transport.c',
60 'xml.c',
61 'xml_expat.c',
62 #'xml_libxml.c',
63 #'xml_nop.c',
64 'xml_write_raw.c',
65 'sigsegv.c',
66 'reserve.c',
68 if bld.env['IS_LINUX']:
69 obj.uselib = 'PTHREAD DL RT DBUS-1 EXPAT'
70 if bld.env['IS_MACOSX']:
71 obj.uselib = 'PTHREAD DL DBUS-1 EXPAT'
72 obj.uselib_local = 'serverlib'
73 obj.target = 'jackdbus'
75 # process org.jackaudio.service.in -> org.jackaudio.service
76 import misc
77 obj = bld.new_task_gen('subst')
78 obj.source = 'org.jackaudio.service.in'
79 obj.target = 'org.jackaudio.service'
80 obj.dict = {'BINDIR': bld.env['PREFIX'] + '/bin'}
81 obj.install_path = '${DBUS_SERVICES_DIR}/'
82 obj.fun = misc.subst_func