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

nedko's avatar
nedko committed
4
5
6
import re
import os

7
8
9
def configure(conf):
    conf.check_tool('misc')

nedko's avatar
nedko committed
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# by default waf subst tool uses @VAR@ while scons legacy is ${VAR}
# so we use same template as scons for now
def subst_func(tsk):
    "Substitutes variables in a .in file"

    m4_re = re.compile('\$\{(\w+)\}', re.M)

    env = tsk.env()
    infile = tsk.m_inputs[0].abspath(env)
    outfile = tsk.m_outputs[0].abspath(env)

    file = open(infile, 'r')
    code = file.read()
    file.close()

    s = m4_re.sub(r'%(\1)s', code)

    dict = tsk.dict
    if not dict:
        names = m4_re.findall(code)
        for i in names:
            if env[i] and type(env[i]) is types.ListType :
                dict[i] = " ".join(env[i])
            else: dict[i] = env[i]

    file = open(outfile, 'w')
    file.write(s % dict)
    file.close()

    return 0

41
def build(bld):
nedko's avatar
nedko committed
42
    common_libsources = [
43
44
45
46
        'JackActivationCount.cpp',
        'JackAPI.cpp',
        'JackClient.cpp',
        'JackConnectionManager.cpp',
nedko's avatar
nedko committed
47
        'ringbuffer.c',
48
49
50
51
52
53
54
55
56
57
        'JackError.cpp',
        'JackFrameTimer.cpp',
        'JackGraphManager.cpp',
        'JackPort.cpp',
        'JackPosixSemaphore.cpp',
        'JackFifo.cpp',
        'JackPortType.cpp',
        'JackAudioPort.cpp',
        'JackMidiPort.cpp',
        'JackMidiAPI.cpp',
nedko's avatar
nedko committed
58
59
        'JackEngineControl.cpp',
        'JackPosixThread.cpp',
60
61
62
63
64
65
66
67
68
69
        'JackShmMem.cpp',
        'shm.c',
        'JackSocket.cpp',
        'JackTime.c',
        'JackGlobals.cpp',
        'JackDebugClient.cpp',
        'JackTransportEngine.cpp',
        'timestamps.c',
        'JackTools.cpp',
        'JackMessageBuffer.cpp',
sletz's avatar
sletz committed
70
        'JackProcessSync.cpp',
71
        ]
nedko's avatar
nedko committed
72
73
74
75
76
77
78
    
    serverlib = bld.create_obj('cpp', 'shlib')
    serverlib.features.append('cc')
    serverlib.defines = 'HAVE_CONFIG_H'
    serverlib.includes = ['.', './jack', '..', '../linux']
    serverlib.name         = 'serverlib'
    serverlib.target       = 'jackserver'
nedko's avatar
nedko committed
79
    serverlib.uselib = ['RT', "PTHREAD"]
nedko's avatar
nedko committed
80
81
82
83
84
85
86
87
88
89
90
    serverlib.source = [] + common_libsources
    serverlib.source += [
        'JackAudioDriver.cpp',
        'JackDriver.cpp',
        'JackEngine.cpp',
        'JackExternalClient.cpp',
        'JackFreewheelDriver.cpp',
        'JackInternalClient.cpp',
        'JackLoopbackDriver.cpp',
        'JackServer.cpp',
        'JackThreadedDriver.cpp',
sletz's avatar
sletz committed
91
	'JackWaitThreadedDriver.cpp',
nedko's avatar
nedko committed
92
93
94
95
96
97
98
        'JackSocketServerChannel.cpp',
        'JackSocketNotifyChannel.cpp',
        'JackSocketServerNotifyChannel.cpp',
        'JackServerAPI.cpp',
        'JackDriverLoader.cpp',
        'JackServerGlobals.cpp',
        'JackControl.cpp',
sletz's avatar
sletz committed
99
	'JackNetTool.cpp',
nedko's avatar
nedko committed
100
        ]
nedko's avatar
nedko committed
101
    serverlib.vnum = bld.env()['JACK_API_VERSION']
102
    serverlib.env.append_value("CPPFLAGS", "-fvisibility=hidden")
nedko's avatar
nedko committed
103
104
105
106

    clientlib = bld.create_obj('cpp', 'shlib')
    clientlib.features.append('cc')
    clientlib.defines = 'HAVE_CONFIG_H'
nedko's avatar
nedko committed
107
    clientlib.uselib = ['RT', "PTHREAD"]
108
    if bld.env()['BUILD_JACKDBUS'] == True:
nedko's avatar
nedko committed
109
        clientlib.uselib.append('DBUS-1')
nedko's avatar
nedko committed
110
111
112
113
114
115
116
117
    clientlib.includes = ['.', './jack', '..', '../linux']
    clientlib.name         = 'clientlib'
    clientlib.target       = 'jack'
    clientlib.source = [] + common_libsources
    clientlib.source += [
        'JackLibClient.cpp',
        'JackLibAPI.cpp',
        'JackSocketClientChannel.cpp',
118
        'JackServerLaunch.cpp', 
nedko's avatar
nedko committed
119
        ]
nedko's avatar
nedko committed
120
    clientlib.vnum = bld.env()['JACK_API_VERSION']
121
    clientlib.env.append_value("CPPFLAGS", "-fvisibility=hidden")
122

123
124
125
126
127
128
129
130
131
    netmanagerlib = bld.create_obj('cpp', 'shlib')
    netmanagerlib.env['shlib_PATTERN'] = '%s.so'
    netmanagerlib.includes = ['./jack', '.']
    netmanagerlib.name     = 'netmanager'
    netmanagerlib.target   = 'netmanager'
    netmanagerlib.source   = 'JackNetManager.cpp'
    netmanagerlib.env.append_value("CPPFLAGS", "-fvisibility=hidden")
    netmanagerlib.inst_var = bld.env()['ADDON_DIR']
    netmanagerlib.inst_dir = '/'
sletz's avatar
sletz committed
132

nedko's avatar
nedko committed
133
    install_files('PREFIX', 'include/jack', 'jack/*.h')
nedko's avatar
nedko committed
134
135
136
137
138
139
140
141
142
143
144
145
146
147

    # process jack.pc.in -> jack.pc
    obj = bld.create_obj('subst')
    obj.source = '../jack.pc.in'
    obj.target = 'jack.pc'
    obj.dict = {'PREFIX': bld.env()['PREFIX'],
                'LIBDIR': os.path.normpath(bld.env()['PREFIX'] + '/lib'),
                'INCLUDEDIR': os.path.normpath(bld.env()['PREFIX'] + '/include'),
                'SERVERLIB': serverlib.target,
                'JACK_VERSION': bld.env()['JACK_VERSION'],
                }
    obj.inst_var = bld.env()['PREFIX']
    obj.inst_dir = '/lib/pkgconfig/'
    obj.fun = subst_func # @VAR@ -> ${VAR}