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

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

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

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

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

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

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

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

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

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

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

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

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

191
192
193
194
195
196
197
    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'
198
        netlib.uselib = ['SAMPLERATE', 'CELT', 'PTHREAD' , 'RT']
199
200
201
202
203
        netlib.install_path = '${LIBDIR}'
        netlib.source = [
            'JackNetAPI.cpp',
            'JackNetInterface.cpp',
            'JackNetTool.cpp',
sletz's avatar
sletz committed
204
	    'JackException.cpp',
205
206
207
208
209
210
211
212
213
214
215
216
217
            '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")
218
219
       

220
221
222
        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")
223

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

sletz's avatar
sletz committed
314
315
316
317
318
    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'

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

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

    # process jack.pc.in -> jack.pc
325
326
    import misc
    obj = bld.new_task_gen('subst')
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/'
336
    obj.fun = misc.subst_func