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',
106 'sfdb_freesound_mootcher.cc',
108 'generic_pluginui.cc',
110 'global_port_matrix.cc',
112 'gtk-custom-hruler.c',
113 'gtk-custom-ruler.c',
114 'gtk_pianokeyboard.c',
116 'insert_time_dialog.cc',
117 'interthread_progress_window.cc',
129 'midi_automation_line.cc',
130 'midi_channel_dialog.cc',
131 'midi_channel_selector.cc',
132 'midi_cut_buffer.cc',
133 'midi_export_dialog.cc',
134 'midi_list_editor.cc',
135 'midi_port_dialog.cc',
136 'midi_region_view.cc',
139 'midi_streamview.cc',
142 'midi_velocity_dialog.cc',
143 'missing_file_dialog.cc',
144 'missing_plugin_dialog.cc',
146 'mixer_group_tabs.cc',
152 'monitor_section.cc',
154 'mono_panner_editor.cc',
157 'new_plugin_preset_dialog.cc',
158 'normalize_dialog.cc',
166 'panner_interface.cc',
168 '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',
219 'stereo_panner_editor.cc',
221 'strip_silence_dialog.cc',
222 'tape_region_view.cc',
227 'time_axis_view_item.cc',
231 'track_selection.cc',
232 'track_view_list.cc',
233 'transpose_dialog.cc',
238 'visibility_group.cc',
239 'volume_controller.cc',
242 # video-timeline related sources:
243 'video_image_frame.cc',
244 'add_video_dialog.cc',
245 'editor_videotimeline.cc',
249 'transcode_ffmpeg.cc',
250 'transcode_video_dialog.cc',
251 'video_server_dialog.cc',
253 'export_video_dialog.cc',
254 'export_video_infobox.cc'
258 autowaf.set_options(opt)
262 conf.load('compiler_cxx')
263 # we don't use hard-coded micro versions with ardour, so hard code it to zero
264 autowaf.build_version_files(
265 path_prefix + 'version.h',
266 path_prefix + 'version.cc',
267 'gtk2_ardour', conf.env['MAJOR'], conf.env['MINOR'], 0)
268 autowaf.configure(conf)
270 if re.search ("linux", sys.platform) != None:
271 autowaf.check_pkg(conf, 'alsa', uselib_store='ALSA')
273 # TODO: Insert a sanity check for on OS X to ensure CoreAudio is present
275 autowaf.check_pkg(conf, 'flac', uselib_store='FLAC',
276 atleast_version='1.2.1')
277 autowaf.check_pkg(conf, 'gthread-2.0', uselib_store='GTHREAD',
278 atleast_version='2.10.1')
279 autowaf.check_pkg(conf, 'gtk+-2.0', uselib_store='GTK',
280 atleast_version='2.18')
281 autowaf.check_pkg(conf, 'gtkmm-2.4', uselib_store='GTKMM',
282 atleast_version='2.18')
283 autowaf.check_pkg(conf, 'libgnomecanvas-2.0',
284 uselib_store='GNOMECANVAS', atleast_version='2.30')
285 autowaf.check_pkg(conf, 'libgnomecanvasmm-2.6',
286 uselib_store='GNOMECANVASMM', atleast_version='2.16')
287 autowaf.check_pkg(conf, 'ogg', uselib_store='OGG', atleast_version='1.1.2')
288 autowaf.check_pkg(conf, 'x11', uselib_store='X11', atleast_version='1.1', mandatory=False)
289 autowaf.check_pkg(conf, 'fontconfig', uselib_store='FONTCONFIG')
291 conf.write_config_header('gtk2ardour-config.h', remove=False)
294 autowaf.check_header(conf, 'cxx', 'boost/shared_ptr.hpp')
295 autowaf.check_header(conf, 'cxx', 'boost/weak_ptr.hpp')
297 # Add a waf `feature' to allow compilation of things using winegcc
298 from waflib.TaskGen import feature
300 def set_winegcc(self):
301 self.env.LINK_CXX = self.env.LINK_CC = 'wineg++'
302 self.env.CC = 'winegcc'
304 def _doPyp(infileName, deps = False):
307 re_spaces = re.compile("\s+")
309 if infileName == '-':
312 fd = open(infileName)
313 inLines = fd.readlines()
319 bits = re_spaces.split(line)
320 if bits[0] == '##include':
325 # assume included file comes from same place as source file
326 incName = os.path.join (os.path.dirname (infileName), incName);
327 outStr += _doPyp(incName)
338 def include_processor(task):
339 infileName = task.inputs[0].srcpath()
340 outfileName = os.path.join(out, task.outputs[0].bldpath())
341 fdOut = open (outfileName, "w")
342 fdOut.write (_doPyp(infileName))
346 def build_color_scheme(path, prefix):
350 if re.search ('^#@color', line):
351 line.strip() # remove newline
353 if len(color_scheme):
355 color_scheme += prefix
357 color_scheme += words[1]
359 color_scheme += words[2]
365 VERSION = "%s.%s" % (bld.env['MAJOR'], bld.env['MINOR'])
367 if bld.is_defined('WINDOWS_VST_SUPPORT'):
368 # If we require VST support we build a stub main() and the FST library
369 # here using winegcc, and link it to the GTK front-end library
370 obj = bld(features = 'cxx c cxxprogram wine')
373 ../libs/fst/fstinfofile.c
379 obj.use = [ 'libpbd',
387 obj.target = 'ardour-' + bld.env['VERSION'] + '-vst.exe.so'
388 obj.includes = [ '../libs/fst', '.' ]
389 obj.linkflags = ['-mwindows', '-Wl,--export-dynamic']
390 obj.defines = ['_POSIX_SOURCE', 'USE_WS_PREFIX']
391 obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
392 # end of the wine executable
394 # now the shared library containing the GTK GUI for ardour
395 obj = bld (features = 'cxx c cxxshlib')
396 obj.source = gtk2_ardour_sources
397 obj.includes = [ '../libs/fst', '.' ]
398 obj.name = 'libgtk2_ardour'
399 obj.target = 'gtk2_ardour'
401 # just the normal executable version of the GTK GUI
402 obj = bld(features = 'cxx c cxxprogram')
403 obj.source = gtk2_ardour_sources
404 obj.target = 'ardour-' + bld.env['VERSION']
407 # continue with setup of obj, which could be a shared library
410 obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
412 obj.uselib = 'UUID FLAC FONTCONFIG GLIBMM GTHREAD GTK OGG ALSA CURL DL'
413 obj.uselib += ' GTKMM GNOMECANVASMM GNOMECANVAS '
414 obj.uselib += ' AUDIOUNITS OSX GTKOSX LO '
415 obj.use = [ 'libpbd',
422 if sys.platform == 'darwin':
423 obj.use += ' libappleutility'
425 'PACKAGE="' + I18N_PACKAGE + '"',
426 'VERSIONSTRING="' + bld.env['VERSION'] + '"',
427 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
428 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
429 'LOCALEDIR="' + os.path.join(os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
430 'PROGRAM_NAME="' + bld.env['PROGRAM_NAME'] + '"'
432 obj.includes += ['../libs']
434 if bld.is_defined('HAVE_SUIL'):
435 obj.source += [ 'lv2_plugin_ui.cc' ]
436 obj.use += [ 'SUIL' ]
438 if bld.is_defined('NEED_INTL'):
439 obj.linkflags = ' -lintl'
441 if bld.is_defined('WINDOWS_VST_SUPPORT'):
442 obj.source += [ 'windows_vst_plugin_ui.cc' ]
443 obj.defines += [ 'WINDOWS_VST_SUPPORT' ]
446 if bld.is_defined('LXVST_SUPPORT'):
447 obj.source += [ 'linux_vst_gui_support.cc', 'lxvst_plugin_ui.cc' ]
448 obj.defines += [ 'LXVST_SUPPORT' ]
451 if bld.is_defined('WINDOWS_VST_SUPPORT') or bld.is_defined('LXVST_SUPPORT'):
452 obj.source += [ 'vst_plugin_ui.cc' ]
454 if bld.is_defined('PHONE_HOME'):
455 obj.defines += [ 'PHONE_HOME' ]
457 if bld.is_defined('HAVE_COREAUDIO'):
458 TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cc']
459 obj.source += [ 'cocoacarbon.mm' ]
460 obj.use += ' libappleutility '
462 if bld.is_defined('AUDIOUNIT_SUPPORT'):
463 obj.source += [ 'au_pluginui.mm' ]
467 wrapper_subst_dict = {
468 'INSTALL_PREFIX' : bld.env['PREFIX'],
469 'LIBDIR' : os.path.normpath(bld.env['LIBDIR']),
470 'DATADIR' : os.path.normpath(bld.env['DATADIR']),
471 'SYSCONFDIR' : os.path.normpath(bld.env['SYSCONFDIR']),
472 'LIBS' : 'build/libs',
473 'VERSION' : bld.env['VERSION'],
474 'EXECUTABLE' : 'build/gtk2_ardour/ardour-' + bld.env['VERSION']
477 def set_subst_dict(obj, dict):
479 setattr(obj, i, dict[i])
481 obj = bld(features = 'subst', rule= 'chmod 0755 ${TGT}')
482 obj.source = 'ardev_common.sh.in'
483 obj.target = 'ardev_common_waf.sh'
484 obj.chmod = Utils.O755
485 obj.dict = wrapper_subst_dict
486 set_subst_dict(obj, wrapper_subst_dict)
488 obj = bld(features = 'subst')
489 obj.source = 'ardour.sh.in'
490 obj.target = 'ardour3'
491 obj.chmod = Utils.O755
492 obj.dict = wrapper_subst_dict
493 obj.install_path = bld.env['BINDIR']
494 set_subst_dict(obj, wrapper_subst_dict)
496 if bld.is_defined('WINDOWS_VST_SUPPORT'):
497 obj = bld(features = 'subst')
498 obj.source = '../vst/ardourvst.in'
499 obj.target = 'ardourvst3'
500 obj.chmod = Utils.O755
501 obj.dict = wrapper_subst_dict
502 obj.install_path = bld.env['BINDIR']
503 set_subst_dict(obj, wrapper_subst_dict)
507 dark_rc_subst_dict = {}
508 light_rc_subst_dict = {}
513 if bld.is_defined('GTKOSX'): # OS X fonts
527 # There is no acceptable monospace font available on older versions of OS X
528 # and no API on those versions to load TTF files that will work with
529 # GTK/fontconfig/pango.
531 # In addition, the ArdourMono font gets clipped for some reason on OS X
533 # Moreover, Lucida Grande just seems to work even though it is not monospace
537 'MONOSPACE' : 'Lucida Grande',
539 else: # Linux/X11 fonts
540 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,