2 from waflib.extras import autowaf as autowaf
3 from waflib import Options, TaskGen
4 import waflib.Logs as Logs, waflib.Utils as Utils
10 from waflib.Task import Task
11 from waflib.Tools import winres
13 I18N_PACKAGE = 'gtk2_ardour3'
19 path_prefix = 'gtk2_ardour/'
21 gtk2_ardour_sources = [
24 'add_route_dialog.cc',
25 'ambiguous_file_dialog.cc',
34 'ardour_ui_dependents.cc',
35 'ardour_ui_dialogs.cc',
38 'ardour_ui_options.cc',
41 'audio_region_editor.cc',
42 'audio_region_view.cc',
43 'audio_streamview.cc',
45 'automation_controller.cc',
47 'automation_region_view.cc',
48 'automation_streamview.cc',
49 'automation_time_axis.cc',
51 'big_clock_window.cc',
57 'control_point_dialog.cc',
60 'edit_note_dialog.cc',
64 'editor_audio_import.cc',
65 'editor_audiotrack.cc',
67 'editor_canvas_events.cc',
68 'editor_component.cc',
71 'editor_route_groups.cc',
72 'editor_export_audio.cc',
73 'editor_group_tabs.cc',
75 'editor_locations.cc',
83 'editor_selection.cc',
84 'editor_snapshots.cc',
86 'editor_tempodisplay.cc',
90 'export_channel_selector.cc',
92 'export_file_notebook.cc',
93 'export_filename_selector.cc',
94 'export_format_dialog.cc',
95 'export_format_selector.cc',
96 'export_preset_selector.cc',
97 'export_timespan_selector.cc',
101 'floating_text_entry.cc',
102 'sfdb_freesound_mootcher.cc',
104 'generic_pluginui.cc',
106 'global_port_matrix.cc',
108 'gtk_pianokeyboard.c',
110 'insert_time_dialog.cc',
111 'interthread_progress_window.cc',
123 'midi_automation_line.cc',
124 'midi_channel_dialog.cc',
125 'midi_channel_selector.cc',
126 'midi_cut_buffer.cc',
127 'midi_export_dialog.cc',
128 'midi_list_editor.cc',
129 'midi_port_dialog.cc',
130 'midi_region_view.cc',
133 'midi_streamview.cc',
136 'midi_velocity_dialog.cc',
137 'missing_file_dialog.cc',
138 'missing_plugin_dialog.cc',
140 'mixer_group_tabs.cc',
146 'monitor_section.cc',
148 'mono_panner_editor.cc',
151 'new_plugin_preset_dialog.cc',
152 'normalize_dialog.cc',
156 'note_select_dialog.cc',
163 'panner_interface.cc',
166 'piano_roll_header.cc',
168 'playlist_selector.cc',
170 'plugin_selector.cc',
175 'port_matrix_body.cc',
176 'port_matrix_column_labels.cc',
177 'port_matrix_component.cc',
178 'port_matrix_grid.cc',
179 'port_matrix_labels.cc',
180 'port_matrix_row_labels.cc',
182 'patch_change_dialog.cc',
183 'progress_reporter.cc',
186 'quantize_dialog.cc',
187 'rc_option_editor.cc',
189 'region_gain_line.cc',
190 'region_layering_order_editor.cc',
191 'region_selection.cc',
195 'route_group_dialog.cc',
196 'route_group_menu.cc',
197 'route_params_ui.cc',
198 'route_processor_selection.cc',
199 'route_time_axis.cc',
202 'search_path_option.cc',
206 'session_import_dialog.cc',
207 'session_metadata_dialog.cc',
208 'session_option_editor.cc',
210 'shuttle_control.cc',
211 'soundcloud_export_selector.cc',
218 'stereo_panner_editor.cc',
220 'strip_silence_dialog.cc',
222 'tape_region_view.cc',
227 'time_axis_view_item.cc',
231 'track_selection.cc',
232 'track_view_list.cc',
233 'transpose_dialog.cc',
238 'visibility_group.cc',
239 'volume_controller.cc',
241 # video-timeline related sources:
242 'video_image_frame.cc',
243 'add_video_dialog.cc',
244 'editor_videotimeline.cc',
247 'transcode_ffmpeg.cc',
248 'transcode_video_dialog.cc',
249 'video_server_dialog.cc',
251 'export_video_dialog.cc',
252 'export_video_infobox.cc'
256 autowaf.set_options(opt)
260 conf.load('compiler_cxx')
261 # we don't use hard-coded micro versions with ardour, so hard code it to zero
262 autowaf.build_version_files(
263 path_prefix + 'version.h',
264 path_prefix + 'version.cc',
265 'gtk2_ardour', conf.env['MAJOR'], conf.env['MINOR'], 0,
267 autowaf.configure(conf)
269 # TODO: Insert a sanity check for on OS X to ensure CoreAudio is present
271 autowaf.check_pkg(conf, 'fftw3f', uselib_store='FFTW3F',
273 autowaf.check_pkg(conf, 'flac', uselib_store='FLAC',
274 atleast_version='1.2.1')
275 autowaf.check_pkg(conf, 'gthread-2.0', uselib_store='GTHREAD',
276 atleast_version='2.10.1')
277 autowaf.check_pkg(conf, 'gtk+-2.0', uselib_store='GTK',
278 atleast_version='2.18')
279 autowaf.check_pkg(conf, 'gtkmm-2.4', uselib_store='GTKMM',
280 atleast_version='2.18')
281 autowaf.check_pkg(conf, 'ogg', uselib_store='OGG', atleast_version='1.1.2')
282 autowaf.check_pkg(conf, 'x11', uselib_store='X11', atleast_version='1.1', mandatory=False)
283 autowaf.check_pkg(conf, 'fontconfig', uselib_store='FONTCONFIG')
285 conf.write_config_header('gtk2ardour-config.h', remove=False)
287 bak = conf.env['define_key']
288 conf.define('VERSIONSTRING', str (conf.env['VERSION']))
289 conf.env['define_key'] = ['VERSIONSTRING']
290 conf.write_config_header('gtk2ardour-version.h')
291 conf.env['define_key'] = bak;
294 autowaf.check_header(conf, 'cxx', 'boost/shared_ptr.hpp')
295 autowaf.check_header(conf, 'cxx', 'boost/weak_ptr.hpp')
297 # Add a waf `feature' to allow compilation of things using winegcc
298 from waflib.TaskGen import feature
300 def set_winegcc(self):
301 self.env.LINK_CXX = self.env.LINK_CC = 'wineg++'
302 self.env.CC = 'winegcc'
304 def _doPyp(infileName, deps = False):
307 re_spaces = re.compile("\s+")
309 if infileName == '-':
312 fd = open(infileName)
313 inLines = fd.readlines()
319 bits = re_spaces.split(line)
320 if bits[0] == '##include':
325 # assume included file comes from same place as source file
326 incName = os.path.join (os.path.dirname (infileName), incName);
327 outStr += _doPyp(incName)
338 def include_processor(task):
339 infileName = task.inputs[0].srcpath()
340 outfileName = os.path.join(out, task.outputs[0].bldpath())
341 fdOut = open (outfileName, "w")
342 fdOut.write (_doPyp(infileName))
346 def build_color_scheme(path, prefix):
350 if re.search ('^#@color', line):
351 line.strip() # remove newline
353 if len(color_scheme):
355 color_scheme += prefix
357 color_scheme += words[1]
359 color_scheme += words[2]
365 VERSION = "%s.%s" % (bld.env['MAJOR'], bld.env['MINOR'])
367 if bld.is_defined('WINDOWS_VST_SUPPORT') and bld.env['build_target'] != 'mingw':
368 # Windows VST support w/wine
369 # If we require VST support we build a stub main() and the FST library
370 # here using winegcc, and link it to the GTK front-end library
371 obj = bld (features = 'cxx c cxxprogram wine')
373 '../libs/fst/vstwin.c',
377 # XXX do we really need to explicitly link to all of these for the wine executable?
379 obj.use = [ 'libpbd',
389 obj.target = 'ardour-' + str (bld.env['VERSION']) + '-vst.exe.so'
390 obj.includes = [ '../libs/fst', '.' ]
391 obj.linkflags = ['-mwindows', '-Wl,--export-dynamic']
392 obj.defines = ['_POSIX_SOURCE', 'USE_WS_PREFIX']
393 obj.install_path = bld.env['DLLDIR']
394 # end of the wine executable
396 # now the shared library containing the GTK GUI for ardour
397 obj = bld (features = 'cxx c cxxshlib')
398 obj.source = gtk2_ardour_sources
399 obj.includes = [ '../libs/fst', '.' ]
400 obj.name = 'libgtk2_ardour'
401 obj.target = 'gtk2_ardour'
403 # just the normal executable version of the GTK GUI
404 if bld.env['build_target'] == 'mingw':
405 obj = bld (features = 'cxx c cxxprogram winres')
407 obj = bld (features = 'cxx c cxxprogram')
408 obj.source = gtk2_ardour_sources
409 obj.target = 'ardour-' + str (bld.env['VERSION'])
411 obj.ldflags = ['-no-undefined']
413 if bld.is_defined('WINDOWS_VST_SUPPORT'):
414 # Windows VST support mingw
415 obj.includes += [ '../libs/fst' ]
417 # at this point, "obj" refers to either the normal native executable
418 # OR the shared library built for use with wine on linux.
420 obj.use = [ 'libpbd',
430 'PACKAGE="' + I18N_PACKAGE + '"',
431 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
432 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
433 'LOCALEDIR="' + os.path.join(os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
435 obj.install_path = bld.env['DLLDIR']
436 obj.uselib = 'UUID FLAC FONTCONFIG GLIBMM GTHREAD GTK OGG CURL DL'
437 obj.uselib += ' GTKMM CANVAS FFTW3F'
438 obj.uselib += ' AUDIOUNITS OSX GTKOSX LO '
439 obj.uselib += ' TAGLIB '
441 if sys.platform == 'darwin':
442 obj.uselib += ' AUDIOUNITS OSX GTKOSX'
443 obj.use += ' libappleutility'
444 obj.source += [ 'cocoacarbon.mm', 'bundle_env_cocoa.cc' ]
445 elif bld.env['build_target'] == 'mingw':
446 obj.source += [ 'bundle_env_mingw.cc' ]
447 obj.source += [ 'windows_icon.rc' ]
449 obj.source += [ 'bundle_env_linux.cc' ]
451 obj.includes += ['../libs']
453 if bld.env['build_target'] == 'mingw':
454 if bld.env['DEBUG'] == False:
455 obj.linkflags = ['-mwindows']
457 if bld.is_defined('HAVE_SUIL'):
458 obj.source += [ 'lv2_plugin_ui.cc' ]
459 obj.use += [ 'SUIL' ]
461 if bld.is_defined('NEED_INTL'):
462 obj.linkflags = ' -lintl'
464 if bld.is_defined('WINDOWS_VST_SUPPORT'):
465 obj.source += [ 'windows_vst_plugin_ui.cc' ]
466 obj.defines += [ 'WINDOWS_VST_SUPPORT' ]
467 if bld.env['build_target'] != 'mingw':
470 if bld.is_defined('LXVST_SUPPORT'):
471 obj.source += [ 'linux_vst_gui_support.cc', 'lxvst_plugin_ui.cc' ]
472 obj.defines += [ 'LXVST_SUPPORT' ]
475 if bld.is_defined('WINDOWS_VST_SUPPORT') or bld.is_defined('LXVST_SUPPORT'):
476 obj.source += [ 'vst_plugin_ui.cc' ]
478 if bld.is_defined('PHONE_HOME'):
479 obj.defines += [ 'PHONE_HOME' ]
481 if bld.is_defined('HAVE_COREAUDIO'):
482 TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cc']
483 obj.use += ' libappleutility '
485 if bld.is_defined('AUDIOUNIT_SUPPORT'):
486 obj.source += [ 'au_pluginui.mm' ]
490 wrapper_subst_dict = {
491 'INSTALL_PREFIX' : bld.env['PREFIX'],
492 'LIBDIR' : os.path.normpath(bld.env['DLLDIR']),
493 'DATADIR' : os.path.normpath(bld.env['DATADIR']),
494 'CONFDIR' : os.path.normpath(bld.env['CONFDIR']),
495 'LIBS' : 'build/libs',
496 'VERSION' : bld.env['VERSION'],
497 'EXECUTABLE' : 'build/gtk2_ardour/ardour-' + str (bld.env['VERSION'])
500 def set_subst_dict(obj, dict):
502 setattr(obj, i, dict[i])
504 obj = bld(features = 'subst', rule= 'chmod 0755 ${TGT}')
505 obj.source = 'ardev_common.sh.in'
506 obj.target = 'ardev_common_waf.sh'
507 obj.chmod = Utils.O755
508 obj.dict = wrapper_subst_dict
509 set_subst_dict(obj, wrapper_subst_dict)
511 obj = bld(features = 'subst')
512 obj.source = 'ardour.sh.in'
513 obj.target = 'ardour3'
514 obj.chmod = Utils.O755
515 obj.dict = wrapper_subst_dict
516 obj.install_path = bld.env['BINDIR']
517 set_subst_dict(obj, wrapper_subst_dict)
519 if bld.is_defined('WINDOWS_VST_SUPPORT'):
520 obj = bld(features = 'subst')
521 obj.source = '../vst/ardourvst.in'
522 obj.target = 'ardourvst3'
523 obj.chmod = Utils.O755
524 obj.dict = wrapper_subst_dict
525 obj.install_path = bld.env['BINDIR']
526 set_subst_dict(obj, wrapper_subst_dict)
530 dark_rc_subst_dict = {}
531 light_rc_subst_dict = {}
537 if bld.is_defined('GTKOSX'): # OS X fonts
551 # There is no acceptable monospace font available on older versions of OS X
552 # and no API on those versions to load TTF files that will work with
553 # GTK/fontconfig/pango.
555 # In addition, the ArdourMono font gets clipped for some reason on OS X
557 # Moreover, Lucida Grande just seems to work even though it is not monospace
561 'MONOSPACE' : 'Lucida Grande',
563 else: # Linux/X11 fonts
564 basefont = '' # unspecified - use system defaults
577 'MONOSPACE' : 'ArdourMono',
580 # Set up font substitution dictionary
582 for style in ['', 'BOLD', 'ITALIC']:
583 for sizename,points in iter(font_sizes.items()):
585 key = "_".join (['FONT',style,sizename])
586 fontstyle = " ".join ([basefont,style.lower(),points])
588 key = "_".join (['FONT',sizename])
589 fontstyle = " ".join ([basefont,points])
591 dark_rc_subst_dict[key] = fontstyle
592 light_rc_subst_dict[key] = fontstyle
593 ui_conf_dict[key] = points
596 for sizename,points in iter(font_sizes.items()):
597 key = "_".join (['FONT_SIZE',sizename])
598 dark_rc_subst_dict[key] = points
599 light_rc_subst_dict[key] = points
600 ui_conf_dict[key] = points
602 # various font names, eg @BOLD_MONOSPACE@
603 for font_sym,text in iter(font_names.items()):
605 dark_rc_subst_dict[key] = text
606 light_rc_subst_dict[key] = text
607 ui_conf_dict[key] = text
610 dark_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
611 'gtk2_ardour/ui_dark.rc.in', 'ARDOUR_DARK')
612 dark_rc_subst_dict['COLPREFIX'] = 'ARDOUR_DARK'
613 light_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
614 'gtk2_ardour/ui_light.rc.in', 'ARDOUR_LIGHT')
615 light_rc_subst_dict['COLPREFIX'] = 'ARDOUR_LIGHT'
617 obj = bld(features = 'subst')
618 obj.source = [ 'ui_dark.rc.in' ]
619 obj.target = 'ui_dark.rc.pre'
620 obj.install_path = None
621 set_subst_dict(obj, dark_rc_subst_dict)
623 obj = bld(features = 'subst')
624 obj.source = [ 'ui_light.rc.in' ]
625 obj.target = 'ui_light.rc.pre'
626 obj.install_path = None
627 set_subst_dict(obj, light_rc_subst_dict)
629 obj = bld(features = 'subst')
630 obj.source = [ 'styles.rc.in' ]
631 obj.target = 'dark_styles.rc'
632 obj.install_path = None
633 set_subst_dict(obj, dark_rc_subst_dict)
635 obj = bld(features = 'subst')
636 obj.source = [ 'styles.rc.in' ]
637 obj.target = 'light_styles.rc'
638 obj.install_path = None
639 set_subst_dict(obj, light_rc_subst_dict)
641 obj = bld(features = 'subst')
642 obj.source = [ 'fonts.rc.in' ]
643 obj.target = 'dark_fonts.rc'
644 obj.install_path = None
645 set_subst_dict(obj, dark_rc_subst_dict)
647 obj = bld(features = 'subst')
648 obj.source = [ 'fonts.rc.in' ]
649 obj.target = 'light_fonts.rc'
650 obj.install_path = None
651 set_subst_dict(obj, light_rc_subst_dict)
653 obj = bld(rule = autowaf.copyfile)
654 obj.source = [ 'widget_list.rc' ]
655 obj.target = 'widgets.rc'
656 obj.install_path = None
658 obj = bld (rule = include_processor)
659 obj.source = [ 'ui_dark.rc.pre' ]
660 # find and add all ##include dependencies as sources
661 obj.source += _doPyp (bld.path.find_resource ('ui_dark.rc.in').srcpath(), True)
662 obj.target = 'ui_dark.rc'
663 obj.install_path = bld.env['CONFDIR']
665 obj = bld (rule = include_processor)
666 obj.source = [ 'ui_light.rc.pre' ]
667 # find and add all ##include dependencies as sources
668 obj.source += _doPyp (bld.path.find_resource ('ui_light.rc.in').srcpath(), True)
669 obj.target = 'ui_light.rc'
670 obj.install_path = bld.env['CONFDIR']
672 obj = bld(features = 'subst')
673 obj.source = [ 'default_ui_config.in' ]
674 obj.target = 'default_ui_config'
675 obj.install_path = None
676 set_subst_dict(obj, ui_conf_dict)
680 if bld.is_defined('GTKOSX'):
681 menus_argv = [ '-E', '-P', '-DGTKOSX' ]
683 menus_argv = [ '-E', '-P' ]
685 # always build all versions of the menu definitions
686 # so that we can try them out with different program builds.
687 for program in [ 'ardour', 'trx' ]:
688 obj = bld(features = 'command-output')
690 obj.command_is_external = True
692 obj.argv = menus_argv
693 obj.dep_vars = ['GTKOSX']
694 obj.stdin = program + '.menus.in'
695 obj.stdout = program + '.menus'
696 bld.install_files (bld.env['CONFDIR'], program + '.menus')
700 # 'SAE-de-keypad', 'SAE-de-nokeypad', 'SAE-us-keypad',
701 # 'SAE-us-nokeypad', 'ergonomic-us'
704 # explicitly state the use of perl here so that it works on windows too
706 a_rule = 'perl ../tools/fmt-bindings --platform="%s" --winkey="%s" --accelmap <${SRC} >${TGT}' % (sys.platform, bld.env['WINDOWS_KEY'] )
707 for b in [ 'mnemonic-us' ] :
709 target = b + '.bindings',
710 source = b + '.bindings.in',
713 obj.install_path = bld.env['CONFDIR']
715 # not modified at present
716 bld.install_files(bld.env['CONFDIR'], 'step_editing.bindings')
717 bld.install_files(bld.env['CONFDIR'], 'mixer.bindings')
720 bld.install_files(os.path.join (bld.env['DATADIR'], 'icons'), bld.path.ant_glob('icons/*.png'))
721 bld.install_files(os.path.join (bld.env['DATADIR'], 'pixmaps'), bld.path.ant_glob('pixmaps/*.xpm'))
722 bld.install_files(bld.env['DATADIR'], 'splash.png')
723 bld.install_files(bld.env['DATADIR'], 'small-splash.png')
724 bld.install_files(bld.env['DATADIR'], 'ArdourMono.ttf')
726 # Default UI configuration
727 bld.install_files(bld.env['CONFDIR'], 'default_ui_config')
729 # Default export stuff
730 bld.install_files(os.path.join(bld.env['CONFDIR'],' export'), bld.path.ant_glob('export/*.format'))
733 if bld.is_defined('ENABLE_NLS'):
734 mo_files = bld.path.ant_glob('po/*.mo')
736 lang = os.path.basename(mo.srcpath()).replace('.mo', '')
737 bld.install_as(os.path.join(bld.env['PREFIX'], 'share', 'locale',
738 lang, 'LC_MESSAGES', I18N_PACKAGE + '.mo'),
742 autowaf.build_i18n(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
746 autowaf.build_i18n_pot(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
750 autowaf.build_i18n_po(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
754 autowaf.build_i18n_mo(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,