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',
73 'edit_note_dialog.cc',
77 'editor_audio_import.cc',
78 'editor_audiotrack.cc',
80 'editor_canvas_events.cc',
81 'editor_component.cc',
84 'editor_route_groups.cc',
85 'editor_export_audio.cc',
86 'editor_group_tabs.cc',
88 'editor_locations.cc',
96 'editor_selection.cc',
97 'editor_snapshots.cc',
99 'editor_tempodisplay.cc',
103 'export_channel_selector.cc',
105 'export_file_notebook.cc',
106 'export_filename_selector.cc',
107 'export_format_dialog.cc',
108 'export_format_selector.cc',
109 'export_preset_selector.cc',
110 'export_timespan_selector.cc',
115 'generic_pluginui.cc',
117 'global_port_matrix.cc',
119 'gtk-custom-hruler.c',
120 'gtk-custom-ruler.c',
121 'gtk_pianokeyboard.c',
123 'insert_time_dialog.cc',
124 'interthread_progress_window.cc',
136 'midi_automation_line.cc',
137 'midi_channel_dialog.cc',
138 'midi_channel_selector.cc',
139 'midi_cut_buffer.cc',
140 'midi_export_dialog.cc',
141 'midi_list_editor.cc',
142 'midi_port_dialog.cc',
143 'midi_region_view.cc',
146 'midi_streamview.cc',
149 'midi_velocity_dialog.cc',
150 'missing_file_dialog.cc',
151 'missing_plugin_dialog.cc',
153 'mixer_group_tabs.cc',
156 'monitor_section.cc',
158 'mono_panner_editor.cc',
161 'new_plugin_preset_dialog.cc',
162 'normalize_dialog.cc',
168 'panner_interface.cc',
170 'piano_roll_header.cc',
171 'playlist_selector.cc',
173 'plugin_selector.cc',
178 'port_matrix_body.cc',
179 'port_matrix_column_labels.cc',
180 'port_matrix_component.cc',
181 'port_matrix_grid.cc',
182 'port_matrix_labels.cc',
183 'port_matrix_row_labels.cc',
185 'patch_change_dialog.cc',
186 'progress_reporter.cc',
189 'quantize_dialog.cc',
190 'rc_option_editor.cc',
192 'region_gain_line.cc',
193 'region_layering_order_editor.cc',
194 'region_selection.cc',
198 'route_group_dialog.cc',
199 'route_group_menu.cc',
200 'route_params_ui.cc',
201 'route_processor_selection.cc',
202 'route_time_axis.cc',
204 'search_path_option.cc',
207 'session_import_dialog.cc',
208 'session_metadata_dialog.cc',
209 'session_option_editor.cc',
211 'shuttle_control.cc',
220 'stereo_panner_editor.cc',
222 'strip_silence_dialog.cc',
223 'tape_region_view.cc',
228 'time_axis_view_item.cc',
232 'track_selection.cc',
233 'track_view_list.cc',
234 'transpose_dialog.cc',
239 'visibility_group.cc',
240 'volume_controller.cc',
246 autowaf.set_options(opt)
250 conf.load('compiler_cxx')
251 autowaf.build_version_files(
252 path_prefix + 'version.h',
253 path_prefix + 'version.cc',
254 'gtk2_ardour', MAJOR, MINOR, MICRO)
255 autowaf.configure(conf)
257 if re.search ("linux", sys.platform) != None:
258 autowaf.check_pkg(conf, 'alsa', uselib_store='ALSA')
260 # TODO: Insert a sanity check for on OS X to ensure CoreAudio is present
262 autowaf.check_pkg(conf, 'flac', uselib_store='FLAC',
263 atleast_version='1.2.1')
264 autowaf.check_pkg(conf, 'gthread-2.0', uselib_store='GTHREAD',
265 atleast_version='2.10.1')
266 autowaf.check_pkg(conf, 'gtk+-2.0', uselib_store='GTK',
267 atleast_version='2.18')
268 autowaf.check_pkg(conf, 'gtkmm-2.4', uselib_store='GTKMM',
269 atleast_version='2.18')
270 autowaf.check_pkg(conf, 'libgnomecanvas-2.0',
271 uselib_store='GNOMECANVAS', atleast_version='2.30')
272 autowaf.check_pkg(conf, 'libgnomecanvasmm-2.6',
273 uselib_store='GNOMECANVASMM', atleast_version='2.16')
274 autowaf.check_pkg(conf, 'ogg', uselib_store='OGG', atleast_version='1.1.2')
275 autowaf.check_pkg(conf, 'x11', uselib_store='X11', atleast_version='1.1', mandatory=False)
277 conf.write_config_header('gtk2ardour-config.h', remove=False)
280 autowaf.check_header(conf, 'cxx', 'boost/shared_ptr.hpp')
281 autowaf.check_header(conf, 'cxx', 'boost/weak_ptr.hpp')
283 # Add a waf `feature' to allow compilation of things using winegcc
284 from waflib.TaskGen import feature
286 def set_winegcc(self):
287 self.env.LINK_CXX = self.env.LINK_CC = 'wineg++'
288 self.env.CC = 'winegcc'
290 def _doPyp(infileName, deps = False):
293 re_spaces = re.compile("\s+")
295 if infileName == '-':
298 fd = open(infileName)
299 inLines = fd.readlines()
305 bits = re_spaces.split(line)
306 if bits[0] == '##include':
311 # assume included file comes from same place as source file
312 incName = os.path.join (os.path.dirname (infileName), incName);
313 outStr += _doPyp(incName)
324 def include_processor(task):
325 infileName = task.inputs[0].srcpath()
326 outfileName = os.path.join(out, task.outputs[0].bldpath())
327 fdOut = open (outfileName, "w")
328 fdOut.write (_doPyp(infileName))
332 def build_color_scheme(path, prefix):
336 if re.search ('^#@color', line):
337 line.strip() # remove newline
339 if len(color_scheme):
341 color_scheme += prefix
343 color_scheme += words[1]
345 color_scheme += words[2]
351 if bld.is_defined('WINDOWS_VST_SUPPORT'):
352 # If we require VST support we build a stub main() and the FST library
353 # here using winegcc, and link it to the GTK front-end library
354 obj = bld(features = 'cxx c cxxprogram wine')
357 ../libs/fst/fstinfofile.c
363 obj.use = [ 'libpbd',
371 obj.target = 'ardour-3.0-vst.exe.so'
372 obj.includes = [ '../libs/fst', '.' ]
373 obj.linkflags = ['-mwindows', '-Wl,--export-dynamic', '-lpthread']
374 obj.defines = ['_POSIX_SOURCE', 'USE_WS_PREFIX']
375 obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
376 # end of the wine executable
378 # now the shared library containing the GTK GUI for ardour
379 obj = bld (features = 'cxx c cxxshlib')
380 obj.source = gtk2_ardour_sources
381 obj.includes = [ '../libs/fst', '.' ]
382 obj.name = 'libgtk2_ardour'
383 obj.target = 'gtk2_ardour'
385 # just the normal executable version of the GTK GUI
386 obj = bld(features = 'cxx c cxxprogram')
387 obj.source = gtk2_ardour_sources
388 obj.target = 'ardour-3.0'
391 # continue with setup of obj, which could be a shared library
394 obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
396 obj.uselib = 'UUID FLAC GLIBMM GTHREAD GTK OGG ALSA CURL DL'
397 obj.uselib += ' GTKMM GNOMECANVASMM GNOMECANVAS '
398 obj.uselib += ' AUDIOUNITS OSX GTKOSX '
399 obj.use = [ 'libpbd',
406 if sys.platform == 'darwin':
407 obj.use += ' libappleutility'
409 'PACKAGE="' + I18N_PACKAGE + '"',
410 'VERSIONSTRING="' + bld.env['VERSION'] + '"',
411 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
412 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
413 'LOCALEDIR="' + os.path.join(os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
414 'PROGRAM_NAME="' + bld.env['PROGRAM_NAME'] + '"'
416 obj.includes += ['../libs']
418 if bld.is_defined('HAVE_SUIL'):
419 obj.source += [ 'lv2_plugin_ui.cc' ]
420 obj.use += [ 'SUIL' ]
422 if bld.is_defined('FREESOUND'):
423 obj.source += [ 'sfdb_freesound_mootcher.cc' ]
424 obj.defines += [ 'FREESOUND' ]
426 if bld.is_defined('NEED_INTL'):
427 obj.linkflags = ' -lintl'
429 if bld.is_defined('WINDOWS_VST_SUPPORT'):
430 obj.source += [ 'windows_vst_plugin_ui.cc' ]
431 obj.defines += [ 'WINDOWS_VST_SUPPORT' ]
434 if bld.is_defined('LXVST_SUPPORT'):
435 obj.source += [ 'linux_vst_gui_support.cc', 'lxvst_plugin_ui.cc' ]
436 obj.defines += [ 'LXVST_SUPPORT' ]
439 if bld.is_defined('WINDOWS_VST_SUPPORT') or bld.is_defined('LXVST_SUPPORT'):
440 obj.source += [ 'vst_plugin_ui.cc' ]
442 if bld.is_defined('PHONE_HOME'):
443 obj.defines += [ 'PHONE_HOME' ]
445 if bld.is_defined('HAVE_COREAUDIO'):
446 TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cc']
447 obj.source += [ 'cocoacarbon.mm' ]
448 obj.use += ' libappleutility '
450 if bld.is_defined('AUDIOUNIT_SUPPORT'):
451 obj.source += [ 'au_pluginui.mm' ]
455 wrapper_subst_dict = {
456 'INSTALL_PREFIX' : bld.env['PREFIX'],
457 'LIBDIR' : os.path.normpath(bld.env['LIBDIR']),
458 'DATADIR' : os.path.normpath(bld.env['DATADIR']),
459 'SYSCONFDIR' : os.path.normpath(bld.env['SYSCONFDIR']),
460 'LIBS' : 'build/libs',
462 'EXECUTABLE' : 'build/gtk2_ardour/ardour-3.0'
465 def set_subst_dict(obj, dict):
467 setattr(obj, i, dict[i])
469 obj = bld(features = 'subst', rule= 'chmod 0755 ${TGT}')
470 obj.source = 'ardev_common.sh.in'
471 obj.target = 'ardev_common_waf.sh'
472 obj.chmod = Utils.O755
473 obj.dict = wrapper_subst_dict
474 set_subst_dict(obj, wrapper_subst_dict)
476 obj = bld(features = 'subst')
477 obj.source = 'ardour.sh.in'
478 obj.target = 'ardour3'
479 obj.chmod = Utils.O755
480 obj.dict = wrapper_subst_dict
481 obj.install_path = bld.env['BINDIR']
482 set_subst_dict(obj, wrapper_subst_dict)
484 if bld.is_defined('WINDOWS_VST_SUPPORT'):
485 obj = bld(features = 'subst')
486 obj.source = '../vst/ardourvst.in'
487 obj.target = 'ardourvst3'
488 obj.chmod = Utils.O755
489 obj.dict = wrapper_subst_dict
490 obj.install_path = bld.env['BINDIR']
491 set_subst_dict(obj, wrapper_subst_dict)
495 dark_rc_subst_dict = {}
496 light_rc_subst_dict = {}
501 if bld.is_defined('GTKOSX'): # OS X fonts
515 'BOLD_MONOSPACE' : 'monospace'
517 else: # Linux/X11 fonts
518 basefont = '' # unspecified - use system defaults
531 'BOLD_MONOSPACE' : 'bold monospace'
534 # Set up font substitution dictionary
536 for style in ['', 'BOLD', 'ITALIC']:
537 for sizename,points in iter(font_sizes.items()):
539 key = "_".join (['FONT',style,sizename])
540 fontstyle = " ".join ([basefont,style.lower(),points])
542 key = "_".join (['FONT',sizename])
543 fontstyle = " ".join ([basefont,points])
545 dark_rc_subst_dict[key] = fontstyle
546 light_rc_subst_dict[key] = fontstyle
549 for sizename,points in iter(font_sizes.items()):
550 key = "_".join (['FONT_SIZE',sizename])
551 dark_rc_subst_dict[key] = points
552 light_rc_subst_dict[key] = points
554 # various font names, eg @BOLD_MONOSPACE@
555 for font_sym,text in iter(font_names.items()):
557 dark_rc_subst_dict[key] = text
558 light_rc_subst_dict[key] = text
561 dark_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
562 'gtk2_ardour/ardour3_ui_dark.rc.in', 'ARDOUR_DARK')
563 dark_rc_subst_dict['COLPREFIX'] = 'ARDOUR_DARK'
564 light_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
565 'gtk2_ardour/ardour3_ui_light.rc.in', 'ARDOUR_LIGHT')
566 light_rc_subst_dict['COLPREFIX'] = 'ARDOUR_LIGHT'
568 obj = bld(features = 'subst')
569 obj.source = [ 'ardour3_ui_dark.rc.in' ]
570 obj.target = 'ardour3_ui_dark.rc.pre'
571 obj.install_path = None
572 set_subst_dict(obj, dark_rc_subst_dict)
574 obj = bld(features = 'subst')
575 obj.source = [ 'ardour3_ui_light.rc.in' ]
576 obj.target = 'ardour3_ui_light.rc.pre'
577 obj.install_path = None
578 set_subst_dict(obj, light_rc_subst_dict)
580 obj = bld(features = 'subst')
581 obj.source = [ 'ardour3_styles.rc.in' ]
582 obj.target = 'ardour3_dark_styles.rc'
583 obj.install_path = None
584 set_subst_dict(obj, dark_rc_subst_dict)
586 obj = bld(features = 'subst')
587 obj.source = [ 'ardour3_styles.rc.in' ]
588 obj.target = 'ardour3_light_styles.rc'
589 obj.install_path = None
590 set_subst_dict(obj, light_rc_subst_dict)
592 obj = bld(features = 'subst')
593 obj.source = [ 'ardour3_fonts.rc.in' ]
594 obj.target = 'ardour3_dark_fonts.rc'
595 obj.install_path = None
596 set_subst_dict(obj, dark_rc_subst_dict)
598 obj = bld(features = 'subst')
599 obj.source = [ 'ardour3_fonts.rc.in' ]
600 obj.target = 'ardour3_light_fonts.rc'
601 obj.install_path = None
602 set_subst_dict(obj, light_rc_subst_dict)
604 obj = bld(rule = 'cp ${SRC} ${TGT}')
605 obj.source = [ 'ardour3_widget_list.rc' ]
606 obj.target = 'ardour3_widgets.rc'
607 obj.install_path = None
609 obj = bld (rule = include_processor)
610 obj.source = [ 'ardour3_ui_dark.rc.pre' ]
611 # find and add all ##include dependencies as sources
612 obj.source += _doPyp (bld.path.find_resource ('ardour3_ui_dark.rc.in').srcpath(), True)
613 obj.target = 'ardour3_ui_dark.rc'
614 obj.install_path = '${SYSCONFDIR}/ardour3'
616 obj = bld (rule = include_processor)
617 obj.source = [ 'ardour3_ui_light.rc.pre' ]
618 # find and add all ##include dependencies as sources
619 obj.source += _doPyp (bld.path.find_resource ('ardour3_ui_light.rc.in').srcpath(), True)
620 obj.target = 'ardour3_ui_light.rc'
621 obj.install_path = '${SYSCONFDIR}/ardour3'
625 if bld.is_defined('GTKOSX'):
626 menus_argv = [ '-E', '-P', '-DGTKOSX' ]
628 menus_argv = [ '-E', '-P' ]
629 obj = bld(features = 'command-output')
631 obj.command_is_external = True
633 obj.argv = menus_argv
634 obj.stdin = 'ardour.menus.in'
635 obj.stdout = 'ardour.menus'
636 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
641 # 'SAE-de-keypad', 'SAE-de-nokeypad', 'SAE-us-keypad',
642 # 'SAE-us-nokeypad', 'ergonomic-us'
644 for b in [ 'mnemonic-us' ] :
646 target = b + '.bindings',
647 source = b + '.bindings.in',
648 rule = '../tools/fmt-bindings --platform="%s" --winkey="%s" --accelmap <${SRC} >${TGT}' % (sys.platform, bld.env['WINDOWS_KEY'] )
650 obj.install_path = os.path.join(bld.env['SYSCONFDIR'], 'ardour3')
652 # not modified at present
653 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
654 'step_editing.bindings')
655 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
659 bld.install_files('${DATADIR}/ardour3/icons', bld.path.ant_glob('icons/*.png'))
660 bld.install_files('${DATADIR}/ardour3/pixmaps', bld.path.ant_glob('pixmaps/*.xpm'))
661 bld.install_files('${DATADIR}/ardour3', 'splash.png')
663 # Default UI configuration
664 bld.install_files('${SYSCONFDIR}/ardour3', 'ardour3_ui_default.conf')
666 # Default export stuff
667 bld.install_files('${SYSCONFDIR}/ardour3/export', bld.path.ant_glob('export/*.format'))
670 if bld.is_defined('ENABLE_NLS'):
671 mo_files = bld.path.ant_glob('po/*.mo')
673 lang = os.path.basename(mo.srcpath()).replace('.mo', '')
674 bld.install_as(os.path.join(bld.env['PREFIX'], 'share', 'locale',
675 lang, 'LC_MESSAGES', I18N_PACKAGE + '.mo'),
679 autowaf.build_i18n(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
683 autowaf.build_i18n_pot(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
687 autowaf.build_i18n_po(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
691 autowaf.build_i18n_mo(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,