| 1 |
|
| 2 |
|
| 3 |
from __future__ import print_function |
| 4 |
|
| 5 |
import os |
| 6 |
import shutil |
| 7 |
import sys |
| 8 |
|
| 9 |
from waflib import Logs, Options, TaskGen |
| 10 |
from waflib.Build import BuildContext, CleanContext, InstallContext, UninstallContext |
| 11 |
|
| 12 |
|
| 13 |
VERSION = '1.9.22' |
| 14 |
APPNAME = 'jack' |
| 15 |
JACK_API_VERSION = '0.1.0' |
| 16 |
|
| 17 |
|
| 18 |
top = '.' |
| 19 |
out = 'build' |
| 20 |
|
| 21 |
|
| 22 |
lib32 = 'lib32' |
| 23 |
|
| 24 |
|
| 25 |
def display_feature(conf, msg, build): |
| 26 |
if build: |
| 27 |
conf.msg(msg, 'yes', color='GREEN') |
| 28 |
else: |
| 29 |
conf.msg(msg, 'no', color='YELLOW') |
| 30 |
|
| 31 |
|
| 32 |
def check_for_celt(conf): |
| 33 |
found = False |
| 34 |
for version in ['11', '8', '7', '5']: |
| 35 |
define = 'HAVE_CELT_API_0_' + version |
| 36 |
if not found: |
| 37 |
try: |
| 38 |
conf.check_cfg( |
| 39 |
package='celt >= 0.%s.0' % version, |
| 40 |
args='--cflags --libs') |
| 41 |
found = True |
| 42 |
conf.define(define, 1) |
| 43 |
continue |
| 44 |
except conf.errors.ConfigurationError: |
| 45 |
pass |
| 46 |
conf.define(define, 0) |
| 47 |
|
| 48 |
if not found: |
| 49 |
raise conf.errors.ConfigurationError |
| 50 |
|
| 51 |
|
| 52 |
def options(opt): |
| 53 |
|
| 54 |
opt.load('compiler_cxx') |
| 55 |
opt.load('compiler_c') |
| 56 |
opt.load('autooptions') |
| 57 |
|
| 58 |
opt.load('xcode6') |
| 59 |
|
| 60 |
opt.recurse('compat') |
| 61 |
|
| 62 |
|
| 63 |
opt.add_option( |
| 64 |
'--htmldir', |
| 65 |
type='string', |
| 66 |
default=None, |
| 67 |
help='HTML documentation directory [Default: <prefix>/share/jack-audio-connection-kit/reference/html/', |
| 68 |
) |
| 69 |
opt.add_option('--libdir', type='string', help='Library directory [Default: <prefix>/lib]') |
| 70 |
opt.add_option('--libdir32', type='string', help='32bit Library directory [Default: <prefix>/lib32]') |
| 71 |
opt.add_option('--pkgconfigdir', type='string', help='pkg-config file directory [Default: <libdir>/pkgconfig]') |
| 72 |
opt.add_option('--mandir', type='string', help='Manpage directory [Default: <prefix>/share/man/man1]') |
| 73 |
|
| 74 |
|
| 75 |
opt.add_option( |
| 76 |
'--platform', |
| 77 |
type='string', |
| 78 |
default=sys.platform, |
| 79 |
help='Target platform for cross-compiling, e.g. cygwin or win32', |
| 80 |
) |
| 81 |
opt.add_option('--mixed', action='store_true', default=False, help='Build with 32/64 bits mixed mode') |
| 82 |
opt.add_option('--debug', action='store_true', default=False, dest='debug', help='Build debuggable binaries') |
| 83 |
opt.add_option( |
| 84 |
'--static', |
| 85 |
action='store_true', |
| 86 |
default=False, |
| 87 |
dest='static', |
| 88 |
help='Build static binaries (Windows only)', |
| 89 |
) |
| 90 |
|
| 91 |
|
| 92 |
opt.add_option( |
| 93 |
'--classic', |
| 94 |
action='store_true', |
| 95 |
default=False, |
| 96 |
help='Force enable standard JACK (jackd) even if D-Bus JACK (jackdbus) is enabled too', |
| 97 |
) |
| 98 |
opt.add_option('--dbus', action='store_true', default=False, help='Enable D-Bus JACK (jackdbus)') |
| 99 |
opt.add_option( |
| 100 |
'--autostart', |
| 101 |
type='string', |
| 102 |
default='default', |
| 103 |
help='Autostart method. Possible values: "default", "classic", "dbus", "none"', |
| 104 |
) |
| 105 |
opt.add_option('--profile', action='store_true', default=False, help='Build with engine profiling') |
| 106 |
opt.add_option('--clients', default=256, type='int', dest='clients', help='Maximum number of JACK clients') |
| 107 |
opt.add_option( |
| 108 |
'--ports-per-application', |
| 109 |
default=2048, |
| 110 |
type='int', |
| 111 |
dest='application_ports', |
| 112 |
help='Maximum number of ports per application', |
| 113 |
) |
| 114 |
opt.add_option('--systemd-unit', action='store_true', default=False, help='Install systemd units.') |
| 115 |
|
| 116 |
opt.set_auto_options_define('HAVE_%s') |
| 117 |
opt.set_auto_options_style('yesno_and_hack') |
| 118 |
|
| 119 |
|
| 120 |
doxygen = opt.add_auto_option( |
| 121 |
'doxygen', |
| 122 |
help='Build doxygen documentation', |
| 123 |
conf_dest='BUILD_DOXYGEN_DOCS', |
| 124 |
default=False) |
| 125 |
doxygen.find_program('doxygen') |
| 126 |
alsa = opt.add_auto_option( |
| 127 |
'alsa', |
| 128 |
help='Enable ALSA driver', |
| 129 |
conf_dest='BUILD_DRIVER_ALSA') |
| 130 |
alsa.check_cfg( |
| 131 |
package='alsa >= 1.0.18', |
| 132 |
args='--cflags --libs') |
| 133 |
firewire = opt.add_auto_option( |
| 134 |
'firewire', |
| 135 |
help='Enable FireWire driver (FFADO)', |
| 136 |
conf_dest='BUILD_DRIVER_FFADO') |
| 137 |
firewire.check_cfg( |
| 138 |
package='libffado >= 1.999.17', |
| 139 |
args='--cflags --libs') |
| 140 |
iio = opt.add_auto_option( |
| 141 |
'iio', |
| 142 |
help='Enable IIO driver', |
| 143 |
conf_dest='BUILD_DRIVER_IIO') |
| 144 |
iio.check_cfg( |
| 145 |
package='gtkIOStream >= 1.4.0', |
| 146 |
args='--cflags --libs') |
| 147 |
iio.check_cfg( |
| 148 |
package='eigen3 >= 3.1.2', |
| 149 |
args='--cflags --libs') |
| 150 |
portaudio = opt.add_auto_option( |
| 151 |
'portaudio', |
| 152 |
help='Enable Portaudio driver', |
| 153 |
conf_dest='BUILD_DRIVER_PORTAUDIO') |
| 154 |
portaudio.check(header_name='windows.h') |
| 155 |
portaudio.check_cfg( |
| 156 |
package='portaudio-2.0 >= 19', |
| 157 |
uselib_store='PORTAUDIO', |
| 158 |
args='--cflags --libs') |
| 159 |
winmme = opt.add_auto_option( |
| 160 |
'winmme', |
| 161 |
help='Enable WinMME driver', |
| 162 |
conf_dest='BUILD_DRIVER_WINMME') |
| 163 |
winmme.check( |
| 164 |
header_name=['windows.h', 'mmsystem.h'], |
| 165 |
msg='Checking for header mmsystem.h') |
| 166 |
|
| 167 |
celt = opt.add_auto_option( |
| 168 |
'celt', |
| 169 |
help='Build with CELT') |
| 170 |
celt.add_function(check_for_celt) |
| 171 |
opt.add_auto_option( |
| 172 |
'tests', |
| 173 |
help='Build tests', |
| 174 |
conf_dest='BUILD_TESTS', |
| 175 |
default=False, |
| 176 |
) |
| 177 |
|
| 178 |
|
| 179 |
opus = opt.add_auto_option( |
| 180 |
'opus', |
| 181 |
help='Build Opus netjack2') |
| 182 |
opus.check(header_name='opus/opus_custom.h') |
| 183 |
opus.check_cfg( |
| 184 |
package='opus >= 0.9.0', |
| 185 |
args='--cflags --libs', |
| 186 |
define_name='HAVE_OPUS_PKG') |
| 187 |
|
| 188 |
samplerate = opt.add_auto_option( |
| 189 |
'samplerate', |
| 190 |
help='Build with libsamplerate') |
| 191 |
samplerate.check_cfg( |
| 192 |
package='samplerate', |
| 193 |
args='--cflags --libs') |
| 194 |
sd = opt.add_auto_option( |
| 195 |
'systemd', |
| 196 |
help='Use systemd notify') |
| 197 |
sd.check(header_name='systemd/sd-daemon.h') |
| 198 |
sd.check(lib='systemd') |
| 199 |
db = opt.add_auto_option( |
| 200 |
'db', |
| 201 |
help='Use Berkeley DB (metadata)') |
| 202 |
db.check(header_name='db.h') |
| 203 |
db.check(lib='db') |
| 204 |
|
| 205 |
|
| 206 |
opt.recurse('dbus') |
| 207 |
|
| 208 |
|
| 209 |
opt.apply_auto_options_hack() |
| 210 |
|
| 211 |
|
| 212 |
def detect_platform(conf): |
| 213 |
|
| 214 |
platforms = [ |
| 215 |
|
| 216 |
('IS_LINUX', 'Linux', ['gnu0', 'gnukfreebsd', 'linux', 'posix']), |
| 217 |
('IS_FREEBSD', 'FreeBSD', ['freebsd']), |
| 218 |
('IS_MACOSX', 'MacOS X', ['darwin']), |
| 219 |
('IS_SUN', 'SunOS', ['sunos']), |
| 220 |
('IS_WINDOWS', 'Windows', ['cygwin', 'msys', 'win32']) |
| 221 |
] |
| 222 |
|
| 223 |
for key, name, strings in platforms: |
| 224 |
conf.env[key] = False |
| 225 |
|
| 226 |
conf.start_msg('Checking platform') |
| 227 |
platform = Options.options.platform |
| 228 |
for key, name, strings in platforms: |
| 229 |
for s in strings: |
| 230 |
if platform.startswith(s): |
| 231 |
conf.env[key] = True |
| 232 |
conf.end_msg(name, color='CYAN') |
| 233 |
break |
| 234 |
|
| 235 |
|
| 236 |
def configure(conf): |
| 237 |
conf.load('compiler_cxx') |
| 238 |
conf.load('compiler_c') |
| 239 |
|
| 240 |
detect_platform(conf) |
| 241 |
|
| 242 |
if conf.env['IS_WINDOWS']: |
| 243 |
conf.env.append_unique('CCDEFINES', '_POSIX') |
| 244 |
conf.env.append_unique('CXXDEFINES', '_POSIX') |
| 245 |
if Options.options.platform in ('msys', 'win32'): |
| 246 |
conf.env.append_value('INCLUDES', ['/mingw64/include']) |
| 247 |
conf.check( |
| 248 |
header_name='pa_asio.h', |
| 249 |
msg='Checking for PortAudio ASIO support', |
| 250 |
define_name='HAVE_ASIO', |
| 251 |
mandatory=False) |
| 252 |
|
| 253 |
conf.env.append_unique('CFLAGS', '-Wall') |
| 254 |
conf.env.append_unique('CXXFLAGS', ['-Wall', '-Wno-invalid-offsetof']) |
| 255 |
conf.env.append_unique('CXXFLAGS', '-std=gnu++11') |
| 256 |
|
| 257 |
if conf.env['IS_FREEBSD']: |
| 258 |
conf.check(lib='execinfo', uselib='EXECINFO', define_name='EXECINFO') |
| 259 |
conf.check_cfg(package='libsysinfo', args='--cflags --libs') |
| 260 |
|
| 261 |
if not conf.env['IS_MACOSX']: |
| 262 |
conf.env.append_unique('LDFLAGS', '-Wl,--no-undefined') |
| 263 |
else: |
| 264 |
conf.check(lib='aften', uselib='AFTEN', define_name='AFTEN') |
| 265 |
conf.check_cxx( |
| 266 |
fragment='' |
| 267 |
+ '#include <aften/aften.h>\n' |
| 268 |
+ 'int\n' |
| 269 |
+ 'main(void)\n' |
| 270 |
+ '{\n' |
| 271 |
+ 'AftenContext fAftenContext;\n' |
| 272 |
+ 'aften_set_defaults(&fAftenContext);\n' |
| 273 |
+ 'unsigned char *fb;\n' |
| 274 |
+ 'float *buf=new float[10];\n' |
| 275 |
+ 'int res = aften_encode_frame(&fAftenContext, fb, buf, 1);\n' |
| 276 |
+ '}\n', |
| 277 |
lib='aften', |
| 278 |
msg='Checking for aften_encode_frame()', |
| 279 |
define_name='HAVE_AFTEN_NEW_API', |
| 280 |
mandatory=False) |
| 281 |
|
| 282 |
|
| 283 |
conf.env.append_unique('CXXFLAGS', '-Wno-deprecated-register') |
| 284 |
|
| 285 |
conf.load('autooptions') |
| 286 |
|
| 287 |
conf.recurse('compat') |
| 288 |
|
| 289 |
|
| 290 |
conf.check( |
| 291 |
fragment='' |
| 292 |
+ '#define _GNU_SOURCE\n' |
| 293 |
+ '#include <poll.h>\n' |
| 294 |
+ '#include <signal.h>\n' |
| 295 |
+ '#include <stddef.h>\n' |
| 296 |
+ 'int\n' |
| 297 |
+ 'main(void)\n' |
| 298 |
+ '{\n' |
| 299 |
+ ' ppoll(NULL, 0, NULL, NULL);\n' |
| 300 |
+ '}\n', |
| 301 |
msg='Checking for ppoll', |
| 302 |
define_name='HAVE_PPOLL', |
| 303 |
mandatory=False) |
| 304 |
|
| 305 |
|
| 306 |
conf.check( |
| 307 |
header_name='execinfo.h', |
| 308 |
define_name='HAVE_EXECINFO_H', |
| 309 |
mandatory=False) |
| 310 |
|
| 311 |
conf.recurse('common') |
| 312 |
if Options.options.dbus: |
| 313 |
conf.recurse('dbus') |
| 314 |
if not conf.env['BUILD_JACKDBUS']: |
| 315 |
conf.fatal('jackdbus was explicitly requested but cannot be built') |
| 316 |
if conf.env['IS_LINUX']: |
| 317 |
if Options.options.systemd_unit: |
| 318 |
conf.recurse('systemd') |
| 319 |
else: |
| 320 |
conf.env['SYSTEMD_USER_UNIT_DIR'] = None |
| 321 |
|
| 322 |
|
| 323 |
for t in ['gp_regs', 'uc_regs', 'mc_gregs', 'gregs']: |
| 324 |
fragment = '#include <ucontext.h>\n' |
| 325 |
fragment += 'int main() { ucontext_t *ucontext; return (int) ucontext->uc_mcontext.%s[0]; }' % t |
| 326 |
confvar = 'HAVE_UCONTEXT_%s' % t.upper() |
| 327 |
conf.check_cc(fragment=fragment, define_name=confvar, mandatory=False, |
| 328 |
msg='Checking for ucontext->uc_mcontext.%s' % t) |
| 329 |
if conf.is_defined(confvar): |
| 330 |
conf.define('HAVE_UCONTEXT', 1) |
| 331 |
|
| 332 |
fragment = '#include <ucontext.h>\n' |
| 333 |
fragment += 'int main() { return NGREG; }' |
| 334 |
conf.check_cc(fragment=fragment, define_name='HAVE_NGREG', mandatory=False, |
| 335 |
msg='Checking for NGREG') |
| 336 |
|
| 337 |
conf.env['LIB_PTHREAD'] = ['pthread'] |
| 338 |
conf.env['LIB_DL'] = ['dl'] |
| 339 |
conf.env['LIB_RT'] = ['rt'] |
| 340 |
conf.env['LIB_M'] = ['m'] |
| 341 |
conf.env['LIB_STDC++'] = ['stdc++'] |
| 342 |
conf.env['JACK_API_VERSION'] = JACK_API_VERSION |
| 343 |
conf.env['JACK_VERSION'] = VERSION |
| 344 |
|
| 345 |
conf.env['BUILD_WITH_PROFILE'] = Options.options.profile |
| 346 |
conf.env['BUILD_WITH_32_64'] = Options.options.mixed |
| 347 |
conf.env['BUILD_CLASSIC'] = Options.options.classic |
| 348 |
conf.env['BUILD_DEBUG'] = Options.options.debug |
| 349 |
conf.env['BUILD_STATIC'] = Options.options.static |
| 350 |
|
| 351 |
if conf.env['BUILD_JACKDBUS']: |
| 352 |
conf.env['BUILD_JACKD'] = conf.env['BUILD_CLASSIC'] |
| 353 |
else: |
| 354 |
conf.env['BUILD_JACKD'] = True |
| 355 |
|
| 356 |
conf.env['BINDIR'] = conf.env['PREFIX'] + '/bin' |
| 357 |
|
| 358 |
if Options.options.htmldir: |
| 359 |
conf.env['HTMLDIR'] = Options.options.htmldir |
| 360 |
else: |
| 361 |
|
| 362 |
|
| 363 |
conf.env['HTMLDIR'] = None |
| 364 |
|
| 365 |
if Options.options.libdir: |
| 366 |
conf.env['LIBDIR'] = Options.options.libdir |
| 367 |
else: |
| 368 |
conf.env['LIBDIR'] = conf.env['PREFIX'] + '/lib' |
| 369 |
|
| 370 |
if Options.options.pkgconfigdir: |
| 371 |
conf.env['PKGCONFDIR'] = Options.options.pkgconfigdir |
| 372 |
else: |
| 373 |
conf.env['PKGCONFDIR'] = conf.env['LIBDIR'] + '/pkgconfig' |
| 374 |
|
| 375 |
if Options.options.mandir: |
| 376 |
conf.env['MANDIR'] = Options.options.mandir |
| 377 |
else: |
| 378 |
conf.env['MANDIR'] = conf.env['PREFIX'] + '/share/man/man1' |
| 379 |
|
| 380 |
if conf.env['BUILD_DEBUG']: |
| 381 |
conf.env.append_unique('CXXFLAGS', '-g') |
| 382 |
conf.env.append_unique('CFLAGS', '-g') |
| 383 |
conf.env.append_unique('LINKFLAGS', '-g') |
| 384 |
|
| 385 |
if Options.options.autostart not in ['default', 'classic', 'dbus', 'none']: |
| 386 |
conf.fatal('Invalid autostart value "' + Options.options.autostart + '"') |
| 387 |
|
| 388 |
if Options.options.autostart == 'default': |
| 389 |
if conf.env['BUILD_JACKD']: |
| 390 |
conf.env['AUTOSTART_METHOD'] = 'classic' |
| 391 |
else: |
| 392 |
conf.env['AUTOSTART_METHOD'] = 'dbus' |
| 393 |
else: |
| 394 |
conf.env['AUTOSTART_METHOD'] = Options.options.autostart |
| 395 |
|
| 396 |
if conf.env['AUTOSTART_METHOD'] == 'dbus' and not conf.env['BUILD_JACKDBUS']: |
| 397 |
conf.fatal('D-Bus autostart mode was specified but jackdbus will not be built') |
| 398 |
if conf.env['AUTOSTART_METHOD'] == 'classic' and not conf.env['BUILD_JACKD']: |
| 399 |
conf.fatal('Classic autostart mode was specified but jackd will not be built') |
| 400 |
|
| 401 |
if conf.env['AUTOSTART_METHOD'] == 'dbus': |
| 402 |
conf.define('USE_LIBDBUS_AUTOLAUNCH', 1) |
| 403 |
elif conf.env['AUTOSTART_METHOD'] == 'classic': |
| 404 |
conf.define('USE_CLASSIC_AUTOLAUNCH', 1) |
| 405 |
|
| 406 |
conf.define('CLIENT_NUM', Options.options.clients) |
| 407 |
conf.define('PORT_NUM_FOR_CLIENT', Options.options.application_ports) |
| 408 |
|
| 409 |
if conf.env['IS_WINDOWS']: |
| 410 |
|
| 411 |
|
| 412 |
|
| 413 |
conf.env['ADDON_DIR'] = conf.env['LIBDIR'] + '/jack' |
| 414 |
if Options.options.platform in ('msys', 'win32'): |
| 415 |
conf.define('ADDON_DIR', 'jack') |
| 416 |
conf.define('__STDC_FORMAT_MACROS', 1) |
| 417 |
else: |
| 418 |
|
| 419 |
|
| 420 |
pass |
| 421 |
else: |
| 422 |
conf.env['ADDON_DIR'] = os.path.normpath(os.path.join(conf.env['LIBDIR'], 'jack')) |
| 423 |
conf.define('ADDON_DIR', conf.env['ADDON_DIR']) |
| 424 |
conf.define('JACK_LOCATION', os.path.normpath(os.path.join(conf.env['PREFIX'], 'bin'))) |
| 425 |
|
| 426 |
if not conf.env['IS_WINDOWS']: |
| 427 |
conf.define('USE_POSIX_SHM', 1) |
| 428 |
conf.define('JACKMP', 1) |
| 429 |
if conf.env['BUILD_JACKDBUS']: |
| 430 |
conf.define('JACK_DBUS', 1) |
| 431 |
if conf.env['BUILD_WITH_PROFILE']: |
| 432 |
conf.define('JACK_MONITOR', 1) |
| 433 |
conf.write_config_header('config.h', remove=False) |
| 434 |
|
| 435 |
if Options.options.mixed: |
| 436 |
conf.setenv(lib32, env=conf.env.derive()) |
| 437 |
conf.env.append_unique('CFLAGS', '-m32') |
| 438 |
conf.env.append_unique('CXXFLAGS', '-m32') |
| 439 |
conf.env.append_unique('CXXFLAGS', '-DBUILD_WITH_32_64') |
| 440 |
conf.env.append_unique('LINKFLAGS', '-m32') |
| 441 |
if Options.options.libdir32: |
| 442 |
conf.env['LIBDIR'] = Options.options.libdir32 |
| 443 |
else: |
| 444 |
conf.env['LIBDIR'] = conf.env['PREFIX'] + '/lib32' |
| 445 |
|
| 446 |
if conf.env['IS_WINDOWS'] and conf.env['BUILD_STATIC']: |
| 447 |
def replaceFor32bit(env): |
| 448 |
for e in env: |
| 449 |
yield e.replace('x86_64', 'i686', 1) |
| 450 |
for env in ('AR', 'CC', 'CXX', 'LINK_CC', 'LINK_CXX'): |
| 451 |
conf.all_envs[lib32][env] = list(replaceFor32bit(conf.all_envs[lib32][env])) |
| 452 |
conf.all_envs[lib32]['LIB_REGEX'] = ['tre32'] |
| 453 |
|
| 454 |
|
| 455 |
conf.all_envs[lib32]['HAVE_DB'] = 0 |
| 456 |
conf.all_envs[lib32]['HAVE_DB_H'] = 0 |
| 457 |
conf.all_envs[lib32]['LIB_DB'] = [] |
| 458 |
|
| 459 |
conf.all_envs[lib32]['LIB_OPUS'] = [] |
| 460 |
|
| 461 |
conf.write_config_header('config.h') |
| 462 |
|
| 463 |
print() |
| 464 |
print('JACK ' + VERSION) |
| 465 |
|
| 466 |
conf.msg('Maximum JACK clients', Options.options.clients, color='NORMAL') |
| 467 |
conf.msg('Maximum ports per application', Options.options.application_ports, color='NORMAL') |
| 468 |
|
| 469 |
conf.msg('Install prefix', conf.env['PREFIX'], color='CYAN') |
| 470 |
conf.msg('Library directory', conf.all_envs['']['LIBDIR'], color='CYAN') |
| 471 |
if conf.env['BUILD_WITH_32_64']: |
| 472 |
conf.msg('32-bit library directory', conf.all_envs[lib32]['LIBDIR'], color='CYAN') |
| 473 |
conf.msg('Drivers directory', conf.env['ADDON_DIR'], color='CYAN') |
| 474 |
display_feature(conf, 'Build debuggable binaries', conf.env['BUILD_DEBUG']) |
| 475 |
|
| 476 |
tool_flags = [ |
| 477 |
('C compiler flags', ['CFLAGS', 'CPPFLAGS']), |
| 478 |
('C++ compiler flags', ['CXXFLAGS', 'CPPFLAGS']), |
| 479 |
('Linker flags', ['LINKFLAGS', 'LDFLAGS']) |
| 480 |
] |
| 481 |
for name, vars in tool_flags: |
| 482 |
flags = [] |
| 483 |
for var in vars: |
| 484 |
flags += conf.all_envs[''][var] |
| 485 |
conf.msg(name, repr(flags), color='NORMAL') |
| 486 |
|
| 487 |
if conf.env['BUILD_WITH_32_64']: |
| 488 |
conf.msg('32-bit C compiler flags', repr(conf.all_envs[lib32]['CFLAGS'])) |
| 489 |
conf.msg('32-bit C++ compiler flags', repr(conf.all_envs[lib32]['CXXFLAGS'])) |
| 490 |
conf.msg('32-bit linker flags', repr(conf.all_envs[lib32]['LINKFLAGS'])) |
| 491 |
display_feature(conf, 'Build with engine profiling', conf.env['BUILD_WITH_PROFILE']) |
| 492 |
display_feature(conf, 'Build with 32/64 bits mixed mode', conf.env['BUILD_WITH_32_64']) |
| 493 |
|
| 494 |
display_feature(conf, 'Build standard JACK (jackd)', conf.env['BUILD_JACKD']) |
| 495 |
display_feature(conf, 'Build D-Bus JACK (jackdbus)', conf.env['BUILD_JACKDBUS']) |
| 496 |
conf.msg('Autostart method', conf.env['AUTOSTART_METHOD']) |
| 497 |
|
| 498 |
if conf.env['BUILD_JACKDBUS'] and conf.env['BUILD_JACKD']: |
| 499 |
print(Logs.colors.RED + 'WARNING !! mixing both jackd and jackdbus may cause issues:' + Logs.colors.NORMAL) |
| 500 |
print(Logs.colors.RED + 'WARNING !! jackdbus does not use .jackdrc nor qjackctl settings' + Logs.colors.NORMAL) |
| 501 |
|
| 502 |
conf.summarize_auto_options() |
| 503 |
|
| 504 |
if conf.env['BUILD_JACKDBUS']: |
| 505 |
conf.msg('D-Bus service install directory', conf.env['DBUS_SERVICES_DIR'], color='CYAN') |
| 506 |
|
| 507 |
if conf.env['DBUS_SERVICES_DIR'] != conf.env['DBUS_SERVICES_DIR_REAL']: |
| 508 |
print() |
| 509 |
print(Logs.colors.RED + 'WARNING: D-Bus session services directory as reported by pkg-config is') |
| 510 |
print(Logs.colors.RED + 'WARNING:', end=' ') |
| 511 |
print(Logs.colors.CYAN + conf.env['DBUS_SERVICES_DIR_REAL']) |
| 512 |
print(Logs.colors.RED + 'WARNING: but service file will be installed in') |
| 513 |
print(Logs.colors.RED + 'WARNING:', end=' ') |
| 514 |
print(Logs.colors.CYAN + conf.env['DBUS_SERVICES_DIR']) |
| 515 |
print( |
| 516 |
Logs.colors.RED + 'WARNING: You may need to adjust your D-Bus configuration after installing jackdbus' |
| 517 |
) |
| 518 |
print('WARNING: You can override dbus service install directory') |
| 519 |
print('WARNING: with --enable-pkg-config-dbus-service-dir option to this script') |
| 520 |
print(Logs.colors.NORMAL, end=' ') |
| 521 |
print() |
| 522 |
|
| 523 |
|
| 524 |
def init(ctx): |
| 525 |
for y in (BuildContext, CleanContext, InstallContext, UninstallContext): |
| 526 |
name = y.__name__.replace('Context', '').lower() |
| 527 |
|
| 528 |
class tmp(y): |
| 529 |
cmd = name + '_' + lib32 |
| 530 |
variant = lib32 |
| 531 |
|
| 532 |
|
| 533 |
def obj_add_includes(bld, obj): |
| 534 |
if bld.env['BUILD_JACKDBUS']: |
| 535 |
obj.includes += ['dbus'] |
| 536 |
|
| 537 |
if bld.env['IS_LINUX']: |
| 538 |
obj.includes += ['linux', 'posix'] |
| 539 |
|
| 540 |
if bld.env['IS_FREEBSD']: |
| 541 |
obj.includes += ['freebsd', 'posix'] |
| 542 |
|
| 543 |
if bld.env['IS_MACOSX']: |
| 544 |
obj.includes += ['macosx', 'posix'] |
| 545 |
|
| 546 |
if bld.env['IS_SUN']: |
| 547 |
obj.includes += ['posix', 'solaris'] |
| 548 |
|
| 549 |
if bld.env['IS_WINDOWS']: |
| 550 |
obj.includes += ['windows'] |
| 551 |
|
| 552 |
|
| 553 |
|
| 554 |
def build_jackd(bld): |
| 555 |
jackd = bld( |
| 556 |
features=['cxx', 'cxxprogram'], |
| 557 |
defines=['HAVE_CONFIG_H', 'SERVER_SIDE'], |
| 558 |
includes=['.', 'common', 'common/jack'], |
| 559 |
target='jackd', |
| 560 |
source=['common/Jackdmp.cpp'], |
| 561 |
use=['serverlib', 'SYSTEMD'] |
| 562 |
) |
| 563 |
|
| 564 |
if bld.env['BUILD_JACKDBUS']: |
| 565 |
jackd.source += ['dbus/audio_reserve.c', 'dbus/reserve.c'] |
| 566 |
jackd.use += ['DBUS-1'] |
| 567 |
|
| 568 |
if bld.env['IS_LINUX']: |
| 569 |
jackd.use += ['DL', 'M', 'PTHREAD', 'RT', 'STDC++'] |
| 570 |
|
| 571 |
if bld.env['IS_FREEBSD']: |
| 572 |
jackd.use += ['M', 'PTHREAD'] |
| 573 |
|
| 574 |
if bld.env['IS_MACOSX']: |
| 575 |
jackd.use += ['DL', 'PTHREAD'] |
| 576 |
jackd.framework = ['CoreFoundation'] |
| 577 |
|
| 578 |
if bld.env['IS_SUN']: |
| 579 |
jackd.use += ['DL', 'PTHREAD'] |
| 580 |
|
| 581 |
obj_add_includes(bld, jackd) |
| 582 |
|
| 583 |
return jackd |
| 584 |
|
| 585 |
|
| 586 |
|
| 587 |
def create_driver_obj(bld, **kw): |
| 588 |
if 'use' in kw: |
| 589 |
kw['use'] += ['serverlib'] |
| 590 |
else: |
| 591 |
kw['use'] = ['serverlib'] |
| 592 |
|
| 593 |
driver = bld( |
| 594 |
features=['c', 'cxx', 'cshlib', 'cxxshlib'], |
| 595 |
defines=['HAVE_CONFIG_H', 'SERVER_SIDE'], |
| 596 |
includes=['.', 'common', 'common/jack'], |
| 597 |
install_path='${ADDON_DIR}/', |
| 598 |
**kw) |
| 599 |
|
| 600 |
if bld.env['IS_WINDOWS']: |
| 601 |
driver.env['cxxshlib_PATTERN'] = 'jack_%s.dll' |
| 602 |
else: |
| 603 |
driver.env['cxxshlib_PATTERN'] = 'jack_%s.so' |
| 604 |
|
| 605 |
obj_add_includes(bld, driver) |
| 606 |
|
| 607 |
return driver |
| 608 |
|
| 609 |
|
| 610 |
def build_drivers(bld): |
| 611 |
|
| 612 |
dummy_src = [ |
| 613 |
'common/JackDummyDriver.cpp' |
| 614 |
] |
| 615 |
|
| 616 |
loopback_src = [ |
| 617 |
'common/JackLoopbackDriver.cpp' |
| 618 |
] |
| 619 |
|
| 620 |
net_src = [ |
| 621 |
'common/JackNetDriver.cpp' |
| 622 |
] |
| 623 |
|
| 624 |
netone_src = [ |
| 625 |
'common/JackNetOneDriver.cpp', |
| 626 |
'common/netjack.c', |
| 627 |
'common/netjack_packet.c' |
| 628 |
] |
| 629 |
|
| 630 |
proxy_src = [ |
| 631 |
'common/JackProxyDriver.cpp' |
| 632 |
] |
| 633 |
|
| 634 |
|
| 635 |
alsa_src = [ |
| 636 |
'common/memops.c', |
| 637 |
'linux/alsa/JackAlsaDriver.cpp', |
| 638 |
'linux/alsa/alsa_rawmidi.c', |
| 639 |
'linux/alsa/alsa_seqmidi.c', |
| 640 |
'linux/alsa/alsa_midi_jackmp.cpp', |
| 641 |
'linux/alsa/generic_hw.c', |
| 642 |
'linux/alsa/hdsp.c', |
| 643 |
'linux/alsa/alsa_driver.c', |
| 644 |
'linux/alsa/hammerfall.c', |
| 645 |
'linux/alsa/ice1712.c' |
| 646 |
] |
| 647 |
|
| 648 |
alsarawmidi_src = [ |
| 649 |
'linux/alsarawmidi/JackALSARawMidiDriver.cpp', |
| 650 |
'linux/alsarawmidi/JackALSARawMidiInputPort.cpp', |
| 651 |
'linux/alsarawmidi/JackALSARawMidiOutputPort.cpp', |
| 652 |
'linux/alsarawmidi/JackALSARawMidiPort.cpp', |
| 653 |
'linux/alsarawmidi/JackALSARawMidiReceiveQueue.cpp', |
| 654 |
'linux/alsarawmidi/JackALSARawMidiSendQueue.cpp', |
| 655 |
'linux/alsarawmidi/JackALSARawMidiUtil.cpp' |
| 656 |
] |
| 657 |
|
| 658 |
boomer_src = [ |
| 659 |
'common/memops.c', |
| 660 |
'solaris/oss/JackBoomerDriver.cpp' |
| 661 |
] |
| 662 |
|
| 663 |
coreaudio_src = [ |
| 664 |
'macosx/coreaudio/JackCoreAudioDriver.mm', |
| 665 |
'common/JackAC3Encoder.cpp' |
| 666 |
] |
| 667 |
|
| 668 |
coremidi_src = [ |
| 669 |
'macosx/coremidi/JackCoreMidiInputPort.mm', |
| 670 |
'macosx/coremidi/JackCoreMidiOutputPort.mm', |
| 671 |
'macosx/coremidi/JackCoreMidiPhysicalInputPort.mm', |
| 672 |
'macosx/coremidi/JackCoreMidiPhysicalOutputPort.mm', |
| 673 |
'macosx/coremidi/JackCoreMidiVirtualInputPort.mm', |
| 674 |
'macosx/coremidi/JackCoreMidiVirtualOutputPort.mm', |
| 675 |
'macosx/coremidi/JackCoreMidiPort.mm', |
| 676 |
'macosx/coremidi/JackCoreMidiUtil.mm', |
| 677 |
'macosx/coremidi/JackCoreMidiDriver.mm' |
| 678 |
] |
| 679 |
|
| 680 |
ffado_src = [ |
| 681 |
'linux/firewire/JackFFADODriver.cpp', |
| 682 |
'linux/firewire/JackFFADOMidiInputPort.cpp', |
| 683 |
'linux/firewire/JackFFADOMidiOutputPort.cpp', |
| 684 |
'linux/firewire/JackFFADOMidiReceiveQueue.cpp', |
| 685 |
'linux/firewire/JackFFADOMidiSendQueue.cpp' |
| 686 |
] |
| 687 |
|
| 688 |
freebsd_oss_src = [ |
| 689 |
'common/memops.c', |
| 690 |
'freebsd/oss/JackOSSDriver.cpp' |
| 691 |
] |
| 692 |
|
| 693 |
iio_driver_src = [ |
| 694 |
'linux/iio/JackIIODriver.cpp' |
| 695 |
] |
| 696 |
|
| 697 |
oss_src = [ |
| 698 |
'common/memops.c', |
| 699 |
'solaris/oss/JackOSSDriver.cpp' |
| 700 |
] |
| 701 |
|
| 702 |
portaudio_src = [ |
| 703 |
'windows/portaudio/JackPortAudioDevices.cpp', |
| 704 |
'windows/portaudio/JackPortAudioDriver.cpp', |
| 705 |
] |
| 706 |
|
| 707 |
winmme_src = [ |
| 708 |
'windows/winmme/JackWinMMEDriver.cpp', |
| 709 |
'windows/winmme/JackWinMMEInputPort.cpp', |
| 710 |
'windows/winmme/JackWinMMEOutputPort.cpp', |
| 711 |
'windows/winmme/JackWinMMEPort.cpp', |
| 712 |
] |
| 713 |
|
| 714 |
|
| 715 |
create_driver_obj( |
| 716 |
bld, |
| 717 |
target='dummy', |
| 718 |
source=dummy_src) |
| 719 |
|
| 720 |
create_driver_obj( |
| 721 |
bld, |
| 722 |
target='loopback', |
| 723 |
source=loopback_src) |
| 724 |
|
| 725 |
create_driver_obj( |
| 726 |
bld, |
| 727 |
target='net', |
| 728 |
source=net_src, |
| 729 |
use=['CELT']) |
| 730 |
|
| 731 |
create_driver_obj( |
| 732 |
bld, |
| 733 |
target='netone', |
| 734 |
source=netone_src, |
| 735 |
use=['SAMPLERATE', 'CELT']) |
| 736 |
|
| 737 |
create_driver_obj( |
| 738 |
bld, |
| 739 |
target='proxy', |
| 740 |
source=proxy_src) |
| 741 |
|
| 742 |
|
| 743 |
|
| 744 |
if bld.env['BUILD_DRIVER_ALSA']: |
| 745 |
create_driver_obj( |
| 746 |
bld, |
| 747 |
target='alsa', |
| 748 |
source=alsa_src, |
| 749 |
use=['ALSA']) |
| 750 |
create_driver_obj( |
| 751 |
bld, |
| 752 |
target='alsarawmidi', |
| 753 |
source=alsarawmidi_src, |
| 754 |
use=['ALSA']) |
| 755 |
|
| 756 |
if bld.env['BUILD_DRIVER_FFADO']: |
| 757 |
create_driver_obj( |
| 758 |
bld, |
| 759 |
target='firewire', |
| 760 |
source=ffado_src, |
| 761 |
use=['LIBFFADO']) |
| 762 |
|
| 763 |
if bld.env['BUILD_DRIVER_IIO']: |
| 764 |
create_driver_obj( |
| 765 |
bld, |
| 766 |
target='iio', |
| 767 |
source=iio_driver_src, |
| 768 |
use=['GTKIOSTREAM', 'EIGEN3']) |
| 769 |
|
| 770 |
if bld.env['BUILD_DRIVER_PORTAUDIO']: |
| 771 |
create_driver_obj( |
| 772 |
bld, |
| 773 |
target='portaudio', |
| 774 |
source=portaudio_src, |
| 775 |
use=['PORTAUDIO']) |
| 776 |
|
| 777 |
if bld.env['BUILD_DRIVER_WINMME']: |
| 778 |
create_driver_obj( |
| 779 |
bld, |
| 780 |
target='winmme', |
| 781 |
source=winmme_src, |
| 782 |
use=['WINMME']) |
| 783 |
|
| 784 |
if bld.env['IS_MACOSX']: |
| 785 |
create_driver_obj( |
| 786 |
bld, |
| 787 |
target='coreaudio', |
| 788 |
source=coreaudio_src, |
| 789 |
use=['AFTEN'], |
| 790 |
framework=['AudioUnit', 'CoreAudio', 'CoreServices']) |
| 791 |
|
| 792 |
create_driver_obj( |
| 793 |
bld, |
| 794 |
target='coremidi', |
| 795 |
source=coremidi_src, |
| 796 |
use=['serverlib'], |
| 797 |
framework=['AudioUnit', 'CoreMIDI', 'CoreServices', 'Foundation']) |
| 798 |
|
| 799 |
if bld.env['IS_FREEBSD']: |
| 800 |
create_driver_obj( |
| 801 |
bld, |
| 802 |
target='oss', |
| 803 |
source=freebsd_oss_src) |
| 804 |
|
| 805 |
if bld.env['IS_SUN']: |
| 806 |
create_driver_obj( |
| 807 |
bld, |
| 808 |
target='boomer', |
| 809 |
source=boomer_src) |
| 810 |
create_driver_obj( |
| 811 |
bld, |
| 812 |
target='oss', |
| 813 |
source=oss_src) |
| 814 |
|
| 815 |
|
| 816 |
def build(bld): |
| 817 |
if not bld.variant and bld.env['BUILD_WITH_32_64']: |
| 818 |
Options.commands.append(bld.cmd + '_' + lib32) |
| 819 |
|
| 820 |
|
| 821 |
bld.recurse('common') |
| 822 |
|
| 823 |
if bld.variant: |
| 824 |
|
| 825 |
return |
| 826 |
|
| 827 |
bld.recurse('compat') |
| 828 |
|
| 829 |
if bld.env['BUILD_JACKD']: |
| 830 |
build_jackd(bld) |
| 831 |
|
| 832 |
build_drivers(bld) |
| 833 |
|
| 834 |
if bld.env['IS_LINUX'] or bld.env['IS_FREEBSD']: |
| 835 |
bld.recurse('man') |
| 836 |
bld.recurse('systemd') |
| 837 |
if not bld.env['IS_WINDOWS'] and bld.env['BUILD_TESTS']: |
| 838 |
bld.recurse('tests') |
| 839 |
if bld.env['BUILD_JACKDBUS']: |
| 840 |
bld.recurse('dbus') |
| 841 |
|
| 842 |
if bld.env['BUILD_DOXYGEN_DOCS']: |
| 843 |
html_build_dir = bld.path.find_or_declare('html').abspath() |
| 844 |
|
| 845 |
bld( |
| 846 |
features='subst', |
| 847 |
source='doxyfile.in', |
| 848 |
target='doxyfile', |
| 849 |
HTML_BUILD_DIR=html_build_dir, |
| 850 |
SRCDIR=bld.srcnode.abspath(), |
| 851 |
VERSION=VERSION |
| 852 |
) |
| 853 |
|
| 854 |
|
| 855 |
|
| 856 |
|
| 857 |
|
| 858 |
|
| 859 |
|
| 860 |
def doxygen(task): |
| 861 |
doxyfile = task.inputs[0].abspath() |
| 862 |
logfile = task.outputs[0].abspath() |
| 863 |
cmd = '%s %s &> %s' % (task.env['DOXYGEN'][0], doxyfile, logfile) |
| 864 |
return task.exec_command(cmd) |
| 865 |
|
| 866 |
bld( |
| 867 |
rule=doxygen, |
| 868 |
source='doxyfile', |
| 869 |
target='doxygen.log' |
| 870 |
) |
| 871 |
|
| 872 |
|
| 873 |
|
| 874 |
|
| 875 |
|
| 876 |
if bld.env['HTMLDIR']: |
| 877 |
html_install_dir = bld.options.destdir + bld.env['HTMLDIR'] |
| 878 |
share_dir = html_install_dir |
| 879 |
else: |
| 880 |
share_dir = bld.options.destdir + bld.env['PREFIX'] + '/share/jack-audio-connection-kit' |
| 881 |
html_install_dir = share_dir + '/reference/html/' |
| 882 |
|
| 883 |
if bld.cmd == 'install': |
| 884 |
if os.path.isdir(html_install_dir): |
| 885 |
Logs.pprint('CYAN', 'Removing old doxygen documentation installation...') |
| 886 |
shutil.rmtree(html_install_dir) |
| 887 |
Logs.pprint('CYAN', 'Removing old doxygen documentation installation done.') |
| 888 |
Logs.pprint('CYAN', 'Installing doxygen documentation...') |
| 889 |
shutil.copytree(html_build_dir, html_install_dir) |
| 890 |
Logs.pprint('CYAN', 'Installing doxygen documentation done.') |
| 891 |
elif bld.cmd == 'uninstall': |
| 892 |
Logs.pprint('CYAN', 'Uninstalling doxygen documentation...') |
| 893 |
if os.path.isdir(share_dir): |
| 894 |
shutil.rmtree(share_dir) |
| 895 |
Logs.pprint('CYAN', 'Uninstalling doxygen documentation done.') |
| 896 |
elif bld.cmd == 'clean': |
| 897 |
if os.access(html_build_dir, os.R_OK): |
| 898 |
Logs.pprint('CYAN', 'Removing doxygen generated documentation...') |
| 899 |
shutil.rmtree(html_build_dir) |
| 900 |
Logs.pprint('CYAN', 'Removing doxygen generated documentation done.') |
| 901 |
|
| 902 |
|
| 903 |
@TaskGen.extension('.mm') |
| 904 |
def mm_hook(self, node): |
| 905 |
"""Alias .mm files to be compiled the same as .cpp files, gcc will do the right thing.""" |
| 906 |
return self.create_compiled_task('cxx', node) |