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',
101 'editor_selection.cc',
102 'editor_snapshots.cc',
104 'editor_tempodisplay.cc',
108 'export_channel_selector.cc',
110 'export_file_notebook.cc',
111 'export_filename_selector.cc',
112 'export_format_dialog.cc',
113 'export_format_selector.cc',
114 'export_preset_selector.cc',
115 'export_timespan_selector.cc',
120 'generic_pluginui.cc',
122 'global_port_matrix.cc',
124 'gtk-custom-hruler.c',
125 'gtk-custom-ruler.c',
126 'gtk_pianokeyboard.c',
128 'insert_time_dialog.cc',
129 'interthread_progress_window.cc',
140 'midi_automation_line.cc',
141 'midi_channel_dialog.cc',
142 'midi_channel_selector.cc',
143 'midi_cut_buffer.cc',
144 'midi_list_editor.cc',
145 'midi_port_dialog.cc',
146 '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',
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]
347 # GTK front-end; if we're using VST we build this as a shared library,
348 # otherwise it's a normal executabale
349 if bld.is_defined('WINDOWS_VST_SUPPORT'):
350 obj = bld(features = 'cxx c cxxshlib')
352 obj = bld(features = 'cxx c cxxprogram')
355 obj.source = gtk2_ardour_sources
356 obj.name = 'gtk2_ardour'
358 if bld.is_defined('WINDOWS_VST_SUPPORT'):
359 obj.target = 'gtk2_ardour'
360 obj.includes += ['../libs/fst']
362 obj.target = 'ardour-3.0'
363 obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
364 obj.uselib = 'UUID FLAC GLIBMM GTHREAD GTK OGG ALSA CURL DL'
365 obj.uselib += ' GTKMM GNOMECANVASMM GNOMECANVAS '
366 obj.uselib += ' AUDIOUNITS OSX GTKOSX '
367 obj.use = [ 'libpbd',
374 if sys.platform == 'darwin':
375 obj.use += ' libappleutility'
377 'PACKAGE="' + I18N_PACKAGE + '"',
378 'VERSIONSTRING="' + bld.env['VERSION'] + '"',
379 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
380 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
381 'MODULE_DIR="' + os.path.normpath(bld.env['LIBDIR']) + '"',
382 'LOCALEDIR="' + os.path.join(os.path.normpath(bld.env['DATADIR']),
384 'PROGRAM_NAME="' + bld.env['PROGRAM_NAME'] + '"'
386 obj.includes += ['../libs']
388 if bld.is_defined('HAVE_SUIL'):
389 obj.source += [ 'lv2_plugin_ui.cc' ]
390 obj.uselib += ' SUIL '
392 if bld.is_defined('FREESOUND'):
393 obj.source += [ 'sfdb_freesound_mootcher.cc' ]
394 obj.defines += [ 'FREESOUND' ]
396 if bld.is_defined('WINDOWS_VST_SUPPORT'):
397 obj.source += [ 'windows_vst_plugin_ui.cc' ]
398 obj.defines += [ 'WINDOWS_VST_SUPPORT' ]
399 obj.uselib += ' X11 '
401 if bld.is_defined('LXVST_SUPPORT'):
402 obj.source += [ 'linux_vst_gui_support.cc', 'lxvst_plugin_ui.cc' ]
403 obj.defines += [ 'LXVST_SUPPORT' ]
404 obj.uselib += ' X11 '
406 if bld.is_defined('WINDOWS_VST_SUPPORT') or bld.is_defined('LXVST_SUPPORT'):
407 obj.source += [ 'vst_plugin_ui.cc' ]
409 if bld.is_defined('PHONE_HOME'):
410 obj.defines += [ 'PHONE_HOME' ]
412 if bld.is_defined('HAVE_COREAUDIO'):
413 TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cc']
414 obj.source += [ 'cocoacarbon.mm', 'au_pluginui.mm' ]
415 obj.use += ' libappleutility '
417 if bld.is_defined('WINDOWS_VST_SUPPORT'):
418 # If we require VST support we build a stub main() and the FST library
419 # here using winegcc, and link it to the GTK front-end library
420 obj = bld(features = 'cxx c cxxprogram wine')
423 ../libs/fst/fstinfofile.c
428 obj.includes = '../libs/fst'
429 obj.target = 'ardour-3.0-vst'
430 obj.linkflags = ['-mwindows', '-Wl,--export-dynamic', '-lpthread']
431 obj.defines = ['_POSIX_SOURCE', 'USE_WS_PREFIX']
433 obj.use = ['libpbd','libmidipp','libtaglib','libardour',
434 'libardour_cp','libgtkmm2ext','libtaglib',
439 wrapper_subst_dict = {
440 'INSTALL_PREFIX' : bld.env['PREFIX'],
441 'LIBDIR' : os.path.normpath(bld.env['LIBDIR']),
442 'LIBS' : 'build/libs',
444 'EXECUTABLE' : 'build/gtk2_ardour/ardour-3.0'
447 def set_subst_dict(obj, dict):
449 setattr(obj, i, dict[i])
451 obj = bld(features = 'subst', rule= 'chmod 0755 ${TGT}')
452 obj.source = 'ardev_common.sh.in'
453 obj.target = 'ardev_common_waf.sh'
454 obj.chmod = Utils.O755
455 obj.dict = wrapper_subst_dict
456 set_subst_dict(obj, wrapper_subst_dict)
458 obj = bld(features = 'subst')
459 obj.source = 'ardour.sh.in'
460 obj.target = 'ardour3'
461 obj.chmod = Utils.O755
462 obj.dict = wrapper_subst_dict
463 obj.install_path = bld.env['BINDIR']
464 set_subst_dict(obj, wrapper_subst_dict)
468 dark_rc_subst_dict = {}
469 light_rc_subst_dict = {}
474 if bld.is_defined('GTKOSX'): # OS X fonts
475 basefont = "Lucida Grande"
488 else: # Linux/X11 fonts
489 basefont = '' # unspecified - use system defaults
503 # Set up font substitution dictionary
505 for style in ['', 'BOLD', 'ITALIC']:
506 for sizename,points in iter(font_sizes.items()):
508 key = "_".join (['FONT',style,sizename])
509 fontstyle = " ".join ([basefont,style.lower(),points])
511 key = "_".join (['FONT',sizename])
512 fontstyle = " ".join ([basefont,points])
514 dark_rc_subst_dict[key] = fontstyle
515 light_rc_subst_dict[key] = fontstyle
518 for sizename,points in iter(font_sizes.items()):
519 key = "_".join (['FONT_SIZE',sizename])
520 dark_rc_subst_dict[key] = points
521 light_rc_subst_dict[key] = points
524 dark_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
525 'gtk2_ardour/ardour3_ui_dark.rc.in', 'ARDOUR_DARK')
526 dark_rc_subst_dict['COLPREFIX'] = 'ARDOUR_DARK'
527 light_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
528 'gtk2_ardour/ardour3_ui_light.rc.in', 'ARDOUR_LIGHT')
529 light_rc_subst_dict['COLPREFIX'] = 'ARDOUR_LIGHT'
531 obj = bld(features = 'subst')
532 obj.source = [ 'ardour3_ui_dark.rc.in' ]
533 obj.target = 'ardour3_ui_dark.rc.pre'
534 obj.install_path = None
535 set_subst_dict(obj, dark_rc_subst_dict)
537 obj = bld(features = 'subst')
538 obj.source = [ 'ardour3_ui_light.rc.in' ]
539 obj.target = 'ardour3_ui_light.rc.pre'
540 obj.install_path = None
541 set_subst_dict(obj, light_rc_subst_dict)
543 obj = bld(features = 'subst')
544 obj.source = [ 'ardour3_styles.rc.in' ]
545 obj.target = 'ardour3_dark_styles.rc'
546 obj.install_path = None
547 set_subst_dict(obj, dark_rc_subst_dict)
549 obj = bld(features = 'subst')
550 obj.source = [ 'ardour3_styles.rc.in' ]
551 obj.target = 'ardour3_light_styles.rc'
552 obj.install_path = None
553 set_subst_dict(obj, light_rc_subst_dict)
555 obj = bld(features = 'subst')
556 obj.source = [ 'ardour3_fonts.rc.in' ]
557 obj.target = 'ardour3_dark_fonts.rc'
558 obj.install_path = None
559 set_subst_dict(obj, dark_rc_subst_dict)
561 obj = bld(features = 'subst')
562 obj.source = [ 'ardour3_fonts.rc.in' ]
563 obj.target = 'ardour3_light_fonts.rc'
564 obj.install_path = None
565 set_subst_dict(obj, light_rc_subst_dict)
567 obj = bld(rule = 'cp ${SRC} ${TGT}')
568 obj.source = [ 'ardour3_widget_list.rc' ]
569 obj.target = 'ardour3_widgets.rc'
570 obj.install_path = None
572 obj = bld (rule = include_processor)
573 obj.source = [ 'ardour3_ui_dark.rc.pre' ]
574 # find and add all ##include dependencies as sources
575 obj.source += _doPyp (bld.path.find_resource ('ardour3_ui_dark.rc.in').srcpath(), True)
576 obj.target = 'ardour3_ui_dark.rc'
577 obj.install_path = '${SYSCONFDIR}/ardour3'
579 obj = bld (rule = include_processor)
580 obj.source = [ 'ardour3_ui_light.rc.pre' ]
581 # find and add all ##include dependencies as sources
582 obj.source += _doPyp (bld.path.find_resource ('ardour3_ui_light.rc.in').srcpath(), True)
583 obj.target = 'ardour3_ui_light.rc'
584 obj.install_path = '${SYSCONFDIR}/ardour3'
588 if bld.is_defined('GTKOSX'):
589 menus_argv = [ '-E', '-P', '-DGTKOSX' ]
591 menus_argv = [ '-E', '-P' ]
592 obj = bld(features = 'command-output')
594 obj.command_is_external = True
596 obj.argv = menus_argv
597 obj.stdin = 'ardour.menus.in'
598 obj.stdout = 'ardour.menus'
599 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
604 # 'SAE-de-keypad', 'SAE-de-nokeypad', 'SAE-us-keypad',
605 # 'SAE-us-nokeypad', 'ergonomic-us'
607 for b in [ 'mnemonic-us' ] :
609 target = b + '.bindings',
610 source = b + '.bindings.in',
611 rule = '../tools/fmt-bindings --platform="%s" --winkey="%s" --accelmap <${SRC} >${TGT}' % (sys.platform, bld.env['WINDOWS_KEY'] )
613 obj.install_path = os.path.join(bld.env['SYSCONFDIR'], 'ardour3')
615 # not modified at present
616 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
617 'step_editing.bindings')
618 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
622 bld.install_files('${DATADIR}/ardour3/icons', bld.path.ant_glob('icons/*.png'))
623 bld.install_files('${DATADIR}/ardour3/pixmaps', bld.path.ant_glob('pixmaps/*.xpm'))
624 bld.install_files('${DATADIR}/ardour3', 'splash.png')
626 # Default UI configuration
627 bld.install_files('${SYSCONFDIR}/ardour3', 'ardour3_ui_default.conf')
628 # Generic widget style mappings
629 bld.install_files('${SYSCONFDIR}/ardour3', 'ardour3_widgets.rc')
631 # Default export stuff
632 bld.install_files('${SYSCONFDIR}/ardour3/export', bld.path.ant_glob('export/*.format'))
635 if bld.is_defined('ENABLE_NLS'):
636 mo_files = bld.path.ant_glob('po/*.mo')
638 lang = os.path.basename(mo.srcpath()).replace('.mo', '')
639 bld.install_as(os.path.join(bld.env['PREFIX'], 'share', 'locale',
640 lang, 'LC_MESSAGES', I18N_PACKAGE + '.mo'),
644 autowaf.build_i18n(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
648 autowaf.build_i18n_pot(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
652 autowaf.build_i18n_po(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
656 autowaf.build_i18n_mo(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,