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('--dbus', action
='store_true', default
=False, help='Enable D-Bus JACK (jackdbus)')
65 opt
.add_option('--classic', action
='store_true', default
=False, help='Force enable standard JACK (jackd) even if D-Bus JACK (jackdbus) is enabled too')
66 opt
.add_option('--doxygen', action
='store_true', default
=False, help='Enable build of doxygen documentation')
67 opt
.add_option('--profile', action
='store_true', default
=False, help='Build with engine profiling')
68 opt
.add_option('--mixed', action
='store_true', default
=False, help='Build with 32/64 bits mixed mode')
69 opt
.add_option('--clients', default
=64, type="int", dest
="clients", help='Maximum number of JACK clients')
70 opt
.add_option('--ports', default
=1024, type="int", dest
="ports", help='Maximum number of ports')
71 opt
.sub_options('dbus')
74 platform
= Utils
.detect_platform()
75 conf
.env
['IS_MACOSX'] = platform
== 'darwin'
76 conf
.env
['IS_LINUX'] = platform
== 'linux'
77 conf
.env
['IS_SUN'] = platform
== 'sunos'
79 if conf
.env
['IS_LINUX']:
80 Utils
.pprint('CYAN', "Linux detected")
82 if conf
.env
['IS_MACOSX']:
83 Utils
.pprint('CYAN', "MacOS X detected")
85 if conf
.env
['IS_SUN']:
86 Utils
.pprint('CYAN', "SunOS detected")
88 if conf
.env
['IS_LINUX']:
89 conf
.check_tool('compiler_cxx')
90 conf
.check_tool('compiler_cc')
92 if conf
.env
['IS_MACOSX']:
93 conf
.check_tool('compiler_cxx')
94 conf
.check_tool('compiler_cc')
96 # waf 1.5 : check_tool('compiler_cxx') and check_tool('compiler_cc') do not work correctly, so explicit use of gcc and g++
97 if conf
.env
['IS_SUN']:
98 conf
.check_tool('g++')
99 conf
.check_tool('gcc')
101 #if conf.env['IS_SUN']:
102 # conf.check_tool('compiler_cxx')
103 # conf.check_tool('compiler_cc')
105 conf
.env
.append_unique('CXXFLAGS', '-O3 -Wall')
106 conf
.env
.append_unique('CCFLAGS', '-O3 -Wall')
108 conf
.sub_config('common')
109 if conf
.env
['IS_LINUX']:
110 conf
.sub_config('linux')
111 if Options
.options
.dbus
:
112 conf
.sub_config('dbus')
113 conf
.sub_config('example-clients')
115 conf
.env
['LIB_PTHREAD'] = ['pthread']
116 conf
.env
['LIB_DL'] = ['dl']
117 conf
.env
['LIB_RT'] = ['rt']
118 conf
.env
['JACK_API_VERSION'] = JACK_API_VERSION
119 conf
.env
['JACK_VERSION'] = VERSION
121 conf
.env
['BUILD_DOXYGEN_DOCS'] = Options
.options
.doxygen
122 conf
.env
['BUILD_WITH_PROFILE'] = Options
.options
.profile
123 conf
.env
['BUILD_WITH_32_64'] = Options
.options
.mixed
124 conf
.env
['BUILD_JACKDBUS'] = Options
.options
.dbus
125 conf
.env
['BUILD_CLASSIC'] = Options
.options
.classic
127 if conf
.env
['BUILD_JACKDBUS']:
128 conf
.env
['BUILD_JACKD'] = conf
.env
['BUILD_CLASSIC']
130 conf
.env
['BUILD_JACKD'] = True
132 if Options
.options
.libdir
:
133 conf
.env
['LIBDIR'] = Options
.options
.libdir
135 conf
.env
['LIBDIR'] = conf
.env
['PREFIX'] + '/lib/'
137 conf
.define('CLIENT_NUM', Options
.options
.clients
)
138 conf
.define('PORT_NUM', Options
.options
. ports
)
140 conf
.define('ADDON_DIR', os
.path
.normpath(os
.path
.join(conf
.env
['LIBDIR'], 'jack')))
141 conf
.define('JACK_LOCATION', os
.path
.normpath(os
.path
.join(conf
.env
['PREFIX'], 'bin')))
142 conf
.define('USE_POSIX_SHM', 1)
143 conf
.define('JACKMP', 1)
144 if conf
.env
['BUILD_JACKDBUS'] == True:
145 conf
.define('JACK_DBUS', 1)
146 if conf
.env
['BUILD_JACKD'] == False:
147 conf
.define('USE_LIBDBUS_AUTOLAUNCH', 1)
148 if conf
.env
['BUILD_WITH_PROFILE'] == True:
149 conf
.define('JACK_MONITOR', 1)
150 if conf
.env
['BUILD_WITH_32_64'] == True:
151 conf
.define('JACK_32_64', 1)
152 conf
.write_config_header('config.h')
155 if os
.access('svnversion.h', os
.R_OK
):
156 data
= file('svnversion.h').read()
157 m
= re
.match(r
'^#define SVN_VERSION "([^"]*)"$', data
)
162 display_msg("==================")
163 version_msg
= "JACK " + VERSION
165 version_msg
+= " exported from r" + svnrev
167 version_msg
+= " svn revision will checked and eventually updated during build"
170 print "Build with a maximum of %d JACK clients" % conf
.env
['CLIENT_NUM']
171 print "Build with a maximum of %d ports" % conf
.env
['PORT_NUM']
173 display_msg("Install prefix", conf
.env
['PREFIX'], 'CYAN')
174 display_msg("Library directory", conf
.env
['LIBDIR'], 'CYAN')
175 display_msg("Drivers directory", conf
.env
['ADDON_DIR'], 'CYAN')
176 display_feature('Build doxygen documentation', conf
.env
['BUILD_DOXYGEN_DOCS'])
177 display_feature('Build with engine profiling', conf
.env
['BUILD_WITH_PROFILE'])
178 display_feature('Build with 32/64 bits mixed mode', conf
.env
['BUILD_WITH_32_64'])
180 display_feature('Build standard JACK (jackd)', conf
.env
['BUILD_JACKD'])
181 display_feature('Build D-Bus JACK (jackdbus)', conf
.env
['BUILD_JACKDBUS'])
183 if conf
.env
['BUILD_JACKDBUS'] and conf
.env
['BUILD_JACKD']:
184 print Logs
.colors
.RED
+ 'WARNING !! mixing both jackd and jackdbus may cause issues!' + Logs
.colors
.NORMAL
186 if conf
.env
['IS_LINUX']:
187 display_feature('Build with ALSA support', conf
.env
['BUILD_DRIVER_ALSA'] == True)
188 display_feature('Build with FireWire (FreeBob) support', conf
.env
['BUILD_DRIVER_FREEBOB'] == True)
189 display_feature('Build with FireWire (FFADO) support', conf
.env
['BUILD_DRIVER_FFADO'] == True)
191 if conf
.env
['BUILD_JACKDBUS'] == True:
192 display_msg('D-Bus service install directory', conf
.env
['DBUS_SERVICES_DIR'], 'CYAN')
193 #display_msg('Settings persistence', xxx)
195 if conf
.env
['DBUS_SERVICES_DIR'] != conf
.env
['DBUS_SERVICES_DIR_REAL']:
197 print Logs
.colors
.RED
+ "WARNING: D-Bus session services directory as reported by pkg-config is"
198 print Logs
.colors
.RED
+ "WARNING:",
199 print Logs
.colors
.CYAN
+ conf
.env
['DBUS_SERVICES_DIR_REAL']
200 print Logs
.colors
.RED
+ 'WARNING: but service file will be installed in'
201 print Logs
.colors
.RED
+ "WARNING:",
202 print Logs
.colors
.CYAN
+ conf
.env
['DBUS_SERVICES_DIR']
203 print Logs
.colors
.RED
+ 'WARNING: You may need to adjust your D-Bus configuration after installing jackdbus'
204 print 'WARNING: You can override dbus service install directory'
205 print 'WARNING: with --enable-pkg-config-dbus-service-dir option to this script'
206 print Logs
.colors
.NORMAL
,
210 if not os
.access('svnversion.h', os
.R_OK
):
211 create_svnversion_task(bld
)
213 # process subfolders from here
214 bld
.add_subdirs('common')
215 if bld
.env
['IS_LINUX']:
216 bld
.add_subdirs('linux')
217 bld
.add_subdirs('example-clients')
218 bld
.add_subdirs('tests')
219 if bld
.env
['BUILD_JACKDBUS'] == True:
220 bld
.add_subdirs('dbus')
222 if bld
.env
['IS_MACOSX']:
223 bld
.add_subdirs('macosx')
224 bld
.add_subdirs('example-clients')
225 bld
.add_subdirs('tests')
226 if bld
.env
['BUILD_JACKDBUS'] == True:
227 bld
.add_subdirs('dbus')
229 if bld
.env
['IS_SUN']:
230 bld
.add_subdirs('solaris')
231 bld
.add_subdirs('example-clients')
232 bld
.add_subdirs('tests')
233 if bld
.env
['BUILD_JACKDBUS'] == True:
234 bld
.add_subdirs('dbus')
236 if bld
.env
['BUILD_DOXYGEN_DOCS'] == True:
237 share_dir
= bld
.env
.get_destdir() + bld
.env
['PREFIX'] + '/share/jack-audio-connection-kit'
238 html_docs_source_dir
= "build/default/html"
239 html_docs_install_dir
= share_dir
+ '/reference/html/'
240 if Options
.commands
['install']:
241 if os
.path
.isdir(html_docs_install_dir
):
242 Utils
.pprint('CYAN', "Removing old doxygen documentation installation...")
243 shutil
.rmtree(html_docs_install_dir
)
244 Utils
.pprint('CYAN', "Removing old doxygen documentation installation done.")
245 Utils
.pprint('CYAN', "Installing doxygen documentation...")
246 shutil
.copytree(html_docs_source_dir
, html_docs_install_dir
)
247 Utils
.pprint('CYAN', "Installing doxygen documentation done.")
248 elif Options
.commands
['uninstall']:
249 Utils
.pprint('CYAN', "Uninstalling doxygen documentation...")
250 if os
.path
.isdir(share_dir
):
251 shutil
.rmtree(share_dir
)
252 Utils
.pprint('CYAN', "Uninstalling doxygen documentation done.")
253 elif Options
.commands
['clean']:
254 if os
.access(html_docs_source_dir
, os
.R_OK
):
255 Utils
.pprint('CYAN', "Removing doxygen generated documentation...")
256 shutil
.rmtree(html_docs_source_dir
)
257 Utils
.pprint('CYAN', "Removing doxygen generated documentation done.")
258 elif Options
.commands
['build']:
259 if not os
.access(html_docs_source_dir
, os
.R_OK
):
260 os
.popen("doxygen").read()
262 Utils
.pprint('CYAN', "doxygen documentation already built.")
265 os
.remove('svnversion_regenerate.sh')
266 os
.system('../svnversion_regenerate.sh svnversion.h')