wscript 8.53 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
24
	env_includes = ['../linux', '../posix', '../linux/alsa']
    process.includes = ['.'] + env_includes + ['jack', '..']
sletz's avatar
sletz committed
25
26
27
28
    process.name     = target
    process.target   = target
    process.source   = sources
    process.env.append_value("CPPFLAGS", "-fvisibility=hidden")
29
    if bld.env['IS_MACOSX']:
sletz's avatar
sletz committed
30
31
32
        process.env.append_value("CPPFLAGS", "-mmacosx-version-min=10.4 -arch i386 -arch ppc")
        #process.env.append_value("LINKFLAGS", "-arch i386 -arch ppc")
        process.env.append_value("LINKFLAGS", "")
33
    process.install_path = '${ADDON_DIR}/'
sletz's avatar
sletz committed
34
    process.uselib_local = uselib.name
sletz's avatar
sletz committed
35
36
    return process

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

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

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

79
    if bld.env['IS_MACOSX']:
80
        common_libsources += [
81
82
            '../posix/JackProcessSync.cpp',
            '../posix/JackPosixThread.cpp',
83
            '../macosx/JackMachThread.cpp',
84
            '../macosx/JackMachSemaphore.cpp',
85
            '../macosx/JackMachPort.cpp',
sletz's avatar
sletz committed
86
	    '../macosx/JackMachTime.c',
87
            ]
88
        includes = ['../macosx', '../macosx/RPC', '../posix'] + includes
89

90
    serverlib = bld.new_task_gen('cxx', 'shlib')
nedko's avatar
nedko committed
91
    serverlib.features.append('cc')
92
    serverlib.defines = ['HAVE_CONFIG_H','SERVER_SIDE']
93
    serverlib.includes = includes
nedko's avatar
nedko committed
94
95
    serverlib.name         = 'serverlib'
    serverlib.target       = 'jackserver'
96
    serverlib.uselib = uselib
97
    serverlib.install_path = '${LIBDIR}'
nedko's avatar
nedko committed
98
99
100
101
102
103
104
105
106
107
108
    serverlib.source = [] + common_libsources
    serverlib.source += [
        'JackAudioDriver.cpp',
        'JackDriver.cpp',
        'JackEngine.cpp',
        'JackExternalClient.cpp',
        'JackFreewheelDriver.cpp',
        'JackInternalClient.cpp',
        'JackLoopbackDriver.cpp',
        'JackServer.cpp',
        'JackThreadedDriver.cpp',
109
110
        'JackRestartThreadedDriver.cpp',
        'JackWaitThreadedDriver.cpp',
nedko's avatar
nedko committed
111
112
113
        'JackServerAPI.cpp',
        'JackDriverLoader.cpp',
        'JackServerGlobals.cpp',
sletz's avatar
sletz committed
114
        'JackControlAPI.cpp',
115
        'JackNetTool.cpp',
moret's avatar
moret committed
116
        'JackNetInterface.cpp',
117
        'JackArgParser.cpp',
nedko's avatar
nedko committed
118
        ]
119

120
    if bld.env['IS_LINUX']:
121
        serverlib.source += [
122
123
124
125
            '../posix/JackSocketServerChannel.cpp',
            '../posix/JackSocketNotifyChannel.cpp',
            '../posix/JackSocketServerNotifyChannel.cpp',
            '../posix/JackNetUnixSocket.cpp',
126
127
            ]

128
    if bld.env['IS_MACOSX']:
129
130
131
132
133
134
        serverlib.source += [
            '../macosx/JackMachServerChannel.cpp',
            '../macosx/JackMachNotifyChannel.cpp',
            '../macosx/JackMachServerNotifyChannel.cpp',
            '../macosx/JackMacEngineRPC.cpp',
            '../macosx/RPC/JackRPCClientUser.c',
135
            '../posix/JackNetUnixSocket.cpp',
136
137
            ]

138
    serverlib.vnum = bld.env['JACK_API_VERSION']
139
    serverlib.env.append_value("CPPFLAGS", "-fvisibility=hidden")
140
    if bld.env['IS_MACOSX']:
sletz's avatar
sletz committed
141
        serverlib.env.append_value("CPPFLAGS", "-mmacosx-version-min=10.4 -arch i386 -arch ppc")
sletz's avatar
sletz committed
142
143
        #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
144
	serverlib.env.append_value("LINKFLAGS", "-compatibility_version 1 -current_version 1")
nedko's avatar
nedko committed
145

146
    clientlib = bld.new_task_gen('cxx', 'shlib')
nedko's avatar
nedko committed
147
148
    clientlib.features.append('cc')
    clientlib.defines = 'HAVE_CONFIG_H'
149
    clientlib.uselib = uselib
150
    clientlib.install_path = '${LIBDIR}'
151
    if bld.env['BUILD_JACKDBUS'] == True:
nedko's avatar
nedko committed
152
        clientlib.uselib.append('DBUS-1')
153
    clientlib.includes = includes
nedko's avatar
nedko committed
154
155
156
157
158
159
160
    clientlib.name         = 'clientlib'
    clientlib.target       = 'jack'
    clientlib.source = [] + common_libsources
    clientlib.source += [
        'JackLibClient.cpp',
        'JackLibAPI.cpp',
        ]
161

162
    if bld.env['IS_LINUX']:
163
        clientlib.source += [
164
            '../posix/JackSocketClientChannel.cpp',
sletz's avatar
sletz committed
165
            '../posix/JackPosixServerLaunch.cpp',
166
167
            ]

168
    if bld.env['IS_MACOSX']:
169
170
171
172
        clientlib.source += [
            '../macosx/JackMachClientChannel.cpp',
            '../macosx/RPC/JackRPCEngineUser.c',
            '../macosx/JackMacLibClientRPC.cpp',
sletz's avatar
sletz committed
173
            '../posix/JackPosixServerLaunch.cpp',
174
175
            ]

176
    clientlib.vnum = bld.env['JACK_API_VERSION']
177
    clientlib.env.append_value("CPPFLAGS", "-fvisibility=hidden")
178
    if bld.env['IS_MACOSX']:
sletz's avatar
sletz committed
179
        clientlib.env.append_value("CPPFLAGS", "-mmacosx-version-min=10.4 -arch i386 -arch ppc")
sletz's avatar
sletz committed
180
181
        #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
182
        clientlib.env.append_value("LINKFLAGS", "-compatibility_version 1 -current_version 1")
183

sletz's avatar
sletz committed
184
185
    create_jack_process_obj(bld, 'netmanager', 'JackNetManager.cpp', serverlib)

186
    net_adapter_sources = [
sletz's avatar
sletz committed
187
188
        'JackResampler.cpp',
        'JackLibSampleRateResampler.cpp',
189
        'JackAudioAdapter.cpp',
190
191
192
193
        'JackAudioAdapterInterface.cpp',
        'JackNetAdapter.cpp',
        ]

194
    if bld.env['BUILD_ADAPTER'] == True:
195
196
        process = create_jack_process_obj(bld, 'netadapter', net_adapter_sources, serverlib)
        process.uselib = 'SAMPLERATE'
197
198
199
200

    audio_adapter_sources = [
        'JackResampler.cpp',
        'JackLibSampleRateResampler.cpp',
201
        'JackAudioAdapter.cpp',
sletz's avatar
sletz committed
202
        'JackAudioAdapterInterface.cpp',
203
        'JackAudioAdapterFactory.cpp',
sletz's avatar
sletz committed
204
        ]
sletz's avatar
sletz committed
205

206
    if bld.env['BUILD_ADAPTER'] and bld.env['IS_MACOSX']:
207
         audio_adapter_sources += ['../macosx/coreaudio/JackCoreAudioAdapter.cpp']
208
         process = create_jack_process_obj(bld, 'audioadapter', audio_adapter_sources, serverlib)
209
210
         process.env.append_value("LINKFLAGS", "-framework CoreAudio -framework AudioUnit -framework AudioToolbox -framework CoreServices")
         process.uselib = 'SAMPLERATE'
moret's avatar
moret committed
211

212
    if bld.env['BUILD_ADAPTER'] and bld.env['IS_LINUX']:
213
214
         audio_adapter_sources += ['../linux/alsa/JackAlsaAdapter.cpp']
         process = create_jack_process_obj(bld, 'audioadapter', audio_adapter_sources, serverlib)
215
         process.uselib = ['ALSA', 'SAMPLERATE']
moret's avatar
moret committed
216

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

220
    bld.install_files('${PREFIX}/include/jack', 'jack/*.h')
nedko's avatar
nedko committed
221
222

    # process jack.pc.in -> jack.pc
223
224
    import misc
    obj = bld.new_task_gen('subst')
nedko's avatar
nedko committed
225
226
    obj.source = '../jack.pc.in'
    obj.target = 'jack.pc'
227
    obj.dict = {'PREFIX': bld.env['PREFIX'],
228
                'LIBDIR': bld.env['LIBDIR'],
229
                'INCLUDEDIR': os.path.normpath(bld.env['PREFIX'] + '/include'),
nedko's avatar
nedko committed
230
                'SERVERLIB': serverlib.target,
231
                'JACK_VERSION': bld.env['JACK_VERSION'],
nedko's avatar
nedko committed
232
                }
233
    obj.install_path = '${LIBDIR}/pkgconfig/'
234
    obj.fun = misc.subst_func