wscript 11.6 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
    serverlib.source = [] + common_libsources
    serverlib.source += [
        'JackAudioDriver.cpp',
sletz's avatar
sletz committed
116
        'JackMidiDriver.cpp',
nedko's avatar
nedko committed
117
118
119
120
121
122
123
124
        'JackDriver.cpp',
        'JackEngine.cpp',
        'JackExternalClient.cpp',
        'JackFreewheelDriver.cpp',
        'JackInternalClient.cpp',
        'JackLoopbackDriver.cpp',
        'JackServer.cpp',
        'JackThreadedDriver.cpp',
125
126
        'JackRestartThreadedDriver.cpp',
        'JackWaitThreadedDriver.cpp',
nedko's avatar
nedko committed
127
128
129
        'JackServerAPI.cpp',
        'JackDriverLoader.cpp',
        'JackServerGlobals.cpp',
sletz's avatar
sletz committed
130
        'JackControlAPI.cpp',
131
        'JackNetTool.cpp',
moret's avatar
moret committed
132
        'JackNetInterface.cpp',
133
        'JackArgParser.cpp',
sletz's avatar
sletz committed
134
        'JackDummyDriver.cpp',
nedko's avatar
nedko committed
135
        ]
136

137
    if bld.env['IS_LINUX']:
138
        serverlib.source += [
139
140
141
142
            '../posix/JackSocketServerChannel.cpp',
            '../posix/JackSocketNotifyChannel.cpp',
            '../posix/JackSocketServerNotifyChannel.cpp',
            '../posix/JackNetUnixSocket.cpp',
143
144
            ]

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

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

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

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

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

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

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

    if bld.env['IS_SUN']:
sletz's avatar
sletz committed
200
        netlib.source += ['../posix/JackNetUnixSocket.cpp','../posix/JackPosixThread.cpp', '../solaris/JackSolarisTime.c']
201
202
203
204
205
206
207
208
209
        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']

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

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

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

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

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

    if bld.env['IS_LINUX']:
        clientlib.env.append_value("CPPFLAGS", "-fvisibility=hidden")
    
251
    if bld.env['IS_MACOSX']:
sletz's avatar
sletz committed
252
        clientlib.env.append_value("CPPFLAGS", "-fvisibility=hidden")
sletz's avatar
sletz committed
253
        clientlib.env.append_value("CPPFLAGS", "-mmacosx-version-min=10.4 -arch i386 -arch ppc")
sletz's avatar
sletz committed
254
255
        #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
256
        clientlib.env.append_value("LINKFLAGS", "-compatibility_version 1 -current_version 1")
257

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

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

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

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

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

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

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

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

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

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

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

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