wscript 14.9 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
def configure(conf):
8
9
    conf.env['BUILD_NETLIB'] = conf.env['SAMPLERATE']
    conf.env['BUILD_ADAPTER'] = conf.env['SAMPLERATE']
10

11
    if conf.env['IS_WINDOWS']:
12
13
14
15
        try:
            conf.check_cc(function_name='regcomp', header_name='regex.h', lib='regex', uselib_store="REGEX", define_name='HAVE_REGEX_H')
        except:
            conf.check_cc(function_name='regcomp', header_name='regex.h', lib='tre', uselib_store="REGEX", define_name='HAVE_REGEX_H')
16
17
18
19
        conf.check_cc(function_name='htons', header_name='winsock2.h', lib='ws2_32', uselib_store="WS2_32", define_name='HAVE_WINSOCK2_H')
        conf.check_cc(function_name='timeGetDevCaps', header_name=['windows.h', 'mmsystem.h'], lib='winmm', uselib_store="WINMM", define_name='HAVE_MMSYSTEM_H')
        conf.check_cc(function_name='EnumProcesses', header_name=['windows.h', 'psapi.h'], lib='psapi', uselib_store="PSAPI", define_name='HAVE_PSAPI_H')

sletz's avatar
sletz committed
20
def create_jack_process_obj(bld, target, sources, uselib = None):
21
    process = bld(features = ['cxx', 'cxxshlib'])
22
23
    if not bld.env['IS_WINDOWS']:
        process.env['cxxshlib_PATTERN'] = '%s.so'
24
    process.defines  = ['HAVE_CONFIG_H','SERVER_SIDE']
25
    if bld.env['IS_MACOSX']:
26
        env_includes = ['../macosx', '../posix', '../macosx/coreaudio']
27
    if bld.env['IS_LINUX']:
28
        env_includes = ['../linux', '../posix', '../linux/alsa']
sletz's avatar
sletz committed
29
30
    if bld.env['IS_SUN']:
        env_includes = ['../solaris', '../posix', '../solaris/oss']
31
32
    if bld.env['IS_WINDOWS']:
        env_includes = ['../windows', '../windows/portaudio']
33
    process.includes = ['.'] + env_includes + ['jack', '..']
sletz's avatar
sletz committed
34
35
36
    process.name     = target
    process.target   = target
    process.source   = sources
sletz's avatar
sletz committed
37
38
    if bld.env['IS_LINUX']:
        process.env.append_value("CPPFLAGS", "-fvisibility=hidden")
39
    if bld.env['IS_MACOSX']:
sletz's avatar
sletz committed
40
        process.env.append_value("CPPFLAGS", "-fvisibility=hidden")
41
    process.install_path = '${ADDON_DIR}/'
42
    process.use = [uselib.name]
sletz's avatar
sletz committed
43
44
    return process

45
def build(bld):
nedko's avatar
nedko committed
46
    common_libsources = [
47
48
49
50
        'JackActivationCount.cpp',
        'JackAPI.cpp',
        'JackClient.cpp',
        'JackConnectionManager.cpp',
nedko's avatar
nedko committed
51
        'ringbuffer.c',
52
        'JackError.cpp',
53
        'JackException.cpp',
54
55
56
57
58
59
60
        'JackFrameTimer.cpp',
        'JackGraphManager.cpp',
        'JackPort.cpp',
        'JackPortType.cpp',
        'JackAudioPort.cpp',
        'JackMidiPort.cpp',
        'JackMidiAPI.cpp',
nedko's avatar
nedko committed
61
        'JackEngineControl.cpp',
62
        'JackShmMem.cpp',
63
        'JackGenericClientChannel.cpp',
64
65
66
67
68
        'shm.c',
        'JackGlobals.cpp',
        'JackTransportEngine.cpp',
        'JackTools.cpp',
        'JackMessageBuffer.cpp',
sletz's avatar
sletz committed
69
        'JackEngineProfiling.cpp',
70
        ]
71

72
73
74
75
76
    includes = ['.', './jack']
    if not bld.variant:
        includes.append('..')
    else:
        includes.append('../..')
Robin Gareus's avatar
Robin Gareus committed
77
    uselib = ["PTHREAD", "CELT", "OPUS"]
78

79
    if bld.env['IS_LINUX']:
80
        common_libsources += [
81
82
            'JackDebugClient.cpp',
            'timestamps.c',
83
84
            '../posix/JackPosixThread.cpp',
            '../posix/JackPosixSemaphore.cpp',
85
            '../posix/JackPosixProcessSync.cpp',
86
            '../posix/JackPosixMutex.cpp',
87
            '../posix/JackSocket.cpp',
sletz's avatar
sletz committed
88
            '../linux/JackLinuxTime.c',
89
            ]
90
        includes = ['../linux', '../posix'] + includes
91
        uselib.append('RT')
92
        uselib.append('DL')
93

sletz's avatar
sletz committed
94
95
    if bld.env['IS_SUN']:
        common_libsources += [
96
97
            'JackDebugClient.cpp',
            'timestamps.c',
sletz's avatar
sletz committed
98
99
           '../posix/JackPosixThread.cpp',
           '../posix/JackFifo.cpp',
100
           '../posix/JackPosixProcessSync.cpp',
sletz's avatar
sletz committed
101
           '../posix/JackPosixMutex.cpp',
sletz's avatar
sletz committed
102
103
104
105
106
107
           '../posix/JackSocket.cpp',
           '../solaris/JackSolarisTime.c',
           ]
        includes = ['../solaris', '../posix'] + includes
        uselib.append('RT')

108
    if bld.env['IS_MACOSX']:
109
        common_libsources += [
110
111
            'JackDebugClient.cpp',
            'timestamps.c',
112
            '../posix/JackPosixProcessSync.cpp',
113
            '../posix/JackPosixThread.cpp',
114
115
116
            '../posix/JackPosixMutex.cpp',
            '../macosx/JackMachThread.mm',
            '../macosx/JackMachSemaphore.mm',
sletz's avatar
sletz committed
117
            '../posix/JackSocket.cpp',
sletz's avatar
sletz committed
118
            '../macosx/JackMachTime.c',
119
            ]
120
        includes = ['../macosx', '../macosx/RPC', '../posix'] + includes
121

122
123
124
125
126
127
128
129
130
131
132
133
134
135
    if bld.env['IS_WINDOWS']:
        common_libsources += [
            '../windows/JackWinMutex.cpp',
            '../windows/JackWinProcessSync.cpp',
            '../windows/JackWinSemaphore.cpp',
            '../windows/JackWinThread.cpp',
            '../windows/JackWinTime.c',
            ]
        includes = ['../windows' ] + includes
        uselib.append('REGEX')
        uselib.append('WS2_32')
        uselib.append('PSAPI')
        uselib.append('WINMM')

136
137
138
139
    if bld.env['IS_MACOSX']:
        clientlib = bld(features = ['c', 'cxx', 'cxxshlib', 'cshlib'], framework = ['CoreAudio', 'Accelerate'])
    else:
        clientlib = bld(features = ['c', 'cxx', 'cxxshlib', 'cshlib'])
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
    clientlib.defines = 'HAVE_CONFIG_H'
    clientlib.use = uselib
    if bld.env['IS_WINDOWS']:
         clientlib.install_path = '${BINDIR}'
    else:
         clientlib.install_path = '${LIBDIR}'
    if bld.env['AUTOSTART_METHOD'] == "dbus":
        clientlib.use.append('DBUS-1')
    clientlib.includes = includes
    clientlib.name         = 'clientlib'
    clientlib.target       = 'jack'
    clientlib.source = [] + common_libsources
    clientlib.source += [
        'JackLibClient.cpp',
        'JackLibAPI.cpp',
        ]

    if bld.env['IS_LINUX']:
        clientlib.source += [
            '../posix/JackSocketClientChannel.cpp',
            '../posix/JackPosixServerLaunch.cpp',
            ]

    if bld.env['IS_SUN']:
        clientlib.source += [
            '../posix/JackSocketClientChannel.cpp',
            '../posix/JackPosixServerLaunch.cpp',
            ]

    if bld.env['IS_MACOSX']:
        clientlib.source += [
            '../posix/JackSocketClientChannel.cpp',
            '../posix/JackPosixServerLaunch.cpp',
            ]

    if bld.env['IS_WINDOWS']:
        clientlib.source += [
            '../windows/JackWinNamedPipe.cpp',
            '../windows/JackWinNamedPipeClientChannel.cpp',
            '../windows/JackWinServerLaunch.cpp',
            '../windows/JackMMCSS.cpp',
            ]

    clientlib.vnum = bld.env['JACK_API_VERSION']

    if bld.env['IS_LINUX']:
        clientlib.env.append_value("CPPFLAGS", "-fvisibility=hidden")

    if bld.env['IS_MACOSX']:
        clientlib.env.append_value("CPPFLAGS", "-fvisibility=hidden")
190
        clientlib.env.append_value("LINKFLAGS", "-single_module")
191
192
193
194
195
196
197
198
199

    if bld.env['IS_SUN']:
        clientlib.env.append_value("LINKFLAGS", "-lnsl -lsocket")

    if bld.variant:
        # if there is variant defined, we expect it to be the 32bit client lib one
        # we don't want to build other stuff in this variant
        return

200
201
202
203
    if bld.env['IS_MACOSX']:
        serverlib = bld(features = ['c', 'cxx', 'cxxshlib', 'cshlib'], framework = ['CoreAudio', 'CoreFoundation', 'Accelerate'])
    else:
        serverlib = bld(features = ['c', 'cxx', 'cxxshlib', 'cshlib'])
204
    serverlib.defines = ['HAVE_CONFIG_H','SERVER_SIDE']
205
    serverlib.includes = includes
nedko's avatar
nedko committed
206
207
    serverlib.name         = 'serverlib'
    serverlib.target       = 'jackserver'
208
    serverlib.use = uselib
209
210
211
212
    if bld.env['IS_WINDOWS']:
         serverlib.install_path = '${BINDIR}'
    else:
         serverlib.install_path = '${LIBDIR}'
nedko's avatar
nedko committed
213
214
215
    serverlib.source = [] + common_libsources
    serverlib.source += [
        'JackAudioDriver.cpp',
216
        'JackTimedDriver.cpp',
sletz's avatar
sletz committed
217
        'JackMidiDriver.cpp',
nedko's avatar
nedko committed
218
219
220
221
222
223
224
        'JackDriver.cpp',
        'JackEngine.cpp',
        'JackExternalClient.cpp',
        'JackFreewheelDriver.cpp',
        'JackInternalClient.cpp',
        'JackServer.cpp',
        'JackThreadedDriver.cpp',
225
226
        'JackRestartThreadedDriver.cpp',
        'JackWaitThreadedDriver.cpp',
Cédric Schieli's avatar
Cédric Schieli committed
227
        'JackWaitCallbackDriver.cpp',
nedko's avatar
nedko committed
228
229
230
        'JackServerAPI.cpp',
        'JackDriverLoader.cpp',
        'JackServerGlobals.cpp',
sletz's avatar
sletz committed
231
        'JackControlAPI.cpp',
232
        'JackNetTool.cpp',
moret's avatar
moret committed
233
        'JackNetInterface.cpp',
234
        'JackArgParser.cpp',
235
        'JackRequestDecoder.cpp',
sletz's avatar
sletz committed
236
237
238
239
240
241
242
243
244
245
246
        'JackMidiAsyncQueue.cpp',
        'JackMidiAsyncWaitQueue.cpp',
        'JackMidiBufferReadQueue.cpp',
        'JackMidiBufferWriteQueue.cpp',
        'JackMidiRawInputWriteQueue.cpp',
        'JackMidiRawOutputWriteQueue.cpp',
        'JackMidiReadQueue.cpp',
        'JackMidiReceiveQueue.cpp',
        'JackMidiSendQueue.cpp',
        'JackMidiUtil.cpp',
        'JackMidiWriteQueue.cpp'
nedko's avatar
nedko committed
247
        ]
248

249
    if bld.env['IS_LINUX']:
250
        serverlib.source += [
251
252
253
254
            '../posix/JackSocketServerChannel.cpp',
            '../posix/JackSocketNotifyChannel.cpp',
            '../posix/JackSocketServerNotifyChannel.cpp',
            '../posix/JackNetUnixSocket.cpp',
255
256
            ]

sletz's avatar
sletz committed
257
258
259
260
261
262
263
264
    if bld.env['IS_SUN']:
        serverlib.source += [
            '../posix/JackSocketServerChannel.cpp',
            '../posix/JackSocketNotifyChannel.cpp',
            '../posix/JackSocketServerNotifyChannel.cpp',
            '../posix/JackNetUnixSocket.cpp',
            ]

265
    if bld.env['IS_MACOSX']:
266
        serverlib.source += [
sletz's avatar
sletz committed
267
268
269
            '../posix/JackSocketServerChannel.cpp',
            '../posix/JackSocketNotifyChannel.cpp',
            '../posix/JackSocketServerNotifyChannel.cpp',
270
            '../posix/JackNetUnixSocket.cpp',
271
272
            ]

273
274
275
276
277
278
279
280
281
282
    if bld.env['IS_WINDOWS']:
        serverlib.source += [
            '../windows/JackMMCSS.cpp',
            '../windows/JackWinNamedPipe.cpp',
            '../windows/JackWinNamedPipeServerChannel.cpp',
            '../windows/JackWinNamedPipeServerNotifyChannel.cpp',
            '../windows/JackWinNamedPipeNotifyChannel.cpp',
            '../windows/JackNetWinSocket.cpp',
            ]

283
    serverlib.vnum = bld.env['JACK_API_VERSION']
sletz's avatar
sletz committed
284
285
286
287

    if bld.env['IS_LINUX']:
        serverlib.env.append_value("CPPFLAGS", "-fvisibility=hidden")

288
    if bld.env['IS_MACOSX']:
sletz's avatar
sletz committed
289
        serverlib.env.append_value("CPPFLAGS", "-fvisibility=hidden")
290
        serverlib.env.append_value("LINKFLAGS", "-single_module")
sletz's avatar
sletz committed
291
292
293

    if bld.env['IS_SUN']:
        serverlib.env.append_value("LINKFLAGS", "-lnsl -lsocket")
nedko's avatar
nedko committed
294

295
    if bld.env['BUILD_NETLIB'] == True:
296
297
298
299
        if bld.env['IS_MACOSX']:
            netlib = bld(features = ['c', 'cxx', 'cxxshlib', 'cshlib'], framework =  ['CoreAudio'])
        else:
            netlib = bld(features = ['c', 'cxx', 'cxxshlib', 'cshlib'])
300
301
302
303
        netlib.defines = ['HAVE_CONFIG_H','SERVER_SIDE']
        netlib.includes = includes
        netlib.name         = 'netlib'
        netlib.target       = 'jacknet'
304
305
306
307
        netlib.use = ['SAMPLERATE', 'CELT', 'OPUS', 'PTHREAD']
        if bld.env['IS_WINDOWS']:
             netlib.install_path = '${BINDIR}'
             netlib.use += ['WS2_32', 'WINMM']
308
309
        elif bld.env['IS_MACOSX']:
             netlib.install_path = '${LIBDIR}'
310
311
312
        else:
             netlib.use += ['RT']
             netlib.install_path = '${LIBDIR}'
313
314
315
316
        netlib.source = [
            'JackNetAPI.cpp',
            'JackNetInterface.cpp',
            'JackNetTool.cpp',
317
            'JackException.cpp',
318
319
320
321
322
323
324
            'JackAudioAdapterInterface.cpp',
            'JackLibSampleRateResampler.cpp',
            'JackResampler.cpp',
            'JackGlobals.cpp',
            'ringbuffer.c']

        if bld.env['IS_LINUX']:
325
            netlib.source += ['../posix/JackNetUnixSocket.cpp','../posix/JackPosixThread.cpp', '../posix/JackPosixMutex.cpp', '../linux/JackLinuxTime.c']
326
327
328
            netlib.env.append_value("CPPFLAGS", "-fvisibility=hidden")

        if bld.env['IS_SUN']:
329
            netlib.source += ['../posix/JackNetUnixSocket.cpp','../posix/JackPosixThread.cpp', '../posix/JackPosixMutex.cpp', '../solaris/JackSolarisTime.c']
330
            netlib.env.append_value("CPPFLAGS", "-fvisibility=hidden")
331
332
       

333
        if bld.env['IS_MACOSX']:
334
335
            netlib.source += ['../posix/JackNetUnixSocket.cpp','../posix/JackPosixThread.cpp', '../posix/JackPosixMutex.cpp', '../macosx/JackMachThread.mm', '../macosx/JackMachTime.c']
            netlib.env.append_value("LINKFLAGS", "-single_module")
336

337
338
339
        if bld.env['IS_WINDOWS']:
            netlib.source += ['../windows/JackNetWinSocket.cpp','../windows/JackWinThread.cpp', '../windows/JackMMCSS.cpp', '../windows/JackWinTime.c']

340
        netlib.vnum = bld.env['JACK_API_VERSION']
341

sletz's avatar
sletz committed
342
343
    create_jack_process_obj(bld, 'netmanager', 'JackNetManager.cpp', serverlib)

sletz's avatar
sletz committed
344
345
    create_jack_process_obj(bld, 'profiler', 'JackProfiler.cpp', serverlib)

346
    net_adapter_sources = [
sletz's avatar
sletz committed
347
348
        'JackResampler.cpp',
        'JackLibSampleRateResampler.cpp',
349
        'JackAudioAdapter.cpp',
350
351
352
353
        'JackAudioAdapterInterface.cpp',
        'JackNetAdapter.cpp',
        ]

354
    if bld.env['BUILD_ADAPTER'] == True:
355
        process = create_jack_process_obj(bld, 'netadapter', net_adapter_sources, serverlib)
356
        process.use += ['SAMPLERATE']
357
358
359
360

    audio_adapter_sources = [
        'JackResampler.cpp',
        'JackLibSampleRateResampler.cpp',
361
        'JackAudioAdapter.cpp',
sletz's avatar
sletz committed
362
        'JackAudioAdapterInterface.cpp',
363
        'JackAudioAdapterFactory.cpp',
sletz's avatar
sletz committed
364
         ]
sletz's avatar
sletz committed
365

366
367
368
369
370
371
372
373
374
375
376
377
378
    if bld.env['BUILD_ADAPTER'] and bld.env['IS_MACOSX'] and False:
         audio_adapter_sources += ['../macosx/coreaudio/JackCoreAudioAdapter.mm']
         process = create_jack_process_obj(bld,
              'audioadapter',
              audio_adapter_sources,
              serverlib,
              framework = [
                      "CoreAudio",
                      "AudioUnit",
                      "AudioToolbox",
                      "CoreServices"
              ]
         )
379
         process.use = 'SAMPLERATE'
moret's avatar
moret committed
380

sletz's avatar
sletz committed
381
    if bld.env['BUILD_ADAPTER'] and bld.env['IS_LINUX'] and bld.env['BUILD_DRIVER_ALSA']:
382
383
         audio_adapter_sources += ['../linux/alsa/JackAlsaAdapter.cpp']
         process = create_jack_process_obj(bld, 'audioadapter', audio_adapter_sources, serverlib)
384
         process.use = ['ALSA', 'SAMPLERATE']
moret's avatar
moret committed
385

sletz's avatar
sletz committed
386
387
388
    if bld.env['BUILD_ADAPTER'] and bld.env['IS_SUN']:
         audio_adapter_sources += ['../solaris/oss/JackOSSAdapter.cpp', 'memops.c']
         process = create_jack_process_obj(bld, 'audioadapter', audio_adapter_sources, serverlib)
389
         process.use = 'SAMPLERATE'
sletz's avatar
sletz committed
390

391
392
393
394
395
    if bld.env['BUILD_ADAPTER'] and bld.env['IS_WINDOWS']:
         audio_adapter_sources += ['../windows/portaudio/JackPortAudioAdapter.cpp', '../windows/portaudio/JackPortAudioDevices.cpp']
         process = create_jack_process_obj(bld, 'audioadapter', audio_adapter_sources, serverlib)
         process.use += ['SAMPLERATE', 'PORTAUDIO']

moret's avatar
moret committed
396

Adrian Knoth's avatar
Adrian Knoth committed
397
    bld.install_files('${PREFIX}/include/jack', bld.path.ant_glob('jack/*.h'))
nedko's avatar
nedko committed
398
399

    # process jack.pc.in -> jack.pc
400
401
402
403
404
405
406
407
    obj = bld(
        features = 'subst_pc',
        source = '../jack.pc.in',
        target = 'jack.pc',
        install_path = '${LIBDIR}/pkgconfig/',
        INCLUDEDIR = os.path.normpath(bld.env['PREFIX'] + '/include'),
        SERVERLIB = serverlib.target,
        )