formatting cleanup
[ardour2.git] / wscript
blobec86e04b62a16fce66fa354bd9e8ade0f6140d3f
1 #!/usr/bin/env python
2 import autowaf
3 import Options
4 import os
5 import re
6 import string
7 import subprocess
8 import sys
9 import glob
11 # Variables for 'waf dist'
12 VERSION = '3.0alpha4'
13 APPNAME = 'Ardour'
15 # Mandatory variables
16 srcdir = '.'
17 blddir = 'build'
19 children = [
20 'libs/pbd',
21 'libs/midi++2',
22 'libs/evoral',
23 'libs/vamp-sdk',
24 'libs/qm-dsp',
25 'libs/vamp-plugins',
26 'libs/taglib',
27 'libs/rubberband',
28 'libs/surfaces',
29 'libs/panners',
30 'libs/timecode',
31 'libs/ardour',
32 'libs/gtkmm2ext',
33 'libs/clearlooks-newer',
34 'libs/audiographer',
35 'libs/gnomecanvas',
36 'gtk2_ardour',
37 'templates',
38 'export',
39 # this needs to be conditional at some point, since
40 # we will not build it or use it on OS X
41 'tools/sanity_check'
44 i18n_children = [
45 'gtk2_ardour',
46 'libs/ardour'
49 # Version stuff
51 def fetch_svn_revision (path):
52 cmd = "LANG= svn info " + path + " | awk '/^Revision:/ { print $2}'"
53 return subprocess.Popen(cmd, shell=True, stderr=subprocess.STDOUT, stdout=subprocess.PIPE).communicate()[0].splitlines()
55 def fetch_gcc_version ():
56 cmd = "LANG= gcc --version"
57 output = subprocess.Popen(cmd, shell=True, stderr=subprocess.STDOUT, stdout=subprocess.PIPE).communicate()[0].splitlines()
58 o = output[0].decode('utf-8')
59 version = o.split(' ')[2].split('.')
60 return version
62 def fetch_git_revision (path):
63 cmd = "LANG= git log --abbrev HEAD^..HEAD " + path
64 output = subprocess.Popen(cmd, shell=True, stderr=subprocess.STDOUT, stdout=subprocess.PIPE).communicate()[0].splitlines()
65 o = output[0].decode('utf-8')
66 rev = o.replace ("commit", "git")[0:10]
67 for line in output:
68 try:
69 if "git-svn-id" in line:
70 line = line.split('@')[1].split(' ')
71 rev = line[0]
72 except:
73 pass
74 return rev
76 def fetch_bzr_revision (path):
77 cmd = subprocess.Popen("LANG= bzr log -l 1 " + path, stdout=subprocess.PIPE, shell=True)
78 out = cmd.communicate()[0]
79 svn = re.search('^svn revno: [0-9]*', out, re.MULTILINE)
80 str = svn.group(0)
81 chars = 'svnreio: '
82 return string.lstrip(str, chars)
84 def create_stored_revision():
85 rev = ""
86 if os.path.exists('.svn'):
87 rev = fetch_svn_revision('.');
88 elif os.path.exists('.git'):
89 rev = fetch_git_revision('.');
90 elif os.path.exists('.bzr'):
91 rev = fetch_bzr_revision('.');
92 print("Revision: %s", rev)
93 elif os.path.exists('libs/ardour/svn_revision.cc'):
94 print("Using packaged svn revision")
95 return
96 else:
97 print("Missing libs/ardour/svn_revision.cc. Blame the packager.")
98 sys.exit(-1)
100 try:
101 text = '#include "ardour/svn_revision.h"\n'
102 text += 'namespace ARDOUR { const char* svn_revision = \"%s\"; }\n' % rev
103 print('Writing svn revision info to libs/ardour/svn_revision.cc')
104 o = open('libs/ardour/svn_revision.cc', 'w')
105 o.write(text)
106 o.close()
107 except IOError:
108 print('Could not open libs/ardour/svn_revision.cc for writing\n')
109 sys.exit(-1)
111 def set_compiler_flags (conf,opt):
113 # Compiler flags and other system-dependent stuff
116 build_host_supports_sse = False
117 optimization_flags = []
118 debug_flags = []
120 # guess at the platform, used to define compiler flags
122 config_guess = os.popen("tools/config.guess").read()[:-1]
124 config_cpu = 0
125 config_arch = 1
126 config_kernel = 2
127 config_os = 3
128 config = config_guess.split ("-")
130 autowaf.display_msg(conf, "System Triple", config_guess)
132 if opt.gprofile:
133 debug_flags = [ '-pg' ]
134 else:
135 if config[config_arch] != 'apple':
136 debug_flags = [ '-rdynamic' ] # waf adds -O0 -g itself. thanks waf!
138 # Autodetect
139 if opt.dist_target == 'auto':
140 if config[config_arch] == 'apple':
141 # The [.] matches to the dot after the major version, "." would match any character
142 if re.search ("darwin[0-7][.]", config[config_kernel]) != None:
143 conf.define ('build_target', 'panther')
144 elif re.search ("darwin8[.]", config[config_kernel]) != None:
145 conf.define ('build_target', 'tiger')
146 else:
147 conf.define ('build_target', 'leopard')
148 else:
149 if re.search ("x86_64", config[config_cpu]) != None:
150 conf.define ('build_target', 'x86_64')
151 elif re.search("i[0-5]86", config[config_cpu]) != None:
152 conf.define ('build_target', 'i386')
153 elif re.search("powerpc", config[config_cpu]) != None:
154 conf.define ('build_target', 'powerpc')
155 else:
156 conf.define ('build_target', 'i686')
157 else:
158 conf.define ('build_target', opt.dist_target)
160 if config[config_cpu] == 'powerpc' and conf.env['build_target'] != 'none':
162 # Apple/PowerPC optimization options
164 # -mcpu=7450 does not reliably work with gcc 3.*
166 if opt.dist_target == 'panther' or opt.dist_target == 'tiger':
167 if config[config_arch] == 'apple':
168 # optimization_flags.extend ([ "-mcpu=7450", "-faltivec"])
169 # to support g3s but still have some optimization for above
170 optimization_flags.extend ([ "-mcpu=G3", "-mtune=7450"])
171 else:
172 optimization_flags.extend ([ "-mcpu=7400", "-maltivec", "-mabi=altivec"])
173 else:
174 optimization_flags.extend([ "-mcpu=750", "-mmultiple" ])
175 optimization_flags.extend (["-mhard-float", "-mpowerpc-gfxopt"])
176 optimization_flags.extend (["-Os"])
178 elif ((re.search ("i[0-9]86", config[config_cpu]) != None) or (re.search ("x86_64", config[config_cpu]) != None)) and conf.env['build_target'] != 'none':
182 # ARCH_X86 means anything in the x86 family from i386 to x86_64
183 # USE_X86_64_ASM is used to distingush 32 and 64 bit assembler
186 if (re.search ("(i[0-9]86|x86_64)", config[config_cpu]) != None):
187 debug_flags.append ("-DARCH_X86")
188 optimization_flags.append ("-DARCH_X86")
190 if config[config_kernel] == 'linux' :
193 # determine processor flags via /proc/cpuinfo
196 if conf.env['build_target'] != 'i386':
198 flag_line = os.popen ("cat /proc/cpuinfo | grep '^flags'").read()[:-1]
199 x86_flags = flag_line.split (": ")[1:][0].split ()
201 if "mmx" in x86_flags:
202 optimization_flags.append ("-mmmx")
203 if "sse" in x86_flags:
204 build_host_supports_sse = True
205 if "3dnow" in x86_flags:
206 optimization_flags.append ("-m3dnow")
208 if config[config_cpu] == "i586":
209 optimization_flags.append ("-march=i586")
210 elif config[config_cpu] == "i686":
211 optimization_flags.append ("-march=i686")
213 if ((conf.env['build_target'] == 'i686') or (conf.env['build_target'] == 'x86_64')) and build_host_supports_sse:
214 optimization_flags.extend (["-msse", "-mfpmath=sse", "-DUSE_XMMINTRIN"])
215 debug_flags.extend (["-msse", "-mfpmath=sse", "-DUSE_XMMINTRIN"])
217 # end of processor-specific section
219 # optimization section
220 if conf.env['FPU_OPTIMIZATION']:
221 if conf.env['build_target'] == 'tiger' or conf.env['build_target'] == 'leopard':
222 optimization_flags.append ("-DBUILD_VECLIB_OPTIMIZATIONS");
223 debug_flags.append ("-DBUILD_VECLIB_OPTIMIZATIONS");
224 conf.env.append_value('LINKFLAGS', "-framework Accelerate")
225 elif conf.env['build_target'] == 'i686' or conf.env['build_target'] == 'x86_64':
226 optimization_flags.append ("-DBUILD_SSE_OPTIMIZATIONS")
227 debug_flags.append ("-DBUILD_SSE_OPTIMIZATIONS")
228 elif conf.env['build_target'] == 'x86_64':
229 optimization_flags.append ("-DUSE_X86_64_ASM")
230 debug_flags.append ("-DUSE_X86_64_ASM")
231 if not build_host_supports_sse:
232 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)")
234 # check this even if we aren't using FPU optimization
235 if not conf.env['HAVE_POSIX_MEMALIGN']:
236 optimization_flags.append("-DNO_POSIX_MEMALIGN")
238 # end optimization section
241 # no VST on x86_64
244 if conf.env['build_target'] == 'x86_64' and opt.vst:
245 print("\n\n==================================================")
246 print("You cannot use VST plugins with a 64 bit host. Please run waf with --vst=0")
247 print("\nIt is theoretically possible to build a 32 bit host on a 64 bit system.")
248 print("However, this is tricky and not recommended for beginners.")
249 sys.exit (-1)
252 # a single way to test if we're on OS X
255 if conf.env['build_target'] in ['panther', 'tiger', 'leopard' ]:
256 conf.define ('IS_OSX', 1)
257 # force tiger or later, to avoid issues on PPC which defaults
258 # back to 10.1 if we don't tell it otherwise.
259 conf.env.append_value('CCFLAGS', "-DMAC_OS_X_VERSION_MIN_REQUIRED=1040")
261 else:
262 conf.define ('IS_OSX', 0)
265 # save off guessed arch element in an env
267 conf.define ('CONFIG_ARCH', config[config_arch])
270 # ARCH="..." overrides all
273 if opt.arch != None:
274 optimization_flags = opt.arch.split()
277 # prepend boiler plate optimization flags that work on all architectures
280 optimization_flags[:0] = [
281 "-O3",
282 "-fomit-frame-pointer",
283 "-ffast-math",
284 "-fstrength-reduce",
285 "-pipe"
288 if opt.debug:
289 conf.env.append_value('CCFLAGS', debug_flags)
290 conf.env.append_value('CXXFLAGS', debug_flags)
291 conf.env.append_value('LINKFLAGS', debug_flags)
292 else:
293 conf.env.append_value('CCFLAGS', optimization_flags)
294 conf.env.append_value('CXXFLAGS', optimization_flags)
295 conf.env.append_value('LINKFLAGS', optimization_flags)
297 if opt.stl_debug:
298 conf.env.append_value('CXXFLAGS', "-D_GLIBCXX_DEBUG")
300 if conf.env['DEBUG_RT_ALLOC']:
301 conf.env.append_value('CCFLAGS', '-DDEBUG_RT_ALLOC')
302 conf.env.append_value('CXXFLAGS', '-DDEBUG_RT_ALLOC')
303 conf.env.append_value('LINKFLAGS', '-ldl')
305 if opt.universal:
306 conf.env.append_value('CCFLAGS', "-arch i386 -arch ppc")
307 conf.env.append_value('CXXFLAGS', "-arch i386 -arch ppc")
308 conf.env.append_value('LINKFLAGS', "-arch i386 -arch ppc")
311 # warnings flags
314 conf.env.append_value('CCFLAGS', "-Wall")
315 conf.env.append_value('CXXFLAGS', [ '-Wall', '-Woverloaded-virtual'])
317 if opt.extra_warn:
318 flags = [ '-Wextra' ]
319 conf.env.append_value('CCFLAGS', flags )
320 conf.env.append_value('CXXFLAGS', flags )
324 # more boilerplate
327 conf.env.append_value('CCFLAGS', '-D_LARGEFILE64_SOURCE')
328 conf.env.append_value('CCFLAGS', '-D_FILE_OFFSET_BITS=64')
329 conf.env.append_value('CXXFLAGS', '-D_LARGEFILE64_SOURCE')
330 conf.env.append_value('CXXFLAGS', '-D_FILE_OFFSET_BITS=64')
332 conf.env.append_value('CXXFLAGS', '-D__STDC_LIMIT_MACROS')
333 conf.env.append_value('CXXFLAGS', '-D__STDC_FORMAT_MACROS')
335 if opt.nls:
336 conf.env.append_value('CXXFLAGS', '-DENABLE_NLS')
337 conf.env.append_value('CCFLAGS', '-DENABLE_NLS')
339 #----------------------------------------------------------------
341 # Waf stages
343 def set_options(opt):
344 autowaf.set_options(opt)
345 opt.add_option('--program-name', type='string', action='store', default='Ardour', dest='program_name',
346 help='The user-visible name of the program being built')
347 opt.add_option('--arch', type='string', action='store', dest='arch',
348 help='Architecture-specific compiler flags')
349 opt.add_option('--boost-sp-debug', action='store_true', default=False, dest='boost_sp_debug',
350 help='Compile with Boost shared pointer debugging')
351 opt.add_option('--dist-target', type='string', default='auto', dest='dist_target',
352 help='Specify the target for cross-compiling [auto,none,x86,i386,i686,x86_64,powerpc,tiger,leopard]')
353 opt.add_option('--extra-warn', action='store_true', default=False, dest='extra_warn',
354 help='Build with even more compiler warning flags')
355 opt.add_option('--fpu-optimization', action='store_true', default=True, dest='fpu_optimization',
356 help='Build runtime checked assembler code (default)')
357 opt.add_option('--no-fpu-optimization', action='store_false', dest='fpu_optimization')
358 opt.add_option('--freedesktop', action='store_true', default=False, dest='freedesktop',
359 help='Install MIME type, icons and .desktop file as per freedesktop.org standards')
360 opt.add_option('--freesound', action='store_true', default=False, dest='freesound',
361 help='Include Freesound database lookup')
362 opt.add_option('--gprofile', action='store_true', default=False, dest='gprofile',
363 help='Compile for use with gprofile')
364 opt.add_option('--lv2', action='store_true', default=False, dest='lv2',
365 help='Compile with support for LV2 (if slv2 is available)')
366 opt.add_option('--nls', action='store_true', default=True, dest='nls',
367 help='Enable i18n (native language support) (default)')
368 opt.add_option('--no-nls', action='store_false', dest='nls')
369 opt.add_option('--phone-home', action='store_false', default=True, dest='phone_home')
370 opt.add_option('--stl-debug', action='store_true', default=False, dest='stl_debug',
371 help='Build with debugging for the STL')
372 opt.add_option('--rt-alloc-debug', action='store_true', default=False, dest='rt_alloc_debug',
373 help='Build with debugging for memory allocation in the real-time thread')
374 opt.add_option('--test', action='store_true', default=False, dest='build_tests',
375 help="Build unit tests")
376 opt.add_option('--tranzport', action='store_true', default=False, dest='tranzport',
377 help='Compile with support for Frontier Designs Tranzport (if libusb is available)')
378 opt.add_option('--universal', action='store_true', default=False, dest='universal',
379 help='Compile as universal binary (requires that external libraries are universal)')
380 opt.add_option('--versioned', action='store_true', default=False, dest='versioned',
381 help='Add revision information to executable name inside the build directory')
382 opt.add_option('--vst', action='store_true', default=False, dest='vst',
383 help='Compile with support for VST')
384 opt.add_option('--wiimote', action='store_true', default=False, dest='wiimote',
385 help='Build the wiimote control surface')
386 opt.add_option('--windows-key', type='string', action='store', dest='windows_key', default='Mod4><Super',
387 help='X Modifier(s) (Mod1,Mod2, etc) for the Windows key (X11 builds only). ' +
388 'Multiple modifiers must be separated by \'><\'')
389 opt.add_option('--boost-include', type='string', action='store', dest='boost_include', default='',
390 help='directory where Boost header files can be found')
391 opt.add_option('--wine-include', type='string', action='store', dest='wine_include', default='/usr/include/wine/windows',
392 help='directory where Wine\'s Windows header files can be found')
393 opt.add_option('--noconfirm', action='store_true', default=False, dest='noconfirm',
394 help='Do not ask questions that require confirmation during the build')
395 for i in children:
396 opt.sub_options(i)
398 def sub_config_and_use(conf, name, has_objects = True):
399 conf.sub_config(name)
400 autowaf.set_local_lib(conf, name, has_objects)
402 def configure(conf):
403 if not Options.options.noconfirm:
404 print ('\n\nThis is an alpha version of Ardour 3.0.\n\n' +
405 'You are respectfully requested NOT to ask for assistance with build issues\n' +
406 'and not to report issues with Ardour 3.0 on the forums at ardour.org.\n\n' +
407 'Please use IRC, the bug tracker and/or the ardour mailing lists (-dev or -user)\n\n' +
408 'Thanks for your co-operation with our development process.\n\n' +
409 'Press Enter to continue.\n')
410 sys.stdin.readline()
411 create_stored_revision()
412 conf.env['VERSION'] = VERSION
413 conf.line_just = 52
414 autowaf.set_recursive()
415 autowaf.configure(conf)
416 autowaf.display_header('Ardour Configuration')
418 gcc_versions = fetch_gcc_version()
419 if not Options.options.debug and gcc_versions[0] == '4' and gcc_versions[1] > '4':
420 print('Version 4.5 of gcc is not ready for use when compiling Ardour with optimization.')
421 print('Please use a different version or re-configure with --debug')
422 exit (1)
424 if sys.platform == 'darwin':
426 conf.define ('AUDIOUNITS', 1)
427 conf.define ('AU_STATE_SUPPORT', 1)
428 conf.define ('COREAUDIO', 1)
429 conf.define ('GTKOSX', 1)
430 conf.define ('TOP_MENUBAR',1)
431 conf.define ('GTKOSX',1)
433 conf.env.append_value('CXXFLAGS_APPLEUTILITY', '-I../libs')
435 # Define OSX as a uselib to use when compiling
436 # on Darwin to add all applicable flags at once
438 conf.env.append_value('CXXFLAGS_OSX', '-DMAC_OS_X_VERSION_MIN_REQUIRED=1040')
439 conf.env.append_value('CCFLAGS_OSX', '-DMAC_OS_X_VERSION_MIN_REQUIRED=1040')
440 conf.env.append_value('CXXFLAGS_OSX', '-mmacosx-version-min=10.4')
441 conf.env.append_value('CCFLAGS_OSX', '-mmacosx-version-min=10.4')
443 #conf.env.append_value('CXXFLAGS_OSX', "-isysroot /Developer/SDKs/MacOSX10.4u.sdk")
444 #conf.env.append_value('CCFLAGS_OSX', "-isysroot /Developer/SDKs/MacOSX10.4u.sdk")
445 #conf.env.append_value('LINKFLAGS_OSX', "-isysroot /Developer/SDKs/MacOSX10.4u.sdk")
447 #conf.env.append_value('LINKFLAGS_OSX', "-sysroot /Developer/SDKs/MacOSX10.4u.sdk")
449 conf.env.append_value('CXXFLAGS_OSX', "-msse")
450 conf.env.append_value('CCFLAGS_OSX', "-msse")
451 conf.env.append_value('CXXFLAGS_OSX', "-msse2")
452 conf.env.append_value('CCFLAGS_OSX', "-msse2")
454 # TODO: The previous sse flags NEED to be based
455 # off processor type. Need to add in a check
456 # for that.
458 conf.env.append_value('CXXFLAGS_OSX', '-F/System/LibraryFrameworks')
459 conf.env.append_value('CXXFLAGS_OSX', '-F/Library/Frameworks')
461 conf.env.append_value('LINKFLAGS_OSX', ['-framework', 'AppKit'])
462 conf.env.append_value('LINKFLAGS_OSX', ['-framework', 'CoreAudio'])
463 conf.env.append_value('LINKFLAGS_OSX', ['-framework', 'CoreFoundation'])
464 conf.env.append_value('LINKFLAGS_OSX', ['-framework', 'CoreServices'])
466 conf.env.append_value('LINKFLAGS_OSX', ['-undefined', 'suppress' ])
467 conf.env.append_value('LINKFLAGS_OSX', '-flat_namespace')
469 conf.env.append_value('LINKFLAGS_GTKOSX', [ '-Xlinker', '-headerpad'])
470 conf.env.append_value('LINKFLAGS_GTKOSX', ['-Xlinker', '2048'])
471 conf.env.append_value('CPPPATH_GTKOSX', "/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/")
473 conf.env.append_value('CXXFLAGS_AUDIOUNITS', "-DHAVE_AUDIOUNITS")
474 conf.env.append_value('LINKFLAGS_AUDIOUNITS', ['-framework', 'Audiotoolbox', '-framework', 'AudioUnit'])
476 if Options.options.boost_include != '':
477 conf.env.append_value('CPPPATH', Options.options.boost_include)
479 autowaf.check_header(conf, 'boost/signals2.hpp', mandatory = True)
481 if Options.options.boost_sp_debug:
482 conf.env.append_value('CXXFLAGS', '-DBOOST_SP_ENABLE_DEBUG_HOOKS')
484 autowaf.check_header(conf, 'jack/session.h', define="JACK_SESSION", mandatory = False)
486 conf.check_cc(fragment = "#include <boost/version.hpp>\nint main(void) { return (BOOST_VERSION >= 103900 ? 0 : 1); }\n",
487 execute = "1",
488 mandatory = True,
489 msg = 'Checking for boost library >= 1.39',
490 okmsg = 'ok',
491 errmsg = 'too old\nPlease install boost version 1.39 or higher.')
493 autowaf.check_pkg(conf, 'cppunit', uselib_store='CPPUNIT', atleast_version='1.12.0', mandatory=False)
494 autowaf.check_pkg(conf, 'glib-2.0', uselib_store='GLIB', atleast_version='2.2')
495 autowaf.check_pkg(conf, 'gthread-2.0', uselib_store='GTHREAD', atleast_version='2.2')
496 autowaf.check_pkg(conf, 'glibmm-2.4', uselib_store='GLIBMM', atleast_version='2.14.0')
497 autowaf.check_pkg(conf, 'sndfile', uselib_store='SNDFILE', atleast_version='1.0.18')
499 if sys.platform == 'darwin':
500 sub_config_and_use(conf, 'libs/appleutility')
501 for i in children:
502 sub_config_and_use(conf, i)
504 # Fix utterly braindead FLAC include path to not smash assert.h
505 conf.env['CPPPATH_FLAC'] = []
507 conf.check_cc(function_name='dlopen', header_name='dlfcn.h', linkflags='-ldl', uselib_store='DL')
508 conf.check_cc(function_name='curl_global_init', header_name='curl/curl.h', linkflags='-lcurl', uselib_store='CURL')
510 # Tell everyone that this is a waf build
512 conf.env.append_value('CCFLAGS', '-DWAF_BUILD')
513 conf.env.append_value('CXXFLAGS', '-DWAF_BUILD')
515 # debug builds should not call home
517 opts = Options.options
518 if opts.debug:
519 opts.phone_home = False;
521 autowaf.display_msg(conf, 'Build Target', conf.env['build_target'])
522 autowaf.display_msg(conf, 'Architecture flags', opts.arch)
523 autowaf.display_msg(conf, 'Aubio', bool(conf.env['HAVE_AUBIO']))
524 autowaf.display_msg(conf, 'CoreAudio', bool(conf.env['HAVE_COREAUDIO']))
525 autowaf.display_msg(conf, 'FLAC', bool(conf.env['HAVE_FLAC']))
526 autowaf.display_msg(conf, 'Phone Home', opts.phone_home)
527 if opts.phone_home:
528 conf.env['PHONE_HOME'] = opts.phone_home
529 autowaf.display_msg(conf, 'FPU Optimization', opts.fpu_optimization)
530 if opts.fpu_optimization:
531 conf.define('FPU_OPTIMIZATION', 1)
532 autowaf.display_msg(conf, 'Freedesktop Files', opts.freedesktop)
533 autowaf.display_msg(conf, 'Freesound', opts.freesound)
534 if opts.freesound:
535 conf.define('FREESOUND',1)
536 autowaf.display_msg(conf, 'LV2 Support', bool(conf.env['HAVE_SLV2']))
537 autowaf.display_msg(conf, 'OGG', bool(conf.env['HAVE_OGG']))
538 autowaf.display_msg(conf, 'Rubberband', bool(conf.env['HAVE_RUBBERBAND']))
539 autowaf.display_msg(conf, 'Samplerate', bool(conf.env['HAVE_SAMPLERATE']))
540 autowaf.display_msg(conf, 'Soundtouch', bool(conf.env['HAVE_SOUNDTOUCH']))
541 autowaf.display_msg(conf, 'Translation', opts.nls)
542 if opts.nls:
543 conf.define ('ENABLE_NLS', 1)
544 autowaf.display_msg(conf, 'Tranzport', opts.tranzport)
545 if opts.build_tests:
546 conf.env['BUILD_TESTS'] = opts.build_tests
547 autowaf.display_msg(conf, 'Unit Tests', bool(conf.env['BUILD_TESTS']) and bool (conf.env['HAVE_CPPUNIT']))
548 if opts.tranzport:
549 conf.define('TRANZPORT', 1)
550 autowaf.display_msg(conf, 'Universal Binary', opts.universal)
551 autowaf.display_msg(conf, 'VST Support', opts.vst)
552 if opts.vst:
553 conf.define('VST_SUPPORT', 1)
554 conf.env.append_value('CPPPATH', Options.options.wine_include)
555 autowaf.check_header(conf, 'windows.h', mandatory = True)
556 if bool(conf.env['JACK_SESSION']):
557 conf.define ('HAVE_JACK_SESSION', 1)
558 autowaf.display_msg(conf, 'Wiimote Support', opts.wiimote)
559 if opts.wiimote:
560 conf.define('WIIMOTE',1)
561 conf.define('WINDOWS_KEY', opts.windows_key)
562 autowaf.display_msg(conf, 'Windows Key', opts.windows_key)
563 conf.env['PROGRAM_NAME'] = opts.program_name
564 autowaf.display_msg(conf, 'Program Name', opts.program_name)
565 if opts.rt_alloc_debug:
566 conf.define('DEBUG_RT_ALLOC', 1)
568 set_compiler_flags (conf, Options.options)
570 autowaf.display_msg(conf, 'C Compiler flags', conf.env['CCFLAGS'])
571 autowaf.display_msg(conf, 'C++ Compiler flags', conf.env['CXXFLAGS'])
572 print('')
574 # and dump the same stuff to a file for use in the build
576 config_text = open ('libs/ardour/config_text.cc',"w")
577 config_text.write ('#include "ardour/ardour.h"\n\nnamespace ARDOUR {\nconst char* const ardour_config_info = "\\n\\\n')
578 config_text.write ("Install prefix: "); config_text.write (str (conf.env['PREFIX'])); config_text.write ("\\n\\\n")
579 config_text.write ("Debuggable build: "); config_text.write (str (str(conf.env['DEBUG']))); config_text.write ("\\n\\\n")
580 config_text.write ("Strict compiler flags: "); config_text.write (str (str(conf.env['STRICT']))); config_text.write ("\\n\\\n")
581 config_text.write ("Build documentation: "); config_text.write (str (str(conf.env['DOCS']))); config_text.write ("\\n\\\n")
582 config_text.write ('Build target: '); config_text.write (str (conf.env['build_target'])); config_text.write ("\\n\\\n")
583 config_text.write ('Architecture flags: '); config_text.write (str (opts.arch)); config_text.write ("\\n\\\n")
584 config_text.write ('Aubio: '); config_text.write (str (bool(conf.env['HAVE_AUBIO']))); config_text.write ("\\n\\\n")
585 config_text.write ('FPU optimization: '); config_text.write (str (opts.fpu_optimization)); config_text.write ("\\n\\\n")
586 config_text.write ('Freedesktop files: '); config_text.write (str (opts.freedesktop)); config_text.write ("\\n\\\n")
587 config_text.write ('Freesound: '); config_text.write (str (opts.freesound)); config_text.write ("\\n\\\n")
588 config_text.write ('LV2 support: '); config_text.write (str (bool(conf.env['HAVE_SLV2']))); config_text.write ("\\n\\\n")
589 config_text.write ('Rubberband: '); config_text.write (str (bool(conf.env['HAVE_RUBBERBAND']))); config_text.write ("\\n\\\n")
590 config_text.write ('Samplerate: '); config_text.write (str (bool(conf.env['HAVE_SAMPLERATE']))); config_text.write ("\\n\\\n")
591 config_text.write ('Soundtouch: '); config_text.write (str (bool(conf.env['HAVE_SOUNDTOUCH']))); config_text.write ("\\n\\\n")
592 config_text.write ('Translation: '); config_text.write (str (opts.nls)); config_text.write ("\\n\\\n")
593 config_text.write ('Tranzport: '); config_text.write (str (opts.tranzport)); config_text.write ("\\n\\\n")
594 config_text.write ('Universal binary: '); config_text.write (str (opts.universal)); config_text.write ("\\n\\\n")
595 config_text.write ('VST support: '); config_text.write (str (opts.vst)); config_text.write ("\\n\\\n")
596 config_text.write ('Wiimote support: '); config_text.write (str (opts.wiimote)); config_text.write ("\\n\\\n")
597 config_text.write ('Windows key: '); config_text.write (str (opts.windows_key)); config_text.write ("\\n\\\n")
598 config_text.write ('C compiler flags: '); config_text.write (str (conf.env['CCFLAGS'])); config_text.write ("\\n\\\n")
599 config_text.write ('C++ compiler flags: '); config_text.write (str (conf.env['CXXFLAGS'])); config_text.write ("\\n\\\n")
600 config_text.write ('Phone home: '); config_text.write (str (bool(conf.env['PHONE_HOME']))); config_text.write ("\\n\\\n")
601 config_text.write ('JACK session support: '); config_text.write (str (bool(conf.env['JACK_SESSION']))); config_text.write ("\\n\\\n")
602 config_text.write ('";}\n')
603 config_text.close ()
605 def build(bld):
606 # add directories that contain only headers, to workaround an issue with waf
608 bld.path.find_dir ('libs/evoral/evoral')
609 bld.path.find_dir ('libs/vamp-sdk/vamp-sdk')
610 bld.path.find_dir ('libs/surfaces/control_protocol/control_protocol')
611 bld.path.find_dir ('libs/timecode/timecode')
612 bld.path.find_dir ('libs/rubberband/rubberband')
613 bld.path.find_dir ('libs/gtkmm2ext/gtkmm2ext')
614 bld.path.find_dir ('libs/ardour/ardour')
615 bld.path.find_dir ('libs/taglib/taglib')
616 bld.path.find_dir ('libs/pbd/pbd')
618 autowaf.set_recursive()
619 if sys.platform == 'darwin':
620 bld.add_subdirs('libs/appleutility')
621 for i in children:
622 bld.add_subdirs(i)
624 # ideally, we'd like to use the OS-provided MIDI API
625 # for default ports. that doesn't work on at least
626 # Fedora (Nov 9th, 2009) so use JACK MIDI on linux.
628 if sys.platform == 'darwin':
629 rc_subst_dict = {
630 'MIDITAG' : 'control',
631 'MIDITYPE' : 'coremidi',
632 'JACK_INPUT' : 'auditioner'
634 else:
635 rc_subst_dict = {
636 'MIDITAG' : 'control',
637 'MIDITYPE' : 'jack',
638 'JACK_INPUT' : 'auditioner'
641 obj = bld.new_task_gen('subst')
642 obj.source = 'ardour.rc.in'
643 obj.target = 'ardour_system.rc'
644 obj.dict = rc_subst_dict
645 obj.install_path = '${CONFIGDIR}/ardour3'
647 def i18n(bld):
648 bld.recurse (i18n_children)