wscript 2.88 KB
Newer Older
1
2
3
#! /usr/bin/env python
# encoding: utf-8

nedko's avatar
nedko committed
4
import os.path
5
import Options
nedko's avatar
nedko committed
6
import re # subst_func
7
import Logs
nedko's avatar
nedko committed
8
9
10
11

def set_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')

12
def configure(conf):
nedko's avatar
nedko committed
13
14
15
    conf.env['BUILD_JACKDBUS'] = False

    if not conf.check_cfg(package='dbus-1', atleast_version='1.0.0', args='--cflags --libs') or not conf.is_defined('HAVE_DBUS_1'):
Adrian Knoth's avatar
Adrian Knoth committed
16
        print(Logs.colors.RED + 'WARNING !! jackdbus will not be built because libdbus-dev is missing' + Logs.colors.NORMAL)
17
18
19
20
        return

    dbus_dir = conf.check_cfg(package='dbus-1', args='--variable=session_bus_services_dir')
    if not dbus_dir:
Adrian Knoth's avatar
Adrian Knoth committed
21
        print(Logs.colors.RED + 'WARNING !! jackdbus will not be built because service dir is unknown' + Logs.colors.NORMAL)
22
23
24
25
        return

    dbus_dir = dbus_dir.strip()
    conf.env['DBUS_SERVICES_DIR_REAL'] = dbus_dir
nedko's avatar
nedko committed
26

27
    if Options.options.enable_pkg_config_dbus_service_dir:
28
        conf.env['DBUS_SERVICES_DIR'] = dbus_dir
nedko's avatar
nedko committed
29
30
31
32
    else:
        conf.env['DBUS_SERVICES_DIR'] = os.path.normpath(conf.env['PREFIX'] + '/share/dbus-1/services')

    conf.check_tool('misc')
33

34
    conf.check(header_name='expat.h', define_name="HAVE_EXPAT")
35
36
37

    if conf.is_defined('HAVE_EXPAT'):
        conf.env['LIB_EXPAT'] = ['expat']
nedko's avatar
nedko committed
38
    else:
Adrian Knoth's avatar
Adrian Knoth committed
39
        print(Logs.colors.RED + 'WARNING !! jackdbus will not be built because of expat is missing' + Logs.colors.NORMAL)
nedko's avatar
nedko committed
40
        return
41

nedko's avatar
nedko committed
42
    conf.env['BUILD_JACKDBUS'] = True
43

44
def build(bld):
45
46
    obj = bld.new_task_gen('cc', 'program')
    if bld.env['IS_LINUX']:
47
        sysdeps_dbus_include = ['../linux', '../posix']
48
    if bld.env['IS_MACOSX']:
49
50
51
        sysdeps_dbus_include = ['../macosx', '../posix']

    obj.includes = sysdeps_dbus_include + ['.', '../', '../common', '../common/jack']
nedko's avatar
nedko committed
52
    obj.defines = ['HAVE_CONFIG_H','SERVER_SIDE']
53
54
55
    obj.source = [
        'jackdbus.c',
        'controller.c',
nedko's avatar
nedko committed
56
        'params.c',
57
58
59
60
        'controller_iface_configure.c',
        'controller_iface_control.c',
        'controller_iface_introspectable.c',
        'controller_iface_patchbay.c',
61
        'controller_iface_session_manager.c',
62
63
64
65
66
67
        'controller_iface_transport.c',
        'xml.c',
        'xml_expat.c',
        #'xml_nop.c',
        'xml_write_raw.c',
        'sigsegv.c',
68
	'reserve.c',
69
        ]
70
    if bld.env['IS_LINUX']:
sletz's avatar
sletz committed
71
        obj.uselib = 'PTHREAD DL RT DBUS-1 EXPAT'
72
    if bld.env['IS_MACOSX']:
sletz's avatar
sletz committed
73
        obj.uselib = 'PTHREAD DL DBUS-1 EXPAT'
74
75
    obj.uselib_local = 'serverlib'
    obj.target       = 'jackdbus'
nedko's avatar
nedko committed
76
77

    # process org.jackaudio.service.in -> org.jackaudio.service
78
79
    import misc
    obj = bld.new_task_gen('subst')
nedko's avatar
nedko committed
80
81
    obj.source = 'org.jackaudio.service.in'
    obj.target = 'org.jackaudio.service'
82
83
84
    obj.dict = {'BINDIR': bld.env['PREFIX'] + '/bin'}
    obj.install_path = '${DBUS_SERVICES_DIR}/'
    obj.fun = misc.subst_func