wscript 15.1 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.env['BUILD_NETLIB'] = conf.is_defined('HAVE_SAMPLERATE')
10
11
    conf.env['BUILD_ADAPTER'] = conf.is_defined('HAVE_SAMPLERATE')

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

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

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

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

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

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

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

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

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