jackdbus/dbus/wscript

101 lines
3.3 KiB
Python

#! /usr/bin/python3
# encoding: utf-8
#
# Copyright (C) 2015, 2018 Karl Linden <karl.j.linden@gmail.com>
# Copyleft (C) 2008-2022 Nedko Arnaudov
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
import os.path
from waflib import Logs, Options, Utils
def options(opt):
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',
)
def configure(conf):
if not conf.check_cfg(package='dbus-1 >= 1.0.0', args='--cflags --libs', mandatory=False):
print(
Logs.colors.RED + 'ERROR !! jackdbus will not be built because libdbus-dev is missing' + Logs.colors.NORMAL
)
return
dbus_dir = conf.check_cfg(package='dbus-1', args='--variable=session_bus_services_dir')
if not dbus_dir:
print(
Logs.colors.RED + 'ERROR !! jackdbus will not be built because service dir is unknown' + Logs.colors.NORMAL
)
return
dbus_dir = dbus_dir.strip()
conf.env['DBUS_SERVICES_DIR_REAL'] = dbus_dir
if Options.options.enable_pkg_config_dbus_service_dir:
conf.env['DBUS_SERVICES_DIR'] = dbus_dir
else:
conf.env['DBUS_SERVICES_DIR'] = os.path.normpath(conf.env['PREFIX'] + '/share/dbus-1/services')
def build(bld):
obj = bld(features=['c', 'cprogram'], idx=17)
sysdeps_dbus_include = ['../linux']
obj.includes = sysdeps_dbus_include + ['.', '../', '../common', '../common/jack']
obj.defines = ['HAVE_CONFIG_H', 'SERVER_SIDE']
obj.source = [
'jackdbus.c',
'controller.c',
'params.c',
'controller_iface_configure.c',
'controller_iface_control.c',
'controller_iface_introspectable.c',
'controller_iface_patchbay.c',
'controller_iface_session_manager.c',
'controller_iface_transport.c',
'xml.c',
'xml_expat.c',
'xml_write_raw.c',
'reserve.c',
]
obj.use = ['JACKSERVER']
if bld.env['IS_LINUX']:
obj.use += ['PTHREAD', 'DL', 'RT', 'DBUS-1', 'EXPAT']
if bld.env['IS_FREEBSD']:
obj.use += ['PTHREAD', 'EXECINFO', 'LIBSYSINFO', 'DBUS-1', 'EXPAT']
if bld.env['BUILD_SIGINFO']:
obj.source += [
'siginfo.c',
]
obj.target = 'jackdbus'
# process org.jackaudio.service.in -> org.jackaudio.service
obj = bld(
features='subst',
source='org.jackaudio.service.in',
target='org.jackaudio.service',
install_path='${DBUS_SERVICES_DIR}/',
BINDIR=bld.env['PREFIX'] + '/bin')
bld.install_as('${PREFIX}/bin/' + "jack_control", 'jack_control/jack_control.py', chmod=Utils.O755)