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',
55 'big_clock_window.cc',
61 'control_point_dialog.cc',
64 'edit_note_dialog.cc',
68 'editor_audio_import.cc',
69 'editor_audiotrack.cc',
71 'editor_canvas_events.cc',
72 'editor_component.cc',
75 'editor_route_groups.cc',
76 'editor_export_audio.cc',
77 'editor_group_tabs.cc',
79 'editor_locations.cc',
87 'editor_selection.cc',
88 'editor_snapshots.cc',
90 'editor_tempodisplay.cc',
94 'export_channel_selector.cc',
96 'export_file_notebook.cc',
97 'export_filename_selector.cc',
98 'export_format_dialog.cc',
99 'export_format_selector.cc',
100 'export_preset_selector.cc',
101 'export_timespan_selector.cc',
106 'generic_pluginui.cc',
108 'global_port_matrix.cc',
110 'gtk-custom-hruler.c',
111 'gtk-custom-ruler.c',
112 'gtk_pianokeyboard.c',
114 'insert_time_dialog.cc',
115 'interthread_progress_window.cc',
127 'midi_automation_line.cc',
128 'midi_channel_dialog.cc',
129 'midi_channel_selector.cc',
130 'midi_cut_buffer.cc',
131 'midi_export_dialog.cc',
132 'midi_list_editor.cc',
133 'midi_port_dialog.cc',
134 'midi_region_view.cc',
137 'midi_streamview.cc',
140 'midi_velocity_dialog.cc',
141 'missing_file_dialog.cc',
142 'missing_plugin_dialog.cc',
144 'mixer_group_tabs.cc',
147 'monitor_section.cc',
149 'mono_panner_editor.cc',
152 'new_plugin_preset_dialog.cc',
153 'normalize_dialog.cc',
163 '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',
215 'stereo_panner_editor.cc',
217 'strip_silence_dialog.cc',
219 'tape_region_view.cc',
224 'time_axis_view_item.cc',
228 'track_selection.cc',
229 'track_view_list.cc',
230 'transpose_dialog.cc',
235 'visibility_group.cc',
236 'volume_controller.cc',
238 # video-timeline related sources:
239 'video_image_frame.cc',
240 'add_video_dialog.cc',
241 'editor_videotimeline.cc',
245 'transcode_ffmpeg.cc',
246 'transcode_video_dialog.cc',
247 'video_server_dialog.cc',
249 'export_video_dialog.cc',
250 'export_video_infobox.cc'
254 autowaf.set_options(opt)
258 conf.load('compiler_cxx')
259 autowaf.build_version_files(
260 path_prefix + 'version.h',
261 path_prefix + 'version.cc',
262 'gtk2_ardour', MAJOR, MINOR, MICRO)
263 autowaf.configure(conf)
265 if re.search ("linux", sys.platform) != None:
266 autowaf.check_pkg(conf, 'alsa', uselib_store='ALSA')
268 # TODO: Insert a sanity check for on OS X to ensure CoreAudio is present
270 autowaf.check_pkg(conf, 'flac', uselib_store='FLAC',
271 atleast_version='1.2.1')
272 autowaf.check_pkg(conf, 'gthread-2.0', uselib_store='GTHREAD',
273 atleast_version='2.10.1')
274 autowaf.check_pkg(conf, 'gtk+-2.0', uselib_store='GTK',
275 atleast_version='2.18')
276 autowaf.check_pkg(conf, 'gtkmm-2.4', uselib_store='GTKMM',
277 atleast_version='2.18')
278 autowaf.check_pkg(conf, 'ogg', uselib_store='OGG', atleast_version='1.1.2')
279 autowaf.check_pkg(conf, 'x11', uselib_store='X11', atleast_version='1.1', mandatory=False)
280 autowaf.check_pkg(conf, 'fontconfig', uselib_store='FONTCONFIG')
282 conf.write_config_header('gtk2ardour-config.h', remove=False)
285 autowaf.check_header(conf, 'cxx', 'boost/shared_ptr.hpp')
286 autowaf.check_header(conf, 'cxx', 'boost/weak_ptr.hpp')
288 # Add a waf `feature' to allow compilation of things using winegcc
289 from waflib.TaskGen import feature
291 def set_winegcc(self):
292 self.env.LINK_CXX = self.env.LINK_CC = 'wineg++'
293 self.env.CC = 'winegcc'
295 def _doPyp(infileName, deps = False):
298 re_spaces = re.compile("\s+")
300 if infileName == '-':
303 fd = open(infileName)
304 inLines = fd.readlines()
310 bits = re_spaces.split(line)
311 if bits[0] == '##include':
316 # assume included file comes from same place as source file
317 incName = os.path.join (os.path.dirname (infileName), incName);
318 outStr += _doPyp(incName)
329 def include_processor(task):
330 infileName = task.inputs[0].srcpath()
331 outfileName = os.path.join(out, task.outputs[0].bldpath())
332 fdOut = open (outfileName, "w")
333 fdOut.write (_doPyp(infileName))
337 def build_color_scheme(path, prefix):
341 if re.search ('^#@color', line):
342 line.strip() # remove newline
344 if len(color_scheme):
346 color_scheme += prefix
348 color_scheme += words[1]
350 color_scheme += words[2]
356 if bld.is_defined('WINDOWS_VST_SUPPORT'):
357 # If we require VST support we build a stub main() and the FST library
358 # here using winegcc, and link it to the GTK front-end library
359 obj = bld(features = 'cxx c cxxprogram wine')
362 ../libs/fst/fstinfofile.c
368 obj.use = [ 'libpbd',
378 obj.target = 'ardour-3.0-vst.exe.so'
379 obj.includes = [ '../libs/fst', '.' ]
380 obj.linkflags = ['-mwindows', '-Wl,--export-dynamic']
381 obj.defines = ['_POSIX_SOURCE', 'USE_WS_PREFIX']
382 obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
383 # end of the wine executable
385 # now the shared library containing the GTK GUI for ardour
386 obj = bld (features = 'cxx c cxxshlib')
387 obj.source = gtk2_ardour_sources
388 obj.includes = [ '../libs/fst', '.' ]
389 obj.name = 'libgtk2_ardour'
390 obj.target = 'gtk2_ardour'
392 # just the normal executable version of the GTK GUI
393 obj = bld(features = 'cxx c cxxprogram')
394 obj.source = gtk2_ardour_sources
395 obj.target = 'ardour-3.0'
398 # continue with setup of obj, which could be a shared library
401 obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
403 obj.uselib = 'UUID FLAC FONTCONFIG GLIBMM GTHREAD GTK OGG ALSA CURL DL GTKMM LO'
404 obj.use = [ 'libpbd',
413 if sys.platform == 'darwin':
414 obj.uselib += ' AUDIOUNITS OSX GTKOSX'
415 obj.use += ' libappleutility'
417 'PACKAGE="' + I18N_PACKAGE + '"',
418 'VERSIONSTRING="' + bld.env['VERSION'] + '"',
419 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
420 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
421 'LOCALEDIR="' + os.path.join(os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
422 'PROGRAM_NAME="' + bld.env['PROGRAM_NAME'] + '"'
424 obj.includes += ['../libs']
426 if bld.is_defined('HAVE_SUIL'):
427 obj.source += [ 'lv2_plugin_ui.cc' ]
428 obj.use += [ 'SUIL' ]
430 if bld.is_defined('FREESOUND'):
431 obj.source += [ 'sfdb_freesound_mootcher.cc' ]
432 obj.defines += [ 'FREESOUND' ]
434 if bld.is_defined('NEED_INTL'):
435 obj.linkflags = ' -lintl'
437 if bld.is_defined('WINDOWS_VST_SUPPORT'):
438 obj.source += [ 'windows_vst_plugin_ui.cc' ]
439 obj.defines += [ 'WINDOWS_VST_SUPPORT' ]
442 if bld.is_defined('LXVST_SUPPORT'):
443 obj.source += [ 'linux_vst_gui_support.cc', 'lxvst_plugin_ui.cc' ]
444 obj.defines += [ 'LXVST_SUPPORT' ]
447 if bld.is_defined('WINDOWS_VST_SUPPORT') or bld.is_defined('LXVST_SUPPORT'):
448 obj.source += [ 'vst_plugin_ui.cc' ]
450 if bld.is_defined('PHONE_HOME'):
451 obj.defines += [ 'PHONE_HOME' ]
453 if bld.is_defined('HAVE_COREAUDIO'):
454 TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cc']
455 obj.source += [ 'cocoacarbon.mm' ]
456 obj.use += ' libappleutility '
458 if bld.is_defined('AUDIOUNIT_SUPPORT'):
459 obj.source += [ 'au_pluginui.mm' ]
463 wrapper_subst_dict = {
464 'INSTALL_PREFIX' : bld.env['PREFIX'],
465 'LIBDIR' : os.path.normpath(bld.env['LIBDIR']),
466 'DATADIR' : os.path.normpath(bld.env['DATADIR']),
467 'SYSCONFDIR' : os.path.normpath(bld.env['SYSCONFDIR']),
468 'LIBS' : 'build/libs',
470 'EXECUTABLE' : 'build/gtk2_ardour/ardour-3.0'
473 def set_subst_dict(obj, dict):
475 setattr(obj, i, dict[i])
477 obj = bld(features = 'subst', rule= 'chmod 0755 ${TGT}')
478 obj.source = 'ardev_common.sh.in'
479 obj.target = 'ardev_common_waf.sh'
480 obj.chmod = Utils.O755
481 obj.dict = wrapper_subst_dict
482 set_subst_dict(obj, wrapper_subst_dict)
484 obj = bld(features = 'subst')
485 obj.source = 'ardour.sh.in'
486 obj.target = 'ardour3'
487 obj.chmod = Utils.O755
488 obj.dict = wrapper_subst_dict
489 obj.install_path = bld.env['BINDIR']
490 set_subst_dict(obj, wrapper_subst_dict)
492 if bld.is_defined('WINDOWS_VST_SUPPORT'):
493 obj = bld(features = 'subst')
494 obj.source = '../vst/ardourvst.in'
495 obj.target = 'ardourvst3'
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)
503 dark_rc_subst_dict = {}
504 light_rc_subst_dict = {}
509 if bld.is_defined('GTKOSX'): # OS X fonts
522 # There is no acceptable monospace font available on older versions of OS X
523 # and no API on those versions to load TTF files that will work with
524 # GTK/fontconfig/pango.
526 # In addition, the ArdourMono font gets clipped for some reason on OS X
528 # Moreover, Lucida Grande just seems to work even though it is not monospace
532 'MONOSPACE' : 'Lucida Grande',
534 else: # Linux/X11 fonts
535 basefont = '' # unspecified - use system defaults
547 'MONOSPACE' : 'ArdourMono',
550 # Set up font substitution dictionary
552 for style in ['', 'BOLD', 'ITALIC']:
553 for sizename,points in iter(font_sizes.items()):
555 key = "_".join (['FONT',style,sizename])
556 fontstyle = " ".join ([basefont,style.lower(),points])
558 key = "_".join (['FONT',sizename])
559 fontstyle = " ".join ([basefont,points])
561 dark_rc_subst_dict[key] = fontstyle
562 light_rc_subst_dict[key] = fontstyle
565 for sizename,points in iter(font_sizes.items()):
566 key = "_".join (['FONT_SIZE',sizename])
567 dark_rc_subst_dict[key] = points
568 light_rc_subst_dict[key] = points
570 # various font names, eg @BOLD_MONOSPACE@
571 for font_sym,text in iter(font_names.items()):
573 dark_rc_subst_dict[key] = text
574 light_rc_subst_dict[key] = text
577 dark_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
578 'gtk2_ardour/ardour3_ui_dark.rc.in', 'ARDOUR_DARK')
579 dark_rc_subst_dict['COLPREFIX'] = 'ARDOUR_DARK'
580 light_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
581 'gtk2_ardour/ardour3_ui_light.rc.in', 'ARDOUR_LIGHT')
582 light_rc_subst_dict['COLPREFIX'] = 'ARDOUR_LIGHT'
584 obj = bld(features = 'subst')
585 obj.source = [ 'ardour3_ui_dark.rc.in' ]
586 obj.target = 'ardour3_ui_dark.rc.pre'
587 obj.install_path = None
588 set_subst_dict(obj, dark_rc_subst_dict)
590 obj = bld(features = 'subst')
591 obj.source = [ 'ardour3_ui_light.rc.in' ]
592 obj.target = 'ardour3_ui_light.rc.pre'
593 obj.install_path = None
594 set_subst_dict(obj, light_rc_subst_dict)
596 obj = bld(features = 'subst')
597 obj.source = [ 'ardour3_styles.rc.in' ]
598 obj.target = 'ardour3_dark_styles.rc'
599 obj.install_path = None
600 set_subst_dict(obj, dark_rc_subst_dict)
602 obj = bld(features = 'subst')
603 obj.source = [ 'ardour3_styles.rc.in' ]
604 obj.target = 'ardour3_light_styles.rc'
605 obj.install_path = None
606 set_subst_dict(obj, light_rc_subst_dict)
608 obj = bld(features = 'subst')
609 obj.source = [ 'ardour3_fonts.rc.in' ]
610 obj.target = 'ardour3_dark_fonts.rc'
611 obj.install_path = None
612 set_subst_dict(obj, dark_rc_subst_dict)
614 obj = bld(features = 'subst')
615 obj.source = [ 'ardour3_fonts.rc.in' ]
616 obj.target = 'ardour3_light_fonts.rc'
617 obj.install_path = None
618 set_subst_dict(obj, light_rc_subst_dict)
620 obj = bld(rule = 'cp ${SRC} ${TGT}')
621 obj.source = [ 'ardour3_widget_list.rc' ]
622 obj.target = 'ardour3_widgets.rc'
623 obj.install_path = None
625 obj = bld (rule = include_processor)
626 obj.source = [ 'ardour3_ui_dark.rc.pre' ]
627 # find and add all ##include dependencies as sources
628 obj.source += _doPyp (bld.path.find_resource ('ardour3_ui_dark.rc.in').srcpath(), True)
629 obj.target = 'ardour3_ui_dark.rc'
630 obj.install_path = '${SYSCONFDIR}/ardour3'
632 obj = bld (rule = include_processor)
633 obj.source = [ 'ardour3_ui_light.rc.pre' ]
634 # find and add all ##include dependencies as sources
635 obj.source += _doPyp (bld.path.find_resource ('ardour3_ui_light.rc.in').srcpath(), True)
636 obj.target = 'ardour3_ui_light.rc'
637 obj.install_path = '${SYSCONFDIR}/ardour3'
641 if bld.is_defined('GTKOSX'):
642 menus_argv = [ '-E', '-P', '-DGTKOSX' ]
644 menus_argv = [ '-E', '-P' ]
646 obj = bld(features = 'command-output')
648 obj.command_is_external = True
650 obj.argv = menus_argv
651 obj.stdin = 'ardour.menus.in'
652 obj.stdout = 'ardour.menus'
653 obj.dep_vars = ['GTKOSX']
654 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
659 # 'SAE-de-keypad', 'SAE-de-nokeypad', 'SAE-us-keypad',
660 # 'SAE-us-nokeypad', 'ergonomic-us'
662 for b in [ 'mnemonic-us' ] :
664 target = b + '.bindings',
665 source = b + '.bindings.in',
666 rule = '../tools/fmt-bindings --platform="%s" --winkey="%s" --accelmap <${SRC} >${TGT}' % (sys.platform, bld.env['WINDOWS_KEY'] )
668 obj.install_path = os.path.join(bld.env['SYSCONFDIR'], 'ardour3')
670 # not modified at present
671 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
672 'step_editing.bindings')
673 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
677 bld.install_files('${DATADIR}/ardour3/icons', bld.path.ant_glob('icons/*.png'))
678 bld.install_files('${DATADIR}/ardour3/pixmaps', bld.path.ant_glob('pixmaps/*.xpm'))
679 bld.install_files('${DATADIR}/ardour3', 'splash.png')
680 bld.install_files('${DATADIR}/ardour3', 'ArdourMono.ttf')
682 # Default UI configuration
683 bld.install_files('${SYSCONFDIR}/ardour3', 'ardour3_ui_default.conf')
685 # Default export stuff
686 bld.install_files('${SYSCONFDIR}/ardour3/export', bld.path.ant_glob('export/*.format'))
689 if bld.is_defined('ENABLE_NLS'):
690 mo_files = bld.path.ant_glob('po/*.mo')
692 lang = os.path.basename(mo.srcpath()).replace('.mo', '')
693 bld.install_as(os.path.join(bld.env['PREFIX'], 'share', 'locale',
694 lang, 'LC_MESSAGES', I18N_PACKAGE + '.mo'),
698 autowaf.build_i18n(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
702 autowaf.build_i18n_pot(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
706 autowaf.build_i18n_po(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
710 autowaf.build_i18n_mo(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,