wscript 15 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
   
    if conf.is_defined('HAVE_SAMPLERATE'):
        conf.env['LIB_SAMPLERATE'] = ['samplerate']

14
    conf.env['BUILD_NETLIB'] = conf.is_defined('HAVE_SAMPLERATE')
15
16
    conf.env['BUILD_ADAPTER'] = conf.is_defined('HAVE_SAMPLERATE')

17
18
19
20
21
22
    if conf.env['IS_WINDOWS']:
        conf.check_cc(function_name='regcomp', header_name='regex.h', lib='regex', uselib_store="REGEX", define_name='HAVE_REGEX_H')
        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
23
def create_jack_process_obj(bld, target, sources, uselib = None):
24
    process = bld(features = ['cxx', 'cxxshlib'])
25
26
    if not bld.env['IS_WINDOWS']:
        process.env['cxxshlib_PATTERN'] = '%s.so'
27
    process.defines  = ['HAVE_CONFIG_H','SERVER_SIDE']
28
    if bld.env['IS_MACOSX']:
29
        env_includes = ['../macosx', '../posix', '../macosx/coreaudio']
30
    if bld.env['IS_LINUX']:
31
        env_includes = ['../linux', '../posix', '../linux/alsa']
sletz's avatar
sletz committed
32
33
    if bld.env['IS_SUN']:
        env_includes = ['../solaris', '../posix', '../solaris/oss']
34
35
    if bld.env['IS_WINDOWS']:
        env_includes = ['../windows', '../windows/portaudio']
36
    process.includes = ['.'] + env_includes + ['jack', '..']
sletz's avatar
sletz committed
37
38
39
    process.name     = target
    process.target   = target
    process.source   = sources
sletz's avatar
sletz committed
40
41
    if bld.env['IS_LINUX']:
        process.env.append_value("CPPFLAGS", "-fvisibility=hidden")
42
    if bld.env['IS_MACOSX']:
43
44
        process.env.append_value("CPPFLAGS", "-mmacosx-version-min=10.4 -arch i386 -arch ppc -arch x86_64")
        #process.env.append_value("LINKFLAGS", "-arch i386 -arch ppc -arch x86_64")
sletz's avatar
sletz committed
45
        process.env.append_value("CPPFLAGS", "-fvisibility=hidden")
46
    process.install_path = '${ADDON_DIR}/'
47
    process.use = [uselib.name]
sletz's avatar
sletz committed
48
49
    return process

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

    includes = ['.', './jack', '..']
Robin Gareus's avatar
Robin Gareus committed
78
    uselib = ["PTHREAD", "CELT", "OPUS"]
79

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

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

109
    if bld.env['IS_MACOSX']:
110
        common_libsources += [
111
112
            'JackDebugClient.cpp',
            'timestamps.c',
113
            '../posix/JackPosixProcessSync.cpp',
114
            '../posix/JackPosixThread.cpp',
115
            '../macosx/JackMachThread.cpp',
116
            '../macosx/JackMachSemaphore.cpp',
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
    serverlib = bld(features = ['c', 'cxx', 'cxxshlib', 'cshlib'])
137
    serverlib.defines = ['HAVE_CONFIG_H','SERVER_SIDE']
138
    serverlib.includes = includes
nedko's avatar
nedko committed
139
140
    serverlib.name         = 'serverlib'
    serverlib.target       = 'jackserver'
141
    serverlib.use = uselib
142
143
144
145
    if bld.env['IS_WINDOWS']:
         serverlib.install_path = '${BINDIR}'
    else:
         serverlib.install_path = '${LIBDIR}'
nedko's avatar
nedko committed
146
147
148
    serverlib.source = [] + common_libsources
    serverlib.source += [
        'JackAudioDriver.cpp',
149
        'JackTimedDriver.cpp',
sletz's avatar
sletz committed
150
        'JackMidiDriver.cpp',
nedko's avatar
nedko committed
151
152
153
154
155
156
157
        'JackDriver.cpp',
        'JackEngine.cpp',
        'JackExternalClient.cpp',
        'JackFreewheelDriver.cpp',
        'JackInternalClient.cpp',
        'JackServer.cpp',
        'JackThreadedDriver.cpp',
158
159
        'JackRestartThreadedDriver.cpp',
        'JackWaitThreadedDriver.cpp',
nedko's avatar
nedko committed
160
161
162
        'JackServerAPI.cpp',
        'JackDriverLoader.cpp',
        'JackServerGlobals.cpp',
sletz's avatar
sletz committed
163
        'JackControlAPI.cpp',
164
        'JackNetTool.cpp',
moret's avatar
moret committed
165
        'JackNetInterface.cpp',
166
        'JackArgParser.cpp',
167
        'JackRequestDecoder.cpp',
sletz's avatar
sletz committed
168
169
170
171
172
173
174
175
176
177
178
        '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
179
        ]
180

181
    if bld.env['IS_LINUX']:
182
        serverlib.source += [
183
184
185
186
            '../posix/JackSocketServerChannel.cpp',
            '../posix/JackSocketNotifyChannel.cpp',
            '../posix/JackSocketServerNotifyChannel.cpp',
            '../posix/JackNetUnixSocket.cpp',
187
188
            ]

sletz's avatar
sletz committed
189
190
191
192
193
194
195
196
    if bld.env['IS_SUN']:
        serverlib.source += [
            '../posix/JackSocketServerChannel.cpp',
            '../posix/JackSocketNotifyChannel.cpp',
            '../posix/JackSocketServerNotifyChannel.cpp',
            '../posix/JackNetUnixSocket.cpp',
            ]

197
    if bld.env['IS_MACOSX']:
198
        serverlib.source += [
sletz's avatar
sletz committed
199
200
201
            '../posix/JackSocketServerChannel.cpp',
            '../posix/JackSocketNotifyChannel.cpp',
            '../posix/JackSocketServerNotifyChannel.cpp',
202
            '../posix/JackNetUnixSocket.cpp',
203
204
            ]

205
206
207
208
209
210
211
212
213
214
    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',
            ]

215
    serverlib.vnum = bld.env['JACK_API_VERSION']
sletz's avatar
sletz committed
216
217
218
219

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

220
    if bld.env['IS_MACOSX']:
sletz's avatar
sletz committed
221
        serverlib.env.append_value("CPPFLAGS", "-fvisibility=hidden")
222
223
        serverlib.env.append_value("CPPFLAGS", "-mmacosx-version-min=10.4 -arch i386 -arch ppc -arch x86_64")
        #serverlib.env.append_value("LINKFLAGS", "-framework CoreAudio -framework vecLib -single_module -arch i386 -arch ppc -arch x86_64")
sletz's avatar
sletz committed
224
        serverlib.env.append_value("LINKFLAGS", "-framework CoreAudio -framework CoreFoundation -framework vecLib -single_module")
sletz's avatar
sletz committed
225
226
227
228
        serverlib.env.append_value("LINKFLAGS", "-compatibility_version 1 -current_version 1")

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

230
    if bld.env['BUILD_NETLIB'] == True:
231
        netlib = bld(features = ['c', 'cxx', 'cxxshlib', 'cshlib'])
232
233
234
235
        netlib.defines = ['HAVE_CONFIG_H','SERVER_SIDE']
        netlib.includes = includes
        netlib.name         = 'netlib'
        netlib.target       = 'jacknet'
236
237
238
239
240
241
242
        netlib.use = ['SAMPLERATE', 'CELT', 'OPUS', 'PTHREAD']
        if bld.env['IS_WINDOWS']:
             netlib.install_path = '${BINDIR}'
             netlib.use += ['WS2_32', 'WINMM']
        else:
             netlib.use += ['RT']
             netlib.install_path = '${LIBDIR}'
243
244
245
246
        netlib.source = [
            'JackNetAPI.cpp',
            'JackNetInterface.cpp',
            'JackNetTool.cpp',
247
            'JackException.cpp',
248
249
250
251
252
253
254
            'JackAudioAdapterInterface.cpp',
            'JackLibSampleRateResampler.cpp',
            'JackResampler.cpp',
            'JackGlobals.cpp',
            'ringbuffer.c']

        if bld.env['IS_LINUX']:
255
            netlib.source += ['../posix/JackNetUnixSocket.cpp','../posix/JackPosixThread.cpp', '../posix/JackPosixMutex.cpp', '../linux/JackLinuxTime.c']
256
257
258
            netlib.env.append_value("CPPFLAGS", "-fvisibility=hidden")

        if bld.env['IS_SUN']:
259
            netlib.source += ['../posix/JackNetUnixSocket.cpp','../posix/JackPosixThread.cpp', '../posix/JackPosixMutex.cpp', '../solaris/JackSolarisTime.c']
260
            netlib.env.append_value("CPPFLAGS", "-fvisibility=hidden")
261
262
       

263
        if bld.env['IS_MACOSX']:
264
            netlib.source += ['../posix/JackNetUnixSocket.cpp','../posix/JackPosixThread.cpp', '../posix/JackPosixMutex.cpp', '../macosx/JackMachThread.cpp', '../macosx/JackMachTime.c']
265
            netlib.env.append_value("LINKFLAGS", "-framework CoreAudio -single_module")
266

267
268
269
        if bld.env['IS_WINDOWS']:
            netlib.source += ['../windows/JackNetWinSocket.cpp','../windows/JackWinThread.cpp', '../windows/JackMMCSS.cpp', '../windows/JackWinTime.c']

270
        netlib.vnum = bld.env['JACK_API_VERSION']
271

272
    clientlib = bld(features = ['c', 'cxx', 'cxxshlib', 'cshlib'])
nedko's avatar
nedko committed
273
    clientlib.defines = 'HAVE_CONFIG_H'
274
    clientlib.use = uselib
275
276
277
278
    if bld.env['IS_WINDOWS']:
         clientlib.install_path = '${BINDIR}'
    else:
         clientlib.install_path = '${LIBDIR}'
279
    if bld.env['AUTOSTART_METHOD'] == "dbus":
280
        clientlib.use.append('DBUS-1')
281
    clientlib.includes = includes
nedko's avatar
nedko committed
282
283
284
285
286
287
288
    clientlib.name         = 'clientlib'
    clientlib.target       = 'jack'
    clientlib.source = [] + common_libsources
    clientlib.source += [
        'JackLibClient.cpp',
        'JackLibAPI.cpp',
        ]
289

290
    if bld.env['IS_LINUX']:
291
        clientlib.source += [
292
            '../posix/JackSocketClientChannel.cpp',
sletz's avatar
sletz committed
293
            '../posix/JackPosixServerLaunch.cpp',
294
295
            ]

sletz's avatar
sletz committed
296
297
298
299
300
301
    if bld.env['IS_SUN']:
        clientlib.source += [
            '../posix/JackSocketClientChannel.cpp',
            '../posix/JackPosixServerLaunch.cpp',
            ]

302
    if bld.env['IS_MACOSX']:
303
        clientlib.source += [
sletz's avatar
sletz committed
304
            '../posix/JackSocketClientChannel.cpp',
sletz's avatar
sletz committed
305
            '../posix/JackPosixServerLaunch.cpp',
306
307
            ]

308
309
310
311
312
313
314
315
    if bld.env['IS_WINDOWS']:
        clientlib.source += [
            '../windows/JackWinNamedPipe.cpp',
            '../windows/JackWinNamedPipeClientChannel.cpp',
            '../windows/JackWinServerLaunch.cpp',
            '../windows/JackMMCSS.cpp',
            ]

316
    clientlib.vnum = bld.env['JACK_API_VERSION']
sletz's avatar
sletz committed
317
318
319
320

    if bld.env['IS_LINUX']:
        clientlib.env.append_value("CPPFLAGS", "-fvisibility=hidden")
    
321
    if bld.env['IS_MACOSX']:
sletz's avatar
sletz committed
322
        clientlib.env.append_value("CPPFLAGS", "-fvisibility=hidden")
323
324
        clientlib.env.append_value("CPPFLAGS", "-mmacosx-version-min=10.4 -arch i386 -arch ppc -arch x86_64")
        #clientlib.env.append_value("LINKFLAGS", "-framework CoreAudio -framework vecLib -single_module -arch i386 -arch ppc -arch x86_64"
sletz's avatar
sletz committed
325
        clientlib.env.append_value("LINKFLAGS", "-framework CoreAudio -framework vecLib -single_module")
sletz's avatar
sletz committed
326
        clientlib.env.append_value("LINKFLAGS", "-compatibility_version 1 -current_version 1")
327

sletz's avatar
sletz committed
328
329
330
    if bld.env['IS_SUN']:
        clientlib.env.append_value("LINKFLAGS", "-lnsl -lsocket")

sletz's avatar
sletz committed
331
    if bld.env['BUILD_WITH_32_64']:
Adrian Knoth's avatar
Adrian Knoth committed
332
        print("create 32bit lib...")
sletz's avatar
sletz committed
333
334
        clientlib32bit = clientlib.clone('lib32')
  
sletz's avatar
sletz committed
335
336
    create_jack_process_obj(bld, 'netmanager', 'JackNetManager.cpp', serverlib)

sletz's avatar
sletz committed
337
338
    create_jack_process_obj(bld, 'profiler', 'JackProfiler.cpp', serverlib)

339
    net_adapter_sources = [
sletz's avatar
sletz committed
340
341
        'JackResampler.cpp',
        'JackLibSampleRateResampler.cpp',
342
        'JackAudioAdapter.cpp',
343
344
345
346
        'JackAudioAdapterInterface.cpp',
        'JackNetAdapter.cpp',
        ]

347
    if bld.env['BUILD_ADAPTER'] == True:
348
        process = create_jack_process_obj(bld, 'netadapter', net_adapter_sources, serverlib)
349
        process.use += ['SAMPLERATE']
350
351
352
353

    audio_adapter_sources = [
        'JackResampler.cpp',
        'JackLibSampleRateResampler.cpp',
354
        'JackAudioAdapter.cpp',
sletz's avatar
sletz committed
355
        'JackAudioAdapterInterface.cpp',
356
        'JackAudioAdapterFactory.cpp',
sletz's avatar
sletz committed
357
         ]
sletz's avatar
sletz committed
358

359
    if bld.env['BUILD_ADAPTER'] and bld.env['IS_MACOSX']:
360
         audio_adapter_sources += ['../macosx/coreaudio/JackCoreAudioAdapter.cpp']
361
         process = create_jack_process_obj(bld, 'audioadapter', audio_adapter_sources, serverlib)
362
         process.env.append_value("LINKFLAGS", "-framework CoreAudio -framework AudioUnit -framework AudioToolbox -framework CoreServices")
363
         process.use = 'SAMPLERATE'
moret's avatar
moret committed
364

sletz's avatar
sletz committed
365
    if bld.env['BUILD_ADAPTER'] and bld.env['IS_LINUX'] and bld.env['BUILD_DRIVER_ALSA']:
366
367
         audio_adapter_sources += ['../linux/alsa/JackAlsaAdapter.cpp']
         process = create_jack_process_obj(bld, 'audioadapter', audio_adapter_sources, serverlib)
368
         process.use = ['ALSA', 'SAMPLERATE']
moret's avatar
moret committed
369

sletz's avatar
sletz committed
370
371
372
    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)
373
         process.use = 'SAMPLERATE'
sletz's avatar
sletz committed
374

375
376
377
378
379
    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
380

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

    # process jack.pc.in -> jack.pc
384
385
386
387
388
389
390
391
    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,
        )