wscript 15.2 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
78
79
80
81
    includes = ['.', './jack']
    if not bld.variant:
        includes.append('..')
    else:
        includes.append('../..')
Robin Gareus's avatar
Robin Gareus committed
82
    uselib = ["PTHREAD", "CELT", "OPUS"]
83

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

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

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

126
127
128
129
130
131
132
133
134
135
136
137
138
139
    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')

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
201
202
203
    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

204
    serverlib = bld(features = ['c', 'cxx', 'cxxshlib', 'cshlib'])
205
    serverlib.defines = ['HAVE_CONFIG_H','SERVER_SIDE']
206
    serverlib.includes = includes
nedko's avatar
nedko committed
207
208
    serverlib.name         = 'serverlib'
    serverlib.target       = 'jackserver'
209
    serverlib.use = uselib
210
211
212
213
    if bld.env['IS_WINDOWS']:
         serverlib.install_path = '${BINDIR}'
    else:
         serverlib.install_path = '${LIBDIR}'
nedko's avatar
nedko committed
214
215
216
    serverlib.source = [] + common_libsources
    serverlib.source += [
        'JackAudioDriver.cpp',
217
        'JackTimedDriver.cpp',
sletz's avatar
sletz committed
218
        'JackMidiDriver.cpp',
nedko's avatar
nedko committed
219
220
221
222
223
224
225
        'JackDriver.cpp',
        'JackEngine.cpp',
        'JackExternalClient.cpp',
        'JackFreewheelDriver.cpp',
        'JackInternalClient.cpp',
        'JackServer.cpp',
        'JackThreadedDriver.cpp',
226
227
        'JackRestartThreadedDriver.cpp',
        'JackWaitThreadedDriver.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
291
        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
292
        serverlib.env.append_value("LINKFLAGS", "-framework CoreAudio -framework CoreFoundation -framework vecLib -single_module")
sletz's avatar
sletz committed
293
294
295
296
        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
297

298
    if bld.env['BUILD_NETLIB'] == True:
299
        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
308
309
310
        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}'
311
312
313
314
        netlib.source = [
            'JackNetAPI.cpp',
            'JackNetInterface.cpp',
            'JackNetTool.cpp',
315
            'JackException.cpp',
316
317
318
319
320
321
322
            'JackAudioAdapterInterface.cpp',
            'JackLibSampleRateResampler.cpp',
            'JackResampler.cpp',
            'JackGlobals.cpp',
            'ringbuffer.c']

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

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

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

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

338
        netlib.vnum = bld.env['JACK_API_VERSION']
339

sletz's avatar
sletz committed
340
341
    create_jack_process_obj(bld, 'netmanager', 'JackNetManager.cpp', serverlib)

sletz's avatar
sletz committed
342
343
    create_jack_process_obj(bld, 'profiler', 'JackProfiler.cpp', serverlib)

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

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

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

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

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

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

380
381
382
383
384
    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
385

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

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