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',
249 autowaf.set_options(opt)
253 conf.load('compiler_cxx')
254 autowaf.build_version_files(
255 path_prefix + 'version.h',
256 path_prefix + 'version.cc',
257 'gtk2_ardour', MAJOR, MINOR, MICRO)
258 autowaf.configure(conf)
260 if re.search ("linux", sys.platform) != None:
261 autowaf.check_pkg(conf, 'alsa', uselib_store='ALSA')
263 # TODO: Insert a sanity check for on OS X to ensure CoreAudio is present
265 autowaf.check_pkg(conf, 'flac', uselib_store='FLAC',
266 atleast_version='1.2.1')
267 autowaf.check_pkg(conf, 'gthread-2.0', uselib_store='GTHREAD',
268 atleast_version='2.10.1')
269 autowaf.check_pkg(conf, 'gtk+-2.0', uselib_store='GTK',
270 atleast_version='2.18')
271 autowaf.check_pkg(conf, 'gtkmm-2.4', uselib_store='GTKMM',
272 atleast_version='2.18')
273 autowaf.check_pkg(conf, 'libgnomecanvas-2.0',
274 uselib_store='GNOMECANVAS', atleast_version='2.30')
275 autowaf.check_pkg(conf, 'libgnomecanvasmm-2.6',
276 uselib_store='GNOMECANVASMM', atleast_version='2.16')
277 autowaf.check_pkg(conf, 'ogg', uselib_store='OGG', atleast_version='1.1.2')
278 autowaf.check_pkg(conf, 'x11', uselib_store='X11', atleast_version='1.1', mandatory=False)
279 autowaf.check_pkg(conf, 'fontconfig', uselib_store='FONTCONFIG')
281 conf.write_config_header('gtk2ardour-config.h', remove=False)
284 autowaf.check_header(conf, 'cxx', 'boost/shared_ptr.hpp')
285 autowaf.check_header(conf, 'cxx', 'boost/weak_ptr.hpp')
287 # Add a waf `feature' to allow compilation of things using winegcc
288 from waflib.TaskGen import feature
290 def set_winegcc(self):
291 self.env.LINK_CXX = self.env.LINK_CC = 'wineg++'
292 self.env.CC = 'winegcc'
294 def _doPyp(infileName, deps = False):
297 re_spaces = re.compile("\s+")
299 if infileName == '-':
302 fd = open(infileName)
303 inLines = fd.readlines()
309 bits = re_spaces.split(line)
310 if bits[0] == '##include':
315 # assume included file comes from same place as source file
316 incName = os.path.join (os.path.dirname (infileName), incName);
317 outStr += _doPyp(incName)
328 def include_processor(task):
329 infileName = task.inputs[0].srcpath()
330 outfileName = os.path.join(out, task.outputs[0].bldpath())
331 fdOut = open (outfileName, "w")
332 fdOut.write (_doPyp(infileName))
336 def build_color_scheme(path, prefix):
340 if re.search ('^#@color', line):
341 line.strip() # remove newline
343 if len(color_scheme):
345 color_scheme += prefix
347 color_scheme += words[1]
349 color_scheme += words[2]
355 if bld.is_defined('WINDOWS_VST_SUPPORT'):
356 # If we require VST support we build a stub main() and the FST library
357 # here using winegcc, and link it to the GTK front-end library
358 obj = bld(features = 'cxx c cxxprogram wine')
361 ../libs/fst/fstinfofile.c
367 obj.use = [ 'libpbd',
375 obj.target = 'ardour-3.0-vst.exe.so'
376 obj.includes = [ '../libs/fst', '.' ]
377 obj.linkflags = ['-mwindows', '-Wl,--export-dynamic']
378 obj.defines = ['_POSIX_SOURCE', 'USE_WS_PREFIX']
379 obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
380 # end of the wine executable
382 # now the shared library containing the GTK GUI for ardour
383 obj = bld (features = 'cxx c cxxshlib')
384 obj.source = gtk2_ardour_sources
385 obj.includes = [ '../libs/fst', '.' ]
386 obj.name = 'libgtk2_ardour'
387 obj.target = 'gtk2_ardour'
389 # just the normal executable version of the GTK GUI
390 obj = bld(features = 'cxx c cxxprogram')
391 obj.source = gtk2_ardour_sources
392 obj.target = 'ardour-3.0'
395 # continue with setup of obj, which could be a shared library
398 obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
400 obj.uselib = 'UUID FLAC FONTCONFIG GLIBMM GTHREAD GTK OGG ALSA CURL DL'
401 obj.uselib += ' GTKMM GNOMECANVASMM GNOMECANVAS '
402 obj.uselib += ' AUDIOUNITS OSX GTKOSX LO '
403 obj.use = [ 'libpbd',
410 if sys.platform == 'darwin':
411 obj.use += ' libappleutility'
413 'PACKAGE="' + I18N_PACKAGE + '"',
414 'VERSIONSTRING="' + bld.env['VERSION'] + '"',
415 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
416 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
417 'LOCALEDIR="' + os.path.join(os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
418 'PROGRAM_NAME="' + bld.env['PROGRAM_NAME'] + '"'
420 obj.includes += ['../libs']
422 if bld.env['VIDEOTIMELINE']:
424 'video_image_frame.cc',
425 'add_video_dialog.cc',
426 'editor_videotimeline.cc',
430 'open_video_monitor_dialog.cc',
431 'transcode_ffmpeg.cc',
432 'transcode_video_dialog.cc',
433 'video_server_dialog.cc',
435 'export_video_dialog.cc',
436 'export_video_infobox.cc'
439 if bld.is_defined('HAVE_SUIL'):
440 obj.source += [ 'lv2_plugin_ui.cc' ]
441 obj.use += [ 'SUIL' ]
443 if bld.is_defined('FREESOUND'):
444 obj.source += [ 'sfdb_freesound_mootcher.cc' ]
445 obj.defines += [ 'FREESOUND' ]
447 if bld.is_defined('NEED_INTL'):
448 obj.linkflags = ' -lintl'
450 if bld.is_defined('WINDOWS_VST_SUPPORT'):
451 obj.source += [ 'windows_vst_plugin_ui.cc' ]
452 obj.defines += [ 'WINDOWS_VST_SUPPORT' ]
455 if bld.is_defined('LXVST_SUPPORT'):
456 obj.source += [ 'linux_vst_gui_support.cc', 'lxvst_plugin_ui.cc' ]
457 obj.defines += [ 'LXVST_SUPPORT' ]
460 if bld.is_defined('WINDOWS_VST_SUPPORT') or bld.is_defined('LXVST_SUPPORT'):
461 obj.source += [ 'vst_plugin_ui.cc' ]
463 if bld.is_defined('PHONE_HOME'):
464 obj.defines += [ 'PHONE_HOME' ]
466 if bld.is_defined('HAVE_COREAUDIO'):
467 TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cc']
468 obj.source += [ 'cocoacarbon.mm' ]
469 obj.use += ' libappleutility '
471 if bld.is_defined('AUDIOUNIT_SUPPORT'):
472 obj.source += [ 'au_pluginui.mm' ]
476 wrapper_subst_dict = {
477 'INSTALL_PREFIX' : bld.env['PREFIX'],
478 'LIBDIR' : os.path.normpath(bld.env['LIBDIR']),
479 'DATADIR' : os.path.normpath(bld.env['DATADIR']),
480 'SYSCONFDIR' : os.path.normpath(bld.env['SYSCONFDIR']),
481 'LIBS' : 'build/libs',
483 'EXECUTABLE' : 'build/gtk2_ardour/ardour-3.0'
486 def set_subst_dict(obj, dict):
488 setattr(obj, i, dict[i])
490 obj = bld(features = 'subst', rule= 'chmod 0755 ${TGT}')
491 obj.source = 'ardev_common.sh.in'
492 obj.target = 'ardev_common_waf.sh'
493 obj.chmod = Utils.O755
494 obj.dict = wrapper_subst_dict
495 set_subst_dict(obj, wrapper_subst_dict)
497 obj = bld(features = 'subst')
498 obj.source = 'ardour.sh.in'
499 obj.target = 'ardour3'
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)
505 if bld.is_defined('WINDOWS_VST_SUPPORT'):
506 obj = bld(features = 'subst')
507 obj.source = '../vst/ardourvst.in'
508 obj.target = 'ardourvst3'
509 obj.chmod = Utils.O755
510 obj.dict = wrapper_subst_dict
511 obj.install_path = bld.env['BINDIR']
512 set_subst_dict(obj, wrapper_subst_dict)
516 dark_rc_subst_dict = {}
517 light_rc_subst_dict = {}
522 if bld.is_defined('GTKOSX'): # OS X fonts
535 # There is no acceptable monospace font available on older versions of OS X
536 # and no API on those versions to load TTF files that will work with
537 # GTK/fontconfig/pango.
539 # In addition, the ArdourMono font gets clipped for some reason on OS X
541 # Moreover, Lucida Grande just seems to work even though it is not monospace
545 'MONOSPACE' : 'Lucida Grande',
547 else: # Linux/X11 fonts
548 basefont = '' # unspecified - use system defaults
560 'MONOSPACE' : 'ArdourMono',
563 # Set up font substitution dictionary
565 for style in ['', 'BOLD', 'ITALIC']:
566 for sizename,points in iter(font_sizes.items()):
568 key = "_".join (['FONT',style,sizename])
569 fontstyle = " ".join ([basefont,style.lower(),points])
571 key = "_".join (['FONT',sizename])
572 fontstyle = " ".join ([basefont,points])
574 dark_rc_subst_dict[key] = fontstyle
575 light_rc_subst_dict[key] = fontstyle
578 for sizename,points in iter(font_sizes.items()):
579 key = "_".join (['FONT_SIZE',sizename])
580 dark_rc_subst_dict[key] = points
581 light_rc_subst_dict[key] = points
583 # various font names, eg @BOLD_MONOSPACE@
584 for font_sym,text in iter(font_names.items()):
586 dark_rc_subst_dict[key] = text
587 light_rc_subst_dict[key] = text
590 dark_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
591 'gtk2_ardour/ardour3_ui_dark.rc.in', 'ARDOUR_DARK')
592 dark_rc_subst_dict['COLPREFIX'] = 'ARDOUR_DARK'
593 light_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
594 'gtk2_ardour/ardour3_ui_light.rc.in', 'ARDOUR_LIGHT')
595 light_rc_subst_dict['COLPREFIX'] = 'ARDOUR_LIGHT'
597 obj = bld(features = 'subst')
598 obj.source = [ 'ardour3_ui_dark.rc.in' ]
599 obj.target = 'ardour3_ui_dark.rc.pre'
600 obj.install_path = None
601 set_subst_dict(obj, dark_rc_subst_dict)
603 obj = bld(features = 'subst')
604 obj.source = [ 'ardour3_ui_light.rc.in' ]
605 obj.target = 'ardour3_ui_light.rc.pre'
606 obj.install_path = None
607 set_subst_dict(obj, light_rc_subst_dict)
609 obj = bld(features = 'subst')
610 obj.source = [ 'ardour3_styles.rc.in' ]
611 obj.target = 'ardour3_dark_styles.rc'
612 obj.install_path = None
613 set_subst_dict(obj, dark_rc_subst_dict)
615 obj = bld(features = 'subst')
616 obj.source = [ 'ardour3_styles.rc.in' ]
617 obj.target = 'ardour3_light_styles.rc'
618 obj.install_path = None
619 set_subst_dict(obj, light_rc_subst_dict)
621 obj = bld(features = 'subst')
622 obj.source = [ 'ardour3_fonts.rc.in' ]
623 obj.target = 'ardour3_dark_fonts.rc'
624 obj.install_path = None
625 set_subst_dict(obj, dark_rc_subst_dict)
627 obj = bld(features = 'subst')
628 obj.source = [ 'ardour3_fonts.rc.in' ]
629 obj.target = 'ardour3_light_fonts.rc'
630 obj.install_path = None
631 set_subst_dict(obj, light_rc_subst_dict)
633 obj = bld(rule = 'cp ${SRC} ${TGT}')
634 obj.source = [ 'ardour3_widget_list.rc' ]
635 obj.target = 'ardour3_widgets.rc'
636 obj.install_path = None
638 obj = bld (rule = include_processor)
639 obj.source = [ 'ardour3_ui_dark.rc.pre' ]
640 # find and add all ##include dependencies as sources
641 obj.source += _doPyp (bld.path.find_resource ('ardour3_ui_dark.rc.in').srcpath(), True)
642 obj.target = 'ardour3_ui_dark.rc'
643 obj.install_path = '${SYSCONFDIR}/ardour3'
645 obj = bld (rule = include_processor)
646 obj.source = [ 'ardour3_ui_light.rc.pre' ]
647 # find and add all ##include dependencies as sources
648 obj.source += _doPyp (bld.path.find_resource ('ardour3_ui_light.rc.in').srcpath(), True)
649 obj.target = 'ardour3_ui_light.rc'
650 obj.install_path = '${SYSCONFDIR}/ardour3'
654 if bld.is_defined('GTKOSX'):
655 menus_argv = [ '-E', '-P', '-DGTKOSX' ]
657 menus_argv = [ '-E', '-P' ]
659 if bld.env['VIDEOTIMELINE']:
660 menus_argv.append ('-DWITH_VIDEOTIMELINE')
661 obj = bld(features = 'command-output')
663 obj.command_is_external = True
665 obj.argv = menus_argv
666 obj.stdin = 'ardour.menus.in'
667 obj.stdout = 'ardour.menus'
668 obj.dep_vars = ['GTKOSX', 'VIDEOTIMELINE']
669 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
674 # 'SAE-de-keypad', 'SAE-de-nokeypad', 'SAE-us-keypad',
675 # 'SAE-us-nokeypad', 'ergonomic-us'
677 for b in [ 'mnemonic-us' ] :
679 target = b + '.bindings',
680 source = b + '.bindings.in',
681 rule = '../tools/fmt-bindings --platform="%s" --winkey="%s" --accelmap <${SRC} >${TGT}' % (sys.platform, bld.env['WINDOWS_KEY'] )
683 obj.install_path = os.path.join(bld.env['SYSCONFDIR'], 'ardour3')
685 # not modified at present
686 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
687 'step_editing.bindings')
688 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
692 bld.install_files('${DATADIR}/ardour3/icons', bld.path.ant_glob('icons/*.png'))
693 bld.install_files('${DATADIR}/ardour3/pixmaps', bld.path.ant_glob('pixmaps/*.xpm'))
694 bld.install_files('${DATADIR}/ardour3', 'splash.png')
695 bld.install_files('${DATADIR}/ardour3', 'ArdourMono.ttf')
697 # Default UI configuration
698 bld.install_files('${SYSCONFDIR}/ardour3', 'ardour3_ui_default.conf')
700 # Default export stuff
701 bld.install_files('${SYSCONFDIR}/ardour3/export', bld.path.ant_glob('export/*.format'))
704 if bld.is_defined('ENABLE_NLS'):
705 mo_files = bld.path.ant_glob('po/*.mo')
707 lang = os.path.basename(mo.srcpath()).replace('.mo', '')
708 bld.install_as(os.path.join(bld.env['PREFIX'], 'share', 'locale',
709 lang, 'LC_MESSAGES', I18N_PACKAGE + '.mo'),
713 autowaf.build_i18n(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
717 autowaf.build_i18n_pot(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
721 autowaf.build_i18n_po(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
725 autowaf.build_i18n_mo(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,