CI: build on ubuntu 18.04 and ubuntu 22.04
[jackdbus.git] / dbus / wscript
blob2760ece557b3486b1919a8b119f965f0011c6f0f
1 #! /usr/bin/python3
2 # encoding: utf-8
4 import os.path
6 from waflib import Logs, Options
9 def options(opt):
10     opt.add_option(
11         '--enable-pkg-config-dbus-service-dir',
12         action='store_true',
13         default=False,
14         help='force D-Bus service install dir to be one returned by pkg-config',
15     )
18 def configure(conf):
19     conf.define('JACK_VERSION', conf.env['JACK_VERSION'])
21     if not conf.check_cfg(package='dbus-1 >= 1.0.0', args='--cflags --libs', mandatory=False):
22         print(
23             Logs.colors.RED + 'ERROR !! jackdbus will not be built because libdbus-dev is missing' + Logs.colors.NORMAL
24         )
25         return
27     dbus_dir = conf.check_cfg(package='dbus-1', args='--variable=session_bus_services_dir')
28     if not dbus_dir:
29         print(
30             Logs.colors.RED + 'ERROR !! jackdbus will not be built because service dir is unknown' + Logs.colors.NORMAL
31         )
32         return
34     dbus_dir = dbus_dir.strip()
35     conf.env['DBUS_SERVICES_DIR_REAL'] = dbus_dir
37     if Options.options.enable_pkg_config_dbus_service_dir:
38         conf.env['DBUS_SERVICES_DIR'] = dbus_dir
39     else:
40         conf.env['DBUS_SERVICES_DIR'] = os.path.normpath(conf.env['PREFIX'] + '/share/dbus-1/services')
44 def build(bld):
45     obj = bld(features=['c', 'cprogram'], idx=17)
46     if bld.env['IS_LINUX']:
47         sysdeps_dbus_include = ['../linux', '../posix']
48     if bld.env['IS_FREEBSD']:
49         sysdeps_dbus_include = ['../freebsd', '../posix']
50     if bld.env['IS_MACOSX']:
51         sysdeps_dbus_include = ['../macosx', '../posix']
53     obj.includes = sysdeps_dbus_include + ['.', '../', '../common', '../common/jack']
55     obj.defines = ['HAVE_CONFIG_H', 'SERVER_SIDE']
56     obj.source = [
57         'jackdbus.c',
58         'controller.c',
59         'params.c',
60         'controller_iface_configure.c',
61         'controller_iface_control.c',
62         'controller_iface_introspectable.c',
63         'controller_iface_patchbay.c',
64         'controller_iface_session_manager.c',
65         'controller_iface_transport.c',
66         'xml.c',
67         'xml_expat.c',
68         'xml_write_raw.c',
69         'sigsegv.c',
70         'reserve.c',
71         ]
72     obj.use = ['JACKSERVER']
73     if bld.env['IS_LINUX']:
74         obj.source += [
75             '../linux/uptime.c',
76         ]
77         obj.use += ['PTHREAD', 'DL', 'RT', 'DBUS-1', 'EXPAT', 'STDC++']
78     if bld.env['IS_FREEBSD']:
79         obj.source += [
80             '../linux/uptime.c',
81         ]
82         obj.use += ['PTHREAD', 'EXECINFO', 'LIBSYSINFO', 'DBUS-1', 'EXPAT']
83     if bld.env['IS_MACOSX']:
84         obj.source += [
85             '../macosx/uptime.c',
86         ]
87         obj.use += ['PTHREAD', 'DL', 'DBUS-1', 'EXPAT']
88     obj.target = 'jackdbus'
90     # process org.jackaudio.service.in -> org.jackaudio.service
91     obj = bld(
92             features='subst',
93             source='org.jackaudio.service.in',
94             target='org.jackaudio.service',
95             install_path='${DBUS_SERVICES_DIR}/',
96             BINDIR=bld.env['PREFIX'] + '/bin')
98     if not bld.env['IS_WINDOWS']:
99         bld.install_files('${PREFIX}/bin', 'jack_control', chmod=0o755)