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(features = ['cxx', 'cxxshlib'])
19
    process.env['cxxshlib_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}/'
38
    process.use = [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',
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
            '../posix/JackPosixThread.cpp',
            '../posix/JackPosixSemaphore.cpp',
77
            '../posix/JackPosixProcessSync.cpp',
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
    if bld.env['IS_SUN']:
        common_libsources += [
           '../posix/JackPosixThread.cpp',
           '../posix/JackFifo.cpp',
90
           '../posix/JackPosixProcessSync.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
            '../posix/JackPosixProcessSync.cpp',
101
            '../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(features = ['c', 'cxx', 'cxxshlib', 'cshlib'])
110
    serverlib.defines = ['HAVE_CONFIG_H','SERVER_SIDE']
111
    serverlib.includes = includes
nedko's avatar
nedko committed
112
113
    serverlib.name         = 'serverlib'
    serverlib.target       = 'jackserver'
114
    serverlib.use = uselib
115
    serverlib.install_path = '${LIBDIR}'
nedko's avatar
nedko committed
116
117
118
    serverlib.source = [] + common_libsources
    serverlib.source += [
        'JackAudioDriver.cpp',
119
        'JackTimedDriver.cpp',
sletz's avatar
sletz committed
120
        'JackMidiDriver.cpp',
nedko's avatar
nedko committed
121
122
123
124
125
126
127
        'JackDriver.cpp',
        'JackEngine.cpp',
        'JackExternalClient.cpp',
        'JackFreewheelDriver.cpp',
        'JackInternalClient.cpp',
        'JackServer.cpp',
        'JackThreadedDriver.cpp',
128
129
        'JackRestartThreadedDriver.cpp',
        'JackWaitThreadedDriver.cpp',
nedko's avatar
nedko committed
130
131
132
        'JackServerAPI.cpp',
        'JackDriverLoader.cpp',
        'JackServerGlobals.cpp',
sletz's avatar
sletz committed
133
        'JackControlAPI.cpp',
134
        'JackNetTool.cpp',
moret's avatar
moret committed
135
        'JackNetInterface.cpp',
136
        'JackArgParser.cpp',
137
        'JackRequestDecoder.cpp',
sletz's avatar
sletz committed
138
139
140
141
142
143
144
145
146
147
148
        '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
149
        ]
150

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

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

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

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

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

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

190
    if bld.env['BUILD_NETLIB'] == True:
191
        netlib = bld(features = ['c', 'cxx', 'cxxshlib', 'cshlib'])
192
193
194
195
        netlib.defines = ['HAVE_CONFIG_H','SERVER_SIDE']
        netlib.includes = includes
        netlib.name         = 'netlib'
        netlib.target       = 'jacknet'
196
        netlib.use = ['SAMPLERATE', 'CELT', 'PTHREAD' , 'RT']
197
198
199
200
201
        netlib.install_path = '${LIBDIR}'
        netlib.source = [
            'JackNetAPI.cpp',
            'JackNetInterface.cpp',
            'JackNetTool.cpp',
202
            'JackException.cpp',
203
204
205
206
            'JackAudioAdapterInterface.cpp',
            'JackLibSampleRateResampler.cpp',
            'JackResampler.cpp',
            'JackGlobals.cpp',
Stephane Letz's avatar
Stephane Letz committed
207
            '../posix/JackPosixMutex.cpp',
208
209
210
211
212
213
214
215
216
            '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")
217
218
       

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

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

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

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

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

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

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

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

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

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

sletz's avatar
sletz committed
279
280
    create_jack_process_obj(bld, 'profiler', 'JackProfiler.cpp', serverlib)

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

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

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

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

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

sletz's avatar
sletz committed
312
313
314
    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)
315
         process.use = 'SAMPLERATE'
sletz's avatar
sletz committed
316

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

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

    # process jack.pc.in -> jack.pc
323
324
325
326
327
328
329
330
    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,
        )