put splitlines() back where it belongs
[ardour2.git] / wscript
blob69b531f93bcb80268591d5507eabbc2bf214a020
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
10 # Variables for 'waf dist'
11 VERSION = '3.0pre0'
12 APPNAME = 'Ardour'
14 # Mandatory variables
15 srcdir = '.'
16 blddir = 'build'
18 children = [
19 'libs/pbd',
20 'libs/midi++2',
21 'libs/evoral',
22 'libs/vamp-sdk',
23 'libs/vamp-plugins',
24 'libs/taglib',
25 'libs/rubberband',
26 'libs/surfaces',
27 'libs/ardour',
28 'libs/gtkmm2ext',
29 'libs/clearlooks-newer',
30 'libs/audiographer',
31 'gtk2_ardour'
35 i18n_children = [
36 'gtk2_ardour',
37 'libs/ardour'
40 # Version stuff
42 def fetch_svn_revision (path):
43 cmd = "LANG= svn info " + path + " | awk '/^Revision:/ { print $2}'"
44 return subprocess.Popen(cmd, shell=True, stderr=subprocess.STDOUT, stdout=subprocess.PIPE).communicate()[0].splitlines()
46 def fetch_gcc_version ():
47 cmd = "LANG= gcc --version"
48 output = subprocess.Popen(cmd, shell=True, stderr=subprocess.STDOUT, stdout=subprocess.PIPE).communicate()[0].splitlines()
49 o = output[0].decode('utf-8')
50 version = o.split(' ')[2].split('.')
51 return version
53 def fetch_git_revision (path):
54 cmd = "LANG= git log --abbrev HEAD^..HEAD " + path
55 output = subprocess.Popen(cmd, shell=True, stderr=subprocess.STDOUT, stdout=subprocess.PIPE).communicate()[0].splitlines()
56 o = output[0].decode('utf-8')
57 rev = o.replace ("commit", "git")[0:10]
58 for line in output:
59 try:
60 if "git-svn-id" in line:
61 line = line.split('@')[1].split(' ')
62 rev = line[0]
63 except:
64 pass
65 return rev
67 def fetch_bzr_revision (path):
68 cmd = subprocess.Popen("LANG= bzr log -l 1 " + path, stdout=subprocess.PIPE, shell=True)
69 out = cmd.communicate()[0]
70 svn = re.search('^svn revno: [0-9]*', out, re.MULTILINE)
71 str = svn.group(0)
72 chars = 'svnreio: '
73 return string.lstrip(str, chars)
75 def create_stored_revision():
76 rev = ""
77 if os.path.exists('.svn'):
78 rev = fetch_svn_revision('.');
79 elif os.path.exists('.git'):
80 rev = fetch_git_revision('.');
81 elif os.path.exists('.bzr'):
82 rev = fetch_bzr_revision('.');
83 print("Revision: %s", rev)
84 elif os.path.exists('libs/ardour/svn_revision.cc'):
85 print("Using packaged svn revision")
86 return
87 else:
88 print("Missing libs/ardour/svn_revision.cc. Blame the packager.")
89 sys.exit(-1)
91 try:
92 text = '#include "ardour/svn_revision.h"\n'
93 text += 'namespace ARDOUR { const char* svn_revision = \"%s\"; }\n' % rev
94 print('Writing svn revision info to libs/ardour/svn_revision.cc')
95 o = open('libs/ardour/svn_revision.cc', 'w')
96 o.write(text)
97 o.close()
98 except IOError:
99 print('Could not open libs/ardour/svn_revision.cc for writing\n')
100 sys.exit(-1)
102 def set_compiler_flags (conf,opt):
104 # Compiler flags and other system-dependent stuff
107 build_host_supports_sse = False
108 optimization_flags = []
109 if opt.gprofile:
110 debug_flags = [ '-pg' ]
111 else:
112 debug_flags = [ '-rdynamic' ] # waf adds -O0 -g itself. thanks waf!
114 # guess at the platform, used to define compiler flags
116 config_guess = os.popen("tools/config.guess").read()[:-1]
118 config_cpu = 0
119 config_arch = 1
120 config_kernel = 2
121 config_os = 3
122 config = config_guess.split ("-")
124 autowaf.display_msg(conf, "System Triple", config_guess)
126 # Autodetect
127 if opt.dist_target == 'auto':
128 if config[config_arch] == 'apple':
129 # The [.] matches to the dot after the major version, "." would match any character
130 if re.search ("darwin[0-7][.]", config[config_kernel]) != None:
131 conf.define ('build_target', 'panther')
132 elif re.search ("darwin8[.]", config[config_kernel]) != None:
133 conf.define ('build_target', 'tiger')
134 else:
135 conf.define ('build_target', 'leopard')
136 else:
137 if re.search ("x86_64", config[config_cpu]) != None:
138 conf.define ('build_target', 'x86_64')
139 elif re.search("i[0-5]86", config[config_cpu]) != None:
140 conf.define ('build_target', 'i386')
141 elif re.search("powerpc", config[config_cpu]) != None:
142 conf.define ('build_target', 'powerpc')
143 else:
144 conf.define ('build_target', 'i686')
145 else:
146 conf.define ('build_target', opt.dist_target)
148 if config[config_cpu] == 'powerpc' and conf.env['build_target'] != 'none':
150 # Apple/PowerPC optimization options
152 # -mcpu=7450 does not reliably work with gcc 3.*
154 if opt.dist_target == 'panther' or opt.dist_target == 'tiger':
155 if config[config_arch] == 'apple':
156 # optimization_flags.extend ([ "-mcpu=7450", "-faltivec"])
157 # to support g3s but still have some optimization for above
158 optimization_flags.extend ([ "-mcpu=G3", "-mtune=7450"])
159 else:
160 optimization_flags.extend ([ "-mcpu=7400", "-maltivec", "-mabi=altivec"])
161 else:
162 optimization_flags.extend([ "-mcpu=750", "-mmultiple" ])
163 optimization_flags.extend (["-mhard-float", "-mpowerpc-gfxopt"])
164 optimization_flags.extend (["-Os"])
166 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':
170 # ARCH_X86 means anything in the x86 family from i386 to x86_64
171 # USE_X86_64_ASM is used to distingush 32 and 64 bit assembler
174 if (re.search ("(i[0-9]86|x86_64)", config[config_cpu]) != None):
175 debug_flags.append ("-DARCH_X86")
176 optimization_flags.append ("-DARCH_X86")
178 if config[config_kernel] == 'linux' :
181 # determine processor flags via /proc/cpuinfo
184 if conf.env['build_target'] != 'i386':
186 flag_line = os.popen ("cat /proc/cpuinfo | grep '^flags'").read()[:-1]
187 x86_flags = flag_line.split (": ")[1:][0].split ()
189 if "mmx" in x86_flags:
190 optimization_flags.append ("-mmmx")
191 if "sse" in x86_flags:
192 build_host_supports_sse = True
193 if "3dnow" in x86_flags:
194 optimization_flags.append ("-m3dnow")
196 if config[config_cpu] == "i586":
197 optimization_flags.append ("-march=i586")
198 elif config[config_cpu] == "i686":
199 optimization_flags.append ("-march=i686")
201 if ((conf.env['build_target'] == 'i686') or (conf.env['build_target'] == 'x86_64')) and build_host_supports_sse:
202 optimization_flags.extend (["-msse", "-mfpmath=sse", "-DUSE_XMMINTRIN"])
203 debug_flags.extend (["-msse", "-mfpmath=sse", "-DUSE_XMMINTRIN"])
205 # end of processor-specific section
207 # optimization section
208 if conf.env['FPU_OPTIMIZATION']:
209 if conf.env['build_target'] == 'tiger' or conf.env['build_target'] == 'leopard':
210 optimization_flags.append ("-DBUILD_VECLIB_OPTIMIZATIONS");
211 debug_flags.append ("-DBUILD_VECLIB_OPTIMIZATIONS");
212 conf.env.append_value('LINKFLAGS', "-framework Accelerate")
213 elif conf.env['build_target'] == 'i686' or conf.env['build_target'] == 'x86_64':
214 optimization_flags.append ("-DBUILD_SSE_OPTIMIZATIONS")
215 debug_flags.append ("-DBUILD_SSE_OPTIMIZATIONS")
216 elif conf.env['build_target'] == 'x86_64':
217 optimization_flags.append ("-DUSE_X86_64_ASM")
218 debug_flags.append ("-DUSE_X86_64_ASM")
219 if not build_host_supports_sse:
220 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)")
222 # check this even if we aren't using FPU optimization
223 if not conf.env['HAVE_POSIX_MEMALIGN']:
224 optimization_flags.append("-DNO_POSIX_MEMALIGN")
226 # end optimization section
229 # no VST on x86_64
232 if conf.env['build_target'] == 'x86_64' and opt.vst:
233 print("\n\n==================================================")
234 print("You cannot use VST plugins with a 64 bit host. Please run waf with --vst=0")
235 print("\nIt is theoretically possible to build a 32 bit host on a 64 bit system.")
236 print("However, this is tricky and not recommended for beginners.")
237 sys.exit (-1)
240 # a single way to test if we're on OS X
243 if conf.env['build_target'] in ['panther', 'tiger', 'leopard' ]:
244 conf.define ('IS_OSX', 1)
245 # force tiger or later, to avoid issues on PPC which defaults
246 # back to 10.1 if we don't tell it otherwise.
247 conf.env.append_value('CCFLAGS', "-DMAC_OS_X_VERSION_MIN_REQUIRED=1040")
249 else:
250 conf.define ('IS_OSX', 0)
253 # save off guessed arch element in an env
255 conf.define ('CONFIG_ARCH', config[config_arch])
258 # ARCH="..." overrides all
261 if opt.arch != None:
262 optimization_flags = opt.arch.split()
265 # prepend boiler plate optimization flags that work on all architectures
268 optimization_flags[:0] = [
269 "-O3",
270 "-fomit-frame-pointer",
271 "-ffast-math",
272 "-fstrength-reduce",
273 "-pipe"
276 if opt.debug:
277 conf.env.append_value('CCFLAGS', debug_flags)
278 conf.env.append_value('CXXFLAGS', debug_flags)
279 conf.env.append_value('LINKFLAGS', debug_flags)
280 else:
281 conf.env.append_value('CCFLAGS', optimization_flags)
282 conf.env.append_value('CXXFLAGS', optimization_flags)
283 conf.env.append_value('LINKFLAGS', optimization_flags)
285 if opt.stl_debug:
286 conf.env.append_value('CXXFLAGS', "-D_GLIBCXX_DEBUG")
288 if opt.universal:
289 conf.env.append_value('CCFLAGS', "-arch i386 -arch ppc")
290 conf.env.append_value('CXXFLAGS', "-arch i386 -arch ppc")
291 conf.env.append_value('LINKFLAGS', "-arch i386 -arch ppc")
294 # warnings flags
297 conf.env.append_value('CCFLAGS', "-Wall")
298 conf.env.append_value('CXXFLAGS', [ '-Wall', '-Woverloaded-virtual'])
300 if opt.extra_warn:
301 flags = [ '-Wextra' ]
302 conf.env.append_value('CCFLAGS', flags )
303 conf.env.append_value('CXXFLAGS', flags )
307 # more boilerplate
310 conf.env.append_value('CCFLAGS', [ '-D_LARGEFILE64_SOURCE', '-D_LARGEFILE_SOURCE' ])
311 conf.env.append_value('CCFLAGS', [ '-D_FILE_OFFSET_BITS=64', '-D_FILE_OFFSET_BITS=64' ])
312 conf.env.append_value('CXXFLAGS', [ '-D_LARGEFILE64_SOURCE', '-D_LARGEFILE_SOURCE' ])
313 conf.env.append_value('CXXFLAGS', [ '-D_FILE_OFFSET_BITS=64', '-D_FILE_OFFSET_BITS=64' ])
315 conf.env.append_value('CXXFLAGS', [ '-D__STDC_LIMIT_MACROS', '-D__STDC_LIMIT_MACROS' ])
316 conf.env.append_value('CXXFLAGS', [ '-D__STDC_FORMAT_MACROS', '-D__STDC_FORMAT_MACROS' ])
318 if opt.nls:
319 conf.env.append_value('CXXFLAGS', '-DENABLE_NLS')
320 conf.env.append_value('CCFLAGS', '-DENABLE_NLS')
323 #----------------------------------------------------------------
325 # Waf stages
327 def set_options(opt):
328 autowaf.set_options(opt)
329 opt.add_option('--program-name', type='string', action='store', default='Ardour', dest='program_name',
330 help='The user-visible name of the program being built')
331 opt.add_option('--arch', type='string', action='store', dest='arch',
332 help='Architecture-specific compiler flags')
333 opt.add_option('--boost-sp-debug', action='store_true', default=False, dest='boost_sp_debug',
334 help='Compile with Boost shared pointer debugging')
335 opt.add_option('--audiounits', action='store_true', default=False, dest='audiounits',
336 help='Compile with Apple\'s AudioUnit library')
337 opt.add_option('--coreaudio', action='store_true', default=False, dest='coreaudio',
338 help='Compile with Apple\'s CoreAudio library')
339 opt.add_option('--dist-target', type='string', default='auto', dest='dist_target',
340 help='Specify the target for cross-compiling [auto,none,x86,i386,i686,x86_64,powerpc,tiger,leopard]')
341 opt.add_option('--extra-warn', action='store_true', default=False, dest='extra_warn',
342 help='Build with even more compiler warning flags')
343 opt.add_option('--fpu-optimization', action='store_true', default=True, dest='fpu_optimization',
344 help='Build runtime checked assembler code (default)')
345 opt.add_option('--no-fpu-optimization', action='store_false', dest='fpu_optimization')
346 opt.add_option('--freedesktop', action='store_true', default=False, dest='freedesktop',
347 help='Install MIME type, icons and .desktop file as per freedesktop.org standards')
348 opt.add_option('--freesound', action='store_true', default=False, dest='freesound',
349 help='Include Freesound database lookup')
350 opt.add_option('--gprofile', action='store_true', default=False, dest='gprofile',
351 help='Compile for use with gprofile')
352 opt.add_option('--gtkosx', action='store_true', default=False, dest='gtkosx',
353 help='Compile for use with GTK-OSX, not GTK-X11')
354 opt.add_option('--lv2', action='store_true', default=False, dest='lv2',
355 help='Compile with support for LV2 (if slv2 is available)')
356 opt.add_option('--nls', action='store_true', default=True, dest='nls',
357 help='Enable i18n (native language support) (default)')
358 opt.add_option('--no-nls', action='store_false', dest='nls')
359 opt.add_option('--phone-home', action='store_false', default=True, dest='phone_home')
360 opt.add_option('--stl-debug', action='store_true', default=False, dest='stl_debug',
361 help='Build with debugging for the STL')
362 opt.add_option('--test', action='store_true', default=False, dest='build_tests',
363 help="Build unit tests")
364 opt.add_option('--tranzport', action='store_true', default=False, dest='tranzport',
365 help='Compile with support for Frontier Designs Tranzport (if libusb is available)')
366 opt.add_option('--universal', action='store_true', default=False, dest='universal',
367 help='Compile as universal binary (requires that external libraries are universal)')
368 opt.add_option('--versioned', action='store_true', default=False, dest='versioned',
369 help='Add revision information to executable name inside the build directory')
370 opt.add_option('--vst', action='store_true', default=False, dest='vst',
371 help='Compile with support for VST')
372 opt.add_option('--wiimote', action='store_true', default=False, dest='wiimote',
373 help='Build the wiimote control surface')
374 opt.add_option('--windows-key', type='string', action='store', dest='windows_key', default='Mod4><Super',
375 help='X Modifier(s) (Mod1,Mod2, etc) for the Windows key (X11 builds only). ' +
376 'Multiple modifiers must be separated by \'><\'')
378 for i in children:
379 opt.sub_options(i)
381 def sub_config_and_use(conf, name, has_objects = True):
382 conf.sub_config(name)
383 autowaf.set_local_lib(conf, name, has_objects)
385 def configure(conf):
386 create_stored_revision()
387 conf.env['VERSION'] = VERSION
388 conf.line_just = 52
389 autowaf.set_recursive()
390 autowaf.configure(conf)
391 autowaf.display_header('Ardour Configuration')
393 gcc_versions = fetch_gcc_version()
394 if not Options.options.debug and gcc_versions[0] == '4' and gcc_versions[1] > '4':
395 print('Version 4.5 of gcc is not ready for use when compiling Ardour with optimization.')
396 print('Please use a different version or re-configure with --debug')
397 exit (1)
399 if sys.platform == 'darwin':
401 # Define OSX as a uselib to use when compiling
402 # on Darwin to add all applicable flags at once
404 conf.env.append_value('CXXFLAGS_OSX', "-mmacosx-version-min=10.4")
405 conf.env.append_value('CCFLAGS_OSX', "-mmacosx-version-min=10.4")
406 conf.env.append_value('CXXFLAGS_OSX', "-isysroot /Developer/SDKs/MacOSX10.4u.sdk")
407 conf.env.append_value('CCFLAGS_OSX', "-isysroot /Developer/SDKs/MacOSX10.4u.sdk")
408 conf.env.append_value('LINKFLAGS_OSX', "-mmacosx-version-min=10.4")
409 conf.env.append_value('LINKFLAGS_OSX', "-isysroot /Developer/SDKs/MacOSX10.4u.sdk")
411 conf.env.append_value('LINKFLAGS_OSX', "-sysroot /Developer/SDKs/MacOSX10.4u.sdk")
412 conf.env.append_value('LINKFLAGS_OSX', "-F/System/Library/Frameworks")
414 conf.env.append_value('CXXFLAGS_OSX', "-msse")
415 conf.env.append_value('CCFLAGS_OSX', "-msse")
416 conf.env.append_value('CXXFLAGS_OSX', "-msse2")
417 conf.env.append_value('CCFLAGS_OSX', "-msse2")
419 # TODO: The previous sse flags NEED to be based
420 # off processor type. Need to add in a check
421 # for that.
424 conf.env.append_value('CPPPATH_OSX', "/System/Library/Frameworks/")
425 conf.env.append_value('CPPPATH_OSX', "/usr/include/")
426 conf.env.append_value('CPPPATH_OSX', "/usr/include/c++/4.0.0")
427 conf.env.append_value('CPPPATH_OSX', "/usr/include/c++/4.0.0/i686-apple-darwin8/")
429 # TODO: Fix the above include path, it needs to be
430 # defined based off what is read in the configuration
431 # stage about the machine(PPC, X86, X86_64, etc.)
433 conf.env.append_value('CPPPATH_OSX', "/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/")
435 # TODO: Likewise this needs to be defined not only
436 # based off the machine characteristics, but also
437 # based off the version of GCC being used.
440 conf.env.append_value('FRAMEWORK_OSX', ['CoreFoundation'])
442 conf.env.append_value('LINKFLAGS_OSX', ['-undefined', 'suppress'])
443 conf.env.append_value('LINKFLAGS_OSX', "-flat_namespace")
445 # The previous 2 flags avoid circular dependencies
446 # between libardour and libardour_cp on OS X.
447 # ld reported -undefined suppress as an unknown option
448 # in one of the tests ran, removing it for the moment
450 conf.env.append_value('CXXFLAGS_OSX', "-F/System/Library/Frameworks")
451 conf.env.append_value('CCFLAGS_OSX', "-F/System/Library/Frameworks")
453 # GTKOSX only builds on darwin anyways
454 if Options.options.gtkosx:
456 # Define Include Paths for GTKOSX
458 conf.env.append_value('CXXFLAGS_GTKOSX', '-DTOP_MENUBAR')
459 conf.env.append_value('CXXFLAGS_GTKOSX', '-DGTKOSX')
460 conf.env.append_value('LINKFLAGS_GTKOSX', "-framework AppKit")
461 conf.env.append_value('LINKFLAGS_GTKOSX', "-Xlinker -headerpad")
462 conf.env.append_value('LINKFLAGS_GTKOSX', "-Xlinker 2048")
463 conf.env.append_value('CPPPATH_GTKOSX', "/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/")
465 if Options.options.coreaudio:
466 conf.check_cc (header_name = '/System/Library/Frameworks/CoreAudio.framework/Headers/CoreAudio.h',
467 define_name = 'HAVE_COREAUDIO', linkflags = ['-framework CoreAudio'],
468 uselib_store="COREAUDIO")
469 conf.check_cxx (header_name = '/System/Library/Frameworks/AudioToolbox.framework/Headers/ExtendedAudioFile.h',
470 linkflags = [ '-framework AudioToolbox' ], uselib_store="COREAUDIO")
471 conf.check_cc (header_name = '/System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h',
472 linkflags = ['-framework CoreServices'], uselib_store="COREAUDIO")
474 if Options.options.audiounits:
475 #conf.env.append_value('CXXFLAGS_AUDIOUNIT', "-DHAVE_AUDIOUNITS")
476 conf.env.append_value('FRAMEWORK_AUDIOUNIT', ['AudioToolbox'])
477 conf.env.append_value('FRAMEWORK_AUDIOUNIT', ['CoreServices'])
478 conf.check_cc (header_name = '/System/Library/Frameworks/AudioUnit.framework/Headers/AudioUnit.h',
479 define_name = 'HAVE_AUDIOUNITS', linkflags = [ '-framework AudioUnit' ],
480 uselib_store="AUDIOUNIT")
482 if Options.options.boost_sp_debug:
483 conf.env.append_value('CXXFLAGS', '-DBOOST_SP_ENABLE_DEBUG_HOOKS')
485 autowaf.check_header(conf, 'boost/signals2.hpp', mandatory = True)
487 autowaf.check_header(conf, 'jack/session.h', define="JACK_SESSION")
489 conf.check_cc(fragment = "#include <boost/version.hpp>\nint main(void) { return (BOOST_VERSION >= 103900 ? 0 : 1); }\n",
490 execute = "1",
491 mandatory = True,
492 msg = 'Checking for boost library >= 1.39',
493 okmsg = 'ok',
494 errmsg = 'too old\nPlease install boost version 1.39 or higher.')
496 autowaf.check_pkg(conf, 'cppunit', uselib_store='CPPUNIT', atleast_version='1.12.0', mandatory=False)
497 autowaf.check_pkg(conf, 'glib-2.0', uselib_store='GLIB', atleast_version='2.2')
498 autowaf.check_pkg(conf, 'gthread-2.0', uselib_store='GTHREAD', atleast_version='2.2')
499 autowaf.check_pkg(conf, 'glibmm-2.4', uselib_store='GLIBMM', atleast_version='2.14.0')
501 if sys.platform == 'darwin':
502 sub_config_and_use(conf, 'libs/appleutility')
503 for i in children:
504 sub_config_and_use(conf, i)
506 # Fix utterly braindead FLAC include path to not smash assert.h
507 conf.env['CPPPATH_FLAC'] = []
509 conf.check_cc(function_name='dlopen', header_name='dlfcn.h', linkflags='-ldl', uselib_store='DL')
510 conf.check_cc(function_name='curl_global_init', header_name='curl/curl.h', linkflags='-lcurl', uselib_store='CURL')
512 if conf.check_cc(function_name='posix_memalign', header_name='stdlib.h', ccflags='-D_XOPEN_SOURCE=600') == False:
513 conf.env['HAVE_POSIX_MEMALIGN'] = True
515 # Tell everyone that this is a waf build
517 conf.env.append_value('CCFLAGS', '-DWAF_BUILD')
518 conf.env.append_value('CXXFLAGS', '-DWAF_BUILD')
520 # debug builds should not call home
522 opts = Options.options
523 if opts.debug:
524 opts.phone_home = False;
526 autowaf.display_msg(conf, 'Build Target', conf.env['build_target'])
527 autowaf.display_msg(conf, 'Architecture flags', opts.arch)
528 autowaf.display_msg(conf, 'Aubio', bool(conf.env['HAVE_AUBIO']))
529 autowaf.display_msg(conf, 'AudioUnits', opts.audiounits)
530 autowaf.display_msg(conf, 'CoreAudio', bool(conf.env['HAVE_COREAUDIO']))
531 autowaf.display_msg(conf, 'FLAC', bool(conf.env['HAVE_FLAC']))
532 if bool(conf.env['HAVE_COREAUDIO']):
533 conf.define ('COREAUDIO', 1)
534 if opts.audiounits:
535 conf.define('AUDIOUNITS',1)
536 autowaf.display_msg(conf, 'Phone Home', opts.phone_home)
537 if opts.phone_home:
538 conf.env['PHONE_HOME'] = opts.phone_home
539 autowaf.display_msg(conf, 'FPU Optimization', opts.fpu_optimization)
540 if opts.fpu_optimization:
541 conf.define('FPU_OPTIMIZATION', 1)
542 autowaf.display_msg(conf, 'Freedesktop Files', opts.freedesktop)
543 autowaf.display_msg(conf, 'Freesound', opts.freesound)
544 if opts.freesound:
545 conf.define('FREESOUND',1)
546 autowaf.display_msg(conf, 'GtkOSX', opts.gtkosx)
547 if opts.gtkosx:
548 conf.define ('GTKOSX', 1)
549 autowaf.display_msg(conf, 'LV2 Support', bool(conf.env['HAVE_SLV2']))
550 autowaf.display_msg(conf, 'OGG', bool(conf.env['HAVE_OGG']))
551 autowaf.display_msg(conf, 'Rubberband', bool(conf.env['HAVE_RUBBERBAND']))
552 autowaf.display_msg(conf, 'Samplerate', bool(conf.env['HAVE_SAMPLERATE']))
553 autowaf.display_msg(conf, 'Soundtouch', bool(conf.env['HAVE_SOUNDTOUCH']))
554 autowaf.display_msg(conf, 'Translation', opts.nls)
555 if opts.nls:
556 conf.define ('ENABLE_NLS', 1)
557 autowaf.display_msg(conf, 'Tranzport', opts.tranzport)
558 if opts.build_tests:
559 conf.env['BUILD_TESTS'] = opts.build_tests
560 autowaf.display_msg(conf, 'Unit Tests', bool(conf.env['BUILD_TESTS']) and bool (conf.env['HAVE_CPPUNIT']))
561 if opts.tranzport:
562 conf.define('TRANZPORT', 1)
563 autowaf.display_msg(conf, 'Universal Binary', opts.universal)
564 autowaf.display_msg(conf, 'VST Support', opts.vst)
565 if opts.vst:
566 conf.define('VST_SUPPORT', 1)
567 if bool(conf.env['JACK_SESSION']):
568 conf.define ('HAVE_JACK_SESSION', 1)
569 autowaf.display_msg(conf, 'Wiimote Support', opts.wiimote)
570 if opts.wiimote:
571 conf.define('WIIMOTE',1)
572 conf.define('WINDOWS_KEY', opts.windows_key)
573 autowaf.display_msg(conf, 'Windows Key', opts.windows_key)
574 conf.env['PROGRAM_NAME'] = opts.program_name
575 autowaf.display_msg(conf, 'Program Name', opts.program_name)
577 set_compiler_flags (conf, Options.options)
579 autowaf.display_msg(conf, 'C Compiler flags', conf.env['CCFLAGS'])
580 autowaf.display_msg(conf, 'C++ Compiler flags', conf.env['CXXFLAGS'])
581 print()
583 # and dump the same stuff to a file for use in the build
585 config_text = open ('libs/ardour/config_text.cc',"w")
586 config_text.write ('#include "ardour/ardour.h"\n\nnamespace ARDOUR {\nconst char* const ardour_config_info = "\\n\\\n')
587 config_text.write ("Install prefix: "); config_text.write (str (conf.env['PREFIX'])); config_text.write ("\\n\\\n")
588 config_text.write ("Debuggable build: "); config_text.write (str (str(conf.env['DEBUG']))); config_text.write ("\\n\\\n")
589 config_text.write ("Strict compiler flags: "); config_text.write (str (str(conf.env['STRICT']))); config_text.write ("\\n\\\n")
590 config_text.write ("Build documentation: "); config_text.write (str (str(conf.env['DOCS']))); config_text.write ("\\n\\\n")
591 config_text.write ('Build target: '); config_text.write (str (conf.env['build_target'])); config_text.write ("\\n\\\n")
592 config_text.write ('Architecture flags: '); config_text.write (str (opts.arch)); config_text.write ("\\n\\\n")
593 config_text.write ('Aubio: '); config_text.write (str (bool(conf.env['HAVE_AUBIO']))); config_text.write ("\\n\\\n")
594 config_text.write ('AudioUnits: '); config_text.write (str (opts.audiounits)); config_text.write ("\\n\\\n")
595 config_text.write ('CoreAudio: '); config_text.write (str (bool(conf.env['HAVE_COREAUDIO']))); config_text.write ("\\n\\\n")
596 config_text.write ('FPU optimization: '); config_text.write (str (opts.fpu_optimization)); config_text.write ("\\n\\\n")
597 config_text.write ('Freedesktop files: '); config_text.write (str (opts.freedesktop)); config_text.write ("\\n\\\n")
598 config_text.write ('Freesound: '); config_text.write (str (opts.freesound)); config_text.write ("\\n\\\n")
599 config_text.write ('GtkOSX: '); config_text.write (str (opts.gtkosx)); config_text.write ("\\n\\\n")
600 config_text.write ('LV2 support: '); config_text.write (str (bool(conf.env['HAVE_SLV2']))); config_text.write ("\\n\\\n")
601 config_text.write ('Rubberband: '); config_text.write (str (bool(conf.env['HAVE_RUBBERBAND']))); config_text.write ("\\n\\\n")
602 config_text.write ('Samplerate: '); config_text.write (str (bool(conf.env['HAVE_SAMPLERATE']))); config_text.write ("\\n\\\n")
603 config_text.write ('Soundtouch: '); config_text.write (str (bool(conf.env['HAVE_SOUNDTOUCH']))); config_text.write ("\\n\\\n")
604 config_text.write ('Translation: '); config_text.write (str (opts.nls)); config_text.write ("\\n\\\n")
605 config_text.write ('Tranzport: '); config_text.write (str (opts.tranzport)); config_text.write ("\\n\\\n")
606 config_text.write ('Universal binary: '); config_text.write (str (opts.universal)); config_text.write ("\\n\\\n")
607 config_text.write ('VST support: '); config_text.write (str (opts.vst)); config_text.write ("\\n\\\n")
608 config_text.write ('Wiimote support: '); config_text.write (str (opts.wiimote)); config_text.write ("\\n\\\n")
609 config_text.write ('Windows key: '); config_text.write (str (opts.windows_key)); config_text.write ("\\n\\\n")
610 config_text.write ('C compiler flags: '); config_text.write (str (conf.env['CCFLAGS'])); config_text.write ("\\n\\\n")
611 config_text.write ('C++ compiler flags: '); config_text.write (str (conf.env['CXXFLAGS'])); config_text.write ("\\n\\\n")
612 config_text.write ('Phone home: '); config_text.write (str (bool(conf.env['PHONE_HOME']))); config_text.write ("\\n\\\n")
613 config_text.write ('JACK session support: '); config_text.write (str (bool(conf.env['JACK_SESSION']))); config_text.write ("\\n\\\n")
614 config_text.write ('";}\n')
615 config_text.close ()
617 def build(bld):
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)