fix mistaken "do not roll" conclusion in TransportFSM::compute_should_roll()
[ardour.git] / wscript
1 #!/usr/bin/env python
2 from waflib.extras import autowaf as autowaf
3 from waflib import Options
4 import os
5 import re
6 import string
7 import subprocess
8 import sys
9 import platform as PLATFORM
10 from waflib.Tools import winres
11 from waflib.Build import Context
12 from waflib.Build import BuildContext
13
14 class i18n(BuildContext):
15         cmd = 'i18n'
16         fun = 'i18n'
17
18 class i18n_pot(BuildContext):
19         cmd = 'i18n_pot'
20         fun = 'i18n_pot'
21
22 class i18n_po(BuildContext):
23         cmd = 'i18n_po'
24         fun = 'i18n_po'
25
26 class i18n_mo(BuildContext):
27         cmd = 'i18n_mo'
28         fun = 'i18n_mo'
29
30 compiler_flags_dictionaries= {
31     'gcc' : {
32         # Flags required when building a debug build
33         'debuggable' : [ '-g' ],
34         # Flags required for the linker (if any) when building a debug build
35         'linker-debuggable' : '',
36         # Flags required when building a non-debug optimized build
37         'nondebuggable' : '-DNDEBUG',
38         # Flags required to enable profiling at runtime with optimized builds
39         'profile' : [ '-fno-omit-frame-pointer' ],
40         # Flags required to enable gprofile profiling
41         'gprofile' : '-pg',
42         # Flags required to disable warnings about unused arguments to function calls
43         'silence-unused-arguments' : '',
44         # Flags required to use SSE unit for general math
45         'sse' : '-msse',
46         # Flags required to use SSE unit for floating point math
47         'fpmath-sse' : '-mfpmath=sse',
48         # Flags required to use XMM Intrinsics
49         'xmmintrinsics' : '-DUSE_XMMINTRIN',
50         # Flags to use posix pipes between compiler stages
51         'pipe' : '-pipe',
52         # Flags for maximally optimized build
53         'full-optimization' : [ '-O3', '-fomit-frame-pointer', '-ffast-math', '-fstrength-reduce', ],
54         # Flag to ensure that compiler error output includes column/line numbers
55         'show-column' : '-fshow-column',
56         # Flags required to build for x86 only (OS X feature)
57         'generic-x86' : '',
58         # Flags required to build for PowerPC only (OS X feature)
59         'generic-ppc' : '',
60         # All flags required to get basic warnings to be generated by the compiler
61         'basic-warnings' : [ '-Wall', '-Wpointer-arith', '-Wcast-qual', '-Wcast-align', '-Wno-unused-parameter' ],
62         # Any additional flags for warnings that are specific to C (not C++)
63         'extra-c-warnings' : [ '-Wstrict-prototypes', '-Wmissing-prototypes' ],
64         # Any additional flags for warnings that are specific to C++ (not C)
65         'extra-cxx-warnings' : [ '-Woverloaded-virtual', '-Wno-unused-local-typedefs' ],
66         # Flags used for "strict" compilation, C and C++ (i.e. compiler will warn about language issues)
67         'strict' : ['-Wall', '-Wcast-align', '-Wextra', '-Wwrite-strings', '-Wunsafe-loop-optimizations', '-Wlogical-op' ],
68         # Flags used for "strict" compilation, C only (i.e. compiler will warn about language issues)
69         'c-strict' : ['-std=c99', '-pedantic', '-Wshadow'],
70         # Flags used for "strict" compilation, C++ only (i.e. compiler will warn about language issues)
71         'cxx-strict' : [ '-ansi', '-Wnon-virtual-dtor', '-Woverloaded-virtual', '-fstrict-overflow' ],
72         # Flags required for whatever consider the strictest possible compilation
73         'ultra-strict' : ['-Wredundant-decls', '-Wstrict-prototypes', '-Wmissing-prototypes'],
74         # Flag to turn on C99 compliance by itself
75         'c99': '-std=c99',
76         # Flag to enable AT&T assembler syntax
77         'attasm': '-masm=att',
78         # Flags to make AVX instructions/intrinsics available
79         'avx': '-mavx',
80         # Flags to generate position independent code, when needed to build a shared object
81         'pic': '-fPIC',
82         # Flags required to compile C code with anonymous unions (only part of C11)
83         'c-anonymous-union': '-fms-extensions',
84     },
85     'msvc' : {
86         'debuggable' : ['/DDEBUG', '/Od', '/Zi', '/MDd', '/Gd', '/EHsc'],
87         'linker-debuggable' : ['/DEBUG', '/INCREMENTAL' ],
88         'nondebuggable' : ['/DNDEBUG', '/Ob1', '/MD', '/Gd', '/EHsc'],
89         'profile' : '/Oy-',
90         'sse' : '/arch:SSE',
91         'silence-unused-arguments' : '',
92         'sse' : '',
93         'fpmath-sse' : '',
94         'xmmintrinsics' : '',
95         'pipe' : '',
96         'full-optimization' : '/O2',
97         'no-frame-pointer' : '',
98         'fast-math' : '',
99         'strength-reduce' : '',
100         'show-column' : '',
101         'generic-x86' : '',
102         'generic-ppc' : '',
103         'basic-warnings' : '',
104         'extra-c-warnings' : '',
105         'extra-cxx-warnings' : '',
106         'ultra-strict' : '',
107         'c-strict' : '',
108         'cxx-strict' : '',
109         'strict' : '',
110         'c99': '/TP',
111         'attasm': '',
112         'avx': '',
113         'pic': '',
114         'c-anonymous-union': '',
115     },
116 }
117
118 # Copy, edit and insert variants on gcc dict for gcc-darwin and clang
119
120 gcc_darwin_dict = compiler_flags_dictionaries['gcc'].copy()
121 gcc_darwin_dict['extra-cxx-warnings'] = [ '-Woverloaded-virtual' ]
122 gcc_darwin_dict['cxx-strict'] = [ '-ansi', '-Wnon-virtual-dtor', '-Woverloaded-virtual' ]
123 gcc_darwin_dict['strict'] = ['-Wall', '-Wcast-align', '-Wextra', '-Wwrite-strings' ]
124 gcc_darwin_dict['generic-x86'] = [ '-arch', 'i386' ]
125 gcc_darwin_dict['generic-ppc'] = [ '-arch', 'ppc' ]
126 compiler_flags_dictionaries['gcc-darwin'] = gcc_darwin_dict;
127
128 clang_dict = compiler_flags_dictionaries['gcc'].copy();
129 clang_dict['sse'] = ''
130 clang_dict['fpmath-sse'] = ''
131 clang_dict['xmmintrinsics'] = ''
132 clang_dict['silence-unused-arguments'] = '-Qunused-arguments'
133 clang_dict['extra-cxx-warnings'] = [ '-Woverloaded-virtual', '-Wno-mismatched-tags', '-Wno-cast-align', '-Wno-unused-local-typedefs', '-Wunneeded-internal-declaration' ]
134 clang_dict['cxx-strict'] = [ '-ansi', '-Wnon-virtual-dtor', '-Woverloaded-virtual', '-fstrict-overflow' ]
135 clang_dict['strict'] = ['-Wall', '-Wcast-align', '-Wextra', '-Wwrite-strings' ]
136 clang_dict['generic-x86'] = [ '-arch', 'i386' ]
137 clang_dict['full-optimization'] = [ '-O3', '-fomit-frame-pointer', '-ffast-math', ]
138 compiler_flags_dictionaries['clang'] = clang_dict;
139
140 clang_darwin_dict = compiler_flags_dictionaries['clang'].copy();
141 clang_darwin_dict['cxx-strict'] = [ '-ansi', '-Wnon-virtual-dtor', '-Woverloaded-virtual', ]
142 clang_darwin_dict['full-optimization'] = [ '-O3', '-ffast-math']
143 compiler_flags_dictionaries['clang-darwin'] = clang_darwin_dict;
144
145 def fetch_git_revision_date ():
146     cmd = ["git", "describe", "HEAD"]
147     output = subprocess.Popen(cmd, stderr=subprocess.STDOUT, stdout=subprocess.PIPE).communicate()[0].splitlines()
148     rev = re.sub(r"^[A-Za-z0-9]*\+", "", output[0].decode('utf-8'))
149
150     cmd = ["git", "log", "-1", "--pretty=format:%ci", "HEAD"]
151     output = subprocess.Popen(cmd, stderr=subprocess.STDOUT, stdout=subprocess.PIPE).communicate()[0].splitlines()
152     date = output[0].decode('utf-8').split(None, 2)[0]
153
154     return rev, date
155
156 def fetch_tarball_revision_date():
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')
159         sys.exit (1)
160     with open('libs/ardour/revision.cc', 'rb') as f:
161         content = f.readlines()
162         remove_punctuation_map = dict((ord(char), None) for char in '";')
163
164         raw_line_tokens = content[1].decode('utf-8').strip().split(' ')
165         rev = raw_line_tokens[7].translate(remove_punctuation_map)
166         date = raw_line_tokens[12].translate(remove_punctuation_map)
167
168         return rev, date
169
170 if os.path.isdir (os.path.join(os.getcwd(), '.git')):
171     rev, rev_date = fetch_git_revision_date()
172 else:
173     rev, rev_date = fetch_tarball_revision_date()
174
175 #
176 # rev is now of the form MAJOR.MINOR[-rcX]-rev-commit
177 # or, if right at the same rev as a release, MAJOR.MINOR[-rcX]
178 #
179
180 parts = rev.split ('.', 1)
181 MAJOR = parts[0]
182 other = parts[1].split('-', 1)
183 MINOR = other[0]
184 if len(other) > 1:
185     MICRO = other[1].rsplit('-',1)[0].replace('-','.')
186 else:
187     MICRO = '0'
188
189 V = MAJOR + '.' + MINOR + '.' + MICRO
190
191 def sanitize(s):
192     # round-trip to remove anything in the string that is not encodable in
193     # ASCII, yet still keep a real (utf8-encoded internally) string.
194     s = s.encode ('ascii', 'ignore').decode ("utf-8")
195     # In Python3, bytes is the class of binary content and encode() returns
196     # bytes to transform a string according to a text encoding; str is the
197     # class of normal strings (utf8-encoded internally) and decode() returns
198     # that type.
199     # Python 2 did not initially cater for encoding problems and can use str
200     # for both binary content and for (decoded) strings. The Unicode type was
201     # added to correspond to Python 3 str, and the Python 2 str type should
202     # only correspond to bytes. Alas, almost everything in the Python 2
203     # ecosystem has been written with str in mind and doesn't handle Unicode
204     # objects correctly. If Python 2 is in use, s will be a Unicode object and
205     # to avoid strange problems later we convert back to str, but in utf-8
206     # nonetheless.
207     if not isinstance(s, str):
208         s = s.encode("utf-8")
209     return s
210 VERSION = sanitize(V)
211 PROGRAM_VERSION = sanitize(MAJOR)
212 del sanitize
213
214 if len (sys.argv) > 1 and sys.argv[1] == 'dist':
215         if not 'APPNAME' in os.environ:
216                 print ("You must define APPNAME in the environment when running ./waf dist")
217                 sys.exit (1)
218         APPNAME = os.environ['APPNAME'];
219
220 # Mandatory variables
221 top = '.'
222 out = 'build'
223
224 children = [
225         # optionally external libraries
226         'libs/fluidsynth',
227         'libs/hidapi',
228         'libs/libltc',
229         'libs/lua',
230         'libs/ptformat',
231         'libs/qm-dsp',
232         'libs/vamp-plugins',
233         'libs/vamp-pyin',
234         'libs/zita-resampler',
235         'libs/zita-convolver',
236         # core ardour libraries
237         'libs/pbd',
238         'libs/midi++2',
239         'libs/evoral',
240         'libs/surfaces',
241         'libs/panners',
242         'libs/backends',
243         'libs/temporal',
244         'libs/ardour',
245         'libs/gtkmm2ext',
246         'libs/audiographer',
247         'libs/canvas',
248         'libs/widgets',
249         'libs/waveview',
250         'libs/plugins/reasonablesynth.lv2',
251         'libs/plugins/a-comp.lv2',
252         'libs/plugins/a-exp.lv2',
253         'libs/plugins/a-delay.lv2',
254         'libs/plugins/a-eq.lv2',
255         'libs/plugins/a-reverb.lv2',
256         'libs/plugins/a-fluidsynth.lv2',
257         'gtk2_ardour',
258         'export',
259         'midi_maps',
260         'mcp',
261         'osc',
262         'patchfiles',
263         'plugin_metadata',
264         'scripts',
265         'headless',
266         'session_utils',
267         # shared helper binaries (plugin-scanner, exec-wrapper)
268         'libs/fst',
269         'libs/vfork',
270         'libs/ardouralsautil',
271         'tools/luadevel',
272 ]
273
274 i18n_children = [
275         'gtk2_ardour',
276         'libs/ardour',
277         'libs/gtkmm2ext',
278 ]
279
280 # Version stuff
281
282 def fetch_gcc_version (CC):
283     cmd = "%s --version" % CC
284     output = subprocess.Popen(cmd, shell=True, stderr=subprocess.STDOUT, stdout=subprocess.PIPE).communicate()[0].splitlines()
285     o = output[0].decode('utf-8')
286     version = o.split(' ')[2].split('.')
287     return version
288
289 def create_stored_revision():
290     rev = ""
291     if os.path.exists('.git'):
292         rev, rev_date = fetch_git_revision_date();
293         print("Git version: " + rev + "\n")
294     elif os.path.exists('libs/ardour/revision.cc'):
295         print("Using packaged revision")
296         return
297     else:
298         print("Missing libs/ardour/revision.cc.  Blame the packager.")
299         sys.exit(-1)
300
301     try:
302         #
303         # if you change the format of this, be sure to fix fetch_tarball_revision_date()
304         # above so that  it still works.
305         #
306         text =  '#include "ardour/revision.h"\n'
307         text += (
308             'namespace ARDOUR { const char* revision = \"%s\"; '
309             'const char* date = \"%s\"; }\n'
310         ) % (rev, rev_date)
311         print('Writing revision info to libs/ardour/revision.cc using ' + rev + ', ' + rev_date)
312         o = open('libs/ardour/revision.cc', 'w')
313         o.write(text)
314         o.close()
315     except IOError:
316         print('Could not open libs/ardour/revision.cc for writing\n')
317         sys.exit(-1)
318
319 def get_depstack_rev(depstack_root):
320     try:
321         with open(depstack_root + '/../.vers', 'r') as f:
322             return f.readline().decode('utf-8').strip()[:7]
323     except IOError:
324         return '-unknown-';
325
326 def set_compiler_flags (conf,opt):
327     #
328     # Compiler flags and other system-dependent stuff
329     #
330     build_host_supports_sse = False
331
332     # Flags necessary for building
333     compiler_flags = []     # generic
334     c_flags = []            # C-specific
335     cxx_flags = []          # C++-specific
336     linker_flags = []
337
338     # Optimization flags (overridable)
339     optimization_flags = []
340
341     # Debugging flags
342     debug_flags = []
343
344     u = PLATFORM.uname ()
345     cpu = u[4]
346     platform = u[0].lower()
347     version = u[2]
348
349     # waf adds -O0 -g itself. thanks waf!
350     is_clang = conf.check_cxx(fragment = '''
351 #ifndef __clang__
352 #error
353 #endif
354 int main() { return 0; }''',
355                          features  = 'cxx',
356                          mandatory = False,
357                          execute   = False,
358                          msg       = 'Checking for clang')
359
360     if is_clang:
361         if platform == 'darwin':
362             compiler_name = 'clang-darwin'
363         else:
364             compiler_name = 'clang'
365     elif conf.env['MSVC_COMPILER']:
366             compiler_name = 'msvc'
367     else:
368         if platform == 'darwin':
369             compiler_name = 'gcc-darwin'
370         else:
371             compiler_name = 'gcc'
372
373     flags_dict = compiler_flags_dictionaries[compiler_name]
374     # Save the compiler flags because we need them at build time
375     # when we need to add compiler specific flags in certain
376     # libraries
377     conf.env['compiler_flags_dict'] = flags_dict;
378
379     autowaf.set_basic_compiler_flags (conf,flags_dict)
380
381     if conf.options.asan:
382         conf.check_cxx(cxxflags=["-fsanitize=address", "-fno-omit-frame-pointer"], linkflags=["-fsanitize=address"])
383         cxx_flags.append('-fsanitize=address')
384         cxx_flags.append('-fno-omit-frame-pointer')
385         linker_flags.append('-fsanitize=address')
386
387     if conf.options.tsan:
388         conf.check_cxx(cxxflags=["-fsanitize=thread", "-fno-omit-frame-pointer"], linkflags=["-fsanitize=thread"])
389         c_flags.extend(('-fsanitize=thread', '-fno-omit-frame-pointer'))
390         cxx_flags.extend(('-fsanitize=thread', '-fno-omit-frame-pointer'))
391         linker_flags.append('-fsanitize=thread')
392
393     if opt.gprofile:
394         debug_flags = [ flags_dict['gprofile'] ]
395
396     # OSX
397     if platform == 'darwin':
398         if re.search ("^13[.]", version) != None:
399             conf.env['build_host'] = 'mavericks'
400         elif re.search ("^14[.]", version) != None:
401             conf.env['build_host'] = 'yosemite'
402         elif re.search ("^15[.]", version) != None:
403             conf.env['build_host'] = 'el_capitan'
404         elif re.search ("^16[.]", version) != None:
405             conf.env['build_host'] = 'sierra'
406         elif re.search ("^17[.]", version) != None:
407             conf.env['build_host'] = 'high_sierra'
408         elif re.search ("^18[.]", version) != None:
409             conf.env['build_host'] = 'mojave'
410         elif re.search ("^19[.]", version) != None:
411             conf.env['build_host'] = 'catalina'
412         else:
413             conf.env['build_host'] = 'irrelevant'
414
415     # Autodetect
416     if opt.dist_target == 'auto':
417         if platform == 'darwin':
418             # The [.] matches to the dot after the major version, "." would match any character
419             if re.search ("^[0-7][.]", version) != None:
420                 conf.env['build_target'] = 'panther'
421             elif re.search ("^8[.]", version) != None:
422                 conf.env['build_target'] = 'tiger'
423             elif re.search ("^9[.]", version) != None:
424                 conf.env['build_target'] = 'leopard'
425             elif re.search ("^10[.]", version) != None:
426                 conf.env['build_target'] = 'snowleopard'
427             elif re.search ("^11[.]", version) != None:
428                 conf.env['build_target'] = 'lion'
429             elif re.search ("^12[.]", version) != None:
430                 conf.env['build_target'] = 'mountainlion'
431             elif re.search ("^13[.]", version) != None:
432                 conf.env['build_target'] = 'mavericks'
433             elif re.search ("^14[.]", version) != None:
434                 conf.env['build_target'] = 'yosemite'
435             elif re.search ("^15[.]", version) != None:
436                 conf.env['build_target'] = 'el_capitan'
437             elif re.search ("^16[.]", version) != None:
438                 conf.env['build_target'] = 'sierra'
439             elif re.search ("^17[.]", version) != None:
440                 conf.env['build_target'] = 'high sierra'
441             elif re.search ("^18[.]", version) != None:
442                 conf.env['build_target'] = 'mojave'
443             else:
444                 conf.env['build_target'] = 'catalina'
445         else:
446             match = re.search(
447                     "(?P<cpu>i[0-6]86|x86_64|powerpc|ppc|ppc64|arm|s390x?)",
448                     cpu)
449             if (match):
450                 conf.env['build_target'] = match.group("cpu")
451                 if re.search("i[0-5]86", conf.env['build_target']):
452                     conf.env['build_target'] = "i386"
453             else:
454                 conf.env['build_target'] = 'none'
455     else:
456         conf.env['build_target'] = opt.dist_target
457
458     if conf.env['build_target'] == 'snowleopard':
459         #
460         # stupid OS X 10.6 has a bug in math.h that prevents llrint and friends
461         # from being visible.
462         #
463         compiler_flags.append ('-U__STRICT_ANSI__')
464
465     if opt.use_libcpp or conf.env['build_host'] in [ 'el_capitan', 'sierra', 'high_sierra', 'mojave', 'catalina' ]:
466        cxx_flags.append('--stdlib=libc++')
467        linker_flags.append('--stdlib=libc++')
468
469     if conf.options.cxx11 or conf.env['build_host'] in [ 'mavericks', 'yosemite', 'el_capitan', 'sierra', 'high_sierra', 'mojave', 'catalina' ]:
470         conf.check_cxx(cxxflags=["-std=c++11"])
471         cxx_flags.append('-std=c++11')
472         if platform == "darwin":
473             # Mavericks and later changed the syntax to be used when including Carbon headers,
474             # from requiring a full path to requiring just the header name.
475             cxx_flags.append('-DCARBON_FLAT_HEADERS')
476
477             if not opt.use_libcpp and not conf.env['build_host'] in [ 'el_capitan', 'sierra', 'high_sierra', 'mojave', 'catalina' ]:
478                 cxx_flags.append('--stdlib=libstdc++')
479                 linker_flags.append('--stdlib=libstdc++')
480             # Prevents visibility issues in standard headers
481             conf.define("_DARWIN_C_SOURCE", 1)
482         else:
483             cxx_flags.append('-DBOOST_NO_AUTO_PTR')
484
485
486     if (is_clang and platform == "darwin") or conf.env['build_host'] in [ 'mavericks', 'yosemite', 'el_capitan', 'sierra', 'high_sierra', 'mojave', 'catalina' ]:
487         # Silence warnings about the non-existing osx clang compiler flags
488         # -compatibility_version and -current_version.  These are Waf
489         # generated and not needed with clang
490         c_flags.append("-Qunused-arguments")
491         cxx_flags.append("-Qunused-arguments")
492
493     if (re.search ("(i[0-9]86|x86_64|AMD64)", cpu) != None) and conf.env['build_target'] != 'none':
494
495         #
496         # ARCH_X86 means anything in the x86 family from i386 to x86_64
497         # the compile-time presence of the macro _LP64 is used to
498         # distingush 32 and 64 bit assembler
499         #
500
501         compiler_flags.append ("-DARCH_X86")
502
503         if platform == 'linux' :
504
505             #
506             # determine processor flags via /proc/cpuinfo
507             #
508
509             if conf.env['build_target'] != 'i386':
510
511                 flag_line = os.popen ("cat /proc/cpuinfo | grep '^flags'").read()[:-1]
512                 x86_flags = flag_line.split (": ")[1:][0].split ()
513
514                 if "mmx" in x86_flags:
515                     compiler_flags.append ("-mmmx")
516                 if "sse" in x86_flags:
517                     build_host_supports_sse = True
518                 if "3dnow" in x86_flags:
519                     compiler_flags.append ("-m3dnow")
520
521             if cpu == "i586":
522                 compiler_flags.append ("-march=i586")
523             elif cpu == "i686":
524                 compiler_flags.append ("-march=i686")
525
526         if not is_clang and ((conf.env['build_target'] == 'i686') or (conf.env['build_target'] == 'x86_64')) and build_host_supports_sse:
527             compiler_flags.extend ([ flags_dict['sse'], flags_dict['fpmath-sse'], flags_dict['xmmintrinsics'] ])
528
529         if (conf.env['build_target'] == 'mingw'):
530             if (re.search ("(x86_64|AMD64)", cpu) != None):
531                 # on Windows sse is supported by 64 bit platforms only
532                 build_host_supports_sse = True
533
534                 # mingw GCC compiler to uses at&t (Unix specific) assembler dialect by default
535                 # compiler_flags.append (["--mmnemonic=att", "msyntax=att")
536
537                 compiler_flags.extend ([ flags_dict['sse'], flags_dict['fpmath-sse'], flags_dict['xmmintrinsics'], flags_dict['attasm'] ])
538
539     # end of processor-specific section
540
541     # optimization section
542     if conf.env['FPU_OPTIMIZATION']:
543         if sys.platform == 'darwin':
544             compiler_flags.append("-DBUILD_VECLIB_OPTIMIZATIONS");
545             conf.env.append_value('LINKFLAGS_OSX', ['-framework', 'Accelerate'])
546         elif conf.env['build_target'] == 'i686' or conf.env['build_target'] == 'x86_64':
547                 compiler_flags.append ("-DBUILD_SSE_OPTIMIZATIONS")
548         elif conf.env['build_target'] == 'mingw':
549                 # usability of the 64 bit windows assembler depends on the compiler target,
550                 # not the build host, which in turn can only be inferred from the name
551                 # of the compiler.
552                 if re.search ('x86_64-w64', str(conf.env['CC'])) != None:
553                         compiler_flags.append ("-DBUILD_SSE_OPTIMIZATIONS")
554         if not build_host_supports_sse:
555             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)")
556
557     # end optimization section
558
559     #
560     # no VST on x86_64
561     #
562
563     if conf.env['build_target'] == 'x86_64' and opt.windows_vst:
564         print("\n\n==================================================")
565         print("64bit Windows VST support on 64bit Linux is experimental.")
566         print("(This version of ardour will not load 32bit VSTs)")
567         print("==================================================\n\n")
568
569     if conf.env['LXVST_SUPPORT'] == True:
570         if conf.env['build_target'] == 'x86_64':
571             compiler_flags.append("-DLXVST_64BIT")
572         else:
573             compiler_flags.append("-DLXVST_32BIT")
574
575     #
576     # a single way to test if we're on OS X
577     #
578
579     if conf.env['build_target'] in ['panther', 'tiger', 'leopard' ]:
580         # force tiger or later, to avoid issues on PPC which defaults
581         # back to 10.1 if we don't tell it otherwise.
582
583         compiler_flags.extend(
584                 ("-DMAC_OS_X_VERSION_MIN_REQUIRED=1040",
585                  '-mmacosx-version-min=10.4'))
586
587     elif conf.env['build_target'] in [ 'snowleopard' ]:
588         compiler_flags.extend(
589                 ("-DMAC_OS_X_VERSION_MIN_REQUIRED=1060",
590                  '-mmacosx-version-min=10.6'))
591
592     elif conf.env['build_target'] in [ 'lion', 'mountainlion' ]:
593         compiler_flags.extend(
594                 ("-DMAC_OS_X_VERSION_MIN_REQUIRED=1070",
595                  '-mmacosx-version-min=10.7'))
596
597     elif conf.env['build_target'] in [ 'mavericks', 'yosemite' ]:
598         compiler_flags.extend(
599                 ("-DMAC_OS_X_VERSION_MAX_ALLOWED=1090",
600                  "-mmacosx-version-min=10.8"))
601
602     elif conf.env['build_target'] in ['el_capitan', 'sierra', 'high_sierra', 'mojave', 'catalina' ]:
603         compiler_flags.extend(
604                 ("-DMAC_OS_X_VERSION_MAX_ALLOWED=1090",
605                  "-mmacosx-version-min=10.9"))
606
607     #
608     # save off CPU element in an env
609     #
610     conf.define ('CONFIG_ARCH', cpu)
611
612     #
613     # ARCH="..." overrides all
614     #
615
616     if opt.arch != None:
617         optimization_flags = opt.arch.split()
618
619     #
620     # prepend boiler plate optimization flags that work on all architectures
621     #
622
623     optimization_flags[:0] = [flags_dict['pipe']]
624
625     # don't prepend optimization flags if "-O<something>" is present
626     prepend_opt_flags = True
627     for flag in optimization_flags:
628         if flag.startswith("-O"):
629             prepend_opt_flags = False
630             break
631
632     if prepend_opt_flags:
633         optimization_flags[:0] = flags_dict['full-optimization']
634
635     if opt.debug_symbols:
636         optimization_flags += flags_dict['debuggable']
637
638     if opt.profile:
639         optimization_flags += flags_dict['profile']
640
641     if opt.stl_debug:
642         cxx_flags.append("-D_GLIBCXX_DEBUG")
643
644     if re.search ("freebsd", sys.platform) != None or re.search ("openbsd", sys.platform) != None:
645         linker_flags.append('-lexecinfo')
646
647     if conf.env['DEBUG_RT_ALLOC']:
648         compiler_flags.append('-DDEBUG_RT_ALLOC')
649         linker_flags.append('-ldl')
650
651     if conf.env['DEBUG_DENORMAL_EXCEPTION']:
652         compiler_flags.append('-DDEBUG_DENORMAL_EXCEPTION')
653
654     if opt.generic:
655         compiler_flags.extend(flags_dict['generic-x86'])
656         linker_flags.extend(flags_dict['generic-x86'])
657
658     if opt.ppc:
659         compiler_flags.extend(flags_dict['generic-ppc'])
660         linker_flags.extend(flags_dict['generic-ppc'])
661
662     #
663     # warnings flags
664     #
665
666     compiler_flags.extend(flags_dict['basic-warnings'])
667
668     c_flags.extend(flags_dict['extra-c-warnings'])
669     cxx_flags.extend (flags_dict['extra-cxx-warnings'])
670
671     #
672     # more boilerplate
673     #
674
675     # need ISOC9X for llabs()
676     compiler_flags.extend(
677         ('-DBOOST_SYSTEM_NO_DEPRECATED', '-D_ISOC9X_SOURCE',
678          '-D_LARGEFILE64_SOURCE', '-D_FILE_OFFSET_BITS=64'))
679     cxx_flags.extend(
680         ('-D__STDC_LIMIT_MACROS', '-D__STDC_FORMAT_MACROS',
681          '-DCANVAS_COMPATIBILITY', '-DCANVAS_DEBUG'))
682
683     # use sparingly, prefer runtime profile
684     if Options.options.program_name.lower().startswith('mixbus'):
685         compiler_flags.append ('-DMIXBUS')
686         conf.define('MIXBUS', 1)
687
688     if Options.options.program_name.lower() == "mixbus32c":
689         conf.define('MIXBUS32C', 1)
690         compiler_flags.append ('-DMIXBUS32C')
691
692     compiler_flags.append ('-DPROGRAM_NAME="' + Options.options.program_name + '"')
693     compiler_flags.append ('-DPROGRAM_VERSION="' + PROGRAM_VERSION + '"')
694
695     conf.env['PROGRAM_NAME'] = Options.options.program_name
696
697     if opt.debug:
698         conf.env.append_value('CFLAGS', debug_flags)
699         conf.env.append_value('CXXFLAGS', debug_flags)
700     else:
701         conf.env.append_value('CFLAGS', optimization_flags)
702         conf.env.append_value('CXXFLAGS', optimization_flags)
703
704     if opt.backtrace:
705         if platform != 'darwin' and not is_clang and not Options.options.dist_target == 'mingw':
706             linker_flags += [ '-rdynamic' ]
707
708     conf.env.append_value('CFLAGS', compiler_flags)
709     conf.env.append_value('CFLAGS', c_flags)
710     conf.env.append_value('CXXFLAGS', compiler_flags)
711     conf.env.append_value('CXXFLAGS', cxx_flags)
712     conf.env.append_value('LINKFLAGS', linker_flags)
713
714 def create_resource_file(icon):
715     try:
716         text = 'IDI_ICON1 ICON DISCARDABLE "icons/' + icon + '.ico"\n'
717         o = open('gtk2_ardour/windows_icon.rc', 'w')
718         o.write(text)
719         o.close()
720     except IOError:
721         print('Could not open gtk2_ardour/windows_icon.rc for writing\n')
722         sys.exit(-1)
723
724 #----------------------------------------------------------------
725
726 # Waf stages
727
728 def options(opt):
729     opt.load('compiler_c')
730     opt.load('compiler_cxx')
731     autowaf.set_options(opt, debug_by_default=True)
732     opt.add_option('--program-name', type='string', action='store', default='Ardour', dest='program_name',
733                     help='The user-visible name of the program being built')
734     opt.add_option('--arch', type='string', action='store', dest='arch',
735                     help='Architecture-specific compiler FLAGS')
736     opt.add_option('--with-backends', type='string', action='store', default='jack', dest='with_backends',
737                     help='Specify which backend modules are to be included(jack,alsa,dummy,portaudio,coreaudio)')
738     opt.add_option('--backtrace', action='store_true', default=False, dest='backtrace',
739                     help='Compile with -rdynamic -- allow obtaining backtraces from within Ardour')
740     opt.add_option('--no-carbon', action='store_true', default=False, dest='nocarbon',
741                     help='Compile without support for AU Plugins with only CARBON UI (needed for 64bit)')
742     opt.add_option('--boost-sp-debug', action='store_true', default=False, dest='boost_sp_debug',
743                     help='Compile with Boost shared pointer debugging')
744     opt.add_option('--debug-symbols', action='store_true', default=False, dest='debug_symbols',
745                     help='Add debug-symbols to optimized builds')
746     opt.add_option('--depstack-root', type='string', default='~', dest='depstack_root',
747                     help='Directory/folder where dependency stack trees (gtk, a3) can be found (defaults to ~)')
748     opt.add_option('--dist-target', type='string', default='auto', dest='dist_target',
749                     help='Specify the target for cross-compiling [auto,none,x86,i386,i686,x86_64,tiger,leopard,mingw,msvc]')
750     opt.add_option('--fpu-optimization', action='store_true', default=True, dest='fpu_optimization',
751                     help='Build runtime checked assembler code (default)')
752     opt.add_option('--no-fpu-optimization', action='store_false', dest='fpu_optimization')
753     opt.add_option('--exports-hidden', action='store_true', default=False, dest='exports_hidden')
754     opt.add_option('--freedesktop', action='store_true', default=False, dest='freedesktop',
755                     help='Build MIME type and .desktop files as per freedesktop.org standards (will be placed in build/gtk2_ardour)')
756     opt.add_option('--freebie', action='store_true', default=False, dest='freebie',
757                     help='Build a version suitable for distribution as a zero-cost binary')
758     opt.add_option('--profile', action='store_true', default=False, dest='profile',
759                     help='Compile for use with profiling tools requiring a frame pointer')
760     opt.add_option('--gprofile', action='store_true', default=False, dest='gprofile',
761                     help='Compile for use with gprofile')
762     opt.add_option('--libjack', type='string', default="auto", dest='libjack_link',
763                     help='libjack link mode  [auto|link|weak]')
764     opt.add_option('--internal-shared-libs', action='store_true', default=True, dest='internal_shared_libs',
765                    help='Build internal libs as shared libraries')
766     opt.add_option('--internal-static-libs', action='store_false', dest='internal_shared_libs',
767                    help='Build internal libs as static libraries')
768     opt.add_option('--use-external-libs', action='store_true', default=False, dest='use_external_libs',
769                    help='Use external/system versions of some bundled libraries')
770     opt.add_option('--keepflags', action='store_true', default=False, dest='keepflags',
771                     help='Do not ignore CFLAGS/CXXFLAGS environment vars')
772     opt.add_option('--luadoc', action='store_true', default=False, dest='luadoc',
773                     help='Compile Tool to dump LuaBindings (needs C++11)')
774     opt.add_option('--canvasui', action='store_true', default=False, dest='canvasui',
775                     help='Compile libcanvas test GUI')
776     opt.add_option('--beatbox', action='store_true', default=False, dest='beatbox',
777                     help='Compile beatbox test app')
778     opt.add_option('--lv2dir', type='string', help="install destination for builtin LV2 bundles [Default: LIBDIR/lv2]")
779     opt.add_option('--lxvst', action='store_true', default=True, dest='lxvst',
780                     help='Compile with support for linuxVST plugins')
781     opt.add_option('--no-lxvst', action='store_false', dest='lxvst',
782                     help='Compile without support for linuxVST plugins')
783     opt.add_option('--no-lrdf', action='store_true', dest='no_lrdf',
784                     help='Compile without support for LRDF LADSPA data even if present')
785     opt.add_option('--nls', action='store_true', default=True, dest='nls',
786                     help='Enable i18n (native language support) (default)')
787     opt.add_option('--no-nls', action='store_false', dest='nls')
788     opt.add_option('--phone-home', action='store_true', default=True, dest='phone_home',
789                    help='Contact ardour.org at startup for new announcements')
790     opt.add_option('--no-phone-home', action='store_false', dest='phone_home',
791                    help='Do not contact ardour.org at startup for new announcements')
792     opt.add_option('--stl-debug', action='store_true', default=False, dest='stl_debug',
793                     help='Build with debugging for the STL')
794     opt.add_option('--rt-alloc-debug', action='store_true', default=False, dest='rt_alloc_debug',
795                     help='Build with debugging for memory allocation in the real-time thread')
796     opt.add_option('--pt-timing', action='store_true', default=False, dest='pt_timing',
797                     help='Build with logging of timing in the process thread(s)')
798     opt.add_option('--denormal-exception', action='store_true', default=False, dest='denormal_exception',
799                     help='Raise a floating point exception if a denormal is detected')
800     opt.add_option('--test', action='store_true', default=False, dest='build_tests',
801                     help="Build unit tests")
802     opt.add_option('--run-tests', action='store_true', default=False, dest='run_tests',
803                     help="Run tests after build")
804     opt.add_option('--single-tests', action='store_true', default=False, dest='single_tests',
805                     help="Build a single executable for each unit test")
806     #opt.add_option('--tranzport', action='store_true', default=False, dest='tranzport',
807     # help='Compile with support for Frontier Designs Tranzport (if libusb is available)')
808     opt.add_option('--maschine', action='store_true', default=False, dest='maschine',
809                     help='Compile with support for NI-Maschine')
810     opt.add_option('--generic', action='store_true', default=False, dest='generic',
811                     help='Compile with -arch i386 (OS X ONLY)')
812     opt.add_option('--ppc', action='store_true', default=False, dest='ppc',
813                     help='Compile with -arch ppc (OS X ONLY)')
814     opt.add_option('--versioned', action='store_true', default=False, dest='versioned',
815                     help='Add revision information to executable name inside the build directory')
816     opt.add_option('--windows-vst', action='store_true', default=False, dest='windows_vst',
817                     help='Compile with support for Windows VST')
818     opt.add_option('--windows-key', type='string', action='store', dest='windows_key', default='Mod4><Super',
819                     help='X Modifier(s) (Mod1,Mod2, etc) for the Windows key (X11 builds only). ' +
820                     'Multiple modifiers must be separated by \'><\'')
821     opt.add_option('--boost-include', type='string', action='store', dest='boost_include', default='',
822                     help='directory where Boost header files can be found')
823     opt.add_option('--also-include', type='string', action='store', dest='also_include', default='',
824                     help='additional include directory where header files can be found (split multiples with commas)')
825     opt.add_option('--also-libdir', type='string', action='store', dest='also_libdir', default='',
826                     help='additional include directory where shared libraries can be found (split multiples with commas)')
827     opt.add_option('--wine-include', type='string', action='store', dest='wine_include', default='/usr/include/wine/windows',
828                     help='directory where Wine\'s Windows header files can be found')
829     opt.add_option('--noconfirm', action='store_true', default=False, dest='noconfirm',
830                     help='Do not ask questions that require confirmation during the build')
831     opt.add_option('--cxx11', action='store_true', default=False, dest='cxx11',
832                     help='Turn on c++11 compiler flags (-std=c++11)')
833     opt.add_option('--use-libc++', action='store_true', default=False, dest='use_libcpp',
834                     help='use libc++ instead of default or auto-detected stdlib')
835     opt.add_option('--address-sanitizer', action='store_true', default=False, dest='asan',
836                     help='Turn on AddressSanitizer (requires GCC >= 4.8 or clang >= 3.1)')
837     opt.add_option('--thread-sanitizer', action='store_true', default=False, dest='tsan',
838                     help='Turn on ThreadSanitizer (requires GCC >= 4.8 or clang, and 64bit CPU)')
839     opt.add_option('--ptformat', action='store_true', default=False, dest='ptformat',
840                     help='Turn on PT session import option')
841     opt.add_option('--no-threaded-waveviews', action='store_true', default=False, dest='no_threaded_waveviews',
842                     help='Disable threaded waveview rendering')
843     opt.add_option(
844         '--qm-dsp-include', type='string', action='store',
845         dest='qm_dsp_include', default='/usr/include/qm-dsp',
846         help='directory where the header files of qm-dsp can be found')
847     opt.add_option ('--use-lld', action='store_true', default=False, dest='use_lld', help='Use LLD linker instead of ld (Linux only)')
848
849     for i in children:
850         opt.recurse(i)
851
852 def sub_config_and_use(conf, name, has_objects = True):
853     conf.recurse(name)
854     autowaf.set_local_lib(conf, name, has_objects)
855
856 def configure(conf):
857     conf.load('compiler_c')
858     conf.load('compiler_cxx')
859     if Options.options.dist_target == 'mingw':
860         conf.load('winres')
861
862     if Options.options.dist_target == 'msvc':
863         conf.env['MSVC_VERSIONS'] = ['msvc 10.0', 'msvc 9.0', 'msvc 8.0', 'msvc 7.1', 'msvc 7.0', 'msvc 6.0', ]
864         conf.env['MSVC_TARGETS'] = ['x64']
865         conf.load('msvc')
866
867     if Options.options.debug and not Options.options.keepflags:
868         # Nuke user CFLAGS/CXXFLAGS if debug is set (they likely contain -O3, NDEBUG, etc)
869         conf.env['CFLAGS'] = []
870         conf.env['CXXFLAGS'] = []
871
872     # freedesktop translations needs itstool > 1.0.3 (-j option)
873     if Options.options.freedesktop:
874         output = subprocess.Popen("itstool --version", shell=True, stderr=subprocess.STDOUT, stdout=subprocess.PIPE).communicate()[0].splitlines()
875         o = output[0].decode('utf-8')
876         itstool = o.split(' ')[0]
877         version = o.split(' ')[1].split('.')
878         # use  distutils.version.StrictVersion  or something python to check >= 1.0.4
879         # but first make sure that all build-hosts (incl. OSX-10.5/PPC) have that python lib.
880         # lazy approach: just use major version 2.X.X
881         if itstool != "itstool" or version[0] < "2":
882             conf.fatal("--freedesktop requires itstool > 2.0.0 to translate files.")
883
884     conf.env['VERSION'] = VERSION
885     conf.env['MAJOR'] = MAJOR
886     conf.env['MINOR'] = MINOR
887     conf.env['MICRO'] = MICRO
888     conf.line_just = 52
889     autowaf.set_recursive()
890     autowaf.configure(conf)
891     autowaf.display_header('Ardour Configuration')
892
893     # systems with glibc have libintl builtin. systems without require explicit
894     # linkage against libintl.
895     #
896
897     pkg_config_path = os.getenv('PKG_CONFIG_PATH')
898     user_gtk_root = os.path.expanduser (Options.options.depstack_root + '/gtk/inst')
899
900     if os.getenv('DEPSTACK_ROOT') is not None and os.path.exists (os.getenv('DEPSTACK_ROOT') + '/lib'):
901         conf.env['DEPSTACK_REV'] = get_depstack_rev (os.getenv('DEPSTACK_ROOT') + '/lib')
902     elif pkg_config_path is not None and pkg_config_path.find (user_gtk_root) >= 0:
903         # told to search user_gtk_root
904         prefinclude = ''.join ([ '-I', user_gtk_root + '/include'])
905         preflib = ''.join ([ '-L', user_gtk_root + '/lib'])
906         conf.env.append_value('CFLAGS', [ prefinclude ])
907         conf.env.append_value('CXXFLAGS',  [prefinclude ])
908         conf.env.append_value('LINKFLAGS', [ preflib ])
909         autowaf.display_msg(conf, 'Will build against private GTK dependency stack in ' + user_gtk_root, 'yes')
910         conf.env['DEPSTACK_REV'] = get_depstack_rev (user_gtk_root)
911     else:
912         autowaf.display_msg(conf, 'Will build against private GTK dependency stack', 'no')
913         conf.env['DEPSTACK_REV'] = '-system-'
914
915     if sys.platform == 'darwin':
916         conf.define ('NEED_INTL', 1)
917         autowaf.display_msg(conf, 'Will use explicit linkage against libintl in ' + user_gtk_root, 'yes')
918     else:
919         # libintl is part of the system, so use it
920         autowaf.display_msg(conf, 'Will rely on libintl built into libc', 'yes')
921
922     user_ardour_root = os.path.expanduser (Options.options.depstack_root + '/a3/inst')
923     if pkg_config_path is not None and pkg_config_path.find (user_ardour_root) >= 0:
924         # told to search user_ardour_root
925         prefinclude = ''.join ([ '-I', user_ardour_root + '/include'])
926         preflib = ''.join ([ '-L', user_ardour_root + '/lib'])
927         conf.env.append_value('CFLAGS', [ prefinclude ])
928         conf.env.append_value('CXXFLAGS',  [prefinclude ])
929         conf.env.append_value('LINKFLAGS', [ preflib ])
930         autowaf.display_msg(conf, 'Will build against private Ardour dependency stack in ' + user_ardour_root, 'yes')
931     else:
932         autowaf.display_msg(conf, 'Will build against private Ardour dependency stack', 'no')
933
934     if Options.options.freebie:
935         conf.env.append_value ('CFLAGS', '-DSILENCE_AFTER')
936         conf.env.append_value ('CXXFLAGS', '-DSILENCE_AFTER')
937         conf.define ('FREEBIE', 1)
938
939     if Options.options.lv2dir:
940         conf.env['LV2DIR'] = Options.options.lv2dir
941     else:
942         conf.env['LV2DIR'] = os.path.join(conf.env['LIBDIR'], 'ardour' + str(conf.env['MAJOR']), 'LV2')
943
944     conf.env['LV2DIR'] = os.path.normpath(conf.env['LV2DIR'])
945
946     if sys.platform == 'darwin':
947
948         # this is required, potentially, for anything we link and then relocate into a bundle
949         conf.env.append_value('LINKFLAGS', [ '-Xlinker', '-headerpad_max_install_names' ])
950
951         conf.define ('HAVE_COREAUDIO', 1)
952         conf.define ('AUDIOUNIT_SUPPORT', 1)
953
954         if not Options.options.ppc:
955             conf.define('MACVST_SUPPORT', 1)
956
957         conf.define ('TOP_MENUBAR',1)
958
959         # It would be nice to be able to use this to force back-compatibility with 10.4
960         # but even by the time of 11, the 10.4 SDK is no longer available in any normal
961         # way.
962         #
963         #conf.env.append_value('CXXFLAGS_OSX', "-isysroot /Developer/SDKs/MacOSX10.4u.sdk")
964         #conf.env.append_value('CFLAGS_OSX', "-isysroot /Developer/SDKs/MacOSX10.4u.sdk")
965         #conf.env.append_value('LINKFLAGS_OSX', "-sysroot /Developer/SDKs/MacOSX10.4u.sdk")
966         #conf.env.append_value('LINKFLAGS_OSX', "-sysroot /Developer/SDKs/MacOSX10.4u.sdk")
967
968         conf.env.append_value('CXXFLAGS_OSX', "-msse")
969         conf.env.append_value('CFLAGS_OSX', "-msse")
970         conf.env.append_value('CXXFLAGS_OSX', "-msse2")
971         conf.env.append_value('CFLAGS_OSX', "-msse2")
972         #
973         #       TODO: The previous sse flags NEED to be based
974         #       off processor type.  Need to add in a check
975         #       for that.
976         #
977         conf.env.append_value('LINKFLAGS_OSX', ['-framework', 'AppKit'])
978         conf.env.append_value('LINKFLAGS_OSX', ['-framework', 'CoreAudio'])
979         conf.env.append_value('LINKFLAGS_OSX', ['-framework', 'CoreAudioKit'])
980         conf.env.append_value('LINKFLAGS_OSX', ['-framework', 'CoreFoundation'])
981         conf.env.append_value('LINKFLAGS_OSX', ['-framework', 'CoreServices'])
982
983         conf.env.append_value('LINKFLAGS_OSX', ['-undefined', 'dynamic_lookup' ])
984         conf.env.append_value('LINKFLAGS_OSX', ['-flat_namespace'])
985
986         conf.env.append_value('CXXFLAGS_AUDIOUNITS', "-DAUDIOUNIT_SUPPORT")
987         conf.env.append_value('LINKFLAGS_AUDIOUNITS', ['-framework', 'AudioToolbox', '-framework', 'AudioUnit'])
988         conf.env.append_value('LINKFLAGS_AUDIOUNITS', ['-framework', 'Cocoa'])
989
990         if (
991                 # osx up to and including 10.6 (uname 10.X.X)
992                 (re.search ("^[1-9][0-9]\.", os.uname()[2]) == None or not re.search ("^10\.", os.uname()[2]) == None)
993                 and (Options.options.generic or Options.options.ppc)
994                 and not Options.options.nocarbon
995            ):
996             conf.env.append_value('CXXFLAGS_AUDIOUNITS', "-DWITH_CARBON")
997             conf.env.append_value('LINKFLAGS_AUDIOUNITS', ['-framework', 'Carbon'])
998         else:
999             print ('No Carbon support available for this build\n')
1000
1001
1002     if Options.options.canvasui:
1003         conf.env['CANVASTESTUI'] = True
1004         conf.define ('CANVASTESTUI', 1)
1005
1006     if Options.options.beatbox:
1007         conf.env['BEATBOX'] = True
1008         conf.define ('BEATBOX', 1)
1009
1010     if Options.options.luadoc:
1011         conf.env['LUABINDINGDOC'] = True
1012         conf.define ('LUABINDINGDOC', 1)
1013
1014     if Options.options.internal_shared_libs:
1015         conf.define('INTERNAL_SHARED_LIBS', 1)
1016
1017     if Options.options.use_external_libs:
1018         conf.define('USE_EXTERNAL_LIBS', 1)
1019         conf.env.append_value(
1020             'CXXFLAGS', '-I' + Options.options.qm_dsp_include)
1021
1022     if Options.options.boost_include != '':
1023         conf.env.append_value('CXXFLAGS', '-I' + Options.options.boost_include)
1024
1025     if Options.options.also_include != '':
1026         conf.env.append_value('CXXFLAGS', '-I' + Options.options.also_include)
1027         conf.env.append_value('CFLAGS', '-I' + Options.options.also_include)
1028
1029     if Options.options.also_libdir != '':
1030         conf.env.append_value('LDFLAGS', '-L' + Options.options.also_libdir)
1031
1032     if Options.options.boost_sp_debug:
1033         conf.env.append_value('CXXFLAGS', '-DBOOST_SP_ENABLE_DEBUG_HOOKS')
1034
1035     # executing a test program is n/a when cross-compiling
1036     if Options.options.dist_target != 'mingw':
1037         if Options.options.dist_target != 'msvc' and re.search ("openbsd", sys.platform) == None:
1038             if re.search ("freebsd", sys.platform) != None:
1039                 conf.check_cc(function_name='dlopen', header_name='dlfcn.h', uselib_store='DL')
1040             else:
1041                 conf.check_cc(function_name='dlopen', header_name='dlfcn.h', lib='dl', uselib_store='DL')
1042
1043     conf.check_cxx(fragment = "#include <boost/version.hpp>\n#if !defined (BOOST_VERSION) || BOOST_VERSION < 105600\n#error boost >= 1.56 is not available\n#endif\nint main(void) { return 0; }\n",
1044               execute = False,
1045               mandatory = True,
1046               msg = 'Checking for boost library >= 1.56',
1047               okmsg = 'ok',
1048               errmsg = 'too old\nPlease install boost version 1.56 or higher.')
1049
1050     if re.search ("linux", sys.platform) != None and Options.options.dist_target != 'mingw':
1051         autowaf.check_pkg(conf, 'alsa', uselib_store='ALSA')
1052
1053     if re.search ("linux", sys.platform) != None and Options.options.dist_target != 'mingw':
1054         autowaf.check_pkg(conf, 'libpulse', uselib_store='PULSEAUDIO', mandatory=False)
1055
1056     if re.search ("openbsd", sys.platform) != None:
1057         conf.env.append_value('LDFLAGS', '-L/usr/X11R6/lib')
1058
1059     autowaf.check_pkg(conf, 'glib-2.0', uselib_store='GLIB', atleast_version='2.28', mandatory=True)
1060     autowaf.check_pkg(conf, 'gthread-2.0', uselib_store='GTHREAD', atleast_version='2.2', mandatory=True)
1061     autowaf.check_pkg(conf, 'glibmm-2.4', uselib_store='GLIBMM', atleast_version='2.32.0', mandatory=True)
1062     autowaf.check_pkg(conf, 'sndfile', uselib_store='SNDFILE', atleast_version='1.0.18', mandatory=True)
1063     autowaf.check_pkg(conf, 'giomm-2.4', uselib_store='GIOMM', atleast_version='2.2', mandatory=True)
1064     autowaf.check_pkg(conf, 'libcurl', uselib_store='CURL', atleast_version='7.0.0', mandatory=True)
1065     autowaf.check_pkg(conf, 'libarchive', uselib_store='ARCHIVE', atleast_version='3.0.0', mandatory=True)
1066     autowaf.check_pkg(conf, 'liblo', uselib_store='LO', atleast_version='0.26', mandatory=True)
1067     autowaf.check_pkg(conf, 'taglib', uselib_store='TAGLIB', atleast_version='1.6', mandatory=True)
1068     autowaf.check_pkg(conf, 'vamp-sdk', uselib_store='VAMPSDK', atleast_version='2.1', mandatory=True)
1069     autowaf.check_pkg(conf, 'vamp-hostsdk', uselib_store='VAMPHOSTSDK', atleast_version='2.1', mandatory=True)
1070     autowaf.check_pkg(conf, 'rubberband', uselib_store='RUBBERBAND', mandatory=True)
1071
1072     have_rf64_riff_support = conf.check_cc(fragment = '''
1073 #include <sndfile.h>
1074 int main () { int x = SFC_RF64_AUTO_DOWNGRADE; return 0; }
1075 ''',
1076                                            features  = 'c',
1077                                            mandatory = False,
1078                                            execute   = False,
1079                                            use = 'SNDFILE',
1080                                            msg       = 'Checking for  sndfile RF64=>RIFF support',
1081                                            okmsg = 'Found',
1082                                            errmsg = 'Not found, no RF64-to-WAV support')
1083
1084     if have_rf64_riff_support:
1085             conf.env.append_value('CXXFLAGS', "-DHAVE_RF64_RIFF")
1086             conf.env.append_value('CFLAGS', "-DHAVE_RF64_RIFF")
1087
1088     if Options.options.dist_target == 'mingw':
1089         Options.options.fpu_optimization = True
1090         conf.env.append_value('CFLAGS', '-DPLATFORM_WINDOWS')
1091         conf.env.append_value('CFLAGS', '-DCOMPILER_MINGW')
1092         conf.env.append_value('CXXFLAGS', '-DPLATFORM_WINDOWS')
1093         conf.env.append_value('CXXFLAGS', '-DCOMPILER_MINGW')
1094         if conf.options.cxx11:
1095             conf.env.append_value('CFLAGS', '-D_USE_MATH_DEFINES')
1096             conf.env.append_value('CXXFLAGS', '-D_USE_MATH_DEFINES')
1097             conf.env.append_value('CFLAGS', '-DWIN32')
1098             conf.env.append_value('CXXFLAGS', '-DWIN32')
1099         conf.env.append_value('LIB', 'pthread')
1100         # needed for at least libsmf
1101         conf.check_cc(function_name='htonl', header_name='winsock2.h', lib='ws2_32')
1102         conf.env.append_value('LIB', 'ws2_32')
1103         conf.env.append_value('LIB', 'winmm')
1104         if Options.options.program_name.lower().startswith('mixbus'):
1105             conf.env.append_value('LIB', 'ole32')
1106             conf.env.append_value('LIB', 'uuid')
1107         # needed for mingw64 packages, not harmful on normal mingw build
1108         conf.env.append_value('LIB', 'intl')
1109         conf.check_cc(function_name='regcomp', header_name='regex.h',
1110                       lib='regex', uselib_store="REGEX", define_name='HAVE_REGEX_H')
1111         # TODO put this only where it is needed
1112         conf.env.append_value('LIB', 'regex')
1113         # TODO this should only be necessary for a debug build
1114         conf.env.append_value('LIB', 'dbghelp')
1115
1116         # work around GdkDrawable BitBlt performance issue on windows
1117         # see http://gareus.org/wiki/ardour_windows_gdk_and_cairo
1118         conf.env.append_value('CFLAGS', '-DUSE_CAIRO_IMAGE_SURFACE')
1119         conf.env.append_value('CXXFLAGS', '-DUSE_CAIRO_IMAGE_SURFACE')
1120         conf.define ('WINDOWS', 1)
1121
1122         have_ptw_semaphore = conf.check_cc(fragment = '''
1123 #include <pthread.h>
1124 #include <semaphore.h>
1125 int main () { return 0; }
1126 ''',
1127                                            features  = 'c',
1128                                            mandatory = False,
1129                                            execute   = False,
1130                                            msg       = 'Checking for pthread posix semaphore',
1131                                            okmsg     = 'Found',
1132                                            errmsg    = 'Not found, falling back to Windows Semaphore.')
1133
1134         #if have_ptw_semaphore:
1135         #    conf.define('USE_PTW32_SEMAPHORE', 1)
1136         #    conf.env.append_value('CFLAGS', '-DUSE_PTW32_SEMAPHORE')
1137         #    conf.env.append_value('CXXFLAGS', '-DUSE_PTW32_SEMAPHORE')
1138
1139     if Options.options.dist_target == 'msvc':
1140         conf.env.append_value('CFLAGS', '-DPLATFORM_WINDOWS')
1141         conf.env.append_value('CFLAGS', '-DCOMPILER_MSVC')
1142         conf.env.append_value('CXXFLAGS', '-DPLATFORM_WINDOWS')
1143         conf.env.append_value('CXXFLAGS', '-DCOMPILER_MSVC')
1144         # work around GdkDrawable BitBlt performance issue on windows
1145         # see http://gareus.org/wiki/ardour_windows_gdk_and_cairo
1146         conf.env.append_value('CFLAGS', '-DUSE_CAIRO_IMAGE_SURFACE')
1147         conf.env.append_value('CXXFLAGS', '-DUSE_CAIRO_IMAGE_SURFACE')
1148         # MORE STUFF PROBABLY NEEDED HERE
1149         conf.define ('WINDOWS', 1)
1150
1151     # Tell everyone that this is a waf build
1152
1153     conf.env.append_value('CFLAGS', '-DWAF_BUILD')
1154     conf.env.append_value('CXXFLAGS', '-DWAF_BUILD')
1155
1156     opts = Options.options
1157
1158     # (optionally) Adopt Microsoft-like convention that makes all non-explicitly exported
1159     # symbols invisible (rather than doing this all over the wscripts in the src tree)
1160     #
1161     # This won't apply to MSVC but that hasn't been added as a target yet
1162     #
1163     # We can't do this till all tests are complete, since some fail if this is et.
1164     if opts.exports_hidden:
1165         conf.define ('EXPORT_VISIBILITY_HIDDEN', True)
1166         if opts.internal_shared_libs:
1167             conf.env.append_value ('CXXFLAGS', '-fvisibility=hidden')
1168             conf.env.append_value ('CFLAGS', '-fvisibility=hidden')
1169     else:
1170         conf.define ('EXPORT_VISIBILITY_HIDDEN', False)
1171
1172     # Set up waf environment and C defines
1173     if opts.phone_home:
1174         conf.define('PHONE_HOME', 1)
1175         conf.env['PHONE_HOME'] = True
1176     if opts.fpu_optimization:
1177         conf.env['FPU_OPTIMIZATION'] = True
1178     if opts.freedesktop:
1179         conf.env['FREEDESKTOP'] = True
1180     if opts.nls:
1181         conf.define('ENABLE_NLS', 1)
1182         conf.env['ENABLE_NLS'] = True
1183     else:
1184         conf.define('ENABLE_NLS', 0)
1185         conf.env['ENABLE_NLS'] = False
1186     if opts.build_tests:
1187         conf.env['BUILD_TESTS'] = True
1188         conf.env['RUN_TESTS'] = opts.run_tests
1189     if opts.single_tests:
1190         conf.env['SINGLE_TESTS'] = opts.single_tests
1191     #if opts.tranzport:
1192     #    conf.env['TRANZPORT'] = 1
1193     if opts.windows_vst:
1194         conf.define('WINDOWS_VST_SUPPORT', 1)
1195         conf.env['WINDOWS_VST_SUPPORT'] = True
1196         if not Options.options.dist_target == 'mingw':
1197             conf.env.append_value('CFLAGS', '-I' + Options.options.wine_include)
1198             conf.env.append_value('CXXFLAGS', '-I' + Options.options.wine_include)
1199             autowaf.check_header(conf, 'cxx', 'windows.h', mandatory = True)
1200     if opts.lxvst:
1201         if sys.platform == 'darwin':
1202             conf.env['LXVST_SUPPORT'] = False
1203         elif Options.options.dist_target == 'mingw':
1204             conf.env['LXVST_SUPPORT'] = False
1205         else:
1206             conf.define('LXVST_SUPPORT', 1)
1207             conf.env['LXVST_SUPPORT'] = True
1208     conf.env['WINDOWS_KEY'] = opts.windows_key
1209     if opts.rt_alloc_debug:
1210         conf.define('DEBUG_RT_ALLOC', 1)
1211         conf.env['DEBUG_RT_ALLOC'] = True
1212     if opts.pt_timing:
1213         conf.define('PT_TIMING', 1)
1214         conf.env['PT_TIMING'] = True
1215     if opts.denormal_exception:
1216         conf.define('DEBUG_DENORMAL_EXCEPTION', 1)
1217         conf.env['DEBUG_DENORMAL_EXCEPTION'] = True
1218     if opts.build_tests:
1219         autowaf.check_pkg(conf, 'cppunit', uselib_store='CPPUNIT', atleast_version='1.12.0', mandatory=True)
1220     if opts.ptformat:
1221         conf.define('PTFORMAT', 1)
1222         conf.env['PTFORMAT'] = True
1223     if opts.no_threaded_waveviews:
1224         conf.define('NO_THREADED_WAVEVIEWS', 1)
1225         conf.env['NO_THREADED_WAVEVIEWS'] = True
1226
1227     backends = opts.with_backends.split(',')
1228     if opts.build_tests and 'dummy' not in backends:
1229         backends += ['dummy']
1230
1231     if not backends:
1232         conf.fatal("Must configure and build at least one backend")
1233
1234     conf.env['BACKENDS'] = backends
1235     conf.env['BUILD_JACKBACKEND'] = any('jack' in b for b in backends)
1236     conf.env['BUILD_ALSABACKEND'] = any('alsa' in b for b in backends)
1237     conf.env['BUILD_DUMMYBACKEND'] = any('dummy' in b for b in backends)
1238     conf.env['BUILD_PABACKEND'] = any('portaudio' in b for b in backends)
1239     conf.env['BUILD_CORECRAPPITA'] = any('coreaudio' in b for b in backends)
1240     conf.env['BUILD_PULSEAUDIO'] = any('pulseaudio' in b for b in backends)
1241
1242     if (Options.options.use_lld):
1243         if re.search ("linux", sys.platform) != None and Options.options.dist_target != 'mingw' and conf.env['BUILD_PABACKEND']:
1244                 conf.fatal("lld is only for Linux builds")
1245         else:
1246                 conf.find_program ('lld')
1247                 conf.env.append_value('LINKFLAGS', '-fuse-ld=lld')
1248
1249     if re.search ("linux", sys.platform) != None and Options.options.dist_target != 'mingw' and conf.env['BUILD_PABACKEND']:
1250         conf.fatal("PortAudio Backend is not for Linux")
1251
1252
1253     if sys.platform != 'darwin' and conf.env['BUILD_CORECRAPPITA']:
1254         conf.fatal("Coreaudio backend is only available for OSX")
1255
1256     if re.search ("linux", sys.platform) == None and conf.env['BUILD_ALSABACKEND']:
1257         conf.fatal("ALSA Backend is only available on Linux")
1258
1259     if re.search ("linux", sys.platform) == None and conf.env['BUILD_PULSEAUDIO']:
1260         conf.fatal("Pulseaudio Backend is only available on Linux")
1261
1262     if conf.env['BUILD_PULSEAUDIO'] and not conf.is_defined('HAVE_PULSEAUDIO'):
1263         conf.fatal("Pulseaudio Backend requires libpulse-dev")
1264
1265     set_compiler_flags (conf, Options.options)
1266
1267     if conf.env['build_host'] not in [ 'mojave', 'catalina']:
1268             conf.env.append_value('CXXFLAGS_OSX', '-F/System/Library/Frameworks')
1269             print("**** YES ADDING FRAMEWORKS")
1270
1271     conf.env.append_value('CXXFLAGS_OSX', '-F/Library/Frameworks')
1272
1273     if sys.platform == 'darwin':
1274         sub_config_and_use(conf, 'libs/appleutility')
1275     elif re.search ("openbsd", sys.platform) != None:
1276         pass
1277     elif Options.options.dist_target != 'mingw':
1278         sub_config_and_use(conf, 'tools/sanity_check')
1279         sub_config_and_use(conf, 'tools/gccabicheck')
1280
1281     sub_config_and_use(conf, 'libs/clearlooks-newer')
1282
1283     for i in children:
1284         sub_config_and_use(conf, i)
1285
1286     # Fix utterly braindead FLAC include path to not smash assert.h
1287     conf.env['INCLUDES_FLAC'] = []
1288
1289     config_text = open('libs/ardour/config_text.cc', "w")
1290     config_text.write('''#include "ardour/ardour.h"
1291 namespace ARDOUR {
1292 const char* const ardour_config_info = "\\n\\
1293 ''')
1294
1295     def write_config_text(title, val):
1296         autowaf.display_msg(conf, title, val)
1297         config_text.write(title + ': ')
1298         config_text.write(str(val).replace ('"', '\\"'))
1299         config_text.write("\\n\\\n")
1300
1301     write_config_text('Build documentation',   conf.env['DOCS'])
1302     write_config_text('Debuggable build',      conf.env['DEBUG'])
1303     write_config_text('Export all symbols (backtrace)', opts.backtrace)
1304     write_config_text('Install prefix',        conf.env['PREFIX'])
1305     write_config_text('Strict compiler flags', conf.env['STRICT'])
1306     write_config_text('Internal Shared Libraries', conf.is_defined('INTERNAL_SHARED_LIBS'))
1307     write_config_text('Use External Libraries', conf.is_defined('USE_EXTERNAL_LIBS'))
1308     write_config_text('Library exports hidden', conf.is_defined('EXPORT_VISIBILITY_HIDDEN'))
1309     write_config_text('Free/Demo copy',        conf.is_defined('FREEBIE'))
1310     config_text.write("\\n\\\n")
1311     write_config_text('ALSA DBus Reservation', conf.is_defined('HAVE_DBUS'))
1312     write_config_text('Architecture flags',    opts.arch)
1313     write_config_text('Aubio',                 conf.is_defined('HAVE_AUBIO'))
1314     write_config_text('AudioUnits',            conf.is_defined('AUDIOUNIT_SUPPORT'))
1315     write_config_text('Build target',          conf.env['build_target'])
1316     write_config_text('Canvas Test UI',        conf.is_defined('CANVASTESTUI'))
1317     write_config_text('Beatbox test app',      conf.is_defined('BEATBOX'))
1318     write_config_text('CoreAudio',             conf.is_defined('HAVE_COREAUDIO'))
1319     write_config_text('CoreAudio 10.5 compat', conf.is_defined('COREAUDIO105'))
1320     write_config_text('Debug RT allocations',  conf.is_defined('DEBUG_RT_ALLOC'))
1321     write_config_text('Debug Symbols',         conf.is_defined('debug_symbols') or conf.env['DEBUG'])
1322     write_config_text('Denormal exceptions',   conf.is_defined('DEBUG_DENORMAL_EXCEPTION'))
1323     write_config_text('FLAC',                  conf.is_defined('HAVE_FLAC'))
1324     write_config_text('FPU optimization',      opts.fpu_optimization)
1325     write_config_text('Freedesktop files',     opts.freedesktop)
1326     write_config_text('Libjack linking',       conf.env['libjack_link'])
1327     write_config_text('Libjack metadata',      conf.is_defined ('HAVE_JACK_METADATA'))
1328     write_config_text('Lua Binding Doc',       conf.is_defined('LUABINDINGDOC'))
1329     write_config_text('Lua Commandline Tool',  conf.is_defined('HAVE_READLINE') and not (conf.is_defined('WINDOWS_VST_SUPPORT') and conf.env['build_target'] != 'mingw'))
1330     write_config_text('LV2 UI embedding',      conf.is_defined('HAVE_SUIL'))
1331     write_config_text('LV2 support',           conf.is_defined('LV2_SUPPORT'))
1332     write_config_text('LV2 extensions',        conf.is_defined('LV2_EXTENDED'))
1333     write_config_text('LXVST support',         conf.is_defined('LXVST_SUPPORT'))
1334     write_config_text('Mac VST support',       conf.is_defined('MACVST_SUPPORT'))
1335     write_config_text('NI-Maschine',           opts.maschine)
1336     write_config_text('OGG',                   conf.is_defined('HAVE_OGG'))
1337     write_config_text('Phone home',            conf.is_defined('PHONE_HOME'))
1338     write_config_text('Process thread timing', conf.is_defined('PT_TIMING'))
1339     write_config_text('Program name',          opts.program_name)
1340     write_config_text('Samplerate',            conf.is_defined('HAVE_SAMPLERATE'))
1341     write_config_text('PT format',             conf.is_defined('PTFORMAT'))
1342     write_config_text('PTW32 Semaphore',       conf.is_defined('USE_PTW32_SEMAPHORE'))
1343 #    write_config_text('Soundtouch',            conf.is_defined('HAVE_SOUNDTOUCH'))
1344     write_config_text('Threaded WaveViews',    not opts.no_threaded_waveviews)
1345     write_config_text('Translation',           opts.nls)
1346 #    write_config_text('Tranzport',             opts.tranzport)
1347     write_config_text('Unit tests',            conf.env['BUILD_TESTS'])
1348     write_config_text('Use LLD linker',        opts.use_lld)
1349     write_config_text('Windows VST support',   opts.windows_vst)
1350     write_config_text('Wiimote support',       conf.is_defined('BUILD_WIIMOTE'))
1351     write_config_text('Windows key',           opts.windows_key)
1352     config_text.write("\\n\\\n")
1353     write_config_text('PortAudio Backend',     conf.env['BUILD_PABACKEND'])
1354     write_config_text('CoreAudio/Midi Backend',conf.env['BUILD_CORECRAPPITA'])
1355     write_config_text('ALSA Backend',          conf.env['BUILD_ALSABACKEND'])
1356     write_config_text('Dummy backend',         conf.env['BUILD_DUMMYBACKEND'])
1357     write_config_text('JACK Backend',          conf.env['BUILD_JACKBACKEND'])
1358     write_config_text('Pulseaudio Backend',    conf.env['BUILD_PULSEAUDIO'])
1359     config_text.write("\\n\\\n")
1360     write_config_text('Buildstack', conf.env['DEPSTACK_REV'])
1361     write_config_text('Mac i386 Architecture', opts.generic)
1362     write_config_text('Mac ppc Architecture',  opts.ppc)
1363     config_text.write("\\n\\\n")
1364     write_config_text('C compiler flags',      conf.env['CFLAGS'])
1365     write_config_text('C++ compiler flags',    conf.env['CXXFLAGS'])
1366     write_config_text('Linker flags',          conf.env['LINKFLAGS'])
1367
1368     config_text.write ('";\n}\n')
1369     config_text.close ()
1370     print('')
1371
1372     if Options.options.dist_target == 'mingw' or Options.options.dist_target == 'msvc':
1373         create_resource_file(Options.options.program_name)
1374
1375 def build(bld):
1376     create_stored_revision()
1377
1378     bld.env['DATE'] = rev_date
1379
1380     # add directories that contain only headers, to workaround an issue with waf
1381
1382     if not bld.is_defined('USE_EXTERNAL_LIBS'):
1383         bld.path.find_dir ('libs/libltc/ltc')
1384     bld.path.find_dir ('libs/evoral/evoral')
1385     bld.path.find_dir ('libs/surfaces/control_protocol/control_protocol')
1386     bld.path.find_dir ('libs/temporal/temporal')
1387     bld.path.find_dir ('libs/gtkmm2ext/gtkmm2ext')
1388     bld.path.find_dir ('libs/ardour/ardour')
1389     bld.path.find_dir ('libs/pbd/pbd')
1390
1391     # set up target directories
1392     lwrcase_dirname = 'ardour' + bld.env['MAJOR']
1393
1394     # configuration files go here
1395     bld.env['CONFDIR'] = os.path.join(bld.env['SYSCONFDIR'], lwrcase_dirname)
1396     # data files loaded at run time go here
1397     bld.env['DATADIR'] = os.path.join(bld.env['DATADIR'], lwrcase_dirname)
1398     # shared objects loaded at runtime go here (two aliases)
1399     bld.env['DLLDIR'] = os.path.join(bld.env['LIBDIR'], lwrcase_dirname)
1400     bld.env['LIBDIR'] = bld.env['DLLDIR']
1401     bld.env['LOCALEDIR'] = os.path.join(bld.env['DATADIR'], 'locale')
1402     bld.env['lwrcase_dirname'] = lwrcase_dirname;
1403
1404     autowaf.set_recursive()
1405
1406     if sys.platform == 'darwin':
1407         bld.recurse('libs/appleutility')
1408     elif re.search ("openbsd", sys.platform) != None:
1409         pass
1410     elif bld.env['build_target'] != 'mingw':
1411         bld.recurse('tools/sanity_check')
1412         bld.recurse('tools/gccabicheck')
1413
1414     bld.recurse('libs/clearlooks-newer')
1415
1416     for i in children:
1417         bld.recurse(i)
1418
1419     if bld.is_defined ('BEATBOX'):
1420         bld.recurse('tools/bb')
1421
1422     bld.install_files (bld.env['CONFDIR'], 'system_config')
1423
1424     bld.install_files (os.path.join (bld.env['DATADIR'], 'templates'), bld.path.ant_glob ('templates/**'), cwd=bld.path.find_dir ('templates'), relative_trick=True)
1425
1426     if bld.env['RUN_TESTS']:
1427         bld.add_post_fun(test)
1428
1429 def i18n(bld):
1430     print(bld.env)
1431     bld.recurse (i18n_children)
1432
1433 def i18n_pot(bld):
1434     bld.recurse (i18n_children)
1435
1436 def i18n_po(bld):
1437     bld.recurse (i18n_children)
1438
1439 def i18n_mo(bld):
1440     bld.recurse (i18n_children)
1441
1442 def tarball(bld):
1443     create_stored_revision()
1444
1445 def test(bld):
1446     subprocess.call("gtk2_ardour/artest")
1447
1448 def help2man(bld):
1449     cmd = "help2man -s 1 -N -o ardour.1 -n Ardour --version-string='Ardour %s' gtk2_ardour/ardev" % PROGRAM_VERSION
1450     subprocess.call(cmd, shell=True)