2019-10-28 12:36:35 +02:00
#! /usr/bin/python3
2008-05-31 00:17:01 +03:00
# encoding: utf-8
2008-06-07 13:36:31 +03:00
import os.path
import re # subst_func
2015-05-02 13:36:31 +03:00
from waflib import Logs, Options
2008-06-07 13:36:31 +03:00
2012-02-15 21:39:22 +02:00
def options(opt):
2008-06-07 13:36:31 +03:00
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')
2008-05-31 01:48:00 +03:00
def configure(conf):
2009-12-28 15:23:14 +02:00
conf.env['BUILD_JACKDBUS'] = False
2018-10-06 15:15:06 +03:00
if not conf.check_cfg(package='dbus-1 >= 1.0.0', args='--cflags --libs', mandatory=False):
2015-04-09 00:53:54 +03:00
print(Logs.colors.RED + 'ERROR !! jackdbus will not be built because libdbus-dev is missing' + Logs.colors.NORMAL)
2008-11-14 03:07:55 +02:00
return
dbus_dir = conf.check_cfg(package='dbus-1', args='--variable=session_bus_services_dir')
if not dbus_dir:
2015-04-09 00:53:54 +03:00
print(Logs.colors.RED + 'ERROR !! jackdbus will not be built because service dir is unknown' + Logs.colors.NORMAL)
2008-11-14 03:07:55 +02:00
return
dbus_dir = dbus_dir.strip()
conf.env['DBUS_SERVICES_DIR_REAL'] = dbus_dir
2008-06-07 13:36:31 +03:00
2008-11-14 03:07:46 +02:00
if Options.options.enable_pkg_config_dbus_service_dir:
2008-11-14 03:07:55 +02:00
conf.env['DBUS_SERVICES_DIR'] = dbus_dir
2008-06-07 13:36:31 +03:00
else:
conf.env['DBUS_SERVICES_DIR'] = os.path.normpath(conf.env['PREFIX'] + '/share/dbus-1/services')
2015-04-09 00:44:14 +03:00
if not conf.check_cfg(package='expat', args='--cflags --libs', mandatory=False):
2015-04-09 00:53:54 +03:00
print(Logs.colors.RED + 'ERROR !! jackdbus will not be built because of expat is missing' + Logs.colors.NORMAL)
2009-12-28 15:23:14 +02:00
return
2008-05-31 01:48:00 +03:00
2009-12-28 15:23:14 +02:00
conf.env['BUILD_JACKDBUS'] = True
2008-05-31 01:48:00 +03:00
2008-05-31 00:17:01 +03:00
def build(bld):
2012-02-15 21:30:08 +02:00
obj = bld(features = ['c', 'cprogram'], idx=17)
2008-11-14 03:07:46 +02:00
if bld.env['IS_LINUX']:
2008-09-05 16:36:28 +03:00
sysdeps_dbus_include = ['../linux', '../posix']
2008-11-14 03:07:46 +02:00
if bld.env['IS_MACOSX']:
2008-09-05 16:36:28 +03:00
sysdeps_dbus_include = ['../macosx', '../posix']
obj.includes = sysdeps_dbus_include + ['.', '../', '../common', '../common/jack']
2011-05-13 03:28:39 +03:00
obj.defines = ['HAVE_CONFIG_H','SERVER_SIDE']
2008-05-31 00:17:01 +03:00
obj.source = [
'jackdbus.c',
'controller.c',
2011-04-17 21:18:32 +03:00
'params.c',
2008-05-31 00:17:01 +03:00
'controller_iface_configure.c',
'controller_iface_control.c',
'controller_iface_introspectable.c',
'controller_iface_patchbay.c',
2011-07-21 00:35:21 +03:00
'controller_iface_session_manager.c',
2008-05-31 00:17:01 +03:00
'controller_iface_transport.c',
'xml.c',
'xml_expat.c',
#'xml_nop.c',
'xml_write_raw.c',
'sigsegv.c',
2012-02-15 21:40:36 +02:00
'reserve.c',
2008-05-31 00:17:01 +03:00
]
2012-02-15 21:36:44 +02:00
obj.use = ['serverlib']
2008-11-14 03:07:46 +02:00
if bld.env['IS_LINUX']:
2019-02-24 19:09:47 +02:00
obj.source += [
'../linux/uptime.c',
]
2012-11-07 14:31:52 +02:00
obj.use += ['PTHREAD', 'DL', 'RT', 'DBUS-1', 'EXPAT', 'STDC++']
2008-11-14 03:07:46 +02:00
if bld.env['IS_MACOSX']:
2019-02-24 19:09:47 +02:00
obj.source += [
'../macosx/uptime.c',
]
2012-02-15 21:36:44 +02:00
obj.use += ['PTHREAD', 'DL', 'DBUS-1', 'EXPAT']
obj.target = 'jackdbus'
2008-06-07 13:36:31 +03:00
# process org.jackaudio.service.in -> org.jackaudio.service
2012-02-10 22:55:03 +02:00
obj = bld(
features = 'subst',
source = 'org.jackaudio.service.in',
target = 'org.jackaudio.service',
install_path = '${DBUS_SERVICES_DIR}/',
BINDIR = bld.env['PREFIX'] + '/bin')