wscript 12.4 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'])
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',
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 = ['cxx', 'cxxshlib'])
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.uselib = 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 = ['cxx', 'cxxshlib'])
192
193
194
195
        netlib.defines = ['HAVE_CONFIG_H','SERVER_SIDE']
        netlib.includes = includes
        netlib.name         = 'netlib'
        netlib.target       = 'jacknet'
196
        netlib.uselib = ['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
207
208
209
210
211
212
213
214
215
            '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")
216
217
       

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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