jack_verbose moved to JackGlobals class.
[jack2.git] / common / wscript
blob6089ff819aacec820d17dd63413e3131ede8a771
1 #! /usr/bin/env python
2 # encoding: utf-8
4 import Build
5 import re
6 import os
8 def configure(conf):
9 conf.check_cc(header_name='samplerate.h', define_name="HAVE_SAMPLERATE")
11 if conf.is_defined('HAVE_SAMPLERATE'):
12 conf.env['LIB_SAMPLERATE'] = ['samplerate']
14 conf.env['BUILD_ADAPTER'] = conf.is_defined('HAVE_SAMPLERATE')
16 def create_jack_process_obj(bld, target, sources, uselib = None):
17 process = bld.new_task_gen('cxx', 'shlib')
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']
24 if bld.env['IS_SUN']:
25 env_includes = ['../solaris', '../posix', '../solaris/oss']
26 process.includes = ['.'] + env_includes + ['jack', '..']
27 process.name = target
28 process.target = target
29 process.source = sources
30 if bld.env['IS_LINUX']:
31 process.env.append_value("CPPFLAGS", "-fvisibility=hidden")
32 if bld.env['IS_MACOSX']:
33 process.env.append_value("CPPFLAGS", "-mmacosx-version-min=10.4 -arch i386 -arch ppc")
34 #process.env.append_value("LINKFLAGS", "-arch i386 -arch ppc")
35 process.env.append_value("CPPFLAGS", "-fvisibility=hidden")
36 process.install_path = '${ADDON_DIR}/'
37 process.uselib_local = uselib.name
38 return process
40 def build(bld):
41 common_libsources = [
42 'JackActivationCount.cpp',
43 'JackAPI.cpp',
44 'JackClient.cpp',
45 'JackConnectionManager.cpp',
46 'ringbuffer.c',
47 'JackError.cpp',
48 'JackFrameTimer.cpp',
49 'JackGraphManager.cpp',
50 'JackPort.cpp',
51 'JackPortType.cpp',
52 'JackAudioPort.cpp',
53 'JackMidiPort.cpp',
54 'JackMidiAPI.cpp',
55 'JackEngineControl.cpp',
56 'JackShmMem.cpp',
57 'shm.c',
58 'JackGlobals.cpp',
59 'JackDebugClient.cpp',
60 'JackTransportEngine.cpp',
61 'timestamps.c',
62 'JackTools.cpp',
63 'JackMessageBuffer.cpp',
64 'JackEngineProfiling.cpp',
67 includes = ['.', './jack', '..']
68 uselib = ["PTHREAD"]
70 if bld.env['IS_LINUX']:
71 common_libsources += [
72 '../posix/JackPosixThread.cpp',
73 '../posix/JackPosixSemaphore.cpp',
74 '../posix/JackFifo.cpp',
75 '../posix/JackProcessSync.cpp',
76 '../posix/JackSocket.cpp',
77 '../linux/JackLinuxTime.c',
79 includes = ['../linux', '../posix'] + includes
80 uselib.append('RT')
81 uselib.append('DL')
83 if bld.env['IS_SUN']:
84 common_libsources += [
85 '../posix/JackPosixThread.cpp',
86 '../posix/JackFifo.cpp',
87 '../posix/JackProcessSync.cpp',
88 '../posix/JackSocket.cpp',
89 '../solaris/JackSolarisTime.c',
91 includes = ['../solaris', '../posix'] + includes
92 uselib.append('RT')
94 if bld.env['IS_MACOSX']:
95 common_libsources += [
96 '../posix/JackProcessSync.cpp',
97 '../posix/JackPosixThread.cpp',
98 '../macosx/JackMachThread.cpp',
99 '../macosx/JackMachSemaphore.cpp',
100 '../macosx/JackMachPort.cpp',
101 '../macosx/JackMachTime.c',
103 includes = ['../macosx', '../macosx/RPC', '../posix'] + includes
105 serverlib = bld.new_task_gen('cxx', 'shlib')
106 serverlib.features.append('cc')
107 serverlib.defines = ['HAVE_CONFIG_H','SERVER_SIDE']
108 serverlib.includes = includes
109 serverlib.name = 'serverlib'
110 serverlib.target = 'jackserver'
111 serverlib.uselib = uselib
112 serverlib.install_path = '${LIBDIR}'
113 serverlib.source = [] + common_libsources
114 serverlib.source += [
115 'JackAudioDriver.cpp',
116 'JackMidiDriver.cpp',
117 'JackDriver.cpp',
118 'JackEngine.cpp',
119 'JackExternalClient.cpp',
120 'JackFreewheelDriver.cpp',
121 'JackInternalClient.cpp',
122 'JackServer.cpp',
123 'JackThreadedDriver.cpp',
124 'JackRestartThreadedDriver.cpp',
125 'JackWaitThreadedDriver.cpp',
126 'JackServerAPI.cpp',
127 'JackDriverLoader.cpp',
128 'JackServerGlobals.cpp',
129 'JackControlAPI.cpp',
130 'JackNetTool.cpp',
131 'JackNetInterface.cpp',
132 'JackArgParser.cpp',
133 'JackDummyDriver.cpp',
136 if bld.env['IS_LINUX']:
137 serverlib.source += [
138 '../posix/JackSocketServerChannel.cpp',
139 '../posix/JackSocketNotifyChannel.cpp',
140 '../posix/JackSocketServerNotifyChannel.cpp',
141 '../posix/JackNetUnixSocket.cpp',
144 if bld.env['IS_SUN']:
145 serverlib.source += [
146 '../posix/JackSocketServerChannel.cpp',
147 '../posix/JackSocketNotifyChannel.cpp',
148 '../posix/JackSocketServerNotifyChannel.cpp',
149 '../posix/JackNetUnixSocket.cpp',
152 if bld.env['IS_MACOSX']:
153 serverlib.source += [
154 '../macosx/JackMachServerChannel.cpp',
155 '../macosx/JackMachNotifyChannel.cpp',
156 '../macosx/JackMachServerNotifyChannel.cpp',
157 '../macosx/JackMacEngineRPC.cpp',
158 '../macosx/RPC/JackRPCClientUser.c',
159 '../posix/JackNetUnixSocket.cpp',
162 serverlib.vnum = bld.env['JACK_API_VERSION']
164 if bld.env['IS_LINUX']:
165 serverlib.env.append_value("CPPFLAGS", "-fvisibility=hidden")
167 if bld.env['IS_MACOSX']:
168 serverlib.env.append_value("CPPFLAGS", "-fvisibility=hidden")
169 serverlib.env.append_value("CPPFLAGS", "-mmacosx-version-min=10.4 -arch i386 -arch ppc")
170 #serverlib.env.append_value("LINKFLAGS", "-framework CoreAudio -framework vecLib -single_module -arch i386 -arch ppc")
171 serverlib.env.append_value("LINKFLAGS", "-framework CoreAudio -framework CoreFoundation -framework vecLib -single_module")
172 serverlib.env.append_value("LINKFLAGS", "-compatibility_version 1 -current_version 1")
174 if bld.env['IS_SUN']:
175 serverlib.env.append_value("LINKFLAGS", "-lnsl -lsocket")
177 clientlib = bld.new_task_gen('cxx', 'shlib')
178 clientlib.features.append('cc')
179 clientlib.defines = 'HAVE_CONFIG_H'
180 clientlib.uselib = uselib
181 clientlib.install_path = '${LIBDIR}'
182 if bld.env['BUILD_JACKDBUS'] == True and bld.env['BUILD_JACKD'] == False:
183 clientlib.uselib.append('DBUS-1')
184 clientlib.includes = includes
185 clientlib.name = 'clientlib'
186 clientlib.target = 'jack'
187 clientlib.source = [] + common_libsources
188 clientlib.source += [
189 'JackLibClient.cpp',
190 'JackLibAPI.cpp',
193 if bld.env['IS_LINUX']:
194 clientlib.source += [
195 '../posix/JackSocketClientChannel.cpp',
196 '../posix/JackPosixServerLaunch.cpp',
199 if bld.env['IS_SUN']:
200 clientlib.source += [
201 '../posix/JackSocketClientChannel.cpp',
202 '../posix/JackPosixServerLaunch.cpp',
205 if bld.env['IS_MACOSX']:
206 clientlib.source += [
207 '../macosx/JackMachClientChannel.cpp',
208 '../macosx/RPC/JackRPCEngineUser.c',
209 '../macosx/JackMacLibClientRPC.cpp',
210 '../posix/JackPosixServerLaunch.cpp',
213 clientlib.vnum = bld.env['JACK_API_VERSION']
215 if bld.env['IS_LINUX']:
216 clientlib.env.append_value("CPPFLAGS", "-fvisibility=hidden")
218 if bld.env['IS_MACOSX']:
219 clientlib.env.append_value("CPPFLAGS", "-fvisibility=hidden")
220 clientlib.env.append_value("CPPFLAGS", "-mmacosx-version-min=10.4 -arch i386 -arch ppc")
221 #clientlib.env.append_value("LINKFLAGS", "-framework CoreAudio -framework vecLib -single_module -arch i386 -arch ppc"
222 clientlib.env.append_value("LINKFLAGS", "-framework CoreAudio -framework vecLib -single_module")
223 clientlib.env.append_value("LINKFLAGS", "-compatibility_version 1 -current_version 1")
225 if bld.env['IS_SUN']:
226 clientlib.env.append_value("LINKFLAGS", "-lnsl -lsocket")
228 if bld.env['BUILD_WITH_32_64']:
229 print "create 32bit lib..."
230 clientlib32bit = clientlib.clone('lib32')
232 create_jack_process_obj(bld, 'netmanager', 'JackNetManager.cpp', serverlib)
234 create_jack_process_obj(bld, 'profiler', 'JackProfiler.cpp', serverlib)
236 net_adapter_sources = [
237 'JackResampler.cpp',
238 'JackLibSampleRateResampler.cpp',
239 'JackAudioAdapter.cpp',
240 'JackAudioAdapterInterface.cpp',
241 'JackNetAdapter.cpp',
244 if bld.env['BUILD_ADAPTER'] == True:
245 process = create_jack_process_obj(bld, 'netadapter', net_adapter_sources, serverlib)
246 process.uselib = 'SAMPLERATE'
248 audio_adapter_sources = [
249 'JackResampler.cpp',
250 'JackLibSampleRateResampler.cpp',
251 'JackAudioAdapter.cpp',
252 'JackAudioAdapterInterface.cpp',
253 'JackAudioAdapterFactory.cpp',
256 if bld.env['BUILD_ADAPTER'] and bld.env['IS_MACOSX']:
257 audio_adapter_sources += ['../macosx/coreaudio/JackCoreAudioAdapter.cpp']
258 process = create_jack_process_obj(bld, 'audioadapter', audio_adapter_sources, serverlib)
259 process.env.append_value("LINKFLAGS", "-framework CoreAudio -framework AudioUnit -framework AudioToolbox -framework CoreServices")
260 process.uselib = 'SAMPLERATE'
262 if bld.env['BUILD_ADAPTER'] and bld.env['IS_LINUX'] and bld.env['BUILD_DRIVER_ALSA']:
263 audio_adapter_sources += ['../linux/alsa/JackAlsaAdapter.cpp']
264 process = create_jack_process_obj(bld, 'audioadapter', audio_adapter_sources, serverlib)
265 process.uselib = ['ALSA', 'SAMPLERATE']
267 if bld.env['BUILD_ADAPTER'] and bld.env['IS_SUN']:
268 audio_adapter_sources += ['../solaris/oss/JackOSSAdapter.cpp', 'memops.c']
269 process = create_jack_process_obj(bld, 'audioadapter', audio_adapter_sources, serverlib)
270 process.uselib = 'SAMPLERATE'
272 #audio_adapter_sources += ['../windows/JackPortAudioAdapter.cpp']
273 #process = create_jack_process_obj(bld, 'audioadapter', audio_adapter_sources, serverlib)
275 bld.install_files('${PREFIX}/include/jack', 'jack/*.h')
277 # process jack.pc.in -> jack.pc
278 import misc
279 obj = bld.new_task_gen('subst')
280 obj.source = '../jack.pc.in'
281 obj.target = 'jack.pc'
282 obj.dict = {'PREFIX': bld.env['PREFIX'],
283 'LIBDIR': bld.env['LIBDIR'],
284 'INCLUDEDIR': os.path.normpath(bld.env['PREFIX'] + '/include'),
285 'SERVERLIB': serverlib.target,
286 'JACK_VERSION': bld.env['JACK_VERSION'],
288 obj.install_path = '${LIBDIR}/pkgconfig/'
289 obj.fun = misc.subst_func