wscript 12.5 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')

sletz's avatar
sletz committed
17
def create_jack_process_obj(bld, target, sources, uselib = None):
18
    process = bld.new_task_gen('cxx', 'shlib')
19
    process.features += 'cxx'
sletz's avatar
sletz committed
20
    process.env['shlib_PATTERN'] = '%s.so'
21
    process.defines  = ['HAVE_CONFIG_H','SERVER_SIDE']
22
    if bld.env['IS_MACOSX']:
23
        env_includes = ['../macosx', '../posix', '../macosx/coreaudio']
24
    if bld.env['IS_LINUX']:
25
        env_includes = ['../linux', '../posix', '../linux/alsa']
sletz's avatar
sletz committed
26
27
    if bld.env['IS_SUN']:
        env_includes = ['../solaris', '../posix', '../solaris/oss']
28
    process.includes = ['.'] + env_includes + ['jack', '..']
sletz's avatar
sletz committed
29
30
31
    process.name     = target
    process.target   = target
    process.source   = sources
sletz's avatar
sletz committed
32
33
    if bld.env['IS_LINUX']:
        process.env.append_value("CPPFLAGS", "-fvisibility=hidden")
34
    if bld.env['IS_MACOSX']:
35
36
        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
37
        process.env.append_value("CPPFLAGS", "-fvisibility=hidden")
38
    process.install_path = '${ADDON_DIR}/'
sletz's avatar
sletz committed
39
    process.uselib_local = uselib.name
sletz's avatar
sletz committed
40
41
    return process

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

    includes = ['.', './jack', '..']
sletz's avatar
sletz committed
72
    uselib = ["PTHREAD", "CELT"]
73

74
    if bld.env['IS_LINUX']:
75
        common_libsources += [
76
77
            '../posix/JackPosixThread.cpp',
            '../posix/JackPosixSemaphore.cpp',
78
            '../posix/JackPosixProcessSync.cpp',
79
            '../posix/JackPosixMutex.cpp',
80
            '../posix/JackSocket.cpp',
sletz's avatar
sletz committed
81
            '../linux/JackLinuxTime.c',
82
            ]
83
        includes = ['../linux', '../posix'] + includes
84
        uselib.append('RT')
85
        uselib.append('DL')
86

sletz's avatar
sletz committed
87
88
89
90
    if bld.env['IS_SUN']:
        common_libsources += [
           '../posix/JackPosixThread.cpp',
           '../posix/JackFifo.cpp',
91
           '../posix/JackPosixProcessSync.cpp',
sletz's avatar
sletz committed
92
           '../posix/JackPosixMutex.cpp',
sletz's avatar
sletz committed
93
94
95
96
97
98
           '../posix/JackSocket.cpp',
           '../solaris/JackSolarisTime.c',
           ]
        includes = ['../solaris', '../posix'] + includes
        uselib.append('RT')

99
    if bld.env['IS_MACOSX']:
100
        common_libsources += [
101
            '../posix/JackPosixProcessSync.cpp',
102
            '../posix/JackPosixThread.cpp',
103
            '../macosx/JackMachThread.cpp',
104
            '../macosx/JackMachSemaphore.cpp',
sletz's avatar
sletz committed
105
            '../posix/JackSocket.cpp',
sletz's avatar
sletz committed
106
            '../macosx/JackMachTime.c',
107
            ]
108
        includes = ['../macosx', '../macosx/RPC', '../posix'] + includes
109

110
    serverlib = bld.new_task_gen('cxx', 'shlib')
nedko's avatar
nedko committed
111
    serverlib.features.append('cc')
112
    serverlib.defines = ['HAVE_CONFIG_H','SERVER_SIDE']
113
    serverlib.includes = includes
nedko's avatar
nedko committed
114
115
    serverlib.name         = 'serverlib'
    serverlib.target       = 'jackserver'
116
    serverlib.uselib = uselib
117
    serverlib.install_path = '${LIBDIR}'
nedko's avatar
nedko committed
118
119
120
    serverlib.source = [] + common_libsources
    serverlib.source += [
        'JackAudioDriver.cpp',
121
        'JackTimedDriver.cpp',
sletz's avatar
sletz committed
122
        'JackMidiDriver.cpp',
nedko's avatar
nedko committed
123
124
125
126
127
128
129
        'JackDriver.cpp',
        'JackEngine.cpp',
        'JackExternalClient.cpp',
        'JackFreewheelDriver.cpp',
        'JackInternalClient.cpp',
        'JackServer.cpp',
        'JackThreadedDriver.cpp',
130
131
        'JackRestartThreadedDriver.cpp',
        'JackWaitThreadedDriver.cpp',
nedko's avatar
nedko committed
132
133
134
        'JackServerAPI.cpp',
        'JackDriverLoader.cpp',
        'JackServerGlobals.cpp',
sletz's avatar
sletz committed
135
        'JackControlAPI.cpp',
136
        'JackNetTool.cpp',
moret's avatar
moret committed
137
        'JackNetInterface.cpp',
138
        'JackArgParser.cpp',
139
        'JackRequestDecoder.cpp',
sletz's avatar
sletz committed
140
141
142
143
144
145
146
147
148
149
150
        '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
151
        ]
152

153
    if bld.env['IS_LINUX']:
154
        serverlib.source += [
155
156
157
158
            '../posix/JackSocketServerChannel.cpp',
            '../posix/JackSocketNotifyChannel.cpp',
            '../posix/JackSocketServerNotifyChannel.cpp',
            '../posix/JackNetUnixSocket.cpp',
159
160
            ]

sletz's avatar
sletz committed
161
162
163
164
165
166
167
168
    if bld.env['IS_SUN']:
        serverlib.source += [
            '../posix/JackSocketServerChannel.cpp',
            '../posix/JackSocketNotifyChannel.cpp',
            '../posix/JackSocketServerNotifyChannel.cpp',
            '../posix/JackNetUnixSocket.cpp',
            ]

169
    if bld.env['IS_MACOSX']:
170
        serverlib.source += [
sletz's avatar
sletz committed
171
172
173
            '../posix/JackSocketServerChannel.cpp',
            '../posix/JackSocketNotifyChannel.cpp',
            '../posix/JackSocketServerNotifyChannel.cpp',
174
            '../posix/JackNetUnixSocket.cpp',
175
176
            ]

177
    serverlib.vnum = bld.env['JACK_API_VERSION']
sletz's avatar
sletz committed
178
179
180
181

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

182
    if bld.env['IS_MACOSX']:
sletz's avatar
sletz committed
183
        serverlib.env.append_value("CPPFLAGS", "-fvisibility=hidden")
184
185
        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
186
        serverlib.env.append_value("LINKFLAGS", "-framework CoreAudio -framework CoreFoundation -framework vecLib -single_module")
sletz's avatar
sletz committed
187
188
189
190
        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
191

192
193
194
195
196
197
198
    if bld.env['BUILD_NETLIB'] == True:
        netlib = bld.new_task_gen('cxx', 'shlib')
        netlib.features.append('cc')
        netlib.defines = ['HAVE_CONFIG_H','SERVER_SIDE']
        netlib.includes = includes
        netlib.name         = 'netlib'
        netlib.target       = 'jacknet'
199
        netlib.uselib = ['SAMPLERATE', 'CELT', 'PTHREAD' , 'RT']
200
201
202
203
204
        netlib.install_path = '${LIBDIR}'
        netlib.source = [
            'JackNetAPI.cpp',
            'JackNetInterface.cpp',
            'JackNetTool.cpp',
205
            'JackException.cpp',
206
207
208
209
210
211
212
213
214
215
216
217
218
            'JackAudioAdapterInterface.cpp',
            'JackLibSampleRateResampler.cpp',
            'JackResampler.cpp',
            'JackGlobals.cpp',
            'ringbuffer.c']

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

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

221
222
223
        if bld.env['IS_MACOSX']:
            netlib.source += ['../posix/JackNetUnixSocket.cpp','../posix/JackPosixThread.cpp', '../macosx/JackMachThread.cpp', '../macosx/JackMachTime.c']
            netlib.env.append_value("LINKFLAGS", "-framework CoreAudio -single_module")
224

225
        netlib.vnum = bld.env['JACK_API_VERSION']
226

227
    clientlib = bld.new_task_gen('cxx', 'shlib')
nedko's avatar
nedko committed
228
229
    clientlib.features.append('cc')
    clientlib.defines = 'HAVE_CONFIG_H'
230
    clientlib.uselib = uselib
231
    clientlib.install_path = '${LIBDIR}'
sletz's avatar
sletz committed
232
    if bld.env['BUILD_JACKDBUS'] == True and bld.env['BUILD_JACKD'] == False:
nedko's avatar
nedko committed
233
        clientlib.uselib.append('DBUS-1')
234
    clientlib.includes = includes
nedko's avatar
nedko committed
235
236
237
238
239
240
241
    clientlib.name         = 'clientlib'
    clientlib.target       = 'jack'
    clientlib.source = [] + common_libsources
    clientlib.source += [
        'JackLibClient.cpp',
        'JackLibAPI.cpp',
        ]
242

243
    if bld.env['IS_LINUX']:
244
        clientlib.source += [
245
            '../posix/JackSocketClientChannel.cpp',
sletz's avatar
sletz committed
246
            '../posix/JackPosixServerLaunch.cpp',
247
248
            ]

sletz's avatar
sletz committed
249
250
251
252
253
254
    if bld.env['IS_SUN']:
        clientlib.source += [
            '../posix/JackSocketClientChannel.cpp',
            '../posix/JackPosixServerLaunch.cpp',
            ]

255
    if bld.env['IS_MACOSX']:
256
        clientlib.source += [
sletz's avatar
sletz committed
257
            '../posix/JackSocketClientChannel.cpp',
sletz's avatar
sletz committed
258
            '../posix/JackPosixServerLaunch.cpp',
259
260
            ]

261
    clientlib.vnum = bld.env['JACK_API_VERSION']
sletz's avatar
sletz committed
262
263
264
265

    if bld.env['IS_LINUX']:
        clientlib.env.append_value("CPPFLAGS", "-fvisibility=hidden")
    
266
    if bld.env['IS_MACOSX']:
sletz's avatar
sletz committed
267
        clientlib.env.append_value("CPPFLAGS", "-fvisibility=hidden")
268
269
        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
270
        clientlib.env.append_value("LINKFLAGS", "-framework CoreAudio -framework vecLib -single_module")
sletz's avatar
sletz committed
271
        clientlib.env.append_value("LINKFLAGS", "-compatibility_version 1 -current_version 1")
272

sletz's avatar
sletz committed
273
274
275
    if bld.env['IS_SUN']:
        clientlib.env.append_value("LINKFLAGS", "-lnsl -lsocket")

sletz's avatar
sletz committed
276
    if bld.env['BUILD_WITH_32_64']:
Adrian Knoth's avatar
Adrian Knoth committed
277
        print("create 32bit lib...")
sletz's avatar
sletz committed
278
279
        clientlib32bit = clientlib.clone('lib32')
  
sletz's avatar
sletz committed
280
281
    create_jack_process_obj(bld, 'netmanager', 'JackNetManager.cpp', serverlib)

sletz's avatar
sletz committed
282
283
    create_jack_process_obj(bld, 'profiler', 'JackProfiler.cpp', serverlib)

284
    net_adapter_sources = [
sletz's avatar
sletz committed
285
286
        'JackResampler.cpp',
        'JackLibSampleRateResampler.cpp',
287
        'JackAudioAdapter.cpp',
288
289
290
291
        'JackAudioAdapterInterface.cpp',
        'JackNetAdapter.cpp',
        ]

292
    if bld.env['BUILD_ADAPTER'] == True:
293
294
        process = create_jack_process_obj(bld, 'netadapter', net_adapter_sources, serverlib)
        process.uselib = 'SAMPLERATE'
295
296
297
298

    audio_adapter_sources = [
        'JackResampler.cpp',
        'JackLibSampleRateResampler.cpp',
299
        'JackAudioAdapter.cpp',
sletz's avatar
sletz committed
300
        'JackAudioAdapterInterface.cpp',
301
        'JackAudioAdapterFactory.cpp',
sletz's avatar
sletz committed
302
         ]
sletz's avatar
sletz committed
303

304
    if bld.env['BUILD_ADAPTER'] and bld.env['IS_MACOSX']:
305
         audio_adapter_sources += ['../macosx/coreaudio/JackCoreAudioAdapter.cpp']
306
         process = create_jack_process_obj(bld, 'audioadapter', audio_adapter_sources, serverlib)
307
308
         process.env.append_value("LINKFLAGS", "-framework CoreAudio -framework AudioUnit -framework AudioToolbox -framework CoreServices")
         process.uselib = 'SAMPLERATE'
moret's avatar
moret committed
309

sletz's avatar
sletz committed
310
    if bld.env['BUILD_ADAPTER'] and bld.env['IS_LINUX'] and bld.env['BUILD_DRIVER_ALSA']:
311
312
         audio_adapter_sources += ['../linux/alsa/JackAlsaAdapter.cpp']
         process = create_jack_process_obj(bld, 'audioadapter', audio_adapter_sources, serverlib)
313
         process.uselib = ['ALSA', 'SAMPLERATE']
moret's avatar
moret committed
314

sletz's avatar
sletz committed
315
316
317
318
319
    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)
         process.uselib = 'SAMPLERATE'

320
321
    #audio_adapter_sources += ['../windows/JackPortAudioAdapter.cpp']
    #process = create_jack_process_obj(bld, 'audioadapter', audio_adapter_sources, serverlib)
moret's avatar
moret committed
322

323
    bld.install_files('${PREFIX}/include/jack', 'jack/*.h')
nedko's avatar
nedko committed
324
325

    # process jack.pc.in -> jack.pc
326
    obj = bld.new_task_gen('subst_pc')
nedko's avatar
nedko committed
327
328
    obj.source = '../jack.pc.in'
    obj.target = 'jack.pc'
329
    obj.dict = {'PREFIX': bld.env['PREFIX'],
330
                'LIBDIR': bld.env['LIBDIR'],
331
                'INCLUDEDIR': os.path.normpath(bld.env['PREFIX'] + '/include'),
nedko's avatar
nedko committed
332
                'SERVERLIB': serverlib.target,
333
                'JACK_VERSION': bld.env['JACK_VERSION'],
nedko's avatar
nedko committed
334
                }
335
    obj.install_path = '${LIBDIR}/pkgconfig/'