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

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

8
def configure(conf):
9
    conf.check_cc(header_name='samplerate.h', define_name="HAVE_SAMPLERATE")
10
11
12
13
14
15
   
    if conf.is_defined('HAVE_SAMPLERATE'):
        conf.env['LIB_SAMPLERATE'] = ['samplerate']

    conf.env['BUILD_ADAPTER'] = conf.is_defined('HAVE_SAMPLERATE')

sletz's avatar
sletz committed
16
def create_jack_process_obj(bld, target, sources, uselib = None):
17
    process = bld.new_task_gen('cxx', 'shlib')
sletz's avatar
sletz committed
18
    process.env['shlib_PATTERN'] = '%s.so'
19
    process.defines  = ['HAVE_CONFIG_H','SERVER_SIDE']
20
    if bld.env['IS_MACOSX']:
21
        env_includes = ['../macosx', '../posix', '../macosx/coreaudio']
22
    if bld.env['IS_LINUX']:
23
24
	env_includes = ['../linux', '../posix', '../linux/alsa']
    process.includes = ['.'] + env_includes + ['jack', '..']
sletz's avatar
sletz committed
25
26
27
28
    process.name     = target
    process.target   = target
    process.source   = sources
    process.env.append_value("CPPFLAGS", "-fvisibility=hidden")
29
    if bld.env['IS_MACOSX']:
sletz's avatar
sletz committed
30
31
32
        process.env.append_value("CPPFLAGS", "-mmacosx-version-min=10.4 -arch i386 -arch ppc")
        #process.env.append_value("LINKFLAGS", "-arch i386 -arch ppc")
        process.env.append_value("LINKFLAGS", "")
33
    process.install_path = '${ADDON_DIR}/'
sletz's avatar
sletz committed
34
    process.uselib_local = uselib.name
sletz's avatar
sletz committed
35
36
    return process

37
def build(bld):
nedko's avatar
nedko committed
38
    common_libsources = [
39
40
41
42
        'JackActivationCount.cpp',
        'JackAPI.cpp',
        'JackClient.cpp',
        'JackConnectionManager.cpp',
nedko's avatar
nedko committed
43
        'ringbuffer.c',
44
45
46
47
48
49
50
51
        'JackError.cpp',
        'JackFrameTimer.cpp',
        'JackGraphManager.cpp',
        'JackPort.cpp',
        'JackPortType.cpp',
        'JackAudioPort.cpp',
        'JackMidiPort.cpp',
        'JackMidiAPI.cpp',
nedko's avatar
nedko committed
52
        'JackEngineControl.cpp',
53
54
55
56
57
58
59
60
61
        'JackShmMem.cpp',
        'shm.c',
        'JackGlobals.cpp',
        'JackDebugClient.cpp',
        'JackTransportEngine.cpp',
        'timestamps.c',
        'JackTools.cpp',
        'JackMessageBuffer.cpp',
        ]
62
63
64
65

    includes = ['.', './jack', '..']
    uselib = ["PTHREAD"]

66
    if bld.env['IS_LINUX']:
67
        common_libsources += [
68
69
70
71
72
            '../posix/JackPosixThread.cpp',
            '../posix/JackPosixSemaphore.cpp',
            '../posix/JackFifo.cpp',
            '../posix/JackProcessSync.cpp',
            '../posix/JackSocket.cpp',
sletz's avatar
sletz committed
73
	    '../linux/JackLinuxTime.c',
74
            ]
75
        includes = ['../linux', '../posix'] + includes
76
        uselib.append('RT')
77
        uselib.append('DL')
78

79
    if bld.env['IS_MACOSX']:
80
        common_libsources += [
81
82
            '../posix/JackProcessSync.cpp',
            '../posix/JackPosixThread.cpp',
83
            '../macosx/JackMachThread.cpp',
84
            '../macosx/JackMachSemaphore.cpp',
85
            '../macosx/JackMachPort.cpp',
sletz's avatar
sletz committed
86
	    '../macosx/JackMachTime.c',
87
            ]
88
        includes = ['../macosx', '../macosx/RPC', '../posix'] + includes
89

90
    serverlib = bld.new_task_gen('cxx', 'shlib')
nedko's avatar
nedko committed
91
    serverlib.features.append('cc')
92
    serverlib.defines = ['HAVE_CONFIG_H','SERVER_SIDE']
93
    serverlib.includes = includes
nedko's avatar
nedko committed
94
95
    serverlib.name         = 'serverlib'
    serverlib.target       = 'jackserver'
96
    serverlib.uselib = uselib
97
    serverlib.install_path = '${LIBDIR}'
nedko's avatar
nedko committed
98
99
100
101
102
103
104
105
106
107
108
    serverlib.source = [] + common_libsources
    serverlib.source += [
        'JackAudioDriver.cpp',
        'JackDriver.cpp',
        'JackEngine.cpp',
        'JackExternalClient.cpp',
        'JackFreewheelDriver.cpp',
        'JackInternalClient.cpp',
        'JackLoopbackDriver.cpp',
        'JackServer.cpp',
        'JackThreadedDriver.cpp',
109
110
        'JackRestartThreadedDriver.cpp',
        'JackWaitThreadedDriver.cpp',
nedko's avatar
nedko committed
111
112
113
        'JackServerAPI.cpp',
        'JackDriverLoader.cpp',
        'JackServerGlobals.cpp',
sletz's avatar
sletz committed
114
        'JackControlAPI.cpp',
115
        'JackNetTool.cpp',
moret's avatar
moret committed
116
        'JackNetInterface.cpp',
nedko's avatar
nedko committed
117
        ]
118

119
    if bld.env['IS_LINUX']:
120
        serverlib.source += [
121
122
123
124
            '../posix/JackSocketServerChannel.cpp',
            '../posix/JackSocketNotifyChannel.cpp',
            '../posix/JackSocketServerNotifyChannel.cpp',
            '../posix/JackNetUnixSocket.cpp',
125
126
            ]

127
    if bld.env['IS_MACOSX']:
128
129
130
131
132
133
        serverlib.source += [
            '../macosx/JackMachServerChannel.cpp',
            '../macosx/JackMachNotifyChannel.cpp',
            '../macosx/JackMachServerNotifyChannel.cpp',
            '../macosx/JackMacEngineRPC.cpp',
            '../macosx/RPC/JackRPCClientUser.c',
134
            '../posix/JackNetUnixSocket.cpp',
135
136
            ]

137
    serverlib.vnum = bld.env['JACK_API_VERSION']
138
    serverlib.env.append_value("CPPFLAGS", "-fvisibility=hidden")
139
    if bld.env['IS_MACOSX']:
sletz's avatar
sletz committed
140
        serverlib.env.append_value("CPPFLAGS", "-mmacosx-version-min=10.4 -arch i386 -arch ppc")
sletz's avatar
sletz committed
141
142
        #serverlib.env.append_value("LINKFLAGS", "-framework CoreAudio -framework vecLib -single_module -arch i386 -arch ppc")
        serverlib.env.append_value("LINKFLAGS", "-framework CoreAudio -framework vecLib -single_module")
sletz's avatar
sletz committed
143
	serverlib.env.append_value("LINKFLAGS", "-compatibility_version 1 -current_version 1")
nedko's avatar
nedko committed
144

145
    clientlib = bld.new_task_gen('cxx', 'shlib')
nedko's avatar
nedko committed
146
147
    clientlib.features.append('cc')
    clientlib.defines = 'HAVE_CONFIG_H'
148
    clientlib.uselib = uselib
149
    clientlib.install_path = '${LIBDIR}'
150
    if bld.env['BUILD_JACKDBUS'] == True:
nedko's avatar
nedko committed
151
        clientlib.uselib.append('DBUS-1')
152
    clientlib.includes = includes
nedko's avatar
nedko committed
153
154
155
156
157
158
159
    clientlib.name         = 'clientlib'
    clientlib.target       = 'jack'
    clientlib.source = [] + common_libsources
    clientlib.source += [
        'JackLibClient.cpp',
        'JackLibAPI.cpp',
        ]
160

161
    if bld.env['IS_LINUX']:
162
        clientlib.source += [
163
            '../posix/JackSocketClientChannel.cpp',
sletz's avatar
sletz committed
164
            '../posix/JackPosixServerLaunch.cpp',
165
166
            ]

167
    if bld.env['IS_MACOSX']:
168
169
170
171
        clientlib.source += [
            '../macosx/JackMachClientChannel.cpp',
            '../macosx/RPC/JackRPCEngineUser.c',
            '../macosx/JackMacLibClientRPC.cpp',
sletz's avatar
sletz committed
172
            '../posix/JackPosixServerLaunch.cpp',
173
174
            ]

175
    clientlib.vnum = bld.env['JACK_API_VERSION']
176
    clientlib.env.append_value("CPPFLAGS", "-fvisibility=hidden")
177
    if bld.env['IS_MACOSX']:
sletz's avatar
sletz committed
178
        clientlib.env.append_value("CPPFLAGS", "-mmacosx-version-min=10.4 -arch i386 -arch ppc")
sletz's avatar
sletz committed
179
180
        #clientlib.env.append_value("LINKFLAGS", "-framework CoreAudio -framework vecLib -single_module -arch i386 -arch ppc")
	clientlib.env.append_value("LINKFLAGS", "-framework CoreAudio -framework vecLib -single_module")
sletz's avatar
sletz committed
181
        clientlib.env.append_value("LINKFLAGS", "-compatibility_version 1 -current_version 1")
182

sletz's avatar
sletz committed
183
184
    create_jack_process_obj(bld, 'netmanager', 'JackNetManager.cpp', serverlib)

185
    net_adapter_sources = [
sletz's avatar
sletz committed
186
187
        'JackResampler.cpp',
        'JackLibSampleRateResampler.cpp',
188
        'JackAudioAdapter.cpp',
189
190
191
192
        'JackAudioAdapterInterface.cpp',
        'JackNetAdapter.cpp',
        ]

193
    if bld.env['BUILD_ADAPTER'] == True:
194
195
        process = create_jack_process_obj(bld, 'netadapter', net_adapter_sources, serverlib)
        process.uselib = 'SAMPLERATE'
196
197
198
199

    audio_adapter_sources = [
        'JackResampler.cpp',
        'JackLibSampleRateResampler.cpp',
200
        'JackAudioAdapter.cpp',
sletz's avatar
sletz committed
201
        'JackAudioAdapterInterface.cpp',
202
        'JackAudioAdapterFactory.cpp',
sletz's avatar
sletz committed
203
        ]
sletz's avatar
sletz committed
204

205
    if bld.env['BUILD_ADAPTER'] and bld.env['IS_MACOSX']:
206
         audio_adapter_sources += ['../macosx/coreaudio/JackCoreAudioAdapter.cpp']
207
         process = create_jack_process_obj(bld, 'audioadapter', audio_adapter_sources, serverlib)
208
209
         process.env.append_value("LINKFLAGS", "-framework CoreAudio -framework AudioUnit -framework AudioToolbox -framework CoreServices")
         process.uselib = 'SAMPLERATE'
moret's avatar
moret committed
210

211
    if bld.env['BUILD_ADAPTER'] and bld.env['IS_LINUX']:
212
213
         audio_adapter_sources += ['../linux/alsa/JackAlsaAdapter.cpp']
         process = create_jack_process_obj(bld, 'audioadapter', audio_adapter_sources, serverlib)
214
         process.uselib = ['ALSA', 'SAMPLERATE']
moret's avatar
moret committed
215

216
217
    #audio_adapter_sources += ['../windows/JackPortAudioAdapter.cpp']
    #process = create_jack_process_obj(bld, 'audioadapter', audio_adapter_sources, serverlib)
moret's avatar
moret committed
218

219
    bld.install_files('${PREFIX}/include/jack', 'jack/*.h')
nedko's avatar
nedko committed
220
221

    # process jack.pc.in -> jack.pc
222
223
    import misc
    obj = bld.new_task_gen('subst')
nedko's avatar
nedko committed
224
225
    obj.source = '../jack.pc.in'
    obj.target = 'jack.pc'
226
    obj.dict = {'PREFIX': bld.env['PREFIX'],
227
                'LIBDIR': bld.env['LIBDIR'],
228
                'INCLUDEDIR': os.path.normpath(bld.env['PREFIX'] + '/include'),
nedko's avatar
nedko committed
229
                'SERVERLIB': serverlib.target,
230
                'JACK_VERSION': bld.env['JACK_VERSION'],
nedko's avatar
nedko committed
231
                }
232
    obj.install_path = '${LIBDIR}/pkgconfig/'
233
    obj.fun = misc.subst_func