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_midi_cc_track_dialog.cc',
32 'add_route_dialog.cc',
33 'ambiguous_file_dialog.cc',
39 'ardour_ui_dependents.cc',
40 'ardour_ui_dialogs.cc',
43 'ardour_ui_options.cc',
46 'audio_region_editor.cc',
47 'audio_region_view.cc',
48 'audio_streamview.cc',
50 'automation_controller.cc',
52 'automation_region_view.cc',
53 'automation_streamview.cc',
54 'automation_time_axis.cc',
60 'canvas-note-event.cc',
62 'canvas_patch_change.cc',
63 'canvas-simpleline.c',
64 'canvas-simplerect.c',
70 'control_point_dialog.cc',
76 'edit_note_dialog.cc',
80 'editor_audio_import.cc',
81 'editor_audiotrack.cc',
83 'editor_canvas_events.cc',
84 'editor_component.cc',
87 'editor_route_groups.cc',
88 'editor_export_audio.cc',
89 'editor_group_tabs.cc',
91 'editor_locations.cc',
100 'editor_selection.cc',
101 'editor_snapshots.cc',
103 'editor_tempodisplay.cc',
107 'export_channel_selector.cc',
109 'export_file_notebook.cc',
110 'export_filename_selector.cc',
111 'export_format_dialog.cc',
112 'export_format_selector.cc',
113 'export_preset_selector.cc',
114 'export_timespan_selector.cc',
119 'generic_pluginui.cc',
121 'global_port_matrix.cc',
123 'gtk-custom-hruler.c',
124 'gtk-custom-ruler.c',
125 'gtk_pianokeyboard.c',
127 'insert_time_dialog.cc',
128 'interthread_progress_window.cc',
139 'midi_automation_line.cc',
140 'midi_channel_dialog.cc',
141 'midi_channel_selector.cc',
142 'midi_cut_buffer.cc',
143 'midi_list_editor.cc',
144 'midi_port_dialog.cc',
145 'midi_region_view.cc',
148 'midi_streamview.cc',
151 'missing_file_dialog.cc',
152 'missing_plugin_dialog.cc',
154 'mixer_group_tabs.cc',
157 'monitor_section.cc',
161 'new_plugin_preset_dialog.cc',
162 'normalize_dialog.cc',
167 'panner_interface.cc',
169 'piano_roll_header.cc',
170 'playlist_selector.cc',
172 'plugin_selector.cc',
177 'port_matrix_body.cc',
178 'port_matrix_column_labels.cc',
179 'port_matrix_component.cc',
180 'port_matrix_grid.cc',
181 'port_matrix_labels.cc',
182 'port_matrix_row_labels.cc',
184 'patch_change_dialog.cc',
185 'progress_reporter.cc',
188 'quantize_dialog.cc',
189 'rc_option_editor.cc',
191 'region_gain_line.cc',
192 'region_layering_order_editor.cc',
193 'region_selection.cc',
197 'route_group_dialog.cc',
198 'route_group_menu.cc',
199 'route_params_ui.cc',
200 'route_processor_selection.cc',
201 'route_time_axis.cc',
203 'search_path_option.cc',
206 'session_import_dialog.cc',
207 'session_metadata_dialog.cc',
208 'session_option_editor.cc',
210 'shuttle_control.cc',
220 'strip_silence_dialog.cc',
221 'tape_region_view.cc',
226 'time_axis_view_item.cc',
230 'track_selection.cc',
231 'track_view_list.cc',
232 'transpose_dialog.cc',
237 'visibility_group.cc',
238 'volume_controller.cc',
244 autowaf.set_options(opt)
248 conf.load('compiler_cxx')
249 autowaf.build_version_files(
250 path_prefix + 'version.h',
251 path_prefix + 'version.cc',
252 'gtk2_ardour', MAJOR, MINOR, MICRO)
253 autowaf.configure(conf)
255 if re.search ("linux", sys.platform) != None:
256 autowaf.check_pkg(conf, 'alsa', uselib_store='ALSA')
258 # TODO: Insert a sanity check for on OS X to ensure CoreAudio is present
260 autowaf.check_pkg(conf, 'flac', uselib_store='FLAC',
261 atleast_version='1.2.1')
262 autowaf.check_pkg(conf, 'gthread-2.0', uselib_store='GTHREAD',
263 atleast_version='2.10.1')
264 autowaf.check_pkg(conf, 'gtk+-2.0', uselib_store='GTK',
265 atleast_version='2.18')
266 autowaf.check_pkg(conf, 'gtkmm-2.4', uselib_store='GTKMM',
267 atleast_version='2.18')
268 autowaf.check_pkg(conf, 'libgnomecanvas-2.0',
269 uselib_store='GNOMECANVAS', atleast_version='2.30')
270 autowaf.check_pkg(conf, 'libgnomecanvasmm-2.6',
271 uselib_store='GNOMECANVASMM', atleast_version='2.16')
272 autowaf.check_pkg(conf, 'ogg', uselib_store='OGG', atleast_version='1.1.2')
273 autowaf.check_pkg(conf, 'x11', uselib_store='X11', atleast_version='1.3', mandatory=False)
275 conf.write_config_header('gtk2ardour-config.h', remove=False)
278 autowaf.check_header(conf, 'cxx', 'boost/shared_ptr.hpp')
279 autowaf.check_header(conf, 'cxx', 'boost/weak_ptr.hpp')
281 # Add a waf `feature' to allow compilation of things using winegcc
282 from waflib.TaskGen import feature
284 def set_winegcc(self):
285 self.env.LINK_CXX = self.env.LINK_CC = 'wineg++'
286 self.env.CC = 'winegcc'
288 def _doPyp(infileName, deps = False):
291 re_spaces = re.compile("\s+")
293 if infileName == '-':
296 fd = open(infileName)
297 inLines = fd.readlines()
303 bits = re_spaces.split(line)
304 if bits[0] == '##include':
309 # assume included file comes from same place as source file
310 incName = os.path.join (os.path.dirname (infileName), incName);
311 outStr += _doPyp(incName)
322 def include_processor(task):
323 infileName = task.inputs[0].srcpath()
324 outfileName = os.path.join(out, task.outputs[0].bldpath())
325 fdOut = open (outfileName, "w")
326 fdOut.write (_doPyp(infileName))
330 def build_color_scheme(path, prefix):
334 if re.search ('^#@color', line):
335 line.strip() # remove newline
337 if len(color_scheme):
339 color_scheme += prefix
341 color_scheme += words[1]
343 color_scheme += words[2]
349 if bld.is_defined('WINDOWS_VST_SUPPORT'):
350 # If we require VST support we build a stub main() and the FST library
351 # here using winegcc, and link it to the GTK front-end library
352 obj = bld(features = 'cxx c cxxprogram wine')
355 ../libs/fst/fstinfofile.c
361 obj.use = [ 'libpbd',
369 obj.target = 'ardour-3.0-vst.exe.so'
370 obj.includes = [ '../libs/fst', '.' ]
371 obj.linkflags = ['-mwindows', '-Wl,--export-dynamic', '-lpthread']
372 obj.defines = ['_POSIX_SOURCE', 'USE_WS_PREFIX']
373 obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
374 # end of the wine executable
376 # now the shared library containing the GTK GUI for ardour
377 obj = bld (features = 'cxx c cxxshlib')
378 obj.source = gtk2_ardour_sources
379 obj.includes = [ '../libs/fst', '.' ]
380 obj.name = 'libgtk2_ardour'
381 obj.target = 'gtk2_ardour'
383 # just the normal executable version of the GTK GUI
384 obj = bld(features = 'cxx c cxxprogram')
385 obj.source = gtk2_ardour_sources
386 obj.target = 'ardour-3.0'
389 # continue with setup of obj, which could be a shared library
392 obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
394 obj.uselib = 'UUID FLAC GLIBMM GTHREAD GTK OGG ALSA CURL DL'
395 obj.uselib += ' GTKMM GNOMECANVASMM GNOMECANVAS '
396 obj.uselib += ' AUDIOUNITS OSX GTKOSX '
397 obj.use = [ 'libpbd',
404 if sys.platform == 'darwin':
405 obj.use += ' libappleutility'
407 'PACKAGE="' + I18N_PACKAGE + '"',
408 'VERSIONSTRING="' + bld.env['VERSION'] + '"',
409 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
410 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
411 'MODULE_DIR="' + os.path.normpath(bld.env['LIBDIR']) + '"',
412 'LOCALEDIR="' + os.path.join(os.path.normpath(bld.env['DATADIR']),
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.uselib += ' SUIL '
422 if bld.is_defined('FREESOUND'):
423 obj.source += [ 'sfdb_freesound_mootcher.cc' ]
424 obj.defines += [ 'FREESOUND' ]
426 if bld.is_defined('WINDOWS_VST_SUPPORT'):
427 obj.source += [ 'windows_vst_plugin_ui.cc' ]
428 obj.defines += [ 'WINDOWS_VST_SUPPORT' ]
429 obj.uselib += ' X11 '
431 if bld.is_defined('LXVST_SUPPORT'):
432 obj.source += [ 'linux_vst_gui_support.cc', 'lxvst_plugin_ui.cc' ]
433 obj.defines += [ 'LXVST_SUPPORT' ]
434 obj.uselib += ' X11 '
436 if bld.is_defined('WINDOWS_VST_SUPPORT') or bld.is_defined('LXVST_SUPPORT'):
437 obj.source += [ 'vst_plugin_ui.cc' ]
439 if bld.is_defined('PHONE_HOME'):
440 obj.defines += [ 'PHONE_HOME' ]
442 if bld.is_defined('HAVE_COREAUDIO'):
443 TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cc']
444 obj.source += [ 'cocoacarbon.mm' ]
445 obj.use += ' libappleutility '
447 if bld.is_defined('AUDIOUNIT_SUPPORT'):
448 obj.source += [ 'au_pluginui.mm' ]
452 wrapper_subst_dict = {
453 'INSTALL_PREFIX' : bld.env['PREFIX'],
454 'LIBDIR' : os.path.normpath(bld.env['LIBDIR']),
455 'LIBS' : 'build/libs',
457 'EXECUTABLE' : 'build/gtk2_ardour/ardour-3.0'
460 def set_subst_dict(obj, dict):
462 setattr(obj, i, dict[i])
464 obj = bld(features = 'subst', rule= 'chmod 0755 ${TGT}')
465 obj.source = 'ardev_common.sh.in'
466 obj.target = 'ardev_common_waf.sh'
467 obj.chmod = Utils.O755
468 obj.dict = wrapper_subst_dict
469 set_subst_dict(obj, wrapper_subst_dict)
471 obj = bld(features = 'subst')
472 obj.source = 'ardour.sh.in'
473 obj.target = 'ardour3'
474 obj.chmod = Utils.O755
475 obj.dict = wrapper_subst_dict
476 obj.install_path = bld.env['BINDIR']
477 set_subst_dict(obj, wrapper_subst_dict)
479 if bld.is_defined('WINDOWS_VST_SUPPORT'):
480 obj = bld(features = 'subst')
481 obj.source = '../vst/ardourvst.in'
482 obj.target = 'ardourvst3'
483 obj.chmod = Utils.O755
484 obj.dict = wrapper_subst_dict
485 obj.install_path = bld.env['BINDIR']
486 set_subst_dict(obj, wrapper_subst_dict)
490 dark_rc_subst_dict = {}
491 light_rc_subst_dict = {}
496 if bld.is_defined('GTKOSX'): # OS X fonts
510 else: # Linux/X11 fonts
511 basefont = '' # unspecified - use system defaults
525 # Set up font substitution dictionary
527 for style in ['', 'BOLD', 'ITALIC']:
528 for sizename,points in iter(font_sizes.items()):
530 key = "_".join (['FONT',style,sizename])
531 fontstyle = " ".join ([basefont,style.lower(),points])
533 key = "_".join (['FONT',sizename])
534 fontstyle = " ".join ([basefont,points])
536 dark_rc_subst_dict[key] = fontstyle
537 light_rc_subst_dict[key] = fontstyle
540 for sizename,points in iter(font_sizes.items()):
541 key = "_".join (['FONT_SIZE',sizename])
542 dark_rc_subst_dict[key] = points
543 light_rc_subst_dict[key] = points
546 dark_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
547 'gtk2_ardour/ardour3_ui_dark.rc.in', 'ARDOUR_DARK')
548 dark_rc_subst_dict['COLPREFIX'] = 'ARDOUR_DARK'
549 light_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
550 'gtk2_ardour/ardour3_ui_light.rc.in', 'ARDOUR_LIGHT')
551 light_rc_subst_dict['COLPREFIX'] = 'ARDOUR_LIGHT'
553 obj = bld(features = 'subst')
554 obj.source = [ 'ardour3_ui_dark.rc.in' ]
555 obj.target = 'ardour3_ui_dark.rc.pre'
556 obj.install_path = None
557 set_subst_dict(obj, dark_rc_subst_dict)
559 obj = bld(features = 'subst')
560 obj.source = [ 'ardour3_ui_light.rc.in' ]
561 obj.target = 'ardour3_ui_light.rc.pre'
562 obj.install_path = None
563 set_subst_dict(obj, light_rc_subst_dict)
565 obj = bld(features = 'subst')
566 obj.source = [ 'ardour3_styles.rc.in' ]
567 obj.target = 'ardour3_dark_styles.rc'
568 obj.install_path = None
569 set_subst_dict(obj, dark_rc_subst_dict)
571 obj = bld(features = 'subst')
572 obj.source = [ 'ardour3_styles.rc.in' ]
573 obj.target = 'ardour3_light_styles.rc'
574 obj.install_path = None
575 set_subst_dict(obj, light_rc_subst_dict)
577 obj = bld(features = 'subst')
578 obj.source = [ 'ardour3_fonts.rc.in' ]
579 obj.target = 'ardour3_dark_fonts.rc'
580 obj.install_path = None
581 set_subst_dict(obj, dark_rc_subst_dict)
583 obj = bld(features = 'subst')
584 obj.source = [ 'ardour3_fonts.rc.in' ]
585 obj.target = 'ardour3_light_fonts.rc'
586 obj.install_path = None
587 set_subst_dict(obj, light_rc_subst_dict)
589 obj = bld(rule = 'cp ${SRC} ${TGT}')
590 obj.source = [ 'ardour3_widget_list.rc' ]
591 obj.target = 'ardour3_widgets.rc'
592 obj.install_path = None
594 obj = bld (rule = include_processor)
595 obj.source = [ 'ardour3_ui_dark.rc.pre' ]
596 # find and add all ##include dependencies as sources
597 obj.source += _doPyp (bld.path.find_resource ('ardour3_ui_dark.rc.in').srcpath(), True)
598 obj.target = 'ardour3_ui_dark.rc'
599 obj.install_path = '${SYSCONFDIR}/ardour3'
601 obj = bld (rule = include_processor)
602 obj.source = [ 'ardour3_ui_light.rc.pre' ]
603 # find and add all ##include dependencies as sources
604 obj.source += _doPyp (bld.path.find_resource ('ardour3_ui_light.rc.in').srcpath(), True)
605 obj.target = 'ardour3_ui_light.rc'
606 obj.install_path = '${SYSCONFDIR}/ardour3'
610 if bld.is_defined('GTKOSX'):
611 menus_argv = [ '-E', '-P', '-DGTKOSX' ]
613 menus_argv = [ '-E', '-P' ]
614 obj = bld(features = 'command-output')
616 obj.command_is_external = True
618 obj.argv = menus_argv
619 obj.stdin = 'ardour.menus.in'
620 obj.stdout = 'ardour.menus'
621 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
626 # 'SAE-de-keypad', 'SAE-de-nokeypad', 'SAE-us-keypad',
627 # 'SAE-us-nokeypad', 'ergonomic-us'
629 for b in [ 'mnemonic-us' ] :
631 target = b + '.bindings',
632 source = b + '.bindings.in',
633 rule = '../tools/fmt-bindings --platform="%s" --winkey="%s" --accelmap <${SRC} >${TGT}' % (sys.platform, bld.env['WINDOWS_KEY'] )
635 obj.install_path = os.path.join(bld.env['SYSCONFDIR'], 'ardour3')
637 # not modified at present
638 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
639 'step_editing.bindings')
640 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
644 bld.install_files('${DATADIR}/ardour3/icons', bld.path.ant_glob('icons/*.png'))
645 bld.install_files('${DATADIR}/ardour3/pixmaps', bld.path.ant_glob('pixmaps/*.xpm'))
646 bld.install_files('${DATADIR}/ardour3', 'splash.png')
648 # Default UI configuration
649 bld.install_files('${SYSCONFDIR}/ardour3', 'ardour3_ui_default.conf')
650 # Generic widget style mappings
651 bld.install_files('${SYSCONFDIR}/ardour3', 'ardour3_widgets.rc')
653 # Default export stuff
654 bld.install_files('${SYSCONFDIR}/ardour3/export', bld.path.ant_glob('export/*.format'))
657 if bld.is_defined('ENABLE_NLS'):
658 mo_files = bld.path.ant_glob('po/*.mo')
660 lang = os.path.basename(mo.srcpath()).replace('.mo', '')
661 bld.install_as(os.path.join(bld.env['PREFIX'], 'share', 'locale',
662 lang, 'LC_MESSAGES', I18N_PACKAGE + '.mo'),
666 autowaf.build_i18n(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
670 autowaf.build_i18n_pot(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
674 autowaf.build_i18n_po(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
678 autowaf.build_i18n_mo(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,