wscript 12.3 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
49
50
51
52
53
54
55
        'JackError.cpp',
        'JackFrameTimer.cpp',
        'JackGraphManager.cpp',
        'JackPort.cpp',
        'JackPortType.cpp',
        'JackAudioPort.cpp',
        'JackMidiPort.cpp',
        'JackMidiAPI.cpp',
nedko's avatar
nedko committed
56
        'JackEngineControl.cpp',
57
58
59
60
61
62
63
64
        'JackShmMem.cpp',
        'shm.c',
        'JackGlobals.cpp',
        'JackDebugClient.cpp',
        'JackTransportEngine.cpp',
        'timestamps.c',
        'JackTools.cpp',
        'JackMessageBuffer.cpp',
sletz's avatar
sletz committed
65
        'JackEngineProfiling.cpp',
66
        ]
67
68

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

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

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

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

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

148
    if bld.env['IS_LINUX']:
149
        serverlib.source += [
150
151
152
153
            '../posix/JackSocketServerChannel.cpp',
            '../posix/JackSocketNotifyChannel.cpp',
            '../posix/JackSocketServerNotifyChannel.cpp',
            '../posix/JackNetUnixSocket.cpp',
154
155
            ]

sletz's avatar
sletz committed
156
157
158
159
160
161
162
163
    if bld.env['IS_SUN']:
        serverlib.source += [
            '../posix/JackSocketServerChannel.cpp',
            '../posix/JackSocketNotifyChannel.cpp',
            '../posix/JackSocketServerNotifyChannel.cpp',
            '../posix/JackNetUnixSocket.cpp',
            ]

164
    if bld.env['IS_MACOSX']:
165
        serverlib.source += [
sletz's avatar
sletz committed
166
167
168
            '../posix/JackSocketServerChannel.cpp',
            '../posix/JackSocketNotifyChannel.cpp',
            '../posix/JackSocketServerNotifyChannel.cpp',
169
            '../posix/JackNetUnixSocket.cpp',
170
171
            ]

172
    serverlib.vnum = bld.env['JACK_API_VERSION']
sletz's avatar
sletz committed
173
174
175
176

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

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

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

215
216
217
        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")
218

219
        netlib.vnum = bld.env['JACK_API_VERSION']
220

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

237
    if bld.env['IS_LINUX']:
238
        clientlib.source += [
239
            '../posix/JackSocketClientChannel.cpp',
sletz's avatar
sletz committed
240
            '../posix/JackPosixServerLaunch.cpp',
241
242
            ]

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

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

255
    clientlib.vnum = bld.env['JACK_API_VERSION']
sletz's avatar
sletz committed
256
257
258
259

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

sletz's avatar
sletz committed
267
268
269
    if bld.env['IS_SUN']:
        clientlib.env.append_value("LINKFLAGS", "-lnsl -lsocket")

sletz's avatar
sletz committed
270
271
272
273
    if bld.env['BUILD_WITH_32_64']:
        print "create 32bit lib..."
        clientlib32bit = clientlib.clone('lib32')
  
sletz's avatar
sletz committed
274
275
    create_jack_process_obj(bld, 'netmanager', 'JackNetManager.cpp', serverlib)

sletz's avatar
sletz committed
276
277
    create_jack_process_obj(bld, 'profiler', 'JackProfiler.cpp', serverlib)

278
    net_adapter_sources = [
sletz's avatar
sletz committed
279
280
        'JackResampler.cpp',
        'JackLibSampleRateResampler.cpp',
281
        'JackAudioAdapter.cpp',
282
283
284
285
        'JackAudioAdapterInterface.cpp',
        'JackNetAdapter.cpp',
        ]

286
    if bld.env['BUILD_ADAPTER'] == True:
287
288
        process = create_jack_process_obj(bld, 'netadapter', net_adapter_sources, serverlib)
        process.uselib = 'SAMPLERATE'
289
290
291
292

    audio_adapter_sources = [
        'JackResampler.cpp',
        'JackLibSampleRateResampler.cpp',
293
        'JackAudioAdapter.cpp',
sletz's avatar
sletz committed
294
        'JackAudioAdapterInterface.cpp',
295
        'JackAudioAdapterFactory.cpp',
sletz's avatar
sletz committed
296
         ]
sletz's avatar
sletz committed
297

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

sletz's avatar
sletz committed
304
    if bld.env['BUILD_ADAPTER'] and bld.env['IS_LINUX'] and bld.env['BUILD_DRIVER_ALSA']:
305
306
         audio_adapter_sources += ['../linux/alsa/JackAlsaAdapter.cpp']
         process = create_jack_process_obj(bld, 'audioadapter', audio_adapter_sources, serverlib)
307
         process.uselib = ['ALSA', 'SAMPLERATE']
moret's avatar
moret committed
308

sletz's avatar
sletz committed
309
310
311
312
313
    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'

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

317
    bld.install_files('${PREFIX}/include/jack', 'jack/*.h')
nedko's avatar
nedko committed
318
319

    # process jack.pc.in -> jack.pc
320
321
    import misc
    obj = bld.new_task_gen('subst')
nedko's avatar
nedko committed
322
323
    obj.source = '../jack.pc.in'
    obj.target = 'jack.pc'
324
    obj.dict = {'PREFIX': bld.env['PREFIX'],
325
                'LIBDIR': bld.env['LIBDIR'],
326
                'INCLUDEDIR': os.path.normpath(bld.env['PREFIX'] + '/include'),
nedko's avatar
nedko committed
327
                'SERVERLIB': serverlib.target,
328
                'JACK_VERSION': bld.env['JACK_VERSION'],
nedko's avatar
nedko committed
329
                }
330
    obj.install_path = '${LIBDIR}/pkgconfig/'
331
    obj.fun = misc.subst_func