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',
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',
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',
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',
167 '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',
201 'search_path_option.cc',
204 'session_import_dialog.cc',
205 'session_metadata_dialog.cc',
206 'session_option_editor.cc',
208 'shuttle_control.cc',
218 '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',
242 autowaf.set_options(opt)
246 conf.load('compiler_cxx')
247 autowaf.build_version_files(
248 path_prefix + 'version.h',
249 path_prefix + 'version.cc',
250 'gtk2_ardour', MAJOR, MINOR, MICRO)
251 autowaf.configure(conf)
253 if re.search ("linux", sys.platform) != None:
254 autowaf.check_pkg(conf, 'alsa', uselib_store='ALSA')
256 # TODO: Insert a sanity check for on OS X to ensure CoreAudio is present
258 autowaf.check_pkg(conf, 'flac', uselib_store='FLAC',
259 atleast_version='1.2.1')
260 autowaf.check_pkg(conf, 'gthread-2.0', uselib_store='GTHREAD',
261 atleast_version='2.10.1')
262 autowaf.check_pkg(conf, 'gtk+-2.0', uselib_store='GTK',
263 atleast_version='2.18')
264 autowaf.check_pkg(conf, 'gtkmm-2.4', uselib_store='GTKMM',
265 atleast_version='2.18')
266 autowaf.check_pkg(conf, 'libgnomecanvas-2.0',
267 uselib_store='GNOMECANVAS', atleast_version='2.30')
268 autowaf.check_pkg(conf, 'libgnomecanvasmm-2.6',
269 uselib_store='GNOMECANVASMM', atleast_version='2.16')
270 autowaf.check_pkg(conf, 'ogg', uselib_store='OGG', atleast_version='1.1.2')
271 autowaf.check_pkg(conf, 'x11', uselib_store='X11', atleast_version='1.3', mandatory=False)
273 conf.write_config_header('gtk2ardour-config.h', remove=False)
276 autowaf.check_header(conf, 'cxx', 'boost/shared_ptr.hpp')
277 autowaf.check_header(conf, 'cxx', 'boost/weak_ptr.hpp')
279 # Add a waf `feature' to allow compilation of things using winegcc
280 from waflib.TaskGen import feature
282 def set_winegcc(self):
283 self.env.LINK_CXX = self.env.LINK_CC = 'wineg++'
284 self.env.CC = 'winegcc'
286 def _doPyp(infileName, deps = False):
289 re_spaces = re.compile("\s+")
291 if infileName == '-':
294 fd = open(infileName)
295 inLines = fd.readlines()
301 bits = re_spaces.split(line)
302 if bits[0] == '##include':
307 # assume included file comes from same place as source file
308 incName = os.path.join (os.path.dirname (infileName), incName);
309 outStr += _doPyp(incName)
320 def include_processor(task):
321 infileName = task.inputs[0].srcpath()
322 outfileName = os.path.join(out, task.outputs[0].bldpath())
323 fdOut = open (outfileName, "w")
324 fdOut.write (_doPyp(infileName))
328 def build_color_scheme(path, prefix):
332 if re.search ('^#@color', line):
333 line.strip() # remove newline
335 if len(color_scheme):
337 color_scheme += prefix
339 color_scheme += words[1]
341 color_scheme += words[2]
346 # GTK front-end; if we're using VST we build this as a shared library,
347 # otherwise it's a normal executabale
348 if bld.is_defined('WINDOWS_VST_SUPPORT'):
349 obj = bld(features = 'cxx c cxxshlib')
351 obj = bld(features = 'cxx c cxxprogram')
354 obj.source = gtk2_ardour_sources
355 obj.name = 'gtk2_ardour'
357 if bld.is_defined('WINDOWS_VST_SUPPORT'):
358 obj.target = 'gtk2_ardour'
359 obj.includes += ['../libs/fst']
361 obj.target = 'ardour-3.0'
362 obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
363 obj.uselib = 'UUID FLAC GLIBMM GTHREAD GTK OGG ALSA CURL DL'
364 obj.uselib += ' GTKMM GNOMECANVASMM GNOMECANVAS '
365 obj.uselib += ' AUDIOUNITS OSX GTKOSX '
366 obj.use = [ 'libpbd',
373 if sys.platform == 'darwin':
374 obj.use += ' libappleutility'
376 'PACKAGE="' + I18N_PACKAGE + '"',
377 'VERSIONSTRING="' + bld.env['VERSION'] + '"',
378 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
379 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
380 'MODULE_DIR="' + os.path.normpath(bld.env['LIBDIR']) + '"',
381 'LOCALEDIR="' + os.path.join(os.path.normpath(bld.env['DATADIR']),
383 'PROGRAM_NAME="' + bld.env['PROGRAM_NAME'] + '"'
385 obj.includes += ['../libs']
387 if bld.is_defined('HAVE_SUIL'):
388 obj.source += [ 'lv2_plugin_ui.cc' ]
389 obj.uselib += ' SUIL '
391 if bld.is_defined('FREESOUND'):
392 obj.source += [ 'sfdb_freesound_mootcher.cc' ]
393 obj.defines += [ 'FREESOUND' ]
395 if bld.is_defined('WINDOWS_VST_SUPPORT'):
396 obj.source += [ 'windows_vst_plugin_ui.cc' ]
397 obj.defines += [ 'WINDOWS_VST_SUPPORT' ]
398 obj.uselib += ' X11 '
400 if bld.is_defined('LXVST_SUPPORT'):
401 obj.source += [ 'linux_vst_gui_support.cc', 'lxvst_plugin_ui.cc' ]
402 obj.defines += [ 'LXVST_SUPPORT' ]
403 obj.uselib += ' X11 '
405 if bld.is_defined('WINDOWS_VST_SUPPORT') or bld.is_defined('LXVST_SUPPORT'):
406 obj.source += [ 'vst_plugin_ui.cc' ]
408 if bld.is_defined('PHONE_HOME'):
409 obj.defines += [ 'PHONE_HOME' ]
411 if bld.is_defined('HAVE_COREAUDIO'):
412 TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cc']
413 obj.source += [ 'cocoacarbon.mm' ]
414 obj.use += ' libappleutility '
416 if bld.is_defined('AUDIOUNIT_SUPPORT'):
417 obj.source += [ 'au_pluginui.mm' ]
419 if bld.is_defined('WINDOWS_VST_SUPPORT'):
420 # If we require VST support we build a stub main() and the FST library
421 # here using winegcc, and link it to the GTK front-end library
422 obj = bld(features = 'cxx c cxxprogram wine')
425 ../libs/fst/fstinfofile.c
430 obj.includes = '../libs/fst'
431 obj.target = 'ardour-3.0-vst'
432 obj.linkflags = ['-mwindows', '-Wl,--export-dynamic', '-lpthread']
433 obj.defines = ['_POSIX_SOURCE', 'USE_WS_PREFIX']
435 obj.use = ['libpbd','libmidipp','libtaglib','libardour',
436 'libardour_cp','libgtkmm2ext','libtaglib',
441 wrapper_subst_dict = {
442 'INSTALL_PREFIX' : bld.env['PREFIX'],
443 'LIBDIR' : os.path.normpath(bld.env['LIBDIR']),
444 'LIBS' : 'build/libs',
446 'EXECUTABLE' : 'build/gtk2_ardour/ardour-3.0'
449 def set_subst_dict(obj, dict):
451 setattr(obj, i, dict[i])
453 obj = bld(features = 'subst', rule= 'chmod 0755 ${TGT}')
454 obj.source = 'ardev_common.sh.in'
455 obj.target = 'ardev_common_waf.sh'
456 obj.chmod = Utils.O755
457 obj.dict = wrapper_subst_dict
458 set_subst_dict(obj, wrapper_subst_dict)
460 obj = bld(features = 'subst')
461 obj.source = 'ardour.sh.in'
462 obj.target = 'ardour3'
463 obj.chmod = Utils.O755
464 obj.dict = wrapper_subst_dict
465 obj.install_path = bld.env['BINDIR']
466 set_subst_dict(obj, wrapper_subst_dict)
470 dark_rc_subst_dict = {}
471 light_rc_subst_dict = {}
476 if bld.is_defined('GTKOSX'): # OS X fonts
477 basefont = "Lucida Grande"
490 else: # Linux/X11 fonts
491 basefont = '' # unspecified - use system defaults
505 # Set up font substitution dictionary
507 for style in ['', 'BOLD', 'ITALIC']:
508 for sizename,points in iter(font_sizes.items()):
510 key = "_".join (['FONT',style,sizename])
511 fontstyle = " ".join ([basefont,style.lower(),points])
513 key = "_".join (['FONT',sizename])
514 fontstyle = " ".join ([basefont,points])
516 dark_rc_subst_dict[key] = fontstyle
517 light_rc_subst_dict[key] = fontstyle
520 for sizename,points in iter(font_sizes.items()):
521 key = "_".join (['FONT_SIZE',sizename])
522 dark_rc_subst_dict[key] = points
523 light_rc_subst_dict[key] = points
526 dark_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
527 'gtk2_ardour/ardour3_ui_dark.rc.in', 'ARDOUR_DARK')
528 dark_rc_subst_dict['COLPREFIX'] = 'ARDOUR_DARK'
529 light_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
530 'gtk2_ardour/ardour3_ui_light.rc.in', 'ARDOUR_LIGHT')
531 light_rc_subst_dict['COLPREFIX'] = 'ARDOUR_LIGHT'
533 obj = bld(features = 'subst')
534 obj.source = [ 'ardour3_ui_dark.rc.in' ]
535 obj.target = 'ardour3_ui_dark.rc.pre'
536 obj.install_path = None
537 set_subst_dict(obj, dark_rc_subst_dict)
539 obj = bld(features = 'subst')
540 obj.source = [ 'ardour3_ui_light.rc.in' ]
541 obj.target = 'ardour3_ui_light.rc.pre'
542 obj.install_path = None
543 set_subst_dict(obj, light_rc_subst_dict)
545 obj = bld(features = 'subst')
546 obj.source = [ 'ardour3_styles.rc.in' ]
547 obj.target = 'ardour3_dark_styles.rc'
548 obj.install_path = None
549 set_subst_dict(obj, dark_rc_subst_dict)
551 obj = bld(features = 'subst')
552 obj.source = [ 'ardour3_styles.rc.in' ]
553 obj.target = 'ardour3_light_styles.rc'
554 obj.install_path = None
555 set_subst_dict(obj, light_rc_subst_dict)
557 obj = bld(features = 'subst')
558 obj.source = [ 'ardour3_fonts.rc.in' ]
559 obj.target = 'ardour3_dark_fonts.rc'
560 obj.install_path = None
561 set_subst_dict(obj, dark_rc_subst_dict)
563 obj = bld(features = 'subst')
564 obj.source = [ 'ardour3_fonts.rc.in' ]
565 obj.target = 'ardour3_light_fonts.rc'
566 obj.install_path = None
567 set_subst_dict(obj, light_rc_subst_dict)
569 obj = bld(rule = 'cp ${SRC} ${TGT}')
570 obj.source = [ 'ardour3_widget_list.rc' ]
571 obj.target = 'ardour3_widgets.rc'
572 obj.install_path = None
574 obj = bld (rule = include_processor)
575 obj.source = [ 'ardour3_ui_dark.rc.pre' ]
576 # find and add all ##include dependencies as sources
577 obj.source += _doPyp (bld.path.find_resource ('ardour3_ui_dark.rc.in').srcpath(), True)
578 obj.target = 'ardour3_ui_dark.rc'
579 obj.install_path = '${SYSCONFDIR}/ardour3'
581 obj = bld (rule = include_processor)
582 obj.source = [ 'ardour3_ui_light.rc.pre' ]
583 # find and add all ##include dependencies as sources
584 obj.source += _doPyp (bld.path.find_resource ('ardour3_ui_light.rc.in').srcpath(), True)
585 obj.target = 'ardour3_ui_light.rc'
586 obj.install_path = '${SYSCONFDIR}/ardour3'
590 if bld.is_defined('GTKOSX'):
591 menus_argv = [ '-E', '-P', '-DGTKOSX' ]
593 menus_argv = [ '-E', '-P' ]
594 obj = bld(features = 'command-output')
596 obj.command_is_external = True
598 obj.argv = menus_argv
599 obj.stdin = 'ardour.menus.in'
600 obj.stdout = 'ardour.menus'
601 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
606 # 'SAE-de-keypad', 'SAE-de-nokeypad', 'SAE-us-keypad',
607 # 'SAE-us-nokeypad', 'ergonomic-us'
609 for b in [ 'mnemonic-us' ] :
611 target = b + '.bindings',
612 source = b + '.bindings.in',
613 rule = '../tools/fmt-bindings --platform="%s" --winkey="%s" --accelmap <${SRC} >${TGT}' % (sys.platform, bld.env['WINDOWS_KEY'] )
615 obj.install_path = os.path.join(bld.env['SYSCONFDIR'], 'ardour3')
617 # not modified at present
618 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
619 'step_editing.bindings')
620 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
624 bld.install_files('${DATADIR}/ardour3/icons', bld.path.ant_glob('icons/*.png'))
625 bld.install_files('${DATADIR}/ardour3/pixmaps', bld.path.ant_glob('pixmaps/*.xpm'))
626 bld.install_files('${DATADIR}/ardour3', 'splash.png')
628 # Default UI configuration
629 bld.install_files('${SYSCONFDIR}/ardour3', 'ardour3_ui_default.conf')
630 # Generic widget style mappings
631 bld.install_files('${SYSCONFDIR}/ardour3', 'ardour3_widgets.rc')
633 # Default export stuff
634 bld.install_files('${SYSCONFDIR}/ardour3/export', bld.path.ant_glob('export/*.format'))
637 if bld.is_defined('ENABLE_NLS'):
638 mo_files = bld.path.ant_glob('po/*.mo')
640 lang = os.path.basename(mo.srcpath()).replace('.mo', '')
641 bld.install_as(os.path.join(bld.env['PREFIX'], 'share', 'locale',
642 lang, 'LC_MESSAGES', I18N_PACKAGE + '.mo'),
646 autowaf.build_i18n(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
650 autowaf.build_i18n_pot(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
654 autowaf.build_i18n_po(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
658 autowaf.build_i18n_mo(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,