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',
60 'control_point_dialog.cc',
63 'edit_note_dialog.cc',
67 'editor_audio_import.cc',
68 'editor_audiotrack.cc',
70 'editor_canvas_events.cc',
71 'editor_component.cc',
74 'editor_route_groups.cc',
75 'editor_export_audio.cc',
76 'editor_group_tabs.cc',
78 'editor_locations.cc',
86 'editor_selection.cc',
87 'editor_snapshots.cc',
89 'editor_tempodisplay.cc',
93 'export_channel_selector.cc',
95 'export_file_notebook.cc',
96 'export_filename_selector.cc',
97 'export_format_dialog.cc',
98 'export_format_selector.cc',
99 'export_preset_selector.cc',
100 'export_timespan_selector.cc',
105 'generic_pluginui.cc',
107 'global_port_matrix.cc',
109 'gtk-custom-hruler.c',
110 'gtk-custom-ruler.c',
111 'gtk_pianokeyboard.c',
113 'insert_time_dialog.cc',
114 'interthread_progress_window.cc',
126 'midi_automation_line.cc',
127 'midi_channel_dialog.cc',
128 'midi_channel_selector.cc',
129 'midi_cut_buffer.cc',
130 'midi_export_dialog.cc',
131 'midi_list_editor.cc',
132 'midi_port_dialog.cc',
133 'midi_region_view.cc',
136 'midi_streamview.cc',
139 'midi_velocity_dialog.cc',
140 'missing_file_dialog.cc',
141 'missing_plugin_dialog.cc',
143 'mixer_group_tabs.cc',
146 'monitor_section.cc',
148 'mono_panner_editor.cc',
151 'new_plugin_preset_dialog.cc',
152 'normalize_dialog.cc',
162 'panner_interface.cc',
165 'piano_roll_header.cc',
167 'playlist_selector.cc',
169 'plugin_selector.cc',
174 'port_matrix_body.cc',
175 'port_matrix_column_labels.cc',
176 'port_matrix_component.cc',
177 'port_matrix_grid.cc',
178 'port_matrix_labels.cc',
179 'port_matrix_row_labels.cc',
181 'patch_change_dialog.cc',
182 'progress_reporter.cc',
185 'quantize_dialog.cc',
186 'rc_option_editor.cc',
188 'region_gain_line.cc',
189 'region_layering_order_editor.cc',
190 'region_selection.cc',
194 'route_group_dialog.cc',
195 'route_group_menu.cc',
196 'route_params_ui.cc',
197 'route_processor_selection.cc',
198 'route_time_axis.cc',
200 'search_path_option.cc',
203 'session_import_dialog.cc',
204 'session_metadata_dialog.cc',
205 'session_option_editor.cc',
207 'shuttle_control.cc',
214 'stereo_panner_editor.cc',
216 'strip_silence_dialog.cc',
218 'tape_region_view.cc',
223 'time_axis_view_item.cc',
227 'track_selection.cc',
228 'track_view_list.cc',
229 'transpose_dialog.cc',
234 'visibility_group.cc',
235 'volume_controller.cc',
240 autowaf.set_options(opt)
244 conf.load('compiler_cxx')
245 autowaf.build_version_files(
246 path_prefix + 'version.h',
247 path_prefix + 'version.cc',
248 'gtk2_ardour', MAJOR, MINOR, MICRO)
249 autowaf.configure(conf)
251 if re.search ("linux", sys.platform) != None:
252 autowaf.check_pkg(conf, 'alsa', uselib_store='ALSA')
254 # TODO: Insert a sanity check for on OS X to ensure CoreAudio is present
256 autowaf.check_pkg(conf, 'flac', uselib_store='FLAC',
257 atleast_version='1.2.1')
258 autowaf.check_pkg(conf, 'gthread-2.0', uselib_store='GTHREAD',
259 atleast_version='2.10.1')
260 autowaf.check_pkg(conf, 'gtk+-2.0', uselib_store='GTK',
261 atleast_version='2.18')
262 autowaf.check_pkg(conf, 'gtkmm-2.4', uselib_store='GTKMM',
263 atleast_version='2.18')
264 autowaf.check_pkg(conf, 'ogg', uselib_store='OGG', atleast_version='1.1.2')
265 autowaf.check_pkg(conf, 'x11', uselib_store='X11', atleast_version='1.1', mandatory=False)
266 autowaf.check_pkg(conf, 'fontconfig', uselib_store='FONTCONFIG')
268 conf.write_config_header('gtk2ardour-config.h', remove=False)
271 autowaf.check_header(conf, 'cxx', 'boost/shared_ptr.hpp')
272 autowaf.check_header(conf, 'cxx', 'boost/weak_ptr.hpp')
274 # Add a waf `feature' to allow compilation of things using winegcc
275 from waflib.TaskGen import feature
277 def set_winegcc(self):
278 self.env.LINK_CXX = self.env.LINK_CC = 'wineg++'
279 self.env.CC = 'winegcc'
281 def _doPyp(infileName, deps = False):
284 re_spaces = re.compile("\s+")
286 if infileName == '-':
289 fd = open(infileName)
290 inLines = fd.readlines()
296 bits = re_spaces.split(line)
297 if bits[0] == '##include':
302 # assume included file comes from same place as source file
303 incName = os.path.join (os.path.dirname (infileName), incName);
304 outStr += _doPyp(incName)
315 def include_processor(task):
316 infileName = task.inputs[0].srcpath()
317 outfileName = os.path.join(out, task.outputs[0].bldpath())
318 fdOut = open (outfileName, "w")
319 fdOut.write (_doPyp(infileName))
323 def build_color_scheme(path, prefix):
327 if re.search ('^#@color', line):
328 line.strip() # remove newline
330 if len(color_scheme):
332 color_scheme += prefix
334 color_scheme += words[1]
336 color_scheme += words[2]
342 if bld.is_defined('WINDOWS_VST_SUPPORT'):
343 # If we require VST support we build a stub main() and the FST library
344 # here using winegcc, and link it to the GTK front-end library
345 obj = bld(features = 'cxx c cxxprogram wine')
348 ../libs/fst/fstinfofile.c
354 obj.use = [ 'libpbd',
364 obj.target = 'ardour-3.0-vst.exe.so'
365 obj.includes = [ '../libs/fst', '.' ]
366 obj.linkflags = ['-mwindows', '-Wl,--export-dynamic']
367 obj.defines = ['_POSIX_SOURCE', 'USE_WS_PREFIX']
368 obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
369 # end of the wine executable
371 # now the shared library containing the GTK GUI for ardour
372 obj = bld (features = 'cxx c cxxshlib')
373 obj.source = gtk2_ardour_sources
374 obj.includes = [ '../libs/fst', '.' ]
375 obj.name = 'libgtk2_ardour'
376 obj.target = 'gtk2_ardour'
378 # just the normal executable version of the GTK GUI
379 obj = bld(features = 'cxx c cxxprogram')
380 obj.source = gtk2_ardour_sources
381 obj.target = 'ardour-3.0'
384 # continue with setup of obj, which could be a shared library
387 obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
389 obj.uselib = 'UUID FLAC FONTCONFIG GLIBMM GTHREAD GTK OGG ALSA CURL DL GTKMM LO'
390 obj.use = [ 'libpbd',
399 if sys.platform == 'darwin':
400 obj.uselib += ' AUDIOUNITS OSX GTKOSX'
401 obj.use += ' libappleutility'
403 'PACKAGE="' + I18N_PACKAGE + '"',
404 'VERSIONSTRING="' + bld.env['VERSION'] + '"',
405 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
406 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
407 'LOCALEDIR="' + os.path.join(os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
408 'PROGRAM_NAME="' + bld.env['PROGRAM_NAME'] + '"'
410 obj.includes += ['../libs']
412 if bld.env['VIDEOTIMELINE']:
414 'video_image_frame.cc',
415 'add_video_dialog.cc',
416 'editor_videotimeline.cc',
420 'transcode_ffmpeg.cc',
421 'transcode_video_dialog.cc',
422 'video_server_dialog.cc',
424 'export_video_dialog.cc',
425 'export_video_infobox.cc'
428 if bld.is_defined('HAVE_SUIL'):
429 obj.source += [ 'lv2_plugin_ui.cc' ]
430 obj.use += [ 'SUIL' ]
432 if bld.is_defined('FREESOUND'):
433 obj.source += [ 'sfdb_freesound_mootcher.cc' ]
434 obj.defines += [ 'FREESOUND' ]
436 if bld.is_defined('NEED_INTL'):
437 obj.linkflags = ' -lintl'
439 if bld.is_defined('WINDOWS_VST_SUPPORT'):
440 obj.source += [ 'windows_vst_plugin_ui.cc' ]
441 obj.defines += [ 'WINDOWS_VST_SUPPORT' ]
444 if bld.is_defined('LXVST_SUPPORT'):
445 obj.source += [ 'linux_vst_gui_support.cc', 'lxvst_plugin_ui.cc' ]
446 obj.defines += [ 'LXVST_SUPPORT' ]
449 if bld.is_defined('WINDOWS_VST_SUPPORT') or bld.is_defined('LXVST_SUPPORT'):
450 obj.source += [ 'vst_plugin_ui.cc' ]
452 if bld.is_defined('PHONE_HOME'):
453 obj.defines += [ 'PHONE_HOME' ]
455 if bld.is_defined('HAVE_COREAUDIO'):
456 TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cc']
457 obj.source += [ 'cocoacarbon.mm' ]
458 obj.use += ' libappleutility '
460 if bld.is_defined('AUDIOUNIT_SUPPORT'):
461 obj.source += [ 'au_pluginui.mm' ]
465 wrapper_subst_dict = {
466 'INSTALL_PREFIX' : bld.env['PREFIX'],
467 'LIBDIR' : os.path.normpath(bld.env['LIBDIR']),
468 'DATADIR' : os.path.normpath(bld.env['DATADIR']),
469 'SYSCONFDIR' : os.path.normpath(bld.env['SYSCONFDIR']),
470 'LIBS' : 'build/libs',
472 'EXECUTABLE' : 'build/gtk2_ardour/ardour-3.0'
475 def set_subst_dict(obj, dict):
477 setattr(obj, i, dict[i])
479 obj = bld(features = 'subst', rule= 'chmod 0755 ${TGT}')
480 obj.source = 'ardev_common.sh.in'
481 obj.target = 'ardev_common_waf.sh'
482 obj.chmod = Utils.O755
483 obj.dict = wrapper_subst_dict
484 set_subst_dict(obj, wrapper_subst_dict)
486 obj = bld(features = 'subst')
487 obj.source = 'ardour.sh.in'
488 obj.target = 'ardour3'
489 obj.chmod = Utils.O755
490 obj.dict = wrapper_subst_dict
491 obj.install_path = bld.env['BINDIR']
492 set_subst_dict(obj, wrapper_subst_dict)
494 if bld.is_defined('WINDOWS_VST_SUPPORT'):
495 obj = bld(features = 'subst')
496 obj.source = '../vst/ardourvst.in'
497 obj.target = 'ardourvst3'
498 obj.chmod = Utils.O755
499 obj.dict = wrapper_subst_dict
500 obj.install_path = bld.env['BINDIR']
501 set_subst_dict(obj, wrapper_subst_dict)
505 dark_rc_subst_dict = {}
506 light_rc_subst_dict = {}
511 if bld.is_defined('GTKOSX'): # OS X fonts
524 # There is no acceptable monospace font available on older versions of OS X
525 # and no API on those versions to load TTF files that will work with
526 # GTK/fontconfig/pango.
528 # In addition, the ArdourMono font gets clipped for some reason on OS X
530 # Moreover, Lucida Grande just seems to work even though it is not monospace
534 'MONOSPACE' : 'Lucida Grande',
536 else: # Linux/X11 fonts
537 basefont = '' # unspecified - use system defaults
549 'MONOSPACE' : 'ArdourMono',
552 # Set up font substitution dictionary
554 for style in ['', 'BOLD', 'ITALIC']:
555 for sizename,points in iter(font_sizes.items()):
557 key = "_".join (['FONT',style,sizename])
558 fontstyle = " ".join ([basefont,style.lower(),points])
560 key = "_".join (['FONT',sizename])
561 fontstyle = " ".join ([basefont,points])
563 dark_rc_subst_dict[key] = fontstyle
564 light_rc_subst_dict[key] = fontstyle
567 for sizename,points in iter(font_sizes.items()):
568 key = "_".join (['FONT_SIZE',sizename])
569 dark_rc_subst_dict[key] = points
570 light_rc_subst_dict[key] = points
572 # various font names, eg @BOLD_MONOSPACE@
573 for font_sym,text in iter(font_names.items()):
575 dark_rc_subst_dict[key] = text
576 light_rc_subst_dict[key] = text
579 dark_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
580 'gtk2_ardour/ardour3_ui_dark.rc.in', 'ARDOUR_DARK')
581 dark_rc_subst_dict['COLPREFIX'] = 'ARDOUR_DARK'
582 light_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
583 'gtk2_ardour/ardour3_ui_light.rc.in', 'ARDOUR_LIGHT')
584 light_rc_subst_dict['COLPREFIX'] = 'ARDOUR_LIGHT'
586 obj = bld(features = 'subst')
587 obj.source = [ 'ardour3_ui_dark.rc.in' ]
588 obj.target = 'ardour3_ui_dark.rc.pre'
589 obj.install_path = None
590 set_subst_dict(obj, dark_rc_subst_dict)
592 obj = bld(features = 'subst')
593 obj.source = [ 'ardour3_ui_light.rc.in' ]
594 obj.target = 'ardour3_ui_light.rc.pre'
595 obj.install_path = None
596 set_subst_dict(obj, light_rc_subst_dict)
598 obj = bld(features = 'subst')
599 obj.source = [ 'ardour3_styles.rc.in' ]
600 obj.target = 'ardour3_dark_styles.rc'
601 obj.install_path = None
602 set_subst_dict(obj, dark_rc_subst_dict)
604 obj = bld(features = 'subst')
605 obj.source = [ 'ardour3_styles.rc.in' ]
606 obj.target = 'ardour3_light_styles.rc'
607 obj.install_path = None
608 set_subst_dict(obj, light_rc_subst_dict)
610 obj = bld(features = 'subst')
611 obj.source = [ 'ardour3_fonts.rc.in' ]
612 obj.target = 'ardour3_dark_fonts.rc'
613 obj.install_path = None
614 set_subst_dict(obj, dark_rc_subst_dict)
616 obj = bld(features = 'subst')
617 obj.source = [ 'ardour3_fonts.rc.in' ]
618 obj.target = 'ardour3_light_fonts.rc'
619 obj.install_path = None
620 set_subst_dict(obj, light_rc_subst_dict)
622 obj = bld(rule = 'cp ${SRC} ${TGT}')
623 obj.source = [ 'ardour3_widget_list.rc' ]
624 obj.target = 'ardour3_widgets.rc'
625 obj.install_path = None
627 obj = bld (rule = include_processor)
628 obj.source = [ 'ardour3_ui_dark.rc.pre' ]
629 # find and add all ##include dependencies as sources
630 obj.source += _doPyp (bld.path.find_resource ('ardour3_ui_dark.rc.in').srcpath(), True)
631 obj.target = 'ardour3_ui_dark.rc'
632 obj.install_path = '${SYSCONFDIR}/ardour3'
634 obj = bld (rule = include_processor)
635 obj.source = [ 'ardour3_ui_light.rc.pre' ]
636 # find and add all ##include dependencies as sources
637 obj.source += _doPyp (bld.path.find_resource ('ardour3_ui_light.rc.in').srcpath(), True)
638 obj.target = 'ardour3_ui_light.rc'
639 obj.install_path = '${SYSCONFDIR}/ardour3'
643 if bld.is_defined('GTKOSX'):
644 menus_argv = [ '-E', '-P', '-DGTKOSX' ]
646 menus_argv = [ '-E', '-P' ]
648 if bld.env['VIDEOTIMELINE']:
649 menus_argv.append ('-DWITH_VIDEOTIMELINE')
650 obj = bld(features = 'command-output')
652 obj.command_is_external = True
654 obj.argv = menus_argv
655 obj.stdin = 'ardour.menus.in'
656 obj.stdout = 'ardour.menus'
657 obj.dep_vars = ['GTKOSX', 'VIDEOTIMELINE']
658 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
663 # 'SAE-de-keypad', 'SAE-de-nokeypad', 'SAE-us-keypad',
664 # 'SAE-us-nokeypad', 'ergonomic-us'
666 for b in [ 'mnemonic-us' ] :
668 target = b + '.bindings',
669 source = b + '.bindings.in',
670 rule = '../tools/fmt-bindings --platform="%s" --winkey="%s" --accelmap <${SRC} >${TGT}' % (sys.platform, bld.env['WINDOWS_KEY'] )
672 obj.install_path = os.path.join(bld.env['SYSCONFDIR'], 'ardour3')
674 # not modified at present
675 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
676 'step_editing.bindings')
677 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
681 bld.install_files('${DATADIR}/ardour3/icons', bld.path.ant_glob('icons/*.png'))
682 bld.install_files('${DATADIR}/ardour3/pixmaps', bld.path.ant_glob('pixmaps/*.xpm'))
683 bld.install_files('${DATADIR}/ardour3', 'splash.png')
684 bld.install_files('${DATADIR}/ardour3', 'ArdourMono.ttf')
686 # Default UI configuration
687 bld.install_files('${SYSCONFDIR}/ardour3', 'ardour3_ui_default.conf')
689 # Default export stuff
690 bld.install_files('${SYSCONFDIR}/ardour3/export', bld.path.ant_glob('export/*.format'))
693 if bld.is_defined('ENABLE_NLS'):
694 mo_files = bld.path.ant_glob('po/*.mo')
696 lang = os.path.basename(mo.srcpath()).replace('.mo', '')
697 bld.install_as(os.path.join(bld.env['PREFIX'], 'share', 'locale',
698 lang, 'LC_MESSAGES', I18N_PACKAGE + '.mo'),
702 autowaf.build_i18n(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
706 autowaf.build_i18n_pot(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
710 autowaf.build_i18n_po(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
714 autowaf.build_i18n_mo(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,