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
12 I18N_PACKAGE = 'gtk2_ardour3'
18 path_prefix = 'gtk2_ardour/'
20 gtk2_ardour_sources = [
23 'add_route_dialog.cc',
24 'ambiguous_file_dialog.cc',
33 'ardour_ui_dependents.cc',
34 'ardour_ui_dialogs.cc',
37 'ardour_ui_options.cc',
40 'audio_region_editor.cc',
41 'audio_region_view.cc',
42 'audio_streamview.cc',
44 'automation_controller.cc',
46 'automation_region_view.cc',
47 'automation_streamview.cc',
48 'automation_time_axis.cc',
50 'big_clock_window.cc',
56 'control_point_dialog.cc',
59 'edit_note_dialog.cc',
63 'editor_audio_import.cc',
64 'editor_audiotrack.cc',
66 'editor_canvas_events.cc',
67 'editor_component.cc',
70 'editor_route_groups.cc',
71 'editor_export_audio.cc',
72 'editor_group_tabs.cc',
74 'editor_locations.cc',
82 'editor_selection.cc',
83 'editor_snapshots.cc',
85 'editor_tempodisplay.cc',
89 'export_channel_selector.cc',
91 'export_file_notebook.cc',
92 'export_filename_selector.cc',
93 'export_format_dialog.cc',
94 'export_format_selector.cc',
95 'export_preset_selector.cc',
96 'export_timespan_selector.cc',
100 'sfdb_freesound_mootcher.cc',
102 'generic_pluginui.cc',
104 'global_port_matrix.cc',
106 'gtk_pianokeyboard.c',
108 'insert_time_dialog.cc',
109 'interthread_progress_window.cc',
121 'midi_automation_line.cc',
122 'midi_channel_dialog.cc',
123 'midi_channel_selector.cc',
124 'midi_cut_buffer.cc',
125 'midi_export_dialog.cc',
126 'midi_list_editor.cc',
127 'midi_port_dialog.cc',
128 'midi_region_view.cc',
131 'midi_streamview.cc',
134 'midi_velocity_dialog.cc',
135 'missing_file_dialog.cc',
136 'missing_plugin_dialog.cc',
138 'mixer_group_tabs.cc',
144 'monitor_section.cc',
146 'mono_panner_editor.cc',
149 'new_plugin_preset_dialog.cc',
150 'normalize_dialog.cc',
160 'panner_interface.cc',
163 'piano_roll_header.cc',
165 'playlist_selector.cc',
167 'plugin_selector.cc',
172 'port_matrix_body.cc',
173 'port_matrix_column_labels.cc',
174 'port_matrix_component.cc',
175 'port_matrix_grid.cc',
176 'port_matrix_labels.cc',
177 'port_matrix_row_labels.cc',
179 'patch_change_dialog.cc',
180 'progress_reporter.cc',
183 'quantize_dialog.cc',
184 'rc_option_editor.cc',
186 'region_gain_line.cc',
187 'region_layering_order_editor.cc',
188 'region_selection.cc',
192 'route_group_dialog.cc',
193 'route_group_menu.cc',
194 'route_params_ui.cc',
195 'route_processor_selection.cc',
196 'route_time_axis.cc',
199 'search_path_option.cc',
203 'session_import_dialog.cc',
204 'session_metadata_dialog.cc',
205 'session_option_editor.cc',
207 'shuttle_control.cc',
208 'soundcloud_export_selector.cc',
215 'stereo_panner_editor.cc',
217 'strip_silence_dialog.cc',
219 'tape_region_view.cc',
224 'time_axis_view_item.cc',
228 'track_selection.cc',
229 'track_view_list.cc',
230 'transpose_dialog.cc',
235 'visibility_group.cc',
236 'volume_controller.cc',
238 # video-timeline related sources:
239 'video_image_frame.cc',
240 'add_video_dialog.cc',
241 'editor_videotimeline.cc',
244 'transcode_ffmpeg.cc',
245 'transcode_video_dialog.cc',
246 'video_server_dialog.cc',
248 'export_video_dialog.cc',
249 'export_video_infobox.cc'
253 autowaf.set_options(opt)
257 conf.load('compiler_cxx')
258 # we don't use hard-coded micro versions with ardour, so hard code it to zero
259 autowaf.build_version_files(
260 path_prefix + 'version.h',
261 path_prefix + 'version.cc',
262 'gtk2_ardour', conf.env['MAJOR'], conf.env['MINOR'], 0,
264 autowaf.configure(conf)
266 # TODO: Insert a sanity check for on OS X to ensure CoreAudio is present
268 autowaf.check_pkg(conf, 'fftw3f', uselib_store='FFTW3F',
270 autowaf.check_pkg(conf, 'flac', uselib_store='FLAC',
271 atleast_version='1.2.1')
272 autowaf.check_pkg(conf, 'gthread-2.0', uselib_store='GTHREAD',
273 atleast_version='2.10.1')
274 autowaf.check_pkg(conf, 'gtk+-2.0', uselib_store='GTK',
275 atleast_version='2.18')
276 autowaf.check_pkg(conf, 'gtkmm-2.4', uselib_store='GTKMM',
277 atleast_version='2.18')
278 autowaf.check_pkg(conf, 'ogg', uselib_store='OGG', atleast_version='1.1.2')
279 autowaf.check_pkg(conf, 'x11', uselib_store='X11', atleast_version='1.1', mandatory=False)
280 autowaf.check_pkg(conf, 'fontconfig', uselib_store='FONTCONFIG')
282 conf.write_config_header('gtk2ardour-config.h', remove=False)
284 bak = conf.env['define_key']
285 conf.define('VERSIONSTRING', str (conf.env['VERSION']))
286 conf.env['define_key'] = ['VERSIONSTRING']
287 conf.write_config_header('gtk2ardour-version.h')
288 conf.env['define_key'] = bak;
291 autowaf.check_header(conf, 'cxx', 'boost/shared_ptr.hpp')
292 autowaf.check_header(conf, 'cxx', 'boost/weak_ptr.hpp')
294 # Add a waf `feature' to allow compilation of things using winegcc
295 from waflib.TaskGen import feature
297 def set_winegcc(self):
298 self.env.LINK_CXX = self.env.LINK_CC = 'wineg++'
299 self.env.CC = 'winegcc'
301 def _doPyp(infileName, deps = False):
304 re_spaces = re.compile("\s+")
306 if infileName == '-':
309 fd = open(infileName)
310 inLines = fd.readlines()
316 bits = re_spaces.split(line)
317 if bits[0] == '##include':
322 # assume included file comes from same place as source file
323 incName = os.path.join (os.path.dirname (infileName), incName);
324 outStr += _doPyp(incName)
335 def include_processor(task):
336 infileName = task.inputs[0].srcpath()
337 outfileName = os.path.join(out, task.outputs[0].bldpath())
338 fdOut = open (outfileName, "w")
339 fdOut.write (_doPyp(infileName))
343 def build_color_scheme(path, prefix):
347 if re.search ('^#@color', line):
348 line.strip() # remove newline
350 if len(color_scheme):
352 color_scheme += prefix
354 color_scheme += words[1]
356 color_scheme += words[2]
362 VERSION = "%s.%s" % (bld.env['MAJOR'], bld.env['MINOR'])
364 if bld.is_defined('WINDOWS_VST_SUPPORT') and bld.env['build_target'] != 'mingw':
365 # Windows VST support w/wine
366 # If we require VST support we build a stub main() and the FST library
367 # here using winegcc, and link it to the GTK front-end library
368 obj = bld (features = 'cxx c cxxprogram wine')
370 '../libs/fst/vstwin.c',
374 # XXX do we really need to explicitly link to all of these for the wine executable?
376 obj.use = [ 'libpbd',
386 obj.target = 'ardour-' + str (bld.env['VERSION']) + '-vst.exe.so'
387 obj.includes = [ '../libs/fst', '.' ]
388 obj.linkflags = ['-mwindows', '-Wl,--export-dynamic']
389 obj.defines = ['_POSIX_SOURCE', 'USE_WS_PREFIX']
390 obj.install_path = bld.env['DLLDIR']
391 # end of the wine executable
393 # now the shared library containing the GTK GUI for ardour
394 obj = bld (features = 'cxx c cxxshlib')
395 obj.source = gtk2_ardour_sources
396 obj.includes = [ '../libs/fst', '.' ]
397 obj.name = 'libgtk2_ardour'
398 obj.target = 'gtk2_ardour'
400 # just the normal executable version of the GTK GUI
401 obj = bld (features = 'cxx c cxxprogram')
402 obj.source = gtk2_ardour_sources
403 obj.target = 'ardour-' + str (bld.env['VERSION'])
405 obj.ldflags = ['-no-undefined']
407 if bld.is_defined('WINDOWS_VST_SUPPORT'):
408 # Windows VST support mingw
409 obj.includes += [ '../libs/fst' ]
411 # at this point, "obj" refers to either the normal native executable
412 # OR the shared library built for use with wine on linux.
414 obj.use = [ 'libpbd',
424 'PACKAGE="' + I18N_PACKAGE + '"',
425 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
426 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
427 'LOCALEDIR="' + os.path.join(os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
429 obj.install_path = bld.env['DLLDIR']
430 obj.uselib = 'UUID FLAC FONTCONFIG GLIBMM GTHREAD GTK OGG CURL DL'
431 obj.uselib += ' GTKMM CANVAS FFTW3F'
432 obj.uselib += ' AUDIOUNITS OSX GTKOSX LO '
433 obj.uselib += ' TAGLIB '
435 if sys.platform == 'darwin':
436 obj.uselib += ' AUDIOUNITS OSX GTKOSX'
437 obj.use += ' libappleutility'
438 obj.source += [ 'cocoacarbon.mm', 'bundle_env_cocoa.cc' ]
439 elif bld.env['build_target'] == 'mingw':
440 obj.source += [ 'bundle_env_mingw.cc' ]
442 obj.source += [ 'bundle_env_linux.cc' ]
444 obj.includes += ['../libs']
446 if bld.env['build_target'] == 'mingw':
447 if bld.env['DEBUG'] == False:
448 obj.linkflags = ['-mwindows']
450 if bld.is_defined('HAVE_SUIL'):
451 obj.source += [ 'lv2_plugin_ui.cc' ]
452 obj.use += [ 'SUIL' ]
454 if bld.is_defined('NEED_INTL'):
455 obj.linkflags = ' -lintl'
457 if bld.is_defined('WINDOWS_VST_SUPPORT'):
458 obj.source += [ 'windows_vst_plugin_ui.cc' ]
459 obj.defines += [ 'WINDOWS_VST_SUPPORT' ]
460 if bld.env['build_target'] != 'mingw':
463 if bld.is_defined('LXVST_SUPPORT'):
464 obj.source += [ 'linux_vst_gui_support.cc', 'lxvst_plugin_ui.cc' ]
465 obj.defines += [ 'LXVST_SUPPORT' ]
468 if bld.is_defined('WINDOWS_VST_SUPPORT') or bld.is_defined('LXVST_SUPPORT'):
469 obj.source += [ 'vst_plugin_ui.cc' ]
471 if bld.is_defined('PHONE_HOME'):
472 obj.defines += [ 'PHONE_HOME' ]
474 if bld.is_defined('HAVE_COREAUDIO'):
475 TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cc']
476 obj.use += ' libappleutility '
478 if bld.is_defined('AUDIOUNIT_SUPPORT'):
479 obj.source += [ 'au_pluginui.mm' ]
483 wrapper_subst_dict = {
484 'INSTALL_PREFIX' : bld.env['PREFIX'],
485 'LIBDIR' : os.path.normpath(bld.env['DLLDIR']),
486 'DATADIR' : os.path.normpath(bld.env['DATADIR']),
487 'CONFDIR' : os.path.normpath(bld.env['CONFDIR']),
488 'LIBS' : 'build/libs',
489 'VERSION' : bld.env['VERSION'],
490 'EXECUTABLE' : 'build/gtk2_ardour/ardour-' + str (bld.env['VERSION'])
493 def set_subst_dict(obj, dict):
495 setattr(obj, i, dict[i])
497 obj = bld(features = 'subst', rule= 'chmod 0755 ${TGT}')
498 obj.source = 'ardev_common.sh.in'
499 obj.target = 'ardev_common_waf.sh'
500 obj.chmod = Utils.O755
501 obj.dict = wrapper_subst_dict
502 set_subst_dict(obj, wrapper_subst_dict)
504 obj = bld(features = 'subst')
505 obj.source = 'ardour.sh.in'
506 obj.target = 'ardour3'
507 obj.chmod = Utils.O755
508 obj.dict = wrapper_subst_dict
509 obj.install_path = bld.env['BINDIR']
510 set_subst_dict(obj, wrapper_subst_dict)
512 if bld.is_defined('WINDOWS_VST_SUPPORT'):
513 obj = bld(features = 'subst')
514 obj.source = '../vst/ardourvst.in'
515 obj.target = 'ardourvst3'
516 obj.chmod = Utils.O755
517 obj.dict = wrapper_subst_dict
518 obj.install_path = bld.env['BINDIR']
519 set_subst_dict(obj, wrapper_subst_dict)
523 dark_rc_subst_dict = {}
524 light_rc_subst_dict = {}
530 if bld.is_defined('GTKOSX'): # OS X fonts
544 # There is no acceptable monospace font available on older versions of OS X
545 # and no API on those versions to load TTF files that will work with
546 # GTK/fontconfig/pango.
548 # In addition, the ArdourMono font gets clipped for some reason on OS X
550 # Moreover, Lucida Grande just seems to work even though it is not monospace
554 'MONOSPACE' : 'Lucida Grande',
556 else: # Linux/X11 fonts
557 basefont = '' # unspecified - use system defaults
570 'MONOSPACE' : 'ArdourMono',
573 # Set up font substitution dictionary
575 for style in ['', 'BOLD', 'ITALIC']:
576 for sizename,points in iter(font_sizes.items()):
578 key = "_".join (['FONT',style,sizename])
579 fontstyle = " ".join ([basefont,style.lower(),points])
581 key = "_".join (['FONT',sizename])
582 fontstyle = " ".join ([basefont,points])
584 dark_rc_subst_dict[key] = fontstyle
585 light_rc_subst_dict[key] = fontstyle
586 ui_conf_dict[key] = points
589 for sizename,points in iter(font_sizes.items()):
590 key = "_".join (['FONT_SIZE',sizename])
591 dark_rc_subst_dict[key] = points
592 light_rc_subst_dict[key] = points
593 ui_conf_dict[key] = points
595 # various font names, eg @BOLD_MONOSPACE@
596 for font_sym,text in iter(font_names.items()):
598 dark_rc_subst_dict[key] = text
599 light_rc_subst_dict[key] = text
600 ui_conf_dict[key] = text
603 dark_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
604 'gtk2_ardour/ui_dark.rc.in', 'ARDOUR_DARK')
605 dark_rc_subst_dict['COLPREFIX'] = 'ARDOUR_DARK'
606 light_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
607 'gtk2_ardour/ui_light.rc.in', 'ARDOUR_LIGHT')
608 light_rc_subst_dict['COLPREFIX'] = 'ARDOUR_LIGHT'
610 obj = bld(features = 'subst')
611 obj.source = [ 'ui_dark.rc.in' ]
612 obj.target = 'ui_dark.rc.pre'
613 obj.install_path = None
614 set_subst_dict(obj, dark_rc_subst_dict)
616 obj = bld(features = 'subst')
617 obj.source = [ 'ui_light.rc.in' ]
618 obj.target = 'ui_light.rc.pre'
619 obj.install_path = None
620 set_subst_dict(obj, light_rc_subst_dict)
622 obj = bld(features = 'subst')
623 obj.source = [ 'styles.rc.in' ]
624 obj.target = 'dark_styles.rc'
625 obj.install_path = None
626 set_subst_dict(obj, dark_rc_subst_dict)
628 obj = bld(features = 'subst')
629 obj.source = [ 'styles.rc.in' ]
630 obj.target = 'light_styles.rc'
631 obj.install_path = None
632 set_subst_dict(obj, light_rc_subst_dict)
634 obj = bld(features = 'subst')
635 obj.source = [ 'fonts.rc.in' ]
636 obj.target = 'dark_fonts.rc'
637 obj.install_path = None
638 set_subst_dict(obj, dark_rc_subst_dict)
640 obj = bld(features = 'subst')
641 obj.source = [ 'fonts.rc.in' ]
642 obj.target = 'light_fonts.rc'
643 obj.install_path = None
644 set_subst_dict(obj, light_rc_subst_dict)
646 obj = bld(rule = autowaf.copyfile)
647 obj.source = [ 'widget_list.rc' ]
648 obj.target = 'widgets.rc'
649 obj.install_path = None
651 obj = bld (rule = include_processor)
652 obj.source = [ 'ui_dark.rc.pre' ]
653 # find and add all ##include dependencies as sources
654 obj.source += _doPyp (bld.path.find_resource ('ui_dark.rc.in').srcpath(), True)
655 obj.target = 'ui_dark.rc'
656 obj.install_path = bld.env['CONFDIR']
658 obj = bld (rule = include_processor)
659 obj.source = [ 'ui_light.rc.pre' ]
660 # find and add all ##include dependencies as sources
661 obj.source += _doPyp (bld.path.find_resource ('ui_light.rc.in').srcpath(), True)
662 obj.target = 'ui_light.rc'
663 obj.install_path = bld.env['CONFDIR']
665 obj = bld(features = 'subst')
666 obj.source = [ 'default_ui_config.in' ]
667 obj.target = 'default_ui_config'
668 obj.install_path = None
669 set_subst_dict(obj, ui_conf_dict)
673 if bld.is_defined('GTKOSX'):
674 menus_argv = [ '-E', '-P', '-DGTKOSX' ]
676 menus_argv = [ '-E', '-P' ]
678 # always build all versions of the menu definitions
679 # so that we can try them out with different program builds.
680 for program in [ 'ardour', 'trx' ]:
681 obj = bld(features = 'command-output')
683 obj.command_is_external = True
685 obj.argv = menus_argv
686 obj.dep_vars = ['GTKOSX']
687 obj.stdin = program + '.menus.in'
688 obj.stdout = program + '.menus'
689 bld.install_files (bld.env['CONFDIR'], program + '.menus')
693 # 'SAE-de-keypad', 'SAE-de-nokeypad', 'SAE-us-keypad',
694 # 'SAE-us-nokeypad', 'ergonomic-us'
697 # explicitly state the use of perl here so that it works on windows too
699 a_rule = 'perl ../tools/fmt-bindings --platform="%s" --winkey="%s" --accelmap <${SRC} >${TGT}' % (sys.platform, bld.env['WINDOWS_KEY'] )
700 for b in [ 'mnemonic-us' ] :
702 target = b + '.bindings',
703 source = b + '.bindings.in',
706 obj.install_path = bld.env['CONFDIR']
708 # not modified at present
709 bld.install_files(bld.env['CONFDIR'], 'step_editing.bindings')
710 bld.install_files(bld.env['CONFDIR'], 'mixer.bindings')
713 bld.install_files(os.path.join (bld.env['DATADIR'], 'icons'), bld.path.ant_glob('icons/*.png'))
714 bld.install_files(os.path.join (bld.env['DATADIR'], 'pixmaps'), bld.path.ant_glob('pixmaps/*.xpm'))
715 bld.install_files(bld.env['DATADIR'], 'splash.png')
716 bld.install_files(bld.env['DATADIR'], 'small-splash.png')
717 bld.install_files(bld.env['DATADIR'], 'ArdourMono.ttf')
719 # Default UI configuration
720 bld.install_files(bld.env['CONFDIR'], 'default_ui_config')
722 # Default export stuff
723 bld.install_files(os.path.join(bld.env['CONFDIR'],' export'), bld.path.ant_glob('export/*.format'))
726 if bld.is_defined('ENABLE_NLS'):
727 mo_files = bld.path.ant_glob('po/*.mo')
729 lang = os.path.basename(mo.srcpath()).replace('.mo', '')
730 bld.install_as(os.path.join(bld.env['PREFIX'], 'share', 'locale',
731 lang, 'LC_MESSAGES', I18N_PACKAGE + '.mo'),
735 autowaf.build_i18n(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
739 autowaf.build_i18n_pot(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
743 autowaf.build_i18n_po(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
747 autowaf.build_i18n_mo(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,