16 JACK_API_VERSION
= '0.1.0'
18 # these variables are mandatory ('/' are converted automatically)
22 def display_msg(msg
, status
= None, color
= None):
25 g_maxlen
= max(g_maxlen
, len(msg
))
27 print "%s :" % msg
.ljust(g_maxlen
),
28 Utils
.pprint(color
, status
)
30 print "%s" % msg
.ljust(g_maxlen
)
32 def display_feature(msg
, build
):
34 display_msg(msg
, "yes", 'GREEN')
36 display_msg(msg
, "no", 'YELLOW')
38 def create_svnversion_task(bld
, header
='svnversion.h', define
=None):
39 import Constants
, Build
41 cmd
= '../svnversion_regenerate.sh ${TGT}'
45 cls
= Task
.simple_task_type('svnversion', cmd
, color
='BLUE', before
='cc')
46 cls
.runnable_status
= lambda self
: Constants
.RUN_ME
49 sg
= Utils
.h_file(self
.outputs
[0].abspath(self
.env
))
50 #print sg.encode('hex')
51 Build
.bld
.node_sigs
[self
.env
.variant()][self
.outputs
[0].id] = sg
52 cls
.post_run
= post_run
54 tsk
= cls(bld
.env
.copy())
56 tsk
.outputs
= [bld
.path
.find_or_declare(header
)]
59 # options provided by the modules
60 opt
.tool_options('compiler_cxx')
61 opt
.tool_options('compiler_cc')
63 opt
.add_option('--libdir', type='string', help="Library directory [Default: <prefix>/lib]")
64 opt
.add_option('--libdir32', type='string', help="32bit Library directory [Default: <prefix>/lib32]")
65 opt
.add_option('--dbus', action
='store_true', default
=False, help='Enable D-Bus JACK (jackdbus)')
66 opt
.add_option('--classic', action
='store_true', default
=False, help='Force enable standard JACK (jackd) even if D-Bus JACK (jackdbus) is enabled too')
67 opt
.add_option('--doxygen', action
='store_true', default
=False, help='Enable build of doxygen documentation')
68 opt
.add_option('--profile', action
='store_true', default
=False, help='Build with engine profiling')
69 opt
.add_option('--mixed', action
='store_true', default
=False, help='Build with 32/64 bits mixed mode')
70 opt
.add_option('--clients', default
=64, type="int", dest
="clients", help='Maximum number of JACK clients')
71 opt
.add_option('--ports-per-application', default
=768, type="int", dest
="application_ports", help='Maximum number of ports per application')
72 opt
.sub_options('dbus')
75 platform
= Utils
.detect_platform()
76 conf
.env
['IS_MACOSX'] = platform
== 'darwin'
77 conf
.env
['IS_LINUX'] = platform
== 'linux'
78 conf
.env
['IS_SUN'] = platform
== 'sunos'
80 if conf
.env
['IS_LINUX']:
81 Utils
.pprint('CYAN', "Linux detected")
83 if conf
.env
['IS_MACOSX']:
84 Utils
.pprint('CYAN', "MacOS X detected")
86 if conf
.env
['IS_SUN']:
87 Utils
.pprint('CYAN', "SunOS detected")
89 if conf
.env
['IS_LINUX']:
90 conf
.check_tool('compiler_cxx')
91 conf
.check_tool('compiler_cc')
93 if conf
.env
['IS_MACOSX']:
94 conf
.check_tool('compiler_cxx')
95 conf
.check_tool('compiler_cc')
97 # waf 1.5 : check_tool('compiler_cxx') and check_tool('compiler_cc') do not work correctly, so explicit use of gcc and g++
98 if conf
.env
['IS_SUN']:
99 conf
.check_tool('g++')
100 conf
.check_tool('gcc')
102 #if conf.env['IS_SUN']:
103 # conf.check_tool('compiler_cxx')
104 # conf.check_tool('compiler_cc')
106 conf
.env
.append_unique('CXXFLAGS', '-O3 -Wall')
107 conf
.env
.append_unique('CCFLAGS', '-O3 -Wall')
109 conf
.sub_config('common')
110 if conf
.env
['IS_LINUX']:
111 conf
.sub_config('linux')
112 if Options
.options
.dbus
:
113 conf
.sub_config('dbus')
114 conf
.sub_config('example-clients')
116 if conf
.check_cfg(package
='celt', atleast_version
='0.7.0', args
='--cflags --libs'):
117 conf
.define('HAVE_CELT', 1)
118 conf
.define('HAVE_CELT_API_0_7', 1)
119 conf
.define('HAVE_CELT_API_0_5', 0)
120 elif conf
.check_cfg(package
='celt', atleast_version
='0.5.0', args
='--cflags --libs', required
=True):
121 conf
.define('HAVE_CELT', 1)
122 conf
.define('HAVE_CELT_API_0_5', 1)
123 conf
.define('HAVE_CELT_API_0_7', 0)
125 conf
.define('HAVE_CELT', 0)
126 conf
.define('HAVE_CELT_API_0_5', 0)
127 conf
.define('HAVE_CELT_API_0_7', 0)
129 conf
.env
['LIB_PTHREAD'] = ['pthread']
130 conf
.env
['LIB_DL'] = ['dl']
131 conf
.env
['LIB_RT'] = ['rt']
132 conf
.env
['JACK_API_VERSION'] = JACK_API_VERSION
133 conf
.env
['JACK_VERSION'] = VERSION
135 conf
.env
['BUILD_DOXYGEN_DOCS'] = Options
.options
.doxygen
136 conf
.env
['BUILD_WITH_PROFILE'] = Options
.options
.profile
137 conf
.env
['BUILD_WITH_32_64'] = Options
.options
.mixed
138 conf
.env
['BUILD_JACKDBUS'] = Options
.options
.dbus
139 conf
.env
['BUILD_CLASSIC'] = Options
.options
.classic
141 if conf
.env
['BUILD_JACKDBUS']:
142 conf
.env
['BUILD_JACKD'] = conf
.env
['BUILD_CLASSIC']
144 conf
.env
['BUILD_JACKD'] = True
146 if Options
.options
.libdir
:
147 conf
.env
['LIBDIR'] = conf
.env
['PREFIX'] + Options
.options
.libdir
149 conf
.env
['LIBDIR'] = conf
.env
['PREFIX'] + '/lib'
151 conf
.define('CLIENT_NUM', Options
.options
.clients
)
152 conf
.define('PORT_NUM_FOR_CLIENT', Options
.options
.application_ports
)
154 conf
.define('ADDON_DIR', os
.path
.normpath(os
.path
.join(conf
.env
['LIBDIR'], 'jack')))
155 conf
.define('JACK_LOCATION', os
.path
.normpath(os
.path
.join(conf
.env
['PREFIX'], 'bin')))
156 conf
.define('USE_POSIX_SHM', 1)
157 conf
.define('JACKMP', 1)
158 if conf
.env
['BUILD_JACKDBUS'] == True:
159 conf
.define('JACK_DBUS', 1)
160 if conf
.env
['BUILD_JACKD'] == False:
161 conf
.define('USE_LIBDBUS_AUTOLAUNCH', 1)
162 if conf
.env
['BUILD_WITH_PROFILE'] == True:
163 conf
.define('JACK_MONITOR', 1)
164 if conf
.env
['BUILD_WITH_32_64'] == True:
165 conf
.define('JACK_32_64', 1)
166 conf
.write_config_header('config.h')
169 if os
.access('svnversion.h', os
.R_OK
):
170 data
= file('svnversion.h').read()
171 m
= re
.match(r
'^#define SVN_VERSION "([^"]*)"$', data
)
176 display_msg("==================")
177 version_msg
= "JACK " + VERSION
179 version_msg
+= " exported from r" + svnrev
181 version_msg
+= " svn revision will checked and eventually updated during build"
184 print "Build with a maximum of %d JACK clients" % conf
.env
['CLIENT_NUM']
185 print "Build with a maximum of %d ports per application" % conf
.env
['PORT_NUM_FOR_CLIENT']
187 display_msg("Install prefix", conf
.env
['PREFIX'], 'CYAN')
188 display_msg("Library directory", conf
.env
['LIBDIR'], 'CYAN')
189 display_msg("Drivers directory", conf
.env
['ADDON_DIR'], 'CYAN')
190 display_feature('Build doxygen documentation', conf
.env
['BUILD_DOXYGEN_DOCS'])
191 display_feature('Build with engine profiling', conf
.env
['BUILD_WITH_PROFILE'])
192 display_feature('Build with 32/64 bits mixed mode', conf
.env
['BUILD_WITH_32_64'])
194 display_feature('Build standard JACK (jackd)', conf
.env
['BUILD_JACKD'])
195 display_feature('Build D-Bus JACK (jackdbus)', conf
.env
['BUILD_JACKDBUS'])
197 if conf
.env
['BUILD_JACKDBUS'] and conf
.env
['BUILD_JACKD']:
198 print Logs
.colors
.RED
+ 'WARNING !! mixing both jackd and jackdbus may cause issues!' + Logs
.colors
.NORMAL
200 if conf
.env
['IS_LINUX']:
201 display_feature('Build with ALSA support', conf
.env
['BUILD_DRIVER_ALSA'] == True)
202 display_feature('Build with FireWire (FreeBob) support', conf
.env
['BUILD_DRIVER_FREEBOB'] == True)
203 display_feature('Build with FireWire (FFADO) support', conf
.env
['BUILD_DRIVER_FFADO'] == True)
205 if conf
.env
['BUILD_JACKDBUS'] == True:
206 display_msg('D-Bus service install directory', conf
.env
['DBUS_SERVICES_DIR'], 'CYAN')
207 #display_msg('Settings persistence', xxx)
209 if conf
.env
['DBUS_SERVICES_DIR'] != conf
.env
['DBUS_SERVICES_DIR_REAL']:
211 print Logs
.colors
.RED
+ "WARNING: D-Bus session services directory as reported by pkg-config is"
212 print Logs
.colors
.RED
+ "WARNING:",
213 print Logs
.colors
.CYAN
+ conf
.env
['DBUS_SERVICES_DIR_REAL']
214 print Logs
.colors
.RED
+ 'WARNING: but service file will be installed in'
215 print Logs
.colors
.RED
+ "WARNING:",
216 print Logs
.colors
.CYAN
+ conf
.env
['DBUS_SERVICES_DIR']
217 print Logs
.colors
.RED
+ 'WARNING: You may need to adjust your D-Bus configuration after installing jackdbus'
218 print 'WARNING: You can override dbus service install directory'
219 print 'WARNING: with --enable-pkg-config-dbus-service-dir option to this script'
220 print Logs
.colors
.NORMAL
,
223 if Options
.options
.mixed
== True:
224 env_variant2
= conf
.env
.copy()
225 conf
.set_env_name('lib32', env_variant2
)
226 env_variant2
.set_variant('lib32')
228 conf
.env
.append_unique('CXXFLAGS', '-m32')
229 conf
.env
.append_unique('CCFLAGS', '-m32')
230 conf
.env
.append_unique('LINKFLAGS', '-m32')
231 if Options
.options
.libdir32
:
232 conf
.env
['LIBDIR'] = conf
.env
['PREFIX'] + Options
.options
.libdir32
234 conf
.env
['LIBDIR'] = conf
.env
['PREFIX'] + '/lib32'
235 conf
.write_config_header('config.h')
238 print ("make[1]: Entering directory `" + os
.getcwd() + "/" + blddir
+ "'" )
239 if not os
.access('svnversion.h', os
.R_OK
):
240 create_svnversion_task(bld
)
242 # process subfolders from here
243 bld
.add_subdirs('common')
244 if bld
.env
['IS_LINUX']:
245 bld
.add_subdirs('linux')
246 bld
.add_subdirs('example-clients')
247 bld
.add_subdirs('tests')
248 if bld
.env
['BUILD_JACKDBUS'] == True:
249 bld
.add_subdirs('dbus')
251 if bld
.env
['IS_MACOSX']:
252 bld
.add_subdirs('macosx')
253 bld
.add_subdirs('example-clients')
254 bld
.add_subdirs('tests')
255 if bld
.env
['BUILD_JACKDBUS'] == True:
256 bld
.add_subdirs('dbus')
258 if bld
.env
['IS_SUN']:
259 bld
.add_subdirs('solaris')
260 bld
.add_subdirs('example-clients')
261 bld
.add_subdirs('tests')
262 if bld
.env
['BUILD_JACKDBUS'] == True:
263 bld
.add_subdirs('dbus')
265 if bld
.env
['BUILD_DOXYGEN_DOCS'] == True:
266 share_dir
= bld
.env
.get_destdir() + bld
.env
['PREFIX'] + '/share/jack-audio-connection-kit'
267 html_docs_source_dir
= "build/default/html"
268 html_docs_install_dir
= share_dir
+ '/reference/html/'
269 if Options
.commands
['install']:
270 if os
.path
.isdir(html_docs_install_dir
):
271 Utils
.pprint('CYAN', "Removing old doxygen documentation installation...")
272 shutil
.rmtree(html_docs_install_dir
)
273 Utils
.pprint('CYAN', "Removing old doxygen documentation installation done.")
274 Utils
.pprint('CYAN', "Installing doxygen documentation...")
275 shutil
.copytree(html_docs_source_dir
, html_docs_install_dir
)
276 Utils
.pprint('CYAN', "Installing doxygen documentation done.")
277 elif Options
.commands
['uninstall']:
278 Utils
.pprint('CYAN', "Uninstalling doxygen documentation...")
279 if os
.path
.isdir(share_dir
):
280 shutil
.rmtree(share_dir
)
281 Utils
.pprint('CYAN', "Uninstalling doxygen documentation done.")
282 elif Options
.commands
['clean']:
283 if os
.access(html_docs_source_dir
, os
.R_OK
):
284 Utils
.pprint('CYAN', "Removing doxygen generated documentation...")
285 shutil
.rmtree(html_docs_source_dir
)
286 Utils
.pprint('CYAN', "Removing doxygen generated documentation done.")
287 elif Options
.commands
['build']:
288 if not os
.access(html_docs_source_dir
, os
.R_OK
):
289 os
.popen("doxygen").read()
291 Utils
.pprint('CYAN', "doxygen documentation already built.")
294 os
.remove('svnversion_regenerate.sh')
295 os
.system('../svnversion_regenerate.sh svnversion.h')