wscript 15.1 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
        try:
13
            conf.check(function_name='regcomp', header_name='regex.h', lib='regex', uselib_store="REGEX", define_name='HAVE_REGEX_H')
14
        except:
15
16
17
18
            conf.check(function_name='regcomp', header_name='regex.h', lib='tre', uselib_store="REGEX", define_name='HAVE_REGEX_H')
        conf.check(function_name='htons', header_name='winsock2.h', lib='ws2_32', uselib_store="WS2_32", define_name='HAVE_WINSOCK2_H')
        conf.check(function_name='timeGetDevCaps', header_name=['windows.h', 'mmsystem.h'], lib='winmm', uselib_store="WINMM", define_name='HAVE_MMSYSTEM_H')
        conf.check(function_name='EnumProcesses', header_name=['windows.h', 'psapi.h'], lib='psapi', uselib_store="PSAPI", define_name='HAVE_PSAPI_H')
19

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']:
40
41
        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
42
        process.env.append_value("CPPFLAGS", "-fvisibility=hidden")
43
    process.install_path = '${ADDON_DIR}/'
44
    process.use = [uselib.name]
sletz's avatar
sletz committed
45
46
    return process

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

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

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

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

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

123
124
125
126
127
128
129
130
131
132
133
134
135
136
    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')

137
138
139
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
190
191
192
193
194
195
196
197
198
199
200
    clientlib = bld(features = ['c', 'cxx', 'cxxshlib', 'cshlib'])
    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")
        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"
        clientlib.env.append_value("LINKFLAGS", "-framework CoreAudio -framework vecLib -single_module")
        clientlib.env.append_value("LINKFLAGS", "-compatibility_version 1 -current_version 1")

    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

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

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

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

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

271
272
273
274
275
276
277
278
279
280
    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',
            ]

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

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

286
    if bld.env['IS_MACOSX']:
sletz's avatar
sletz committed
287
        serverlib.env.append_value("CPPFLAGS", "-fvisibility=hidden")
288
289
        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
290
        serverlib.env.append_value("LINKFLAGS", "-framework CoreAudio -framework CoreFoundation -framework vecLib -single_module")
sletz's avatar
sletz committed
291
292
293
294
        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
295

296
    if bld.env['BUILD_NETLIB']:
297
        netlib = bld(features = ['c', 'cxx', 'cxxshlib', 'cshlib'])
298
299
300
301
        netlib.defines = ['HAVE_CONFIG_H','SERVER_SIDE']
        netlib.includes = includes
        netlib.name         = 'netlib'
        netlib.target       = 'jacknet'
302
303
304
305
306
307
308
        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}'
309
310
311
312
        netlib.source = [
            'JackNetAPI.cpp',
            'JackNetInterface.cpp',
            'JackNetTool.cpp',
313
            'JackException.cpp',
314
315
316
317
318
319
320
            'JackAudioAdapterInterface.cpp',
            'JackLibSampleRateResampler.cpp',
            'JackResampler.cpp',
            'JackGlobals.cpp',
            'ringbuffer.c']

        if bld.env['IS_LINUX']:
321
            netlib.source += ['../posix/JackNetUnixSocket.cpp','../posix/JackPosixThread.cpp', '../posix/JackPosixMutex.cpp', '../linux/JackLinuxTime.c']
322
323
324
            netlib.env.append_value("CPPFLAGS", "-fvisibility=hidden")

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

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

333
334
335
        if bld.env['IS_WINDOWS']:
            netlib.source += ['../windows/JackNetWinSocket.cpp','../windows/JackWinThread.cpp', '../windows/JackMMCSS.cpp', '../windows/JackWinTime.c']

336
        netlib.vnum = bld.env['JACK_API_VERSION']
337

sletz's avatar
sletz committed
338
339
    create_jack_process_obj(bld, 'netmanager', 'JackNetManager.cpp', serverlib)

sletz's avatar
sletz committed
340
341
    create_jack_process_obj(bld, 'profiler', 'JackProfiler.cpp', serverlib)

342
    net_adapter_sources = [
sletz's avatar
sletz committed
343
344
        'JackResampler.cpp',
        'JackLibSampleRateResampler.cpp',
345
        'JackAudioAdapter.cpp',
346
347
348
349
        'JackAudioAdapterInterface.cpp',
        'JackNetAdapter.cpp',
        ]

350
    if bld.env['BUILD_ADAPTER']:
351
        process = create_jack_process_obj(bld, 'netadapter', net_adapter_sources, serverlib)
352
        process.use += ['SAMPLERATE']
353
354
355
356

    audio_adapter_sources = [
        'JackResampler.cpp',
        'JackLibSampleRateResampler.cpp',
357
        'JackAudioAdapter.cpp',
sletz's avatar
sletz committed
358
        'JackAudioAdapterInterface.cpp',
359
        'JackAudioAdapterFactory.cpp',
sletz's avatar
sletz committed
360
         ]
sletz's avatar
sletz committed
361

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

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

sletz's avatar
sletz committed
373
374
375
    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)
376
         process.use = 'SAMPLERATE'
sletz's avatar
sletz committed
377

378
379
380
381
382
    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
383

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

    # process jack.pc.in -> jack.pc
387
388
389
390
391
392
393
394
    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,
        )