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 I18N_PACKAGE = 'gtk2_ardour3'
17 path_prefix = 'gtk2_ardour/'
19 gtk2_ardour_sources = [
22 'add_route_dialog.cc',
23 'ambiguous_file_dialog.cc',
29 'ardour_ui_dependents.cc',
30 'ardour_ui_dialogs.cc',
33 'ardour_ui_options.cc',
36 'audio_region_editor.cc',
37 'audio_region_view.cc',
38 'audio_streamview.cc',
40 'automation_controller.cc',
42 'automation_region_view.cc',
43 'automation_streamview.cc',
44 'automation_time_axis.cc',
46 'big_clock_window.cc',
51 'canvas-note-event.cc',
53 'canvas_patch_change.cc',
54 'canvas-simpleline.c',
55 'canvas-simplerect.c',
61 'control_point_dialog.cc',
65 'edit_note_dialog.cc',
69 'editor_audio_import.cc',
70 'editor_audiotrack.cc',
72 'editor_canvas_events.cc',
73 'editor_component.cc',
76 'editor_route_groups.cc',
77 'editor_export_audio.cc',
78 'editor_group_tabs.cc',
80 'editor_locations.cc',
88 'editor_selection.cc',
89 'editor_snapshots.cc',
91 'editor_tempodisplay.cc',
95 'export_channel_selector.cc',
97 'export_file_notebook.cc',
98 'export_filename_selector.cc',
99 'export_format_dialog.cc',
100 'export_format_selector.cc',
101 'export_preset_selector.cc',
102 'export_timespan_selector.cc',
107 'generic_pluginui.cc',
109 'global_port_matrix.cc',
111 'gtk-custom-hruler.c',
112 'gtk-custom-ruler.c',
113 'gtk_pianokeyboard.c',
115 'insert_time_dialog.cc',
116 'interthread_progress_window.cc',
128 'midi_automation_line.cc',
129 'midi_channel_dialog.cc',
130 'midi_channel_selector.cc',
131 'midi_cut_buffer.cc',
132 'midi_export_dialog.cc',
133 'midi_list_editor.cc',
134 'midi_port_dialog.cc',
135 'midi_region_view.cc',
138 'midi_streamview.cc',
141 'midi_velocity_dialog.cc',
142 'missing_file_dialog.cc',
143 'missing_plugin_dialog.cc',
145 'mixer_group_tabs.cc',
150 'monitor_section.cc',
152 'mono_panner_editor.cc',
155 'new_plugin_preset_dialog.cc',
156 'normalize_dialog.cc',
164 'panner_interface.cc',
166 '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',
217 'stereo_panner_editor.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',
240 # video-timeline related sources:
241 'video_image_frame.cc',
242 'add_video_dialog.cc',
243 'editor_videotimeline.cc',
247 'transcode_ffmpeg.cc',
248 'transcode_video_dialog.cc',
249 'video_server_dialog.cc',
251 'export_video_dialog.cc',
252 'export_video_infobox.cc'
256 autowaf.set_options(opt)
260 conf.load('compiler_cxx')
261 # we don't use hard-coded micro versions with ardour, so hard code it to zero
262 autowaf.build_version_files(
263 path_prefix + 'version.h',
264 path_prefix + 'version.cc',
265 'gtk2_ardour', conf.env['MAJOR'], conf.env['MINOR'], 0)
266 autowaf.configure(conf)
268 if re.search ("linux", sys.platform) != None:
269 autowaf.check_pkg(conf, 'alsa', uselib_store='ALSA')
271 # TODO: Insert a sanity check for on OS X to ensure CoreAudio is present
273 autowaf.check_pkg(conf, 'flac', uselib_store='FLAC',
274 atleast_version='1.2.1')
275 autowaf.check_pkg(conf, 'gthread-2.0', uselib_store='GTHREAD',
276 atleast_version='2.10.1')
277 autowaf.check_pkg(conf, 'gtk+-2.0', uselib_store='GTK',
278 atleast_version='2.18')
279 autowaf.check_pkg(conf, 'gtkmm-2.4', uselib_store='GTKMM',
280 atleast_version='2.18')
281 autowaf.check_pkg(conf, 'libgnomecanvas-2.0',
282 uselib_store='GNOMECANVAS', atleast_version='2.30')
283 autowaf.check_pkg(conf, 'libgnomecanvasmm-2.6',
284 uselib_store='GNOMECANVASMM', atleast_version='2.16')
285 autowaf.check_pkg(conf, 'ogg', uselib_store='OGG', atleast_version='1.1.2')
286 autowaf.check_pkg(conf, 'x11', uselib_store='X11', atleast_version='1.1', mandatory=False)
287 autowaf.check_pkg(conf, 'fontconfig', uselib_store='FONTCONFIG')
289 conf.write_config_header('gtk2ardour-config.h', remove=False)
292 autowaf.check_header(conf, 'cxx', 'boost/shared_ptr.hpp')
293 autowaf.check_header(conf, 'cxx', 'boost/weak_ptr.hpp')
295 # Add a waf `feature' to allow compilation of things using winegcc
296 from waflib.TaskGen import feature
298 def set_winegcc(self):
299 self.env.LINK_CXX = self.env.LINK_CC = 'wineg++'
300 self.env.CC = 'winegcc'
302 def _doPyp(infileName, deps = False):
305 re_spaces = re.compile("\s+")
307 if infileName == '-':
310 fd = open(infileName)
311 inLines = fd.readlines()
317 bits = re_spaces.split(line)
318 if bits[0] == '##include':
323 # assume included file comes from same place as source file
324 incName = os.path.join (os.path.dirname (infileName), incName);
325 outStr += _doPyp(incName)
336 def include_processor(task):
337 infileName = task.inputs[0].srcpath()
338 outfileName = os.path.join(out, task.outputs[0].bldpath())
339 fdOut = open (outfileName, "w")
340 fdOut.write (_doPyp(infileName))
344 def build_color_scheme(path, prefix):
348 if re.search ('^#@color', line):
349 line.strip() # remove newline
351 if len(color_scheme):
353 color_scheme += prefix
355 color_scheme += words[1]
357 color_scheme += words[2]
363 VERSION = "%s.%s" % (bld.env['MAJOR'], bld.env['MINOR'])
365 if bld.is_defined('WINDOWS_VST_SUPPORT'):
366 # If we require VST support we build a stub main() and the FST library
367 # here using winegcc, and link it to the GTK front-end library
368 obj = bld(features = 'cxx c cxxprogram wine')
371 ../libs/fst/fstinfofile.c
377 obj.use = [ 'libpbd',
385 obj.target = 'ardour-' + bld.env['VERSION'] + '-vst.exe.so'
386 obj.includes = [ '../libs/fst', '.' ]
387 obj.linkflags = ['-mwindows', '-Wl,--export-dynamic']
388 obj.defines = ['_POSIX_SOURCE', 'USE_WS_PREFIX']
389 obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
390 # end of the wine executable
392 # now the shared library containing the GTK GUI for ardour
393 obj = bld (features = 'cxx c cxxshlib')
394 obj.source = gtk2_ardour_sources
395 obj.includes = [ '../libs/fst', '.' ]
396 obj.name = 'libgtk2_ardour'
397 obj.target = 'gtk2_ardour'
399 # just the normal executable version of the GTK GUI
400 obj = bld(features = 'cxx c cxxprogram')
401 obj.source = gtk2_ardour_sources
402 obj.target = 'ardour-' + bld.env['VERSION']
405 # continue with setup of obj, which could be a shared library
408 obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
410 obj.uselib = 'UUID FLAC FONTCONFIG GLIBMM GTHREAD GTK OGG ALSA CURL DL'
411 obj.uselib += ' GTKMM GNOMECANVASMM GNOMECANVAS '
412 obj.uselib += ' AUDIOUNITS OSX GTKOSX LO '
413 obj.use = [ 'libpbd',
420 if sys.platform == 'darwin':
421 obj.use += ' libappleutility'
423 'PACKAGE="' + I18N_PACKAGE + '"',
424 'VERSIONSTRING="' + bld.env['VERSION'] + '"',
425 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
426 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
427 'LOCALEDIR="' + os.path.join(os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
428 'PROGRAM_NAME="' + bld.env['PROGRAM_NAME'] + '"'
430 obj.includes += ['../libs']
432 if bld.is_defined('HAVE_SUIL'):
433 obj.source += [ 'lv2_plugin_ui.cc' ]
434 obj.use += [ 'SUIL' ]
436 if bld.is_defined('FREESOUND'):
437 obj.source += [ 'sfdb_freesound_mootcher.cc' ]
438 obj.defines += [ 'FREESOUND' ]
440 if bld.is_defined('NEED_INTL'):
441 obj.linkflags = ' -lintl'
443 if bld.is_defined('WINDOWS_VST_SUPPORT'):
444 obj.source += [ 'windows_vst_plugin_ui.cc' ]
445 obj.defines += [ 'WINDOWS_VST_SUPPORT' ]
448 if bld.is_defined('LXVST_SUPPORT'):
449 obj.source += [ 'linux_vst_gui_support.cc', 'lxvst_plugin_ui.cc' ]
450 obj.defines += [ 'LXVST_SUPPORT' ]
453 if bld.is_defined('WINDOWS_VST_SUPPORT') or bld.is_defined('LXVST_SUPPORT'):
454 obj.source += [ 'vst_plugin_ui.cc' ]
456 if bld.is_defined('PHONE_HOME'):
457 obj.defines += [ 'PHONE_HOME' ]
459 if bld.is_defined('HAVE_COREAUDIO'):
460 TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cc']
461 obj.source += [ 'cocoacarbon.mm' ]
462 obj.use += ' libappleutility '
464 if bld.is_defined('AUDIOUNIT_SUPPORT'):
465 obj.source += [ 'au_pluginui.mm' ]
469 wrapper_subst_dict = {
470 'INSTALL_PREFIX' : bld.env['PREFIX'],
471 'LIBDIR' : os.path.normpath(bld.env['LIBDIR']),
472 'DATADIR' : os.path.normpath(bld.env['DATADIR']),
473 'SYSCONFDIR' : os.path.normpath(bld.env['SYSCONFDIR']),
474 'LIBS' : 'build/libs',
475 'VERSION' : bld.env['VERSION'],
476 'EXECUTABLE' : 'build/gtk2_ardour/ardour-' + bld.env['VERSION']
479 def set_subst_dict(obj, dict):
481 setattr(obj, i, dict[i])
483 obj = bld(features = 'subst', rule= 'chmod 0755 ${TGT}')
484 obj.source = 'ardev_common.sh.in'
485 obj.target = 'ardev_common_waf.sh'
486 obj.chmod = Utils.O755
487 obj.dict = wrapper_subst_dict
488 set_subst_dict(obj, wrapper_subst_dict)
490 obj = bld(features = 'subst')
491 obj.source = 'ardour.sh.in'
492 obj.target = 'ardour3'
493 obj.chmod = Utils.O755
494 obj.dict = wrapper_subst_dict
495 obj.install_path = bld.env['BINDIR']
496 set_subst_dict(obj, wrapper_subst_dict)
498 if bld.is_defined('WINDOWS_VST_SUPPORT'):
499 obj = bld(features = 'subst')
500 obj.source = '../vst/ardourvst.in'
501 obj.target = 'ardourvst3'
502 obj.chmod = Utils.O755
503 obj.dict = wrapper_subst_dict
504 obj.install_path = bld.env['BINDIR']
505 set_subst_dict(obj, wrapper_subst_dict)
509 dark_rc_subst_dict = {}
510 light_rc_subst_dict = {}
515 if bld.is_defined('GTKOSX'): # OS X fonts
528 # There is no acceptable monospace font available on older versions of OS X
529 # and no API on those versions to load TTF files that will work with
530 # GTK/fontconfig/pango.
532 # In addition, the ArdourMono font gets clipped for some reason on OS X
534 # Moreover, Lucida Grande just seems to work even though it is not monospace
538 'MONOSPACE' : 'Lucida Grande',
540 else: # Linux/X11 fonts
541 basefont = '' # unspecified - use system defaults
553 'MONOSPACE' : 'ArdourMono',
556 # Set up font substitution dictionary
558 for style in ['', 'BOLD', 'ITALIC']:
559 for sizename,points in iter(font_sizes.items()):
561 key = "_".join (['FONT',style,sizename])
562 fontstyle = " ".join ([basefont,style.lower(),points])
564 key = "_".join (['FONT',sizename])
565 fontstyle = " ".join ([basefont,points])
567 dark_rc_subst_dict[key] = fontstyle
568 light_rc_subst_dict[key] = fontstyle
571 for sizename,points in iter(font_sizes.items()):
572 key = "_".join (['FONT_SIZE',sizename])
573 dark_rc_subst_dict[key] = points
574 light_rc_subst_dict[key] = points
576 # various font names, eg @BOLD_MONOSPACE@
577 for font_sym,text in iter(font_names.items()):
579 dark_rc_subst_dict[key] = text
580 light_rc_subst_dict[key] = text
583 dark_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
584 'gtk2_ardour/ardour3_ui_dark.rc.in', 'ARDOUR_DARK')
585 dark_rc_subst_dict['COLPREFIX'] = 'ARDOUR_DARK'
586 light_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
587 'gtk2_ardour/ardour3_ui_light.rc.in', 'ARDOUR_LIGHT')
588 light_rc_subst_dict['COLPREFIX'] = 'ARDOUR_LIGHT'
590 obj = bld(features = 'subst')
591 obj.source = [ 'ardour3_ui_dark.rc.in' ]
592 obj.target = 'ardour3_ui_dark.rc.pre'
593 obj.install_path = None
594 set_subst_dict(obj, dark_rc_subst_dict)
596 obj = bld(features = 'subst')
597 obj.source = [ 'ardour3_ui_light.rc.in' ]
598 obj.target = 'ardour3_ui_light.rc.pre'
599 obj.install_path = None
600 set_subst_dict(obj, light_rc_subst_dict)
602 obj = bld(features = 'subst')
603 obj.source = [ 'ardour3_styles.rc.in' ]
604 obj.target = 'ardour3_dark_styles.rc'
605 obj.install_path = None
606 set_subst_dict(obj, dark_rc_subst_dict)
608 obj = bld(features = 'subst')
609 obj.source = [ 'ardour3_styles.rc.in' ]
610 obj.target = 'ardour3_light_styles.rc'
611 obj.install_path = None
612 set_subst_dict(obj, light_rc_subst_dict)
614 obj = bld(features = 'subst')
615 obj.source = [ 'ardour3_fonts.rc.in' ]
616 obj.target = 'ardour3_dark_fonts.rc'
617 obj.install_path = None
618 set_subst_dict(obj, dark_rc_subst_dict)
620 obj = bld(features = 'subst')
621 obj.source = [ 'ardour3_fonts.rc.in' ]
622 obj.target = 'ardour3_light_fonts.rc'
623 obj.install_path = None
624 set_subst_dict(obj, light_rc_subst_dict)
626 obj = bld(rule = 'cp ${SRC} ${TGT}')
627 obj.source = [ 'ardour3_widget_list.rc' ]
628 obj.target = 'ardour3_widgets.rc'
629 obj.install_path = None
631 obj = bld (rule = include_processor)
632 obj.source = [ 'ardour3_ui_dark.rc.pre' ]
633 # find and add all ##include dependencies as sources
634 obj.source += _doPyp (bld.path.find_resource ('ardour3_ui_dark.rc.in').srcpath(), True)
635 obj.target = 'ardour3_ui_dark.rc'
636 obj.install_path = '${SYSCONFDIR}/ardour3'
638 obj = bld (rule = include_processor)
639 obj.source = [ 'ardour3_ui_light.rc.pre' ]
640 # find and add all ##include dependencies as sources
641 obj.source += _doPyp (bld.path.find_resource ('ardour3_ui_light.rc.in').srcpath(), True)
642 obj.target = 'ardour3_ui_light.rc'
643 obj.install_path = '${SYSCONFDIR}/ardour3'
647 if bld.is_defined('GTKOSX'):
648 menus_argv = [ '-E', '-P', '-DGTKOSX', '-DNOVIDEOTIMELINE' ]
650 menus_argv = [ '-E', '-P' ]
652 obj = bld(features = 'command-output')
654 obj.command_is_external = True
656 obj.argv = menus_argv
657 obj.stdin = 'ardour.menus.in'
658 obj.stdout = 'ardour.menus'
659 obj.dep_vars = ['GTKOSX']
660 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
665 # 'SAE-de-keypad', 'SAE-de-nokeypad', 'SAE-us-keypad',
666 # 'SAE-us-nokeypad', 'ergonomic-us'
668 for b in [ 'mnemonic-us' ] :
670 target = b + '.bindings',
671 source = b + '.bindings.in',
672 rule = '../tools/fmt-bindings --platform="%s" --winkey="%s" --accelmap <${SRC} >${TGT}' % (sys.platform, bld.env['WINDOWS_KEY'] )
674 obj.install_path = os.path.join(bld.env['SYSCONFDIR'], 'ardour3')
676 # not modified at present
677 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
678 'step_editing.bindings')
679 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
683 bld.install_files('${DATADIR}/ardour3/icons', bld.path.ant_glob('icons/*.png'))
684 bld.install_files('${DATADIR}/ardour3/pixmaps', bld.path.ant_glob('pixmaps/*.xpm'))
685 bld.install_files('${DATADIR}/ardour3', 'splash.png')
686 bld.install_files('${DATADIR}/ardour3', 'ArdourMono.ttf')
688 # Default UI configuration
689 bld.install_files('${SYSCONFDIR}/ardour3', 'ardour3_ui_default.conf')
691 # Default export stuff
692 bld.install_files('${SYSCONFDIR}/ardour3/export', bld.path.ant_glob('export/*.format'))
695 if bld.is_defined('ENABLE_NLS'):
696 mo_files = bld.path.ant_glob('po/*.mo')
698 lang = os.path.basename(mo.srcpath()).replace('.mo', '')
699 bld.install_as(os.path.join(bld.env['PREFIX'], 'share', 'locale',
700 lang, 'LC_MESSAGES', I18N_PACKAGE + '.mo'),
704 autowaf.build_i18n(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
708 autowaf.build_i18n_pot(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
712 autowaf.build_i18n_po(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
716 autowaf.build_i18n_mo(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,