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_route_dialog.cc',
32 'ambiguous_file_dialog.cc',
38 'ardour_ui_dependents.cc',
39 'ardour_ui_dialogs.cc',
42 'ardour_ui_options.cc',
45 'audio_region_editor.cc',
46 'audio_region_view.cc',
47 'audio_streamview.cc',
49 'automation_controller.cc',
51 'automation_region_view.cc',
52 'automation_streamview.cc',
53 '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',
73 'edit_note_dialog.cc',
77 'editor_audio_import.cc',
78 'editor_audiotrack.cc',
80 'editor_canvas_events.cc',
81 'editor_component.cc',
84 'editor_route_groups.cc',
85 'editor_export_audio.cc',
86 'editor_group_tabs.cc',
88 'editor_locations.cc',
96 'editor_selection.cc',
97 'editor_snapshots.cc',
99 'editor_tempodisplay.cc',
103 'export_channel_selector.cc',
105 'export_file_notebook.cc',
106 'export_filename_selector.cc',
107 'export_format_dialog.cc',
108 'export_format_selector.cc',
109 'export_preset_selector.cc',
110 'export_timespan_selector.cc',
115 'generic_pluginui.cc',
117 'global_port_matrix.cc',
119 'gtk-custom-hruler.c',
120 'gtk-custom-ruler.c',
121 'gtk_pianokeyboard.c',
123 'insert_time_dialog.cc',
124 'interthread_progress_window.cc',
136 'midi_automation_line.cc',
137 'midi_channel_dialog.cc',
138 'midi_channel_selector.cc',
139 'midi_cut_buffer.cc',
140 'midi_export_dialog.cc',
141 'midi_list_editor.cc',
142 'midi_port_dialog.cc',
143 'midi_region_view.cc',
146 'midi_streamview.cc',
149 'midi_velocity_dialog.cc',
150 'missing_file_dialog.cc',
151 'missing_plugin_dialog.cc',
153 'mixer_group_tabs.cc',
156 'monitor_section.cc',
158 'mono_panner_editor.cc',
161 'new_plugin_preset_dialog.cc',
162 'normalize_dialog.cc',
170 'panner_interface.cc',
172 'piano_roll_header.cc',
174 'playlist_selector.cc',
176 'plugin_selector.cc',
181 'port_matrix_body.cc',
182 'port_matrix_column_labels.cc',
183 'port_matrix_component.cc',
184 'port_matrix_grid.cc',
185 'port_matrix_labels.cc',
186 'port_matrix_row_labels.cc',
188 'patch_change_dialog.cc',
189 'progress_reporter.cc',
192 'quantize_dialog.cc',
193 'rc_option_editor.cc',
195 'region_gain_line.cc',
196 'region_layering_order_editor.cc',
197 'region_selection.cc',
201 'route_group_dialog.cc',
202 'route_group_menu.cc',
203 'route_params_ui.cc',
204 'route_processor_selection.cc',
205 'route_time_axis.cc',
207 'search_path_option.cc',
210 'session_import_dialog.cc',
211 'session_metadata_dialog.cc',
212 'session_option_editor.cc',
214 'shuttle_control.cc',
223 'stereo_panner_editor.cc',
225 'strip_silence_dialog.cc',
226 'tape_region_view.cc',
231 'time_axis_view_item.cc',
235 'track_selection.cc',
236 'track_view_list.cc',
237 'transpose_dialog.cc',
242 'visibility_group.cc',
243 'volume_controller.cc',
246 # video-timeline related sources:
247 'video_image_frame.cc',
248 'add_video_dialog.cc',
249 'editor_videotimeline.cc',
253 'transcode_ffmpeg.cc',
254 'transcode_video_dialog.cc',
255 'video_server_dialog.cc',
257 'export_video_dialog.cc',
258 'export_video_infobox.cc'
262 autowaf.set_options(opt)
266 conf.load('compiler_cxx')
267 autowaf.build_version_files(
268 path_prefix + 'version.h',
269 path_prefix + 'version.cc',
270 'gtk2_ardour', MAJOR, MINOR, MICRO)
271 autowaf.configure(conf)
273 if re.search ("linux", sys.platform) != None:
274 autowaf.check_pkg(conf, 'alsa', uselib_store='ALSA')
276 # TODO: Insert a sanity check for on OS X to ensure CoreAudio is present
278 autowaf.check_pkg(conf, 'flac', uselib_store='FLAC',
279 atleast_version='1.2.1')
280 autowaf.check_pkg(conf, 'gthread-2.0', uselib_store='GTHREAD',
281 atleast_version='2.10.1')
282 autowaf.check_pkg(conf, 'gtk+-2.0', uselib_store='GTK',
283 atleast_version='2.18')
284 autowaf.check_pkg(conf, 'gtkmm-2.4', uselib_store='GTKMM',
285 atleast_version='2.18')
286 autowaf.check_pkg(conf, 'libgnomecanvas-2.0',
287 uselib_store='GNOMECANVAS', atleast_version='2.30')
288 autowaf.check_pkg(conf, 'libgnomecanvasmm-2.6',
289 uselib_store='GNOMECANVASMM', atleast_version='2.16')
290 autowaf.check_pkg(conf, 'ogg', uselib_store='OGG', atleast_version='1.1.2')
291 autowaf.check_pkg(conf, 'x11', uselib_store='X11', atleast_version='1.1', mandatory=False)
292 autowaf.check_pkg(conf, 'fontconfig', uselib_store='FONTCONFIG')
294 conf.write_config_header('gtk2ardour-config.h', remove=False)
297 autowaf.check_header(conf, 'cxx', 'boost/shared_ptr.hpp')
298 autowaf.check_header(conf, 'cxx', 'boost/weak_ptr.hpp')
300 # Add a waf `feature' to allow compilation of things using winegcc
301 from waflib.TaskGen import feature
303 def set_winegcc(self):
304 self.env.LINK_CXX = self.env.LINK_CC = 'wineg++'
305 self.env.CC = 'winegcc'
307 def _doPyp(infileName, deps = False):
310 re_spaces = re.compile("\s+")
312 if infileName == '-':
315 fd = open(infileName)
316 inLines = fd.readlines()
322 bits = re_spaces.split(line)
323 if bits[0] == '##include':
328 # assume included file comes from same place as source file
329 incName = os.path.join (os.path.dirname (infileName), incName);
330 outStr += _doPyp(incName)
341 def include_processor(task):
342 infileName = task.inputs[0].srcpath()
343 outfileName = os.path.join(out, task.outputs[0].bldpath())
344 fdOut = open (outfileName, "w")
345 fdOut.write (_doPyp(infileName))
349 def build_color_scheme(path, prefix):
353 if re.search ('^#@color', line):
354 line.strip() # remove newline
356 if len(color_scheme):
358 color_scheme += prefix
360 color_scheme += words[1]
362 color_scheme += words[2]
368 if bld.is_defined('WINDOWS_VST_SUPPORT'):
369 # If we require VST support we build a stub main() and the FST library
370 # here using winegcc, and link it to the GTK front-end library
371 obj = bld(features = 'cxx c cxxprogram wine')
374 ../libs/fst/fstinfofile.c
380 obj.use = [ 'libpbd',
388 obj.target = 'ardour-3.0-vst.exe.so'
389 obj.includes = [ '../libs/fst', '.' ]
390 obj.linkflags = ['-mwindows', '-Wl,--export-dynamic']
391 obj.defines = ['_POSIX_SOURCE', 'USE_WS_PREFIX']
392 obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
393 # end of the wine executable
395 # now the shared library containing the GTK GUI for ardour
396 obj = bld (features = 'cxx c cxxshlib')
397 obj.source = gtk2_ardour_sources
398 obj.includes = [ '../libs/fst', '.' ]
399 obj.name = 'libgtk2_ardour'
400 obj.target = 'gtk2_ardour'
402 # just the normal executable version of the GTK GUI
403 obj = bld(features = 'cxx c cxxprogram')
404 obj.source = gtk2_ardour_sources
405 obj.target = 'ardour-3.0'
408 # continue with setup of obj, which could be a shared library
411 obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
413 obj.uselib = 'UUID FLAC FONTCONFIG GLIBMM GTHREAD GTK OGG ALSA CURL DL'
414 obj.uselib += ' GTKMM GNOMECANVASMM GNOMECANVAS '
415 obj.uselib += ' AUDIOUNITS OSX GTKOSX LO '
416 obj.use = [ 'libpbd',
423 if sys.platform == 'darwin':
424 obj.use += ' libappleutility'
426 'PACKAGE="' + I18N_PACKAGE + '"',
427 'VERSIONSTRING="' + bld.env['VERSION'] + '"',
428 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
429 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
430 'LOCALEDIR="' + os.path.join(os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
431 'PROGRAM_NAME="' + bld.env['PROGRAM_NAME'] + '"'
433 obj.includes += ['../libs']
435 if bld.is_defined('HAVE_SUIL'):
436 obj.source += [ 'lv2_plugin_ui.cc' ]
437 obj.use += [ 'SUIL' ]
439 if bld.is_defined('FREESOUND'):
440 obj.source += [ 'sfdb_freesound_mootcher.cc' ]
441 obj.defines += [ 'FREESOUND' ]
443 if bld.is_defined('NEED_INTL'):
444 obj.linkflags = ' -lintl'
446 if bld.is_defined('WINDOWS_VST_SUPPORT'):
447 obj.source += [ 'windows_vst_plugin_ui.cc' ]
448 obj.defines += [ 'WINDOWS_VST_SUPPORT' ]
451 if bld.is_defined('LXVST_SUPPORT'):
452 obj.source += [ 'linux_vst_gui_support.cc', 'lxvst_plugin_ui.cc' ]
453 obj.defines += [ 'LXVST_SUPPORT' ]
456 if bld.is_defined('WINDOWS_VST_SUPPORT') or bld.is_defined('LXVST_SUPPORT'):
457 obj.source += [ 'vst_plugin_ui.cc' ]
459 if bld.is_defined('PHONE_HOME'):
460 obj.defines += [ 'PHONE_HOME' ]
462 if bld.is_defined('HAVE_COREAUDIO'):
463 TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cc']
464 obj.source += [ 'cocoacarbon.mm' ]
465 obj.use += ' libappleutility '
467 if bld.is_defined('AUDIOUNIT_SUPPORT'):
468 obj.source += [ 'au_pluginui.mm' ]
472 wrapper_subst_dict = {
473 'INSTALL_PREFIX' : bld.env['PREFIX'],
474 'LIBDIR' : os.path.normpath(bld.env['LIBDIR']),
475 'DATADIR' : os.path.normpath(bld.env['DATADIR']),
476 'SYSCONFDIR' : os.path.normpath(bld.env['SYSCONFDIR']),
477 'LIBS' : 'build/libs',
479 'EXECUTABLE' : 'build/gtk2_ardour/ardour-3.0'
482 def set_subst_dict(obj, dict):
484 setattr(obj, i, dict[i])
486 obj = bld(features = 'subst', rule= 'chmod 0755 ${TGT}')
487 obj.source = 'ardev_common.sh.in'
488 obj.target = 'ardev_common_waf.sh'
489 obj.chmod = Utils.O755
490 obj.dict = wrapper_subst_dict
491 set_subst_dict(obj, wrapper_subst_dict)
493 obj = bld(features = 'subst')
494 obj.source = 'ardour.sh.in'
495 obj.target = 'ardour3'
496 obj.chmod = Utils.O755
497 obj.dict = wrapper_subst_dict
498 obj.install_path = bld.env['BINDIR']
499 set_subst_dict(obj, wrapper_subst_dict)
501 if bld.is_defined('WINDOWS_VST_SUPPORT'):
502 obj = bld(features = 'subst')
503 obj.source = '../vst/ardourvst.in'
504 obj.target = 'ardourvst3'
505 obj.chmod = Utils.O755
506 obj.dict = wrapper_subst_dict
507 obj.install_path = bld.env['BINDIR']
508 set_subst_dict(obj, wrapper_subst_dict)
512 dark_rc_subst_dict = {}
513 light_rc_subst_dict = {}
518 if bld.is_defined('GTKOSX'): # OS X fonts
531 # There is no acceptable monospace font available on older versions of OS X
532 # and no API on those versions to load TTF files that will work with
533 # GTK/fontconfig/pango.
535 # In addition, the ArdourMono font gets clipped for some reason on OS X
537 # Moreover, Lucida Grande just seems to work even though it is not monospace
541 'MONOSPACE' : 'Lucida Grande',
543 else: # Linux/X11 fonts
544 basefont = '' # unspecified - use system defaults
556 'MONOSPACE' : 'ArdourMono',
559 # Set up font substitution dictionary
561 for style in ['', 'BOLD', 'ITALIC']:
562 for sizename,points in iter(font_sizes.items()):
564 key = "_".join (['FONT',style,sizename])
565 fontstyle = " ".join ([basefont,style.lower(),points])
567 key = "_".join (['FONT',sizename])
568 fontstyle = " ".join ([basefont,points])
570 dark_rc_subst_dict[key] = fontstyle
571 light_rc_subst_dict[key] = fontstyle
574 for sizename,points in iter(font_sizes.items()):
575 key = "_".join (['FONT_SIZE',sizename])
576 dark_rc_subst_dict[key] = points
577 light_rc_subst_dict[key] = points
579 # various font names, eg @BOLD_MONOSPACE@
580 for font_sym,text in iter(font_names.items()):
582 dark_rc_subst_dict[key] = text
583 light_rc_subst_dict[key] = text
586 dark_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
587 'gtk2_ardour/ardour3_ui_dark.rc.in', 'ARDOUR_DARK')
588 dark_rc_subst_dict['COLPREFIX'] = 'ARDOUR_DARK'
589 light_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
590 'gtk2_ardour/ardour3_ui_light.rc.in', 'ARDOUR_LIGHT')
591 light_rc_subst_dict['COLPREFIX'] = 'ARDOUR_LIGHT'
593 obj = bld(features = 'subst')
594 obj.source = [ 'ardour3_ui_dark.rc.in' ]
595 obj.target = 'ardour3_ui_dark.rc.pre'
596 obj.install_path = None
597 set_subst_dict(obj, dark_rc_subst_dict)
599 obj = bld(features = 'subst')
600 obj.source = [ 'ardour3_ui_light.rc.in' ]
601 obj.target = 'ardour3_ui_light.rc.pre'
602 obj.install_path = None
603 set_subst_dict(obj, light_rc_subst_dict)
605 obj = bld(features = 'subst')
606 obj.source = [ 'ardour3_styles.rc.in' ]
607 obj.target = 'ardour3_dark_styles.rc'
608 obj.install_path = None
609 set_subst_dict(obj, dark_rc_subst_dict)
611 obj = bld(features = 'subst')
612 obj.source = [ 'ardour3_styles.rc.in' ]
613 obj.target = 'ardour3_light_styles.rc'
614 obj.install_path = None
615 set_subst_dict(obj, light_rc_subst_dict)
617 obj = bld(features = 'subst')
618 obj.source = [ 'ardour3_fonts.rc.in' ]
619 obj.target = 'ardour3_dark_fonts.rc'
620 obj.install_path = None
621 set_subst_dict(obj, dark_rc_subst_dict)
623 obj = bld(features = 'subst')
624 obj.source = [ 'ardour3_fonts.rc.in' ]
625 obj.target = 'ardour3_light_fonts.rc'
626 obj.install_path = None
627 set_subst_dict(obj, light_rc_subst_dict)
629 obj = bld(rule = 'cp ${SRC} ${TGT}')
630 obj.source = [ 'ardour3_widget_list.rc' ]
631 obj.target = 'ardour3_widgets.rc'
632 obj.install_path = None
634 obj = bld (rule = include_processor)
635 obj.source = [ 'ardour3_ui_dark.rc.pre' ]
636 # find and add all ##include dependencies as sources
637 obj.source += _doPyp (bld.path.find_resource ('ardour3_ui_dark.rc.in').srcpath(), True)
638 obj.target = 'ardour3_ui_dark.rc'
639 obj.install_path = '${SYSCONFDIR}/ardour3'
641 obj = bld (rule = include_processor)
642 obj.source = [ 'ardour3_ui_light.rc.pre' ]
643 # find and add all ##include dependencies as sources
644 obj.source += _doPyp (bld.path.find_resource ('ardour3_ui_light.rc.in').srcpath(), True)
645 obj.target = 'ardour3_ui_light.rc'
646 obj.install_path = '${SYSCONFDIR}/ardour3'
650 if bld.is_defined('GTKOSX'):
651 menus_argv = [ '-E', '-P', '-DGTKOSX' ]
653 menus_argv = [ '-E', '-P' ]
655 obj = bld(features = 'command-output')
657 obj.command_is_external = True
659 obj.argv = menus_argv
660 obj.stdin = 'ardour.menus.in'
661 obj.stdout = 'ardour.menus'
662 obj.dep_vars = ['GTKOSX']
663 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
668 # 'SAE-de-keypad', 'SAE-de-nokeypad', 'SAE-us-keypad',
669 # 'SAE-us-nokeypad', 'ergonomic-us'
671 for b in [ 'mnemonic-us' ] :
673 target = b + '.bindings',
674 source = b + '.bindings.in',
675 rule = '../tools/fmt-bindings --platform="%s" --winkey="%s" --accelmap <${SRC} >${TGT}' % (sys.platform, bld.env['WINDOWS_KEY'] )
677 obj.install_path = os.path.join(bld.env['SYSCONFDIR'], 'ardour3')
679 # not modified at present
680 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
681 'step_editing.bindings')
682 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
686 bld.install_files('${DATADIR}/ardour3/icons', bld.path.ant_glob('icons/*.png'))
687 bld.install_files('${DATADIR}/ardour3/pixmaps', bld.path.ant_glob('pixmaps/*.xpm'))
688 bld.install_files('${DATADIR}/ardour3', 'splash.png')
689 bld.install_files('${DATADIR}/ardour3', 'ArdourMono.ttf')
691 # Default UI configuration
692 bld.install_files('${SYSCONFDIR}/ardour3', 'ardour3_ui_default.conf')
694 # Default export stuff
695 bld.install_files('${SYSCONFDIR}/ardour3/export', bld.path.ant_glob('export/*.format'))
698 if bld.is_defined('ENABLE_NLS'):
699 mo_files = bld.path.ant_glob('po/*.mo')
701 lang = os.path.basename(mo.srcpath()).replace('.mo', '')
702 bld.install_as(os.path.join(bld.env['PREFIX'], 'share', 'locale',
703 lang, 'LC_MESSAGES', I18N_PACKAGE + '.mo'),
707 autowaf.build_i18n(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
711 autowaf.build_i18n_pot(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
715 autowaf.build_i18n_po(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
719 autowaf.build_i18n_mo(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,