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

nedko's avatar
nedko committed
4
5
6
7
8
9
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
import re
import os

# 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

38
def build(bld):
nedko's avatar
nedko committed
39
    common_libsources = [
40
41
42
43
        'JackActivationCount.cpp',
        'JackAPI.cpp',
        'JackClient.cpp',
        'JackConnectionManager.cpp',
nedko's avatar
nedko committed
44
        'ringbuffer.c',
45
46
47
48
49
50
51
52
53
54
        '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
55
56
        'JackEngineControl.cpp',
        'JackPosixThread.cpp',
57
58
59
60
61
62
63
64
65
66
        '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
67
        'JackProcessSync.cpp',
68
        ]
nedko's avatar
nedko committed
69
70
71
72
73
74
75
    
    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
76
    serverlib.uselib = ['RT', "PTHREAD"]
nedko's avatar
nedko committed
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
    serverlib.source = [] + common_libsources
    serverlib.source += [
        'JackAudioDriver.cpp',
        'JackDriver.cpp',
        'JackEngine.cpp',
        'JackExternalClient.cpp',
        'JackFreewheelDriver.cpp',
        'JackInternalClient.cpp',
        'JackLoopbackDriver.cpp',
        'JackServer.cpp',
        'JackThreadedDriver.cpp',
        'JackSocketServerChannel.cpp',
        'JackSocketNotifyChannel.cpp',
        'JackSocketServerNotifyChannel.cpp',
        'JackServerAPI.cpp',
        'JackDriverLoader.cpp',
        'JackServerGlobals.cpp',
        'JackControl.cpp',
sletz's avatar
sletz committed
95
	'JackNetTool.cpp',
nedko's avatar
nedko committed
96
        ]
nedko's avatar
nedko committed
97
    serverlib.vnum = bld.env()['JACK_API_VERSION']
nedko's avatar
nedko committed
98
99
100
101

    clientlib = bld.create_obj('cpp', 'shlib')
    clientlib.features.append('cc')
    clientlib.defines = 'HAVE_CONFIG_H'
nedko's avatar
nedko committed
102
    clientlib.uselib = ['RT', "PTHREAD"]
103
    if bld.env()['BUILD_JACKDBUS'] == True:
nedko's avatar
nedko committed
104
        clientlib.uselib.append('DBUS-1')
nedko's avatar
nedko committed
105
106
107
108
109
110
111
112
    clientlib.includes = ['.', './jack', '..', '../linux']
    clientlib.name         = 'clientlib'
    clientlib.target       = 'jack'
    clientlib.source = [] + common_libsources
    clientlib.source += [
        'JackLibClient.cpp',
        'JackLibAPI.cpp',
        'JackSocketClientChannel.cpp',
113
        'JackServerLaunch.cpp', 
nedko's avatar
nedko committed
114
        ]
nedko's avatar
nedko committed
115
    clientlib.vnum = bld.env()['JACK_API_VERSION']
116

sletz's avatar
sletz committed
117
118
119
120
121
122
123
    netmanager_lib = bld.create_obj('cpp', 'shlib')
    netmanager_lib.env['shlib_PATTERN'] = '%s.so'
    netmanager_lib.includes = ['./jack', '.']
    netmanager_lib.name     = 'netmanager'
    netmanager_lib.target   = 'netmanager'
    netmanager_lib.source   = 'JackNetManager.cpp'

nedko's avatar
nedko committed
124
    install_files('PREFIX', 'include/jack', 'jack/*.h')
nedko's avatar
nedko committed
125
126
127
128
129
130
131
132
133
134
135
136
137
138

    # 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}