2 from waflib.extras import autowaf as autowaf
3 from waflib import Options, TaskGen
4 import waflib.Logs as Logs, waflib.Utils as Utils
9 from waflib.Task import Task
11 # Version of this package (even if built as a child)
15 GTK2_ARDOUR_VERSION = "%s.%s.%s" % (MAJOR, MINOR, MICRO)
17 # Variables for 'waf dist'
18 APPNAME = 'gtk2_ardour3'
19 VERSION = GTK2_ARDOUR_VERSION
20 I18N_PACKAGE = 'gtk2_ardour3'
26 path_prefix = 'gtk2_ardour/'
28 gtk2_ardour_sources = [
31 'add_route_dialog.cc',
32 'ambiguous_file_dialog.cc',
38 'ardour_ui_dependents.cc',
39 'ardour_ui_dialogs.cc',
42 'ardour_ui_options.cc',
45 'audio_region_editor.cc',
46 'audio_region_view.cc',
47 'audio_streamview.cc',
49 'automation_controller.cc',
51 'automation_region_view.cc',
52 'automation_streamview.cc',
53 'automation_time_axis.cc',
59 'canvas-note-event.cc',
61 'canvas_patch_change.cc',
62 'canvas-simpleline.c',
63 'canvas-simplerect.c',
69 'control_point_dialog.cc',
75 'edit_note_dialog.cc',
79 'editor_audio_import.cc',
80 'editor_audiotrack.cc',
82 'editor_canvas_events.cc',
83 'editor_component.cc',
86 'editor_route_groups.cc',
87 'editor_export_audio.cc',
88 'editor_group_tabs.cc',
90 'editor_locations.cc',
99 'editor_selection.cc',
100 'editor_snapshots.cc',
102 'editor_tempodisplay.cc',
106 'export_channel_selector.cc',
108 'export_file_notebook.cc',
109 'export_filename_selector.cc',
110 'export_format_dialog.cc',
111 'export_format_selector.cc',
112 'export_preset_selector.cc',
113 'export_timespan_selector.cc',
118 'generic_pluginui.cc',
120 'global_port_matrix.cc',
122 'gtk-custom-hruler.c',
123 'gtk-custom-ruler.c',
124 'gtk_pianokeyboard.c',
126 'insert_time_dialog.cc',
127 'interthread_progress_window.cc',
138 'midi_automation_line.cc',
139 'midi_channel_dialog.cc',
140 'midi_channel_selector.cc',
141 'midi_cut_buffer.cc',
142 'midi_list_editor.cc',
143 'midi_port_dialog.cc',
144 'midi_region_view.cc',
147 'midi_streamview.cc',
150 'missing_file_dialog.cc',
151 'missing_plugin_dialog.cc',
153 'mixer_group_tabs.cc',
156 'monitor_section.cc',
160 'new_plugin_preset_dialog.cc',
161 'normalize_dialog.cc',
166 'panner_interface.cc',
168 'piano_roll_header.cc',
169 'playlist_selector.cc',
171 'plugin_selector.cc',
176 'port_matrix_body.cc',
177 'port_matrix_column_labels.cc',
178 'port_matrix_component.cc',
179 'port_matrix_grid.cc',
180 'port_matrix_labels.cc',
181 'port_matrix_row_labels.cc',
183 'patch_change_dialog.cc',
184 'progress_reporter.cc',
187 'quantize_dialog.cc',
188 'rc_option_editor.cc',
190 'region_gain_line.cc',
191 'region_layering_order_editor.cc',
192 'region_selection.cc',
196 'route_group_dialog.cc',
197 'route_group_menu.cc',
198 'route_params_ui.cc',
199 'route_processor_selection.cc',
200 'route_time_axis.cc',
202 'search_path_option.cc',
205 'session_import_dialog.cc',
206 'session_metadata_dialog.cc',
207 'session_option_editor.cc',
209 'shuttle_control.cc',
219 'strip_silence_dialog.cc',
220 'tape_region_view.cc',
225 'time_axis_view_item.cc',
229 'track_selection.cc',
230 'track_view_list.cc',
231 'transpose_dialog.cc',
236 'visibility_group.cc',
237 'volume_controller.cc',
243 autowaf.set_options(opt)
247 conf.load('compiler_cxx')
248 autowaf.build_version_files(
249 path_prefix + 'version.h',
250 path_prefix + 'version.cc',
251 'gtk2_ardour', MAJOR, MINOR, MICRO)
252 autowaf.configure(conf)
254 if re.search ("linux", sys.platform) != None:
255 autowaf.check_pkg(conf, 'alsa', uselib_store='ALSA')
257 # TODO: Insert a sanity check for on OS X to ensure CoreAudio is present
259 autowaf.check_pkg(conf, 'flac', uselib_store='FLAC',
260 atleast_version='1.2.1')
261 autowaf.check_pkg(conf, 'gthread-2.0', uselib_store='GTHREAD',
262 atleast_version='2.10.1')
263 autowaf.check_pkg(conf, 'gtk+-2.0', uselib_store='GTK',
264 atleast_version='2.18')
265 autowaf.check_pkg(conf, 'gtkmm-2.4', uselib_store='GTKMM',
266 atleast_version='2.18')
267 autowaf.check_pkg(conf, 'libgnomecanvas-2.0',
268 uselib_store='GNOMECANVAS', atleast_version='2.30')
269 autowaf.check_pkg(conf, 'libgnomecanvasmm-2.6',
270 uselib_store='GNOMECANVASMM', atleast_version='2.16')
271 autowaf.check_pkg(conf, 'ogg', uselib_store='OGG', atleast_version='1.1.2')
272 autowaf.check_pkg(conf, 'x11', uselib_store='X11', atleast_version='1.3', mandatory=False)
274 conf.write_config_header('gtk2ardour-config.h', remove=False)
277 autowaf.check_header(conf, 'cxx', 'boost/shared_ptr.hpp')
278 autowaf.check_header(conf, 'cxx', 'boost/weak_ptr.hpp')
280 # Add a waf `feature' to allow compilation of things using winegcc
281 from waflib.TaskGen import feature
283 def set_winegcc(self):
284 self.env.LINK_CXX = self.env.LINK_CC = 'wineg++'
285 self.env.CC = 'winegcc'
287 def _doPyp(infileName, deps = False):
290 re_spaces = re.compile("\s+")
292 if infileName == '-':
295 fd = open(infileName)
296 inLines = fd.readlines()
302 bits = re_spaces.split(line)
303 if bits[0] == '##include':
308 # assume included file comes from same place as source file
309 incName = os.path.join (os.path.dirname (infileName), incName);
310 outStr += _doPyp(incName)
321 def include_processor(task):
322 infileName = task.inputs[0].srcpath()
323 outfileName = os.path.join(out, task.outputs[0].bldpath())
324 fdOut = open (outfileName, "w")
325 fdOut.write (_doPyp(infileName))
329 def build_color_scheme(path, prefix):
333 if re.search ('^#@color', line):
334 line.strip() # remove newline
336 if len(color_scheme):
338 color_scheme += prefix
340 color_scheme += words[1]
342 color_scheme += words[2]
348 if bld.is_defined('WINDOWS_VST_SUPPORT'):
349 # If we require VST support we build a stub main() and the FST library
350 # here using winegcc, and link it to the GTK front-end library
351 obj = bld(features = 'cxx c cxxprogram wine')
354 ../libs/fst/fstinfofile.c
360 obj.use = [ 'libpbd',
368 obj.target = 'ardour-3.0-vst.exe.so'
369 obj.includes = [ '../libs/fst', '.' ]
370 obj.linkflags = ['-mwindows', '-Wl,--export-dynamic', '-lpthread']
371 obj.defines = ['_POSIX_SOURCE', 'USE_WS_PREFIX']
372 obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
373 # end of the wine executable
375 # now the shared library containing the GTK GUI for ardour
376 obj = bld (features = 'cxx c cxxshlib')
377 obj.source = gtk2_ardour_sources
378 obj.includes = [ '../libs/fst', '.' ]
379 obj.name = 'libgtk2_ardour'
380 obj.target = 'gtk2_ardour'
382 # just the normal executable version of the GTK GUI
383 obj = bld(features = 'cxx c cxxprogram')
384 obj.source = gtk2_ardour_sources
385 obj.target = 'ardour-3.0'
388 # continue with setup of obj, which could be a shared library
391 obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
393 obj.uselib = 'UUID FLAC GLIBMM GTHREAD GTK OGG ALSA CURL DL'
394 obj.uselib += ' GTKMM GNOMECANVASMM GNOMECANVAS '
395 obj.uselib += ' AUDIOUNITS OSX GTKOSX '
396 obj.use = [ 'libpbd',
403 if sys.platform == 'darwin':
404 obj.use += ' libappleutility'
406 'PACKAGE="' + I18N_PACKAGE + '"',
407 'VERSIONSTRING="' + bld.env['VERSION'] + '"',
408 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
409 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
410 'MODULE_DIR="' + os.path.normpath(bld.env['LIBDIR']) + '"',
411 'LOCALEDIR="' + os.path.join(os.path.normpath(bld.env['DATADIR']),
413 'PROGRAM_NAME="' + bld.env['PROGRAM_NAME'] + '"'
415 obj.includes += ['../libs']
417 if bld.is_defined('HAVE_SUIL'):
418 obj.source += [ 'lv2_plugin_ui.cc' ]
419 obj.uselib += ' SUIL '
421 if bld.is_defined('FREESOUND'):
422 obj.source += [ 'sfdb_freesound_mootcher.cc' ]
423 obj.defines += [ 'FREESOUND' ]
425 if bld.is_defined('WINDOWS_VST_SUPPORT'):
426 obj.source += [ 'windows_vst_plugin_ui.cc' ]
427 obj.defines += [ 'WINDOWS_VST_SUPPORT' ]
428 obj.uselib += ' X11 '
430 if bld.is_defined('LXVST_SUPPORT'):
431 obj.source += [ 'linux_vst_gui_support.cc', 'lxvst_plugin_ui.cc' ]
432 obj.defines += [ 'LXVST_SUPPORT' ]
433 obj.uselib += ' X11 '
435 if bld.is_defined('WINDOWS_VST_SUPPORT') or bld.is_defined('LXVST_SUPPORT'):
436 obj.source += [ 'vst_plugin_ui.cc' ]
438 if bld.is_defined('PHONE_HOME'):
439 obj.defines += [ 'PHONE_HOME' ]
441 if bld.is_defined('HAVE_COREAUDIO'):
442 TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cc']
443 obj.source += [ 'cocoacarbon.mm' ]
444 obj.use += ' libappleutility '
446 if bld.is_defined('AUDIOUNIT_SUPPORT'):
447 obj.source += [ 'au_pluginui.mm' ]
451 wrapper_subst_dict = {
452 'INSTALL_PREFIX' : bld.env['PREFIX'],
453 'LIBDIR' : os.path.normpath(bld.env['LIBDIR']),
454 'LIBS' : 'build/libs',
456 'EXECUTABLE' : 'build/gtk2_ardour/ardour-3.0'
459 def set_subst_dict(obj, dict):
461 setattr(obj, i, dict[i])
463 obj = bld(features = 'subst', rule= 'chmod 0755 ${TGT}')
464 obj.source = 'ardev_common.sh.in'
465 obj.target = 'ardev_common_waf.sh'
466 obj.chmod = Utils.O755
467 obj.dict = wrapper_subst_dict
468 set_subst_dict(obj, wrapper_subst_dict)
470 obj = bld(features = 'subst')
471 obj.source = 'ardour.sh.in'
472 obj.target = 'ardour3'
473 obj.chmod = Utils.O755
474 obj.dict = wrapper_subst_dict
475 obj.install_path = bld.env['BINDIR']
476 set_subst_dict(obj, wrapper_subst_dict)
478 if bld.is_defined('WINDOWS_VST_SUPPORT'):
479 obj = bld(features = 'subst')
480 obj.source = '../vst/ardourvst.in'
481 obj.target = 'ardourvst3'
482 obj.chmod = Utils.O755
483 obj.dict = wrapper_subst_dict
484 obj.install_path = bld.env['BINDIR']
485 set_subst_dict(obj, wrapper_subst_dict)
489 dark_rc_subst_dict = {}
490 light_rc_subst_dict = {}
495 if bld.is_defined('GTKOSX'): # OS X fonts
509 else: # Linux/X11 fonts
510 basefont = '' # unspecified - use system defaults
524 # Set up font substitution dictionary
526 for style in ['', 'BOLD', 'ITALIC']:
527 for sizename,points in iter(font_sizes.items()):
529 key = "_".join (['FONT',style,sizename])
530 fontstyle = " ".join ([basefont,style.lower(),points])
532 key = "_".join (['FONT',sizename])
533 fontstyle = " ".join ([basefont,points])
535 dark_rc_subst_dict[key] = fontstyle
536 light_rc_subst_dict[key] = fontstyle
539 for sizename,points in iter(font_sizes.items()):
540 key = "_".join (['FONT_SIZE',sizename])
541 dark_rc_subst_dict[key] = points
542 light_rc_subst_dict[key] = points
545 dark_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
546 'gtk2_ardour/ardour3_ui_dark.rc.in', 'ARDOUR_DARK')
547 dark_rc_subst_dict['COLPREFIX'] = 'ARDOUR_DARK'
548 light_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
549 'gtk2_ardour/ardour3_ui_light.rc.in', 'ARDOUR_LIGHT')
550 light_rc_subst_dict['COLPREFIX'] = 'ARDOUR_LIGHT'
552 obj = bld(features = 'subst')
553 obj.source = [ 'ardour3_ui_dark.rc.in' ]
554 obj.target = 'ardour3_ui_dark.rc.pre'
555 obj.install_path = None
556 set_subst_dict(obj, dark_rc_subst_dict)
558 obj = bld(features = 'subst')
559 obj.source = [ 'ardour3_ui_light.rc.in' ]
560 obj.target = 'ardour3_ui_light.rc.pre'
561 obj.install_path = None
562 set_subst_dict(obj, light_rc_subst_dict)
564 obj = bld(features = 'subst')
565 obj.source = [ 'ardour3_styles.rc.in' ]
566 obj.target = 'ardour3_dark_styles.rc'
567 obj.install_path = None
568 set_subst_dict(obj, dark_rc_subst_dict)
570 obj = bld(features = 'subst')
571 obj.source = [ 'ardour3_styles.rc.in' ]
572 obj.target = 'ardour3_light_styles.rc'
573 obj.install_path = None
574 set_subst_dict(obj, light_rc_subst_dict)
576 obj = bld(features = 'subst')
577 obj.source = [ 'ardour3_fonts.rc.in' ]
578 obj.target = 'ardour3_dark_fonts.rc'
579 obj.install_path = None
580 set_subst_dict(obj, dark_rc_subst_dict)
582 obj = bld(features = 'subst')
583 obj.source = [ 'ardour3_fonts.rc.in' ]
584 obj.target = 'ardour3_light_fonts.rc'
585 obj.install_path = None
586 set_subst_dict(obj, light_rc_subst_dict)
588 obj = bld(rule = 'cp ${SRC} ${TGT}')
589 obj.source = [ 'ardour3_widget_list.rc' ]
590 obj.target = 'ardour3_widgets.rc'
591 obj.install_path = None
593 obj = bld (rule = include_processor)
594 obj.source = [ 'ardour3_ui_dark.rc.pre' ]
595 # find and add all ##include dependencies as sources
596 obj.source += _doPyp (bld.path.find_resource ('ardour3_ui_dark.rc.in').srcpath(), True)
597 obj.target = 'ardour3_ui_dark.rc'
598 obj.install_path = '${SYSCONFDIR}/ardour3'
600 obj = bld (rule = include_processor)
601 obj.source = [ 'ardour3_ui_light.rc.pre' ]
602 # find and add all ##include dependencies as sources
603 obj.source += _doPyp (bld.path.find_resource ('ardour3_ui_light.rc.in').srcpath(), True)
604 obj.target = 'ardour3_ui_light.rc'
605 obj.install_path = '${SYSCONFDIR}/ardour3'
609 if bld.is_defined('GTKOSX'):
610 menus_argv = [ '-E', '-P', '-DGTKOSX' ]
612 menus_argv = [ '-E', '-P' ]
613 obj = bld(features = 'command-output')
615 obj.command_is_external = True
617 obj.argv = menus_argv
618 obj.stdin = 'ardour.menus.in'
619 obj.stdout = 'ardour.menus'
620 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
625 # 'SAE-de-keypad', 'SAE-de-nokeypad', 'SAE-us-keypad',
626 # 'SAE-us-nokeypad', 'ergonomic-us'
628 for b in [ 'mnemonic-us' ] :
630 target = b + '.bindings',
631 source = b + '.bindings.in',
632 rule = '../tools/fmt-bindings --platform="%s" --winkey="%s" --accelmap <${SRC} >${TGT}' % (sys.platform, bld.env['WINDOWS_KEY'] )
634 obj.install_path = os.path.join(bld.env['SYSCONFDIR'], 'ardour3')
636 # not modified at present
637 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
638 'step_editing.bindings')
639 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
643 bld.install_files('${DATADIR}/ardour3/icons', bld.path.ant_glob('icons/*.png'))
644 bld.install_files('${DATADIR}/ardour3/pixmaps', bld.path.ant_glob('pixmaps/*.xpm'))
645 bld.install_files('${DATADIR}/ardour3', 'splash.png')
647 # Default UI configuration
648 bld.install_files('${SYSCONFDIR}/ardour3', 'ardour3_ui_default.conf')
649 # Generic widget style mappings
650 bld.install_files('${SYSCONFDIR}/ardour3', 'ardour3_widgets.rc')
652 # Default export stuff
653 bld.install_files('${SYSCONFDIR}/ardour3/export', bld.path.ant_glob('export/*.format'))
656 if bld.is_defined('ENABLE_NLS'):
657 mo_files = bld.path.ant_glob('po/*.mo')
659 lang = os.path.basename(mo.srcpath()).replace('.mo', '')
660 bld.install_as(os.path.join(bld.env['PREFIX'], 'share', 'locale',
661 lang, 'LC_MESSAGES', I18N_PACKAGE + '.mo'),
665 autowaf.build_i18n(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
669 autowaf.build_i18n_pot(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
673 autowaf.build_i18n_po(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
677 autowaf.build_i18n_mo(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,