wscript 11.7 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
14
15
   
    if conf.is_defined('HAVE_SAMPLERATE'):
        conf.env['LIB_SAMPLERATE'] = ['samplerate']

    conf.env['BUILD_ADAPTER'] = conf.is_defined('HAVE_SAMPLERATE')

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

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

    includes = ['.', './jack', '..']
    uselib = ["PTHREAD"]

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

sletz's avatar
sletz committed
83
84
85
86
87
88
89
90
91
92
93
    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')

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

105
    serverlib = bld.new_task_gen('cxx', 'shlib')
nedko's avatar
nedko committed
106
    serverlib.features.append('cc')
107
    serverlib.defines = ['HAVE_CONFIG_H','SERVER_SIDE']
108
    serverlib.includes = includes
nedko's avatar
nedko committed
109
110
    serverlib.name         = 'serverlib'
    serverlib.target       = 'jackserver'
111
    serverlib.uselib = uselib
112
    serverlib.install_path = '${LIBDIR}'
nedko's avatar
nedko committed
113
114
115
116
117
118
119
120
121
122
123
    serverlib.source = [] + common_libsources
    serverlib.source += [
        'JackAudioDriver.cpp',
        'JackDriver.cpp',
        'JackEngine.cpp',
        'JackExternalClient.cpp',
        'JackFreewheelDriver.cpp',
        'JackInternalClient.cpp',
        'JackLoopbackDriver.cpp',
        'JackServer.cpp',
        'JackThreadedDriver.cpp',
124
125
        'JackRestartThreadedDriver.cpp',
        'JackWaitThreadedDriver.cpp',
nedko's avatar
nedko committed
126
127
128
        'JackServerAPI.cpp',
        'JackDriverLoader.cpp',
        'JackServerGlobals.cpp',
sletz's avatar
sletz committed
129
        'JackControlAPI.cpp',
130
        'JackNetTool.cpp',
moret's avatar
moret committed
131
        'JackNetInterface.cpp',
132
        'JackArgParser.cpp',
nedko's avatar
nedko committed
133
        ]
134

135
    if bld.env['IS_LINUX']:
136
        serverlib.source += [
137
138
139
140
            '../posix/JackSocketServerChannel.cpp',
            '../posix/JackSocketNotifyChannel.cpp',
            '../posix/JackSocketServerNotifyChannel.cpp',
            '../posix/JackNetUnixSocket.cpp',
141
            ]
sletz's avatar
sletz committed
142
143
144
	    
    if bld.env['IS_LINUX'] and bld.env['BUILD_JACKDBUS']:
	serverlib.source += ['../dbus/reserve.c', '../dbus/audio_reserve.c']
145

sletz's avatar
sletz committed
146
147
148
149
150
151
152
153
    if bld.env['IS_SUN']:
        serverlib.source += [
            '../posix/JackSocketServerChannel.cpp',
            '../posix/JackSocketNotifyChannel.cpp',
            '../posix/JackSocketServerNotifyChannel.cpp',
            '../posix/JackNetUnixSocket.cpp',
            ]

154
    if bld.env['IS_MACOSX']:
155
156
157
158
159
160
        serverlib.source += [
            '../macosx/JackMachServerChannel.cpp',
            '../macosx/JackMachNotifyChannel.cpp',
            '../macosx/JackMachServerNotifyChannel.cpp',
            '../macosx/JackMacEngineRPC.cpp',
            '../macosx/RPC/JackRPCClientUser.c',
161
            '../posix/JackNetUnixSocket.cpp',
162
163
            ]

164
    serverlib.vnum = bld.env['JACK_API_VERSION']
sletz's avatar
sletz committed
165
166
167
168

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

169
    if bld.env['IS_MACOSX']:
sletz's avatar
sletz committed
170
        serverlib.env.append_value("CPPFLAGS", "-fvisibility=hidden")
sletz's avatar
sletz committed
171
        serverlib.env.append_value("CPPFLAGS", "-mmacosx-version-min=10.4 -arch i386 -arch ppc")
sletz's avatar
sletz committed
172
173
        #serverlib.env.append_value("LINKFLAGS", "-framework CoreAudio -framework vecLib -single_module -arch i386 -arch ppc")
        serverlib.env.append_value("LINKFLAGS", "-framework CoreAudio -framework vecLib -single_module")
sletz's avatar
sletz committed
174
175
176
177
        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
178

179
180
181
182
183
184
    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'
sletz's avatar
sletz committed
185
    netlib.uselib = 'SAMPLERATE'
186
    netlib.install_path = '${LIBDIR}'
sletz's avatar
sletz committed
187
188
189
190
191
192
    netlib.source = ['JackNetAPI.cpp', 
		'JackNetInterface.cpp', 
		'JackNetTool.cpp', 
		'JackAudioAdapterInterface.cpp', 
		'JackLibSampleRateResampler.cpp',
		'JackResampler.cpp', 
sletz's avatar
sletz committed
193
                'JackGlobals.cpp',
sletz's avatar
sletz committed
194
		'ringbuffer.c']
195
196

    if bld.env['IS_LINUX']:
sletz's avatar
sletz committed
197
        netlib.source += ['../posix/JackNetUnixSocket.cpp','../posix/JackPosixThread.cpp', '../linux/JackLinuxTime.c']
198
199
200
        netlib.env.append_value("CPPFLAGS", "-fvisibility=hidden")

    if bld.env['IS_SUN']:
sletz's avatar
sletz committed
201
        netlib.source += ['../posix/JackNetUnixSocket.cpp','../posix/JackPosixThread.cpp', '../solaris/JackSolarisTime.c']
202
203
204
205
206
207
208
209
210
        netlib.env.append_value("CPPFLAGS", "-fvisibility=hidden")
       

    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")

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

211
    clientlib = bld.new_task_gen('cxx', 'shlib')
nedko's avatar
nedko committed
212
213
    clientlib.features.append('cc')
    clientlib.defines = 'HAVE_CONFIG_H'
214
    clientlib.uselib = uselib
215
    clientlib.install_path = '${LIBDIR}'
216
    if bld.env['BUILD_JACKDBUS'] == True:
nedko's avatar
nedko committed
217
        clientlib.uselib.append('DBUS-1')
218
    clientlib.includes = includes
nedko's avatar
nedko committed
219
220
221
222
223
224
225
    clientlib.name         = 'clientlib'
    clientlib.target       = 'jack'
    clientlib.source = [] + common_libsources
    clientlib.source += [
        'JackLibClient.cpp',
        'JackLibAPI.cpp',
        ]
226

227
    if bld.env['IS_LINUX']:
228
        clientlib.source += [
229
            '../posix/JackSocketClientChannel.cpp',
sletz's avatar
sletz committed
230
            '../posix/JackPosixServerLaunch.cpp',
231
232
            ]

sletz's avatar
sletz committed
233
234
235
236
237
238
    if bld.env['IS_SUN']:
        clientlib.source += [
            '../posix/JackSocketClientChannel.cpp',
            '../posix/JackPosixServerLaunch.cpp',
            ]

239
    if bld.env['IS_MACOSX']:
240
241
242
243
        clientlib.source += [
            '../macosx/JackMachClientChannel.cpp',
            '../macosx/RPC/JackRPCEngineUser.c',
            '../macosx/JackMacLibClientRPC.cpp',
sletz's avatar
sletz committed
244
            '../posix/JackPosixServerLaunch.cpp',
245
246
            ]

247
    clientlib.vnum = bld.env['JACK_API_VERSION']
sletz's avatar
sletz committed
248
249
250
251

    if bld.env['IS_LINUX']:
        clientlib.env.append_value("CPPFLAGS", "-fvisibility=hidden")
    
252
    if bld.env['IS_MACOSX']:
sletz's avatar
sletz committed
253
        clientlib.env.append_value("CPPFLAGS", "-fvisibility=hidden")
sletz's avatar
sletz committed
254
        clientlib.env.append_value("CPPFLAGS", "-mmacosx-version-min=10.4 -arch i386 -arch ppc")
sletz's avatar
sletz committed
255
256
        #clientlib.env.append_value("LINKFLAGS", "-framework CoreAudio -framework vecLib -single_module -arch i386 -arch ppc"
        clientlib.env.append_value("LINKFLAGS", "-framework CoreAudio -framework vecLib -single_module")
sletz's avatar
sletz committed
257
        clientlib.env.append_value("LINKFLAGS", "-compatibility_version 1 -current_version 1")
258

sletz's avatar
sletz committed
259
260
261
    if bld.env['IS_SUN']:
        clientlib.env.append_value("LINKFLAGS", "-lnsl -lsocket")

sletz's avatar
sletz committed
262
263
    create_jack_process_obj(bld, 'netmanager', 'JackNetManager.cpp', serverlib)

sletz's avatar
sletz committed
264
265
    create_jack_process_obj(bld, 'profiler', 'JackProfiler.cpp', serverlib)

266
    net_adapter_sources = [
sletz's avatar
sletz committed
267
268
        'JackResampler.cpp',
        'JackLibSampleRateResampler.cpp',
269
        'JackAudioAdapter.cpp',
270
271
272
273
        'JackAudioAdapterInterface.cpp',
        'JackNetAdapter.cpp',
        ]

274
    if bld.env['BUILD_ADAPTER'] == True:
275
276
        process = create_jack_process_obj(bld, 'netadapter', net_adapter_sources, serverlib)
        process.uselib = 'SAMPLERATE'
277
278
279
280

    audio_adapter_sources = [
        'JackResampler.cpp',
        'JackLibSampleRateResampler.cpp',
281
        'JackAudioAdapter.cpp',
sletz's avatar
sletz committed
282
        'JackAudioAdapterInterface.cpp',
283
        'JackAudioAdapterFactory.cpp',
sletz's avatar
sletz committed
284
         ]
sletz's avatar
sletz committed
285

286
    if bld.env['BUILD_ADAPTER'] and bld.env['IS_MACOSX']:
287
         audio_adapter_sources += ['../macosx/coreaudio/JackCoreAudioAdapter.cpp']
288
         process = create_jack_process_obj(bld, 'audioadapter', audio_adapter_sources, serverlib)
289
290
         process.env.append_value("LINKFLAGS", "-framework CoreAudio -framework AudioUnit -framework AudioToolbox -framework CoreServices")
         process.uselib = 'SAMPLERATE'
moret's avatar
moret committed
291

sletz's avatar
sletz committed
292
    if bld.env['BUILD_ADAPTER'] and bld.env['IS_LINUX'] and bld.env['BUILD_DRIVER_ALSA']:
293
294
         audio_adapter_sources += ['../linux/alsa/JackAlsaAdapter.cpp']
         process = create_jack_process_obj(bld, 'audioadapter', audio_adapter_sources, serverlib)
295
         process.uselib = ['ALSA', 'SAMPLERATE']
moret's avatar
moret committed
296

sletz's avatar
sletz committed
297
298
299
300
301
    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'

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

305
    bld.install_files('${PREFIX}/include/jack', 'jack/*.h')
nedko's avatar
nedko committed
306
307

    # process jack.pc.in -> jack.pc
308
309
    import misc
    obj = bld.new_task_gen('subst')
nedko's avatar
nedko committed
310
311
    obj.source = '../jack.pc.in'
    obj.target = 'jack.pc'
312
    obj.dict = {'PREFIX': bld.env['PREFIX'],
313
                'LIBDIR': bld.env['LIBDIR'],
314
                'INCLUDEDIR': os.path.normpath(bld.env['PREFIX'] + '/include'),
nedko's avatar
nedko committed
315
                'SERVERLIB': serverlib.target,
316
                'JACK_VERSION': bld.env['JACK_VERSION'],
nedko's avatar
nedko committed
317
                }
318
    obj.install_path = '${LIBDIR}/pkgconfig/'
319
    obj.fun = misc.subst_func