2 from waflib.extras import autowaf as autowaf
3 from waflib import Options
9 import platform as PLATFORM
10 from waflib.Tools import winres
11 from waflib.Build import Context
12 from waflib.Build import BuildContext
14 class i18n(BuildContext):
18 class i18n_pot(BuildContext):
22 class i18n_po(BuildContext):
26 class i18n_mo(BuildContext):
30 def is_tracks_build(self, *k, **kw):
31 return self.env['PROGRAM_NAME'] == 'Tracks Live'
33 Context.Context.is_tracks_build = is_tracks_build
35 compiler_flags_dictionaries= {
37 # Flags required when building a debug build
38 'debuggable' : [ '-g' ],
39 # Flags required for the linker (if any) when building a debug build
40 'linker-debuggable' : '',
41 # Flags required when building a non-debug optimized build
42 'nondebuggable' : '-DNDEBUG',
43 # Flags required to enable profiling at runtime with optimized builds
44 'profile' : [ '-fno-omit-frame-pointer' ],
45 # Flags required to enable gprofile profiling
47 # Flags required to disable warnings about unused arguments to function calls
48 'silence-unused-arguments' : '',
49 # Flags required to use SSE unit for general math
51 # Flags required to use SSE unit for floating point math
52 'fpmath-sse' : '-mfpmath=sse',
53 # Flags required to use XMM Intrinsics
54 'xmmintrinsics' : '-DUSE_XMMINTRIN',
55 # Flags to use posix pipes between compiler stages
57 # Flags for maximally optimized build
58 'full-optimization' : [ '-O3', '-fomit-frame-pointer', '-ffast-math', '-fstrength-reduce', ],
59 # Flag to ensure that compiler error output includes column/line numbers
60 'show-column' : '-fshow-column',
61 # Flags required to build for x86 only (OS X feature)
63 # Flags required to build for PowerPC only (OS X feature)
65 # All flags required to get basic warnings to be generated by the compiler
66 'basic-warnings' : [ '-Wall', '-Wpointer-arith', '-Wcast-qual', '-Wcast-align', '-Wno-unused-parameter' ],
67 # Any additional flags for warnings that are specific to C (not C++)
68 'extra-c-warnings' : [ '-Wstrict-prototypes', '-Wmissing-prototypes' ],
69 # Any additional flags for warnings that are specific to C++ (not C)
70 'extra-cxx-warnings' : [ '-Woverloaded-virtual', '-Wno-unused-local-typedefs' ],
71 # Flags used for "strict" compilation, C and C++ (i.e. compiler will warn about language issues)
72 'strict' : ['-Wall', '-Wcast-align', '-Wextra', '-Wwrite-strings', '-Wunsafe-loop-optimizations', '-Wlogical-op' ],
73 # Flags used for "strict" compilation, C only (i.e. compiler will warn about language issues)
74 'c-strict' : ['-std=c99', '-pedantic', '-Wshadow'],
75 # Flags used for "strict" compilation, C++ only (i.e. compiler will warn about language issues)
76 'cxx-strict' : [ '-ansi', '-Wnon-virtual-dtor', '-Woverloaded-virtual', '-fstrict-overflow' ],
77 # Flags required for whatever consider the strictest possible compilation
78 'ultra-strict' : ['-Wredundant-decls', '-Wstrict-prototypes', '-Wmissing-prototypes'],
79 # Flag to turn on C99 compliance by itself
81 # Flag to enable AT&T assembler syntax
82 'attasm': '-masm=att',
83 # Flags to make AVX instructions/intrinsics available
85 # Flags to generate position independent code, when needed to build a shared object
87 # Flags required to compile C code with anonymous unions (only part of C11)
88 'c-anonymous-union': '-fms-extensions',
91 'debuggable' : ['/DDEBUG', '/Od', '/Zi', '/MDd', '/Gd', '/EHsc'],
92 'linker-debuggable' : ['/DEBUG', '/INCREMENTAL' ],
93 'nondebuggable' : ['/DNDEBUG', '/Ob1', '/MD', '/Gd', '/EHsc'],
96 'silence-unused-arguments' : '',
101 'full-optimization' : '/O2',
102 'no-frame-pointer' : '',
104 'strength-reduce' : '',
108 'basic-warnings' : '',
109 'extra-c-warnings' : '',
110 'extra-cxx-warnings' : '',
119 'c-anonymous-union': '',
123 # Copy, edit and insert variants on gcc dict for gcc-darwin and clang
125 gcc_darwin_dict = compiler_flags_dictionaries['gcc'].copy()
126 gcc_darwin_dict['extra-cxx-warnings'] = [ '-Woverloaded-virtual' ]
127 gcc_darwin_dict['cxx-strict'] = [ '-ansi', '-Wnon-virtual-dtor', '-Woverloaded-virtual' ]
128 gcc_darwin_dict['strict'] = ['-Wall', '-Wcast-align', '-Wextra', '-Wwrite-strings' ]
129 gcc_darwin_dict['generic-x86'] = [ '-arch', 'i386' ]
130 gcc_darwin_dict['generic-ppc'] = [ '-arch', 'ppc' ]
131 compiler_flags_dictionaries['gcc-darwin'] = gcc_darwin_dict;
133 clang_dict = compiler_flags_dictionaries['gcc'].copy();
134 clang_dict['sse'] = ''
135 clang_dict['fpmath-sse'] = ''
136 clang_dict['xmmintrinsics'] = ''
137 clang_dict['silence-unused-arguments'] = '-Qunused-arguments'
138 clang_dict['extra-cxx-warnings'] = [ '-Woverloaded-virtual', '-Wno-mismatched-tags', '-Wno-cast-align', '-Wno-unused-local-typedefs' ]
139 clang_dict['cxx-strict'] = [ '-ansi', '-Wnon-virtual-dtor', '-Woverloaded-virtual', '-fstrict-overflow' ]
140 clang_dict['strict'] = ['-Wall', '-Wcast-align', '-Wextra', '-Wwrite-strings' ]
141 clang_dict['generic-x86'] = [ '-arch', 'i386' ]
142 clang_dict['full-optimization'] = [ '-O3', '-fomit-frame-pointer', '-ffast-math', ]
143 compiler_flags_dictionaries['clang'] = clang_dict;
145 clang_darwin_dict = compiler_flags_dictionaries['clang'].copy();
146 clang_darwin_dict['cxx-strict'] = [ '-ansi', '-Wnon-virtual-dtor', '-Woverloaded-virtual', ]
147 clang_darwin_dict['full-optimization'] = [ '-O3', '-ffast-math']
148 compiler_flags_dictionaries['clang-darwin'] = clang_darwin_dict;
150 def fetch_git_revision ():
151 cmd = "git describe HEAD | sed 's/^[A-Za-z0-9]*+//'"
152 output = subprocess.Popen(cmd, shell=True, stderr=subprocess.STDOUT, stdout=subprocess.PIPE).communicate()[0].splitlines()
153 rev = output[0].decode ('utf-8')
156 def fetch_tarball_revision ():
157 if not os.path.exists ('libs/ardour/revision.cc'):
158 print ('This tarball was not created correctly - it is missing libs/ardour/revision.cc')
160 with open('libs/ardour/revision.cc') as f:
161 content = f.readlines()
162 remove_punctuation_map = dict((ord(char), None) for char in '";')
163 return content[1].decode('utf-8').strip().split(' ')[7].translate (remove_punctuation_map)
165 if os.path.isdir (os.path.join(os.getcwd(), '.git')):
166 rev = fetch_git_revision ()
168 rev = fetch_tarball_revision ()
171 # rev is now of the form MAJOR.MINOR[-rcX]-rev-commit
172 # or, if right at the same rev as a release, MAJOR.MINOR[-rcX]
175 parts = rev.split ('.', 1)
177 other = parts[1].split('-', 1)
180 MICRO = other[1].rsplit('-',1)[0].replace('-','.')
184 V = MAJOR + '.' + MINOR + '.' + MICRO
185 # Ensure that these are not unicode, which
186 # can cause odd problems elsewhere. Note that
187 # in python3, encode and decode do not return
188 # strings, so we have to force the type.
189 VERSION = V.encode ('ascii', 'ignore').decode ("utf-8")
190 PROGRAM_VERSION = MAJOR.encode ('ascii', 'ignore').decode ("utf-8")
192 if len (sys.argv) > 1 and sys.argv[1] == 'dist':
193 if not 'APPNAME' in os.environ:
194 print ("You must define APPNAME in the environment when running ./waf dist")
196 APPNAME = os.environ['APPNAME'];
198 # Mandatory variables
203 # optionally external libraries
211 # core ardour libraries
223 'libs/plugins/reasonablesynth.lv2',
224 'libs/plugins/a-comp.lv2',
225 'libs/plugins/a-delay.lv2',
226 'libs/plugins/a-eq.lv2',
227 'libs/plugins/a-reverb.lv2',
228 'libs/plugins/a-fluidsynth.lv2',
238 # shared helper binaries (plugin-scanner, exec-wrapper)
241 'libs/ardouralsautil',
254 def fetch_gcc_version (CC):
255 cmd = "%s --version" % CC
256 output = subprocess.Popen(cmd, shell=True, stderr=subprocess.STDOUT, stdout=subprocess.PIPE).communicate()[0].splitlines()
257 o = output[0].decode('utf-8')
258 version = o.split(' ')[2].split('.')
261 def create_stored_revision():
263 if os.path.exists('.git'):
264 rev = fetch_git_revision();
265 print("Git version: " + rev + "\n")
266 elif os.path.exists('libs/ardour/revision.cc'):
267 print("Using packaged revision")
270 print("Missing libs/ardour/revision.cc. Blame the packager.")
275 # if you change the format of this, be sure to fix fetch_tarball_revision() above
276 # so that it still works.
278 text = '#include "ardour/revision.h"\n'
279 text += 'namespace ARDOUR { const char* revision = \"%s\"; }\n' % rev
280 print('Writing revision info to libs/ardour/revision.cc using ' + rev)
281 o = open('libs/ardour/revision.cc', 'w')
285 print('Could not open libs/ardour/revision.cc for writing\n')
288 def set_compiler_flags (conf,opt):
290 # Compiler flags and other system-dependent stuff
292 build_host_supports_sse = False
294 # Flags necessary for building
295 compiler_flags = [] # generic
296 c_flags = [] # C-specific
297 cxx_flags = [] # C++-specific
300 # Optimization flags (overridable)
301 optimization_flags = []
306 u = PLATFORM.uname ()
308 platform = u[0].lower()
311 # waf adds -O0 -g itself. thanks waf!
312 is_clang = conf.check_cxx(fragment = '''
316 int main() { return 0; }''',
320 msg = 'Checking for clang')
323 if platform == 'darwin':
324 compiler_name = 'clang-darwin'
326 compiler_name = 'clang'
327 elif conf.env['MSVC_COMPILER']:
328 compiler_name = 'msvc'
330 if platform == 'darwin':
331 compiler_name = 'gcc-darwin'
333 compiler_name = 'gcc'
335 flags_dict = compiler_flags_dictionaries[compiler_name]
336 # Save the compiler flags because we need them at build time
337 # when we need to add compiler specific flags in certain
339 conf.env['compiler_flags_dict'] = flags_dict;
341 autowaf.set_basic_compiler_flags (conf,flags_dict)
343 if conf.options.asan:
344 conf.check_cxx(cxxflags=["-fsanitize=address", "-fno-omit-frame-pointer"], linkflags=["-fsanitize=address"])
345 cxx_flags.append('-fsanitize=address')
346 cxx_flags.append('-fno-omit-frame-pointer')
347 linker_flags.append('-fsanitize=address')
350 debug_flags = [ flags_dict['gprofile'] ]
353 if platform == 'darwin':
354 if re.search ("^13[.]", version) != None:
355 conf.env['build_host'] = 'mavericks'
356 elif re.search ("^14[.]", version) != None:
357 conf.env['build_host'] = 'yosemite'
358 elif re.search ("^15[.]", version) != None:
359 conf.env['build_host'] = 'el_capitan'
361 conf.env['build_host'] = 'irrelevant'
364 if opt.dist_target == 'auto':
365 if platform == 'darwin':
366 # The [.] matches to the dot after the major version, "." would match any character
367 if re.search ("^[0-7][.]", version) != None:
368 conf.env['build_target'] = 'panther'
369 elif re.search ("^8[.]", version) != None:
370 conf.env['build_target'] = 'tiger'
371 elif re.search ("^9[.]", version) != None:
372 conf.env['build_target'] = 'leopard'
373 elif re.search ("^10[.]", version) != None:
374 conf.env['build_target'] = 'snowleopard'
375 elif re.search ("^11[.]", version) != None:
376 conf.env['build_target'] = 'lion'
377 elif re.search ("^12[.]", version) != None:
378 conf.env['build_target'] = 'mountainlion'
379 elif re.search ("^13[.]", version) != None:
380 conf.env['build_target'] = 'mavericks'
381 elif re.search ("^14[.]", version) != None:
382 conf.env['build_target'] = 'yosemite'
384 conf.env['build_target'] = 'el_capitan'
387 "(?P<cpu>i[0-6]86|x86_64|powerpc|ppc|ppc64|arm|s390x?)",
390 conf.env['build_target'] = match.group("cpu")
391 if re.search("i[0-5]86", conf.env['build_target']):
392 conf.env['build_target'] = "i386"
394 conf.env['build_target'] = 'none'
396 conf.env['build_target'] = opt.dist_target
398 if conf.env['build_target'] == 'snowleopard':
400 # stupid OS X 10.6 has a bug in math.h that prevents llrint and friends
401 # from being visible.
403 compiler_flags.append ('-U__STRICT_ANSI__')
405 if opt.use_libcpp or conf.env['build_host'] in [ 'el_capitan' ]:
406 cxx_flags.append('--stdlib=libc++')
407 linker_flags.append('--stdlib=libc++')
409 if conf.options.cxx11 or conf.env['build_host'] in [ 'mavericks', 'yosemite', 'el_capitan' ]:
410 conf.check_cxx(cxxflags=["-std=c++11"])
411 cxx_flags.append('-std=c++11')
412 if platform == "darwin":
413 # Mavericks and later changed the syntax to be used when including Carbon headers,
414 # from requiring a full path to requiring just the header name.
415 cxx_flags.append('-DCARBON_FLAT_HEADERS')
417 if not opt.use_libcpp and not conf.env['build_host'] in [ 'el_capitan' ]:
418 cxx_flags.append('--stdlib=libstdc++')
419 linker_flags.append('--stdlib=libstdc++')
420 # Prevents visibility issues in standard headers
421 conf.define("_DARWIN_C_SOURCE", 1)
423 cxx_flags.append('-DBOOST_NO_AUTO_PTR')
426 if (is_clang and platform == "darwin") or conf.env['build_host'] in ['mavericks', 'yosemite', 'el_capitan']:
427 # Silence warnings about the non-existing osx clang compiler flags
428 # -compatibility_version and -current_version. These are Waf
429 # generated and not needed with clang
430 c_flags.append("-Qunused-arguments")
431 cxx_flags.append("-Qunused-arguments")
433 if (re.search ("(i[0-9]86|x86_64|AMD64)", cpu) != None) and conf.env['build_target'] != 'none':
436 # ARCH_X86 means anything in the x86 family from i386 to x86_64
437 # the compile-time presence of the macro _LP64 is used to
438 # distingush 32 and 64 bit assembler
441 compiler_flags.append ("-DARCH_X86")
443 if platform == 'linux' :
446 # determine processor flags via /proc/cpuinfo
449 if conf.env['build_target'] != 'i386':
451 flag_line = os.popen ("cat /proc/cpuinfo | grep '^flags'").read()[:-1]
452 x86_flags = flag_line.split (": ")[1:][0].split ()
454 if "mmx" in x86_flags:
455 compiler_flags.append ("-mmmx")
456 if "sse" in x86_flags:
457 build_host_supports_sse = True
458 if "3dnow" in x86_flags:
459 compiler_flags.append ("-m3dnow")
462 compiler_flags.append ("-march=i586")
464 compiler_flags.append ("-march=i686")
466 if not is_clang and ((conf.env['build_target'] == 'i686') or (conf.env['build_target'] == 'x86_64')) and build_host_supports_sse:
467 compiler_flags.extend ([ flags_dict['sse'], flags_dict['fpmath-sse'], flags_dict['xmmintrinsics'] ])
469 if (conf.env['build_target'] == 'mingw'):
470 if (re.search ("(x86_64|AMD64)", cpu) != None):
471 # on Windows sse is supported by 64 bit platforms only
472 build_host_supports_sse = True
474 # mingw GCC compiler to uses at&t (Unix specific) assembler dialect by default
475 # compiler_flags.append (["--mmnemonic=att", "msyntax=att")
477 compiler_flags.extend ([ flags_dict['sse'], flags_dict['fpmath-sse'], flags_dict['xmmintrinsics'], flags_dict['attasm'] ])
479 # end of processor-specific section
481 # optimization section
482 if conf.env['FPU_OPTIMIZATION']:
483 if sys.platform == 'darwin':
484 compiler_flags.append("-DBUILD_VECLIB_OPTIMIZATIONS");
485 conf.env.append_value('LINKFLAGS_OSX', ['-framework', 'Accelerate'])
486 elif conf.env['build_target'] == 'i686' or conf.env['build_target'] == 'x86_64':
487 compiler_flags.append ("-DBUILD_SSE_OPTIMIZATIONS")
488 elif conf.env['build_target'] == 'mingw':
489 # usability of the 64 bit windows assembler depends on the compiler target,
490 # not the build host, which in turn can only be inferred from the name
492 if re.search ('x86_64-w64', str(conf.env['CC'])) != None:
493 compiler_flags.append ("-DBUILD_SSE_OPTIMIZATIONS")
494 if not build_host_supports_sse:
495 print("\nWarning: you are building Ardour with SSE support even though your system does not support these instructions. (This may not be an error, especially if you are a package maintainer)")
497 # end optimization section
503 if conf.env['build_target'] == 'x86_64' and opt.windows_vst:
504 print("\n\n==================================================")
505 print("64bit Windows VST support on 64bit Linux is experimental.")
506 print("(This version of ardour will not load 32bit VSTs)")
507 print("==================================================\n\n")
509 if conf.env['LXVST_SUPPORT'] == True:
510 if conf.env['build_target'] == 'x86_64':
511 compiler_flags.append("-DLXVST_64BIT")
513 compiler_flags.append("-DLXVST_32BIT")
516 # a single way to test if we're on OS X
519 if conf.env['build_target'] in ['panther', 'tiger', 'leopard' ]:
520 # force tiger or later, to avoid issues on PPC which defaults
521 # back to 10.1 if we don't tell it otherwise.
523 compiler_flags.extend(
524 ("-DMAC_OS_X_VERSION_MIN_REQUIRED=1040",
525 '-mmacosx-version-min=10.4'))
527 elif conf.env['build_target'] in [ 'snowleopard' ]:
528 compiler_flags.extend(
529 ("-DMAC_OS_X_VERSION_MIN_REQUIRED=1060",
530 '-mmacosx-version-min=10.6'))
532 elif conf.env['build_target'] in [ 'lion', 'mountainlion' ]:
533 compiler_flags.extend(
534 ("-DMAC_OS_X_VERSION_MIN_REQUIRED=1070",
535 '-mmacosx-version-min=10.7'))
537 elif conf.env['build_target'] in [ 'mavericks', 'yosemite', 'el_capitan' ]:
538 compiler_flags.extend(
539 ("-DMAC_OS_X_VERSION_MAX_ALLOWED=1090",
540 "-mmacosx-version-min=10.8"))
543 # save off CPU element in an env
545 conf.define ('CONFIG_ARCH', cpu)
548 # ARCH="..." overrides all
552 optimization_flags = opt.arch.split()
555 # prepend boiler plate optimization flags that work on all architectures
558 optimization_flags[:0] = [flags_dict['pipe']]
560 # don't prepend optimization flags if "-O<something>" is present
561 prepend_opt_flags = True
562 for flag in optimization_flags:
563 if flag.startswith("-O"):
564 prepend_opt_flags = False
567 if prepend_opt_flags:
568 optimization_flags[:0] = flags_dict['full-optimization']
570 if opt.debug_symbols:
571 optimization_flags += flags_dict['debuggable']
574 optimization_flags += flags_dict['profile']
577 cxx_flags.append("-D_GLIBCXX_DEBUG")
579 if re.search ("freebsd", sys.platform) != None:
580 linker_flags.append('-lexecinfo')
582 if conf.env['DEBUG_RT_ALLOC']:
583 compiler_flags.append('-DDEBUG_RT_ALLOC')
584 linker_flags.append('-ldl')
586 if conf.env['DEBUG_DENORMAL_EXCEPTION']:
587 compiler_flags.append('-DDEBUG_DENORMAL_EXCEPTION')
590 compiler_flags.extend(flags_dict['generic-x86'])
591 linker_flags.extend(flags_dict['generic-x86'])
594 compiler_flags.extend(flags_dict['generic-ppc'])
595 linker_flags.extend(flags_dict['generic-ppc'])
601 compiler_flags.extend(flags_dict['basic-warnings'])
603 c_flags.extend(flags_dict['extra-c-warnings'])
604 cxx_flags.extend (flags_dict['extra-cxx-warnings'])
610 # need ISOC9X for llabs()
611 compiler_flags.extend(
612 ('-DBOOST_SYSTEM_NO_DEPRECATED', '-D_ISOC9X_SOURCE',
613 '-D_LARGEFILE64_SOURCE', '-D_FILE_OFFSET_BITS=64'))
615 ('-D__STDC_LIMIT_MACROS', '-D__STDC_FORMAT_MACROS',
616 '-DCANVAS_COMPATIBILITY', '-DCANVAS_DEBUG'))
619 compiler_flags.append('-DENABLE_NLS')
621 # use sparingly, prefer runtime profile
622 if Options.options.program_name.lower() == "mixbus":
623 compiler_flags.append ('-DMIXBUS')
625 if Options.options.program_name.lower() == "mixbus32c":
626 compiler_flags.append ('-DMIXBUS')
627 compiler_flags.append ('-DMIXBUS32C')
629 compiler_flags.append ('-DPROGRAM_NAME="' + Options.options.program_name + '"')
630 compiler_flags.append ('-DPROGRAM_VERSION="' + PROGRAM_VERSION + '"')
632 conf.env['PROGRAM_NAME'] = Options.options.program_name
635 conf.env.append_value('CFLAGS', debug_flags)
636 conf.env.append_value('CXXFLAGS', debug_flags)
638 conf.env.append_value('CFLAGS', optimization_flags)
639 conf.env.append_value('CXXFLAGS', optimization_flags)
642 if platform != 'darwin' and not is_clang and not Options.options.dist_target == 'mingw':
643 linker_flags += [ '-rdynamic' ]
645 conf.env.append_value('CFLAGS', compiler_flags)
646 conf.env.append_value('CFLAGS', c_flags)
647 conf.env.append_value('CXXFLAGS', compiler_flags)
648 conf.env.append_value('CXXFLAGS', cxx_flags)
649 conf.env.append_value('LINKFLAGS', linker_flags)
651 def create_resource_file(icon):
653 text = 'IDI_ICON1 ICON DISCARDABLE "icons/' + icon + '.ico"\n'
654 o = open('gtk2_ardour/windows_icon.rc', 'w')
658 print('Could not open gtk2_ardour/windows_icon.rc for writing\n')
661 def is_tracks_build (conf):
662 return conf.env['PROGRAM_NAME'] == 'Tracks Live'
664 #----------------------------------------------------------------
669 opt.load('compiler_c')
670 opt.load('compiler_cxx')
671 autowaf.set_options(opt, debug_by_default=True)
672 opt.add_option('--program-name', type='string', action='store', default='Ardour', dest='program_name',
673 help='The user-visible name of the program being built')
674 opt.add_option('--arch', type='string', action='store', dest='arch',
675 help='Architecture-specific compiler FLAGS')
676 opt.add_option('--with-backends', type='string', action='store', default='jack', dest='with_backends',
677 help='Specify which backend modules are to be included(jack,alsa,dummy,portaudio,coreaudio)')
678 opt.add_option('--backtrace', action='store_true', default=False, dest='backtrace',
679 help='Compile with -rdynamic -- allow obtaining backtraces from within Ardour')
680 opt.add_option('--no-carbon', action='store_true', default=False, dest='nocarbon',
681 help='Compile without support for AU Plugins with only CARBON UI (needed for 64bit)')
682 opt.add_option('--boost-sp-debug', action='store_true', default=False, dest='boost_sp_debug',
683 help='Compile with Boost shared pointer debugging')
684 opt.add_option('--debug-symbols', action='store_true', default=False, dest='debug_symbols',
685 help='Add debug-symbols to optimized builds')
686 opt.add_option('--depstack-root', type='string', default='~', dest='depstack_root',
687 help='Directory/folder where dependency stack trees (gtk, a3) can be found (defaults to ~)')
688 opt.add_option('--dist-target', type='string', default='auto', dest='dist_target',
689 help='Specify the target for cross-compiling [auto,none,x86,i386,i686,x86_64,tiger,leopard,mingw,msvc]')
690 opt.add_option('--fpu-optimization', action='store_true', default=True, dest='fpu_optimization',
691 help='Build runtime checked assembler code (default)')
692 opt.add_option('--no-fpu-optimization', action='store_false', dest='fpu_optimization')
693 opt.add_option('--exports-hidden', action='store_true', default=False, dest='exports_hidden')
694 opt.add_option('--freedesktop', action='store_true', default=False, dest='freedesktop',
695 help='Build MIME type and .desktop files as per freedesktop.org standards (will be placed in build/gtk2_ardour)')
696 opt.add_option('--freebie', action='store_true', default=False, dest='freebie',
697 help='Build a version suitable for distribution as a zero-cost binary')
698 opt.add_option('--profile', action='store_true', default=False, dest='profile',
699 help='Compile for use with profiling tools requiring a frame pointer')
700 opt.add_option('--gprofile', action='store_true', default=False, dest='gprofile',
701 help='Compile for use with gprofile')
702 opt.add_option('--libjack', type='string', default="auto", dest='libjack_link',
703 help='libjack link mode [auto|link|weak]')
704 opt.add_option('--internal-shared-libs', action='store_true', default=True, dest='internal_shared_libs',
705 help='Build internal libs as shared libraries')
706 opt.add_option('--internal-static-libs', action='store_false', dest='internal_shared_libs',
707 help='Build internal libs as static libraries')
708 opt.add_option('--use-external-libs', action='store_true', default=False, dest='use_external_libs',
709 help='Use external/system versions of some bundled libraries')
710 opt.add_option('--luadoc', action='store_true', default=False, dest='luadoc',
711 help='Compile Tool to dump LuaBindings (needs C++11)')
712 opt.add_option('--lv2', action='store_true', default=True, dest='lv2',
713 help='Compile with support for LV2 (if Lilv+Suil is available)')
714 opt.add_option('--no-lv2', action='store_false', dest='lv2',
715 help='Do not compile with support for LV2')
716 opt.add_option('--lv2dir', type='string', help="install destination for builtin LV2 bundles [Default: LIBDIR/lv2]")
717 opt.add_option('--lxvst', action='store_true', default=True, dest='lxvst',
718 help='Compile with support for linuxVST plugins')
719 opt.add_option('--no-lxvst', action='store_false', dest='lxvst',
720 help='Compile without support for linuxVST plugins')
721 opt.add_option('--no-lrdf', action='store_true', dest='no_lrdf',
722 help='Compile without support for LRDF LADSPA data even if present')
723 opt.add_option('--nls', action='store_true', default=True, dest='nls',
724 help='Enable i18n (native language support) (default)')
725 opt.add_option('--no-nls', action='store_false', dest='nls')
726 opt.add_option('--phone-home', action='store_true', default=True, dest='phone_home',
727 help='Contact ardour.org at startup for new announcements')
728 opt.add_option('--no-phone-home', action='store_false', dest='phone_home',
729 help='Do not contact ardour.org at startup for new announcements')
730 opt.add_option('--stl-debug', action='store_true', default=False, dest='stl_debug',
731 help='Build with debugging for the STL')
732 opt.add_option('--rt-alloc-debug', action='store_true', default=False, dest='rt_alloc_debug',
733 help='Build with debugging for memory allocation in the real-time thread')
734 opt.add_option('--pt-timing', action='store_true', default=False, dest='pt_timing',
735 help='Build with logging of timing in the process thread(s)')
736 opt.add_option('--denormal-exception', action='store_true', default=False, dest='denormal_exception',
737 help='Raise a floating point exception if a denormal is detected')
738 opt.add_option('--test', action='store_true', default=False, dest='build_tests',
739 help="Build unit tests")
740 opt.add_option('--run-tests', action='store_true', default=False, dest='run_tests',
741 help="Run tests after build")
742 opt.add_option('--single-tests', action='store_true', default=False, dest='single_tests',
743 help="Build a single executable for each unit test")
744 #opt.add_option('--tranzport', action='store_true', default=False, dest='tranzport',
745 # help='Compile with support for Frontier Designs Tranzport (if libusb is available)')
746 opt.add_option('--generic', action='store_true', default=False, dest='generic',
747 help='Compile with -arch i386 (OS X ONLY)')
748 opt.add_option('--ppc', action='store_true', default=False, dest='ppc',
749 help='Compile with -arch ppc (OS X ONLY)')
750 opt.add_option('--versioned', action='store_true', default=False, dest='versioned',
751 help='Add revision information to executable name inside the build directory')
752 opt.add_option('--windows-vst', action='store_true', default=False, dest='windows_vst',
753 help='Compile with support for Windows VST')
754 opt.add_option('--windows-key', type='string', action='store', dest='windows_key', default='Mod4><Super',
755 help='X Modifier(s) (Mod1,Mod2, etc) for the Windows key (X11 builds only). ' +
756 'Multiple modifiers must be separated by \'><\'')
757 opt.add_option('--boost-include', type='string', action='store', dest='boost_include', default='',
758 help='directory where Boost header files can be found')
759 opt.add_option('--also-include', type='string', action='store', dest='also_include', default='',
760 help='additional include directory where header files can be found (split multiples with commas)')
761 opt.add_option('--also-libdir', type='string', action='store', dest='also_libdir', default='',
762 help='additional include directory where shared libraries can be found (split multiples with commas)')
763 opt.add_option('--wine-include', type='string', action='store', dest='wine_include', default='/usr/include/wine/windows',
764 help='directory where Wine\'s Windows header files can be found')
765 opt.add_option('--noconfirm', action='store_true', default=False, dest='noconfirm',
766 help='Do not ask questions that require confirmation during the build')
767 opt.add_option('--cxx11', action='store_true', default=False, dest='cxx11',
768 help='Turn on c++11 compiler flags (-std=c++11)')
769 opt.add_option('--use-libc++', action='store_true', default=False, dest='use_libcpp',
770 help='use libc++ instead of default or auto-detected stdlib')
771 opt.add_option('--address-sanitizer', action='store_true', default=False, dest='asan',
772 help='Turn on AddressSanitizer (requires GCC >= 4.8 or clang >= 3.1)')
773 opt.add_option('--ptformat', action='store_true', default=False, dest='ptformat',
774 help='Turn on PT session import option')
775 opt.add_option('--no-threaded-waveviews', action='store_true', default=False, dest='no_threaded_waveviews',
776 help='Disable threaded waveview rendering')
778 '--qm-dsp-include', type='string', action='store',
779 dest='qm_dsp_include', default='/usr/include/qm-dsp',
780 help='directory where the header files of qm-dsp can be found')
785 def sub_config_and_use(conf, name, has_objects = True):
787 autowaf.set_local_lib(conf, name, has_objects)
790 conf.load('compiler_c')
791 conf.load('compiler_cxx')
792 if Options.options.dist_target == 'mingw':
795 if Options.options.dist_target == 'msvc':
796 conf.env['MSVC_VERSIONS'] = ['msvc 10.0', 'msvc 9.0', 'msvc 8.0', 'msvc 7.1', 'msvc 7.0', 'msvc 6.0', ]
797 conf.env['MSVC_TARGETS'] = ['x64']
800 if Options.options.debug:
801 # Nuke user CFLAGS/CXXFLAGS if debug is set (they likely contain -O3, NDEBUG, etc)
802 conf.env['CFLAGS'] = []
803 conf.env['CXXFLAGS'] = []
805 # freedesktop translations needs itstool > 1.0.3 (-j option)
806 if Options.options.freedesktop:
807 output = subprocess.Popen("itstool --version", shell=True, stderr=subprocess.STDOUT, stdout=subprocess.PIPE).communicate()[0].splitlines()
808 o = output[0].decode('utf-8')
809 itstool = o.split(' ')[0]
810 version = o.split(' ')[1].split('.')
811 # use distutils.version.StrictVersion or something python to check >= 1.0.4
812 # but first make sure that all build-hosts (incl. OSX-10.5/PPC) have that python lib.
813 # lazy approach: just use major version 2.X.X
814 if itstool != "itstool" or version[0] < "2":
815 print("--freedesktop requires itstool > 2.0.0 to translate files.")
818 conf.env['VERSION'] = VERSION
819 conf.env['MAJOR'] = MAJOR
820 conf.env['MINOR'] = MINOR
821 conf.env['MICRO'] = MICRO
823 autowaf.set_recursive()
824 autowaf.configure(conf)
825 autowaf.display_header('Ardour Configuration')
827 # systems with glibc have libintl builtin. systems without require explicit
828 # linkage against libintl.
831 pkg_config_path = os.getenv('PKG_CONFIG_PATH')
832 user_gtk_root = os.path.expanduser (Options.options.depstack_root + '/gtk/inst')
834 if pkg_config_path is not None and pkg_config_path.find (user_gtk_root) >= 0:
835 # told to search user_gtk_root
836 prefinclude = ''.join ([ '-I', user_gtk_root + '/include'])
837 preflib = ''.join ([ '-L', user_gtk_root + '/lib'])
838 conf.env.append_value('CFLAGS', [ prefinclude ])
839 conf.env.append_value('CXXFLAGS', [prefinclude ])
840 conf.env.append_value('LINKFLAGS', [ preflib ])
841 autowaf.display_msg(conf, 'Will build against private GTK dependency stack in ' + user_gtk_root, 'yes')
843 autowaf.display_msg(conf, 'Will build against private GTK dependency stack', 'no')
845 if sys.platform == 'darwin':
846 conf.define ('NEED_INTL', 1)
847 autowaf.display_msg(conf, 'Will use explicit linkage against libintl in ' + user_gtk_root, 'yes')
849 # libintl is part of the system, so use it
850 autowaf.display_msg(conf, 'Will rely on libintl built into libc', 'yes')
852 user_ardour_root = os.path.expanduser (Options.options.depstack_root + '/a3/inst')
853 if pkg_config_path is not None and pkg_config_path.find (user_ardour_root) >= 0:
854 # told to search user_ardour_root
855 prefinclude = ''.join ([ '-I', user_ardour_root + '/include'])
856 preflib = ''.join ([ '-L', user_ardour_root + '/lib'])
857 conf.env.append_value('CFLAGS', [ prefinclude ])
858 conf.env.append_value('CXXFLAGS', [prefinclude ])
859 conf.env.append_value('LINKFLAGS', [ preflib ])
860 autowaf.display_msg(conf, 'Will build against private Ardour dependency stack in ' + user_ardour_root, 'yes')
862 autowaf.display_msg(conf, 'Will build against private Ardour dependency stack', 'no')
864 if Options.options.freebie:
865 conf.env.append_value ('CFLAGS', '-DSILENCE_AFTER')
866 conf.env.append_value ('CXXFLAGS', '-DSILENCE_AFTER')
867 conf.define ('FREEBIE', 1)
869 if Options.options.lv2dir:
870 conf.env['LV2DIR'] = Options.options.lv2dir
872 conf.env['LV2DIR'] = os.path.join(conf.env['LIBDIR'], 'ardour' + str(conf.env['MAJOR']), 'LV2')
874 conf.env['LV2DIR'] = os.path.normpath(conf.env['LV2DIR'])
876 if sys.platform == 'darwin':
878 # this is required, potentially, for anything we link and then relocate into a bundle
879 conf.env.append_value('LINKFLAGS', [ '-Xlinker', '-headerpad_max_install_names' ])
881 conf.define ('HAVE_COREAUDIO', 1)
882 conf.define ('AUDIOUNIT_SUPPORT', 1)
883 conf.define('MACVST_SUPPORT', 1)
885 conf.define ('TOP_MENUBAR',1)
887 # It would be nice to be able to use this to force back-compatibility with 10.4
888 # but even by the time of 11, the 10.4 SDK is no longer available in any normal
891 #conf.env.append_value('CXXFLAGS_OSX', "-isysroot /Developer/SDKs/MacOSX10.4u.sdk")
892 #conf.env.append_value('CFLAGS_OSX', "-isysroot /Developer/SDKs/MacOSX10.4u.sdk")
893 #conf.env.append_value('LINKFLAGS_OSX', "-sysroot /Developer/SDKs/MacOSX10.4u.sdk")
894 #conf.env.append_value('LINKFLAGS_OSX', "-sysroot /Developer/SDKs/MacOSX10.4u.sdk")
896 conf.env.append_value('CXXFLAGS_OSX', "-msse")
897 conf.env.append_value('CFLAGS_OSX', "-msse")
898 conf.env.append_value('CXXFLAGS_OSX', "-msse2")
899 conf.env.append_value('CFLAGS_OSX', "-msse2")
901 # TODO: The previous sse flags NEED to be based
902 # off processor type. Need to add in a check
905 conf.env.append_value('CXXFLAGS_OSX', '-F/System/Library/Frameworks')
906 conf.env.append_value('CXXFLAGS_OSX', '-F/Library/Frameworks')
908 conf.env.append_value('LINKFLAGS_OSX', ['-framework', 'AppKit'])
909 conf.env.append_value('LINKFLAGS_OSX', ['-framework', 'CoreAudio'])
910 conf.env.append_value('LINKFLAGS_OSX', ['-framework', 'CoreAudioKit'])
911 conf.env.append_value('LINKFLAGS_OSX', ['-framework', 'CoreFoundation'])
912 conf.env.append_value('LINKFLAGS_OSX', ['-framework', 'CoreServices'])
914 conf.env.append_value('LINKFLAGS_OSX', ['-undefined', 'dynamic_lookup' ])
915 conf.env.append_value('LINKFLAGS_OSX', ['-flat_namespace'])
917 conf.env.append_value('CXXFLAGS_AUDIOUNITS', "-DAUDIOUNIT_SUPPORT")
918 conf.env.append_value('LINKFLAGS_AUDIOUNITS', ['-framework', 'AudioToolbox', '-framework', 'AudioUnit'])
919 conf.env.append_value('LINKFLAGS_AUDIOUNITS', ['-framework', 'Cocoa'])
922 # osx up to and including 10.6 (uname 10.X.X)
923 (re.search ("^[1-9][0-9]\.", os.uname()[2]) == None or not re.search ("^10\.", os.uname()[2]) == None)
924 and (Options.options.generic or Options.options.ppc)
925 and not Options.options.nocarbon
927 conf.env.append_value('CXXFLAGS_AUDIOUNITS', "-DWITH_CARBON")
928 conf.env.append_value('LINKFLAGS_AUDIOUNITS', ['-framework', 'Carbon'])
930 print ('No Carbon support available for this build\n')
933 if Options.options.luadoc:
934 conf.env['LUABINDINGDOC'] = True
935 conf.define ('LUABINDINGDOC', 1)
937 if Options.options.internal_shared_libs:
938 conf.define('INTERNAL_SHARED_LIBS', 1)
940 if Options.options.use_external_libs:
941 conf.define('USE_EXTERNAL_LIBS', 1)
942 conf.env.append_value(
943 'CXXFLAGS', '-I' + Options.options.qm_dsp_include)
945 if Options.options.boost_include != '':
946 conf.env.append_value('CXXFLAGS', '-I' + Options.options.boost_include)
948 if Options.options.also_include != '':
949 conf.env.append_value('CXXFLAGS', '-I' + Options.options.also_include)
950 conf.env.append_value('CFLAGS', '-I' + Options.options.also_include)
952 if Options.options.also_libdir != '':
953 conf.env.append_value('LDFLAGS', '-L' + Options.options.also_libdir)
955 if Options.options.boost_sp_debug:
956 conf.env.append_value('CXXFLAGS', '-DBOOST_SP_ENABLE_DEBUG_HOOKS')
958 # executing a test program is n/a when cross-compiling
959 if Options.options.dist_target != 'mingw':
960 if Options.options.dist_target != 'msvc':
961 if re.search ("freebsd", sys.platform) != None:
962 conf.check_cc(function_name='dlopen', header_name='dlfcn.h', uselib_store='DL')
964 conf.check_cc(function_name='dlopen', header_name='dlfcn.h', lib='dl', uselib_store='DL')
965 conf.check_cxx(fragment = "#include <boost/version.hpp>\nint main(void) { return (BOOST_VERSION >= 103900 ? 0 : 1); }\n",
968 msg = 'Checking for boost library >= 1.39',
970 errmsg = 'too old\nPlease install boost version 1.39 or higher.')
972 if re.search ("linux", sys.platform) != None and Options.options.dist_target != 'mingw':
973 autowaf.check_pkg(conf, 'alsa', uselib_store='ALSA')
975 autowaf.check_pkg(conf, 'glib-2.0', uselib_store='GLIB', atleast_version='2.28', mandatory=True)
976 autowaf.check_pkg(conf, 'gthread-2.0', uselib_store='GTHREAD', atleast_version='2.2', mandatory=True)
977 autowaf.check_pkg(conf, 'glibmm-2.4', uselib_store='GLIBMM', atleast_version='2.32.0', mandatory=True)
978 autowaf.check_pkg(conf, 'sndfile', uselib_store='SNDFILE', atleast_version='1.0.18', mandatory=True)
979 autowaf.check_pkg(conf, 'giomm-2.4', uselib_store='GIOMM', atleast_version='2.2', mandatory=True)
980 autowaf.check_pkg(conf, 'libcurl', uselib_store='CURL', atleast_version='7.0.0', mandatory=True)
981 autowaf.check_pkg(conf, 'libarchive', uselib_store='ARCHIVE', atleast_version='3.0.0', mandatory=True)
982 autowaf.check_pkg(conf, 'liblo', uselib_store='LO', atleast_version='0.26', mandatory=True)
983 autowaf.check_pkg(conf, 'taglib', uselib_store='TAGLIB', atleast_version='1.6', mandatory=True)
984 autowaf.check_pkg(conf, 'vamp-sdk', uselib_store='VAMPSDK', atleast_version='2.1', mandatory=True)
985 autowaf.check_pkg(conf, 'vamp-hostsdk', uselib_store='VAMPHOSTSDK', atleast_version='2.1', mandatory=True)
986 autowaf.check_pkg(conf, 'rubberband', uselib_store='RUBBERBAND', mandatory=True)
988 have_rf64_riff_support = conf.check_cc(fragment = '''
990 int main () { int x = SFC_RF64_AUTO_DOWNGRADE; return 0; }
996 msg = 'Checking for sndfile RF64=>RIFF support',
998 errmsg = 'Not found, no RF64-to-WAV support')
1000 if have_rf64_riff_support:
1001 conf.env.append_value('CXXFLAGS', "-DHAVE_RF64_RIFF")
1002 conf.env.append_value('CFLAGS', "-DHAVE_RF64_RIFF")
1004 if Options.options.dist_target == 'mingw':
1005 Options.options.fpu_optimization = True
1006 conf.env.append_value('CFLAGS', '-DPLATFORM_WINDOWS')
1007 conf.env.append_value('CFLAGS', '-DCOMPILER_MINGW')
1008 conf.env.append_value('CXXFLAGS', '-DPLATFORM_WINDOWS')
1009 conf.env.append_value('CXXFLAGS', '-DCOMPILER_MINGW')
1010 if conf.options.cxx11:
1011 conf.env.append_value('CFLAGS', '-D_USE_MATH_DEFINES')
1012 conf.env.append_value('CXXFLAGS', '-D_USE_MATH_DEFINES')
1013 conf.env.append_value('CFLAGS', '-DWIN32')
1014 conf.env.append_value('CXXFLAGS', '-DWIN32')
1015 conf.env.append_value('LIB', 'pthread')
1016 # needed for at least libsmf
1017 conf.check_cc(function_name='htonl', header_name='winsock2.h', lib='ws2_32')
1018 conf.env.append_value('LIB', 'ws2_32')
1019 conf.env.append_value('LIB', 'winmm')
1020 # needed for mingw64 packages, not harmful on normal mingw build
1021 conf.env.append_value('LIB', 'intl')
1022 conf.check_cc(function_name='regcomp', header_name='regex.h',
1023 lib='regex', uselib_store="REGEX", define_name='HAVE_REGEX_H')
1024 # TODO put this only where it is needed
1025 conf.env.append_value('LIB', 'regex')
1026 # TODO this should only be necessary for a debug build
1027 conf.env.append_value('LIB', 'dbghelp')
1029 # work around GdkDrawable BitBlt performance issue on windows
1030 # see http://gareus.org/wiki/ardour_windows_gdk_and_cairo
1031 conf.env.append_value('CFLAGS', '-DUSE_CAIRO_IMAGE_SURFACE')
1032 conf.env.append_value('CXXFLAGS', '-DUSE_CAIRO_IMAGE_SURFACE')
1033 conf.define ('WINDOWS', 1)
1035 have_ptw_semaphore = conf.check_cc(fragment = '''
1036 #include <pthread.h>
1037 #include <semaphore.h>
1038 int main () { return 0; }
1043 msg = 'Checking for pthread posix semaphore',
1045 errmsg = 'Not found, falling back to Windows Semaphore.')
1047 #if have_ptw_semaphore:
1048 # conf.define('USE_PTW32_SEMAPHORE', 1)
1049 # conf.env.append_value('CFLAGS', '-DUSE_PTW32_SEMAPHORE')
1050 # conf.env.append_value('CXXFLAGS', '-DUSE_PTW32_SEMAPHORE')
1052 if Options.options.dist_target == 'msvc':
1053 conf.env.append_value('CFLAGS', '-DPLATFORM_WINDOWS')
1054 conf.env.append_value('CFLAGS', '-DCOMPILER_MSVC')
1055 conf.env.append_value('CXXFLAGS', '-DPLATFORM_WINDOWS')
1056 conf.env.append_value('CXXFLAGS', '-DCOMPILER_MSVC')
1057 # work around GdkDrawable BitBlt performance issue on windows
1058 # see http://gareus.org/wiki/ardour_windows_gdk_and_cairo
1059 conf.env.append_value('CFLAGS', '-DUSE_CAIRO_IMAGE_SURFACE')
1060 conf.env.append_value('CXXFLAGS', '-DUSE_CAIRO_IMAGE_SURFACE')
1061 # MORE STUFF PROBABLY NEEDED HERE
1062 conf.define ('WINDOWS', 1)
1064 # Tell everyone that this is a waf build
1066 conf.env.append_value('CFLAGS', '-DWAF_BUILD')
1067 conf.env.append_value('CXXFLAGS', '-DWAF_BUILD')
1069 opts = Options.options
1071 # (optionally) Adopt Microsoft-like convention that makes all non-explicitly exported
1072 # symbols invisible (rather than doing this all over the wscripts in the src tree)
1074 # This won't apply to MSVC but that hasn't been added as a target yet
1076 # We can't do this till all tests are complete, since some fail if this is et.
1077 if opts.exports_hidden:
1078 conf.define ('EXPORT_VISIBILITY_HIDDEN', True)
1079 if opts.internal_shared_libs:
1080 conf.env.append_value ('CXXFLAGS', '-fvisibility=hidden')
1081 conf.env.append_value ('CFLAGS', '-fvisibility=hidden')
1083 conf.define ('EXPORT_VISIBILITY_HIDDEN', False)
1085 # Set up waf environment and C defines
1087 conf.define('PHONE_HOME', 1)
1088 conf.env['PHONE_HOME'] = True
1089 if opts.fpu_optimization:
1090 conf.env['FPU_OPTIMIZATION'] = True
1091 if opts.freedesktop:
1092 conf.env['FREEDESKTOP'] = True
1094 conf.define('ENABLE_NLS', 1)
1095 conf.env['ENABLE_NLS'] = True
1096 if opts.build_tests:
1097 conf.env['BUILD_TESTS'] = True
1098 conf.env['RUN_TESTS'] = opts.run_tests
1099 if opts.single_tests:
1100 conf.env['SINGLE_TESTS'] = opts.single_tests
1102 # conf.env['TRANZPORT'] = 1
1103 if opts.windows_vst:
1104 conf.define('WINDOWS_VST_SUPPORT', 1)
1105 conf.env['WINDOWS_VST_SUPPORT'] = True
1106 if not Options.options.dist_target == 'mingw':
1107 conf.env.append_value('CFLAGS', '-I' + Options.options.wine_include)
1108 conf.env.append_value('CXXFLAGS', '-I' + Options.options.wine_include)
1109 autowaf.check_header(conf, 'cxx', 'windows.h', mandatory = True)
1111 if sys.platform == 'darwin':
1112 conf.env['LXVST_SUPPORT'] = False
1113 elif Options.options.dist_target == 'mingw':
1114 conf.env['LXVST_SUPPORT'] = False
1116 conf.define('LXVST_SUPPORT', 1)
1117 conf.env['LXVST_SUPPORT'] = True
1118 conf.env['WINDOWS_KEY'] = opts.windows_key
1119 if opts.rt_alloc_debug:
1120 conf.define('DEBUG_RT_ALLOC', 1)
1121 conf.env['DEBUG_RT_ALLOC'] = True
1123 conf.define('PT_TIMING', 1)
1124 conf.env['PT_TIMING'] = True
1125 if opts.denormal_exception:
1126 conf.define('DEBUG_DENORMAL_EXCEPTION', 1)
1127 conf.env['DEBUG_DENORMAL_EXCEPTION'] = True
1128 if opts.build_tests:
1129 autowaf.check_pkg(conf, 'cppunit', uselib_store='CPPUNIT', atleast_version='1.12.0', mandatory=True)
1131 conf.define('PTFORMAT', 1)
1132 conf.env['PTFORMAT'] = True
1133 if opts.no_threaded_waveviews:
1134 conf.define('NO_THREADED_WAVEVIEWS', 1)
1135 conf.env['NO_THREADED_WAVEVIEWS'] = True
1137 backends = opts.with_backends.split(',')
1140 print("Must configure and build at least one backend")
1143 conf.env['BACKENDS'] = backends
1144 conf.env['BUILD_JACKBACKEND'] = any('jack' in b for b in backends)
1145 conf.env['BUILD_ALSABACKEND'] = any('alsa' in b for b in backends)
1146 conf.env['BUILD_DUMMYBACKEND'] = any('dummy' in b for b in backends)
1147 conf.env['BUILD_PABACKEND'] = any('portaudio' in b for b in backends)
1148 conf.env['BUILD_CORECRAPPITA'] = any('coreaudio' in b for b in backends)
1150 if re.search ("linux", sys.platform) != None and Options.options.dist_target != 'mingw' and conf.env['BUILD_PABACKEND']:
1151 print("PortAudio Backend is not for Linux")
1154 if sys.platform != 'darwin' and conf.env['BUILD_CORECRAPPITA']:
1155 print("Coreaudio backend is only available for OSX")
1158 if re.search ("linux", sys.platform) == None and conf.env['BUILD_ALSABACKEND']:
1159 print("ALSA Backend is only available on Linux")
1162 set_compiler_flags (conf, Options.options)
1164 if sys.platform == 'darwin':
1165 sub_config_and_use(conf, 'libs/appleutility')
1166 elif Options.options.dist_target != 'mingw':
1167 sub_config_and_use(conf, 'tools/sanity_check')
1168 sub_config_and_use(conf, 'tools/gccabicheck')
1170 sub_config_and_use(conf, 'libs/clearlooks-newer')
1173 sub_config_and_use(conf, i)
1175 # Fix utterly braindead FLAC include path to not smash assert.h
1176 conf.env['INCLUDES_FLAC'] = []
1178 config_text = open('libs/ardour/config_text.cc', "w")
1179 config_text.write('''#include "ardour/ardour.h"
1181 const char* const ardour_config_info = "\\n\\
1184 def write_config_text(title, val):
1185 autowaf.display_msg(conf, title, val)
1186 config_text.write(title + ': ')
1187 config_text.write(str(val).replace ('"', '\\"'))
1188 config_text.write("\\n\\\n")
1190 write_config_text('Build documentation', conf.env['DOCS'])
1191 write_config_text('Debuggable build', conf.env['DEBUG'])
1192 write_config_text('Export all symbols (backtrace)', opts.backtrace)
1193 write_config_text('Install prefix', conf.env['PREFIX'])
1194 write_config_text('Strict compiler flags', conf.env['STRICT'])
1195 write_config_text('Internal Shared Libraries', conf.is_defined('INTERNAL_SHARED_LIBS'))
1196 write_config_text('Use External Libraries', conf.is_defined('USE_EXTERNAL_LIBS'))
1197 write_config_text('Library exports hidden', conf.is_defined('EXPORT_VISIBILITY_HIDDEN'))
1199 write_config_text('ALSA DBus Reservation', conf.is_defined('HAVE_DBUS'))
1200 write_config_text('Architecture flags', opts.arch)
1201 write_config_text('Aubio', conf.is_defined('HAVE_AUBIO'))
1202 write_config_text('AudioUnits', conf.is_defined('AUDIOUNIT_SUPPORT'))
1203 write_config_text('Free/Demo copy', conf.is_defined('FREEBIE'))
1204 write_config_text('Build target', conf.env['build_target'])
1205 write_config_text('CoreAudio', conf.is_defined('HAVE_COREAUDIO'))
1206 write_config_text('CoreAudio 10.5 compat', conf.is_defined('COREAUDIO105'))
1207 write_config_text('Debug RT allocations', conf.is_defined('DEBUG_RT_ALLOC'))
1208 write_config_text('Debug Symbols', conf.is_defined('debug_symbols') or conf.env['DEBUG'])
1209 write_config_text('Process thread timing', conf.is_defined('PT_TIMING'))
1210 write_config_text('Denormal exceptions', conf.is_defined('DEBUG_DENORMAL_EXCEPTION'))
1211 write_config_text('FLAC', conf.is_defined('HAVE_FLAC'))
1212 write_config_text('FPU optimization', opts.fpu_optimization)
1213 write_config_text('Freedesktop files', opts.freedesktop)
1214 write_config_text('Libjack linking', conf.env['libjack_link'])
1215 write_config_text('Libjack metadata', conf.is_defined ('HAVE_JACK_METADATA'))
1216 write_config_text('Lua Binding Doc', conf.is_defined('LUABINDINGDOC'))
1217 write_config_text('LV2 UI embedding', conf.is_defined('HAVE_SUIL'))
1218 write_config_text('LV2 support', conf.is_defined('LV2_SUPPORT'))
1219 write_config_text('LV2 extensions', conf.is_defined('LV2_EXTENDED'))
1220 write_config_text('LXVST support', conf.is_defined('LXVST_SUPPORT'))
1221 write_config_text('OGG', conf.is_defined('HAVE_OGG'))
1222 write_config_text('Phone home', conf.is_defined('PHONE_HOME'))
1223 write_config_text('Program name', opts.program_name)
1224 write_config_text('Samplerate', conf.is_defined('HAVE_SAMPLERATE'))
1225 write_config_text('PT format', conf.is_defined('PTFORMAT'))
1226 write_config_text('PTW32 Semaphore', conf.is_defined('USE_PTW32_SEMAPHORE'))
1227 # write_config_text('Soundtouch', conf.is_defined('HAVE_SOUNDTOUCH'))
1228 write_config_text('Translation', opts.nls)
1229 # write_config_text('Tranzport', opts.tranzport)
1230 write_config_text('Unit tests', conf.env['BUILD_TESTS'])
1231 write_config_text('Mac i386 Architecture', opts.generic)
1232 write_config_text('Mac ppc Architecture', opts.ppc)
1233 write_config_text('Mac VST support', conf.is_defined('MACVST_SUPPORT'))
1234 write_config_text('Windows VST support', opts.windows_vst)
1235 write_config_text('Wiimote support', conf.is_defined('BUILD_WIIMOTE'))
1236 write_config_text('Windows key', opts.windows_key)
1238 write_config_text('PortAudio Backend', conf.env['BUILD_PABACKEND'])
1239 write_config_text('CoreAudio/Midi Backend',conf.env['BUILD_CORECRAPPITA'])
1240 write_config_text('ALSA Backend', conf.env['BUILD_ALSABACKEND'])
1241 write_config_text('Dummy backend', conf.env['BUILD_DUMMYBACKEND'])
1242 write_config_text('JACK Backend', conf.env['BUILD_JACKBACKEND'])
1244 write_config_text('C compiler flags', conf.env['CFLAGS'])
1245 write_config_text('C++ compiler flags', conf.env['CXXFLAGS'])
1246 write_config_text('Linker flags', conf.env['LINKFLAGS'])
1248 config_text.write ('";\n}\n')
1249 config_text.close ()
1252 if Options.options.dist_target == 'mingw' or Options.options.dist_target == 'msvc':
1253 create_resource_file(Options.options.program_name.lower())
1256 create_stored_revision()
1258 # add directories that contain only headers, to workaround an issue with waf
1260 if not bld.is_defined('USE_EXTERNAL_LIBS'):
1261 bld.path.find_dir ('libs/libltc/ltc')
1262 bld.path.find_dir ('libs/evoral/evoral')
1263 bld.path.find_dir ('libs/surfaces/control_protocol/control_protocol')
1264 bld.path.find_dir ('libs/timecode/timecode')
1265 bld.path.find_dir ('libs/gtkmm2ext/gtkmm2ext')
1266 bld.path.find_dir ('libs/ardour/ardour')
1267 bld.path.find_dir ('libs/pbd/pbd')
1269 # set up target directories
1270 lwrcase_dirname = 'ardour' + bld.env['MAJOR']
1272 if bld.is_tracks_build():
1273 bld.env.append_value ('CXXFLAGS', '-DUSE_TRACKS_CODE_FEATURES')
1274 bld.env.append_value ('CFLAGS', '-DUSE_TRACKS_CODE_FEATURES')
1275 lwrcase_dirname = 'trx'
1277 # configuration files go here
1278 bld.env['CONFDIR'] = os.path.join(bld.env['SYSCONFDIR'], lwrcase_dirname)
1279 # data files loaded at run time go here
1280 bld.env['DATADIR'] = os.path.join(bld.env['DATADIR'], lwrcase_dirname)
1281 # shared objects loaded at runtime go here (two aliases)
1282 bld.env['DLLDIR'] = os.path.join(bld.env['LIBDIR'], lwrcase_dirname)
1283 bld.env['LIBDIR'] = bld.env['DLLDIR']
1284 bld.env['LOCALEDIR'] = os.path.join(bld.env['DATADIR'], 'locale')
1285 bld.env['lwrcase_dirname'] = lwrcase_dirname;
1287 autowaf.set_recursive()
1289 if sys.platform == 'darwin':
1290 bld.recurse('libs/appleutility')
1291 elif bld.env['build_target'] != 'mingw':
1292 bld.recurse('tools/sanity_check')
1293 bld.recurse('tools/gccabicheck')
1295 bld.recurse('libs/clearlooks-newer')
1300 bld.install_files (bld.env['CONFDIR'], 'system_config')
1302 if bld.env['RUN_TESTS']:
1303 bld.add_post_fun(test)
1307 bld.recurse (i18n_children)
1310 bld.recurse (i18n_children)
1313 bld.recurse (i18n_children)
1316 bld.recurse (i18n_children)
1319 create_stored_revision()
1322 subprocess.call("gtk2_ardour/artest")