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',
237 # video-timeline related sources:
238 'video_image_frame.cc',
239 'add_video_dialog.cc',
240 'editor_videotimeline.cc',
244 'transcode_ffmpeg.cc',
245 'transcode_video_dialog.cc',
246 'video_server_dialog.cc',
248 'export_video_dialog.cc',
249 'export_video_infobox.cc'
253 autowaf.set_options(opt)
257 conf.load('compiler_cxx')
258 autowaf.build_version_files(
259 path_prefix + 'version.h',
260 path_prefix + 'version.cc',
261 'gtk2_ardour', MAJOR, MINOR, MICRO)
262 autowaf.configure(conf)
264 if re.search ("linux", sys.platform) != None:
265 autowaf.check_pkg(conf, 'alsa', uselib_store='ALSA')
267 # TODO: Insert a sanity check for on OS X to ensure CoreAudio is present
269 autowaf.check_pkg(conf, 'flac', uselib_store='FLAC',
270 atleast_version='1.2.1')
271 autowaf.check_pkg(conf, 'gthread-2.0', uselib_store='GTHREAD',
272 atleast_version='2.10.1')
273 autowaf.check_pkg(conf, 'gtk+-2.0', uselib_store='GTK',
274 atleast_version='2.18')
275 autowaf.check_pkg(conf, 'gtkmm-2.4', uselib_store='GTKMM',
276 atleast_version='2.18')
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',
377 obj.target = 'ardour-3.0-vst.exe.so'
378 obj.includes = [ '../libs/fst', '.' ]
379 obj.linkflags = ['-mwindows', '-Wl,--export-dynamic']
380 obj.defines = ['_POSIX_SOURCE', 'USE_WS_PREFIX']
381 obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
382 # end of the wine executable
384 # now the shared library containing the GTK GUI for ardour
385 obj = bld (features = 'cxx c cxxshlib')
386 obj.source = gtk2_ardour_sources
387 obj.includes = [ '../libs/fst', '.' ]
388 obj.name = 'libgtk2_ardour'
389 obj.target = 'gtk2_ardour'
391 # just the normal executable version of the GTK GUI
392 obj = bld(features = 'cxx c cxxprogram')
393 obj.source = gtk2_ardour_sources
394 obj.target = 'ardour-3.0'
397 # continue with setup of obj, which could be a shared library
400 obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
402 obj.uselib = 'UUID FLAC FONTCONFIG GLIBMM GTHREAD GTK OGG ALSA CURL DL GTKMM LO'
403 obj.use = [ 'libpbd',
412 if sys.platform == 'darwin':
413 obj.uselib += ' AUDIOUNITS OSX GTKOSX'
414 obj.use += ' libappleutility'
416 'PACKAGE="' + I18N_PACKAGE + '"',
417 'VERSIONSTRING="' + bld.env['VERSION'] + '"',
418 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
419 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
420 'LOCALEDIR="' + os.path.join(os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
421 'PROGRAM_NAME="' + bld.env['PROGRAM_NAME'] + '"'
423 obj.includes += ['../libs']
425 if bld.is_defined('HAVE_SUIL'):
426 obj.source += [ 'lv2_plugin_ui.cc' ]
427 obj.use += [ 'SUIL' ]
429 if bld.is_defined('FREESOUND'):
430 obj.source += [ 'sfdb_freesound_mootcher.cc' ]
431 obj.defines += [ 'FREESOUND' ]
433 if bld.is_defined('NEED_INTL'):
434 obj.linkflags = ' -lintl'
436 if bld.is_defined('WINDOWS_VST_SUPPORT'):
437 obj.source += [ 'windows_vst_plugin_ui.cc' ]
438 obj.defines += [ 'WINDOWS_VST_SUPPORT' ]
441 if bld.is_defined('LXVST_SUPPORT'):
442 obj.source += [ 'linux_vst_gui_support.cc', 'lxvst_plugin_ui.cc' ]
443 obj.defines += [ 'LXVST_SUPPORT' ]
446 if bld.is_defined('WINDOWS_VST_SUPPORT') or bld.is_defined('LXVST_SUPPORT'):
447 obj.source += [ 'vst_plugin_ui.cc' ]
449 if bld.is_defined('PHONE_HOME'):
450 obj.defines += [ 'PHONE_HOME' ]
452 if bld.is_defined('HAVE_COREAUDIO'):
453 TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cc']
454 obj.source += [ 'cocoacarbon.mm' ]
455 obj.use += ' libappleutility '
457 if bld.is_defined('AUDIOUNIT_SUPPORT'):
458 obj.source += [ 'au_pluginui.mm' ]
462 wrapper_subst_dict = {
463 'INSTALL_PREFIX' : bld.env['PREFIX'],
464 'LIBDIR' : os.path.normpath(bld.env['LIBDIR']),
465 'DATADIR' : os.path.normpath(bld.env['DATADIR']),
466 'SYSCONFDIR' : os.path.normpath(bld.env['SYSCONFDIR']),
467 'LIBS' : 'build/libs',
469 'EXECUTABLE' : 'build/gtk2_ardour/ardour-3.0'
472 def set_subst_dict(obj, dict):
474 setattr(obj, i, dict[i])
476 obj = bld(features = 'subst', rule= 'chmod 0755 ${TGT}')
477 obj.source = 'ardev_common.sh.in'
478 obj.target = 'ardev_common_waf.sh'
479 obj.chmod = Utils.O755
480 obj.dict = wrapper_subst_dict
481 set_subst_dict(obj, wrapper_subst_dict)
483 obj = bld(features = 'subst')
484 obj.source = 'ardour.sh.in'
485 obj.target = 'ardour3'
486 obj.chmod = Utils.O755
487 obj.dict = wrapper_subst_dict
488 obj.install_path = bld.env['BINDIR']
489 set_subst_dict(obj, wrapper_subst_dict)
491 if bld.is_defined('WINDOWS_VST_SUPPORT'):
492 obj = bld(features = 'subst')
493 obj.source = '../vst/ardourvst.in'
494 obj.target = 'ardourvst3'
495 obj.chmod = Utils.O755
496 obj.dict = wrapper_subst_dict
497 obj.install_path = bld.env['BINDIR']
498 set_subst_dict(obj, wrapper_subst_dict)
502 dark_rc_subst_dict = {}
503 light_rc_subst_dict = {}
508 if bld.is_defined('GTKOSX'): # OS X fonts
521 # There is no acceptable monospace font available on older versions of OS X
522 # and no API on those versions to load TTF files that will work with
523 # GTK/fontconfig/pango.
525 # In addition, the ArdourMono font gets clipped for some reason on OS X
527 # Moreover, Lucida Grande just seems to work even though it is not monospace
531 'MONOSPACE' : 'Lucida Grande',
533 else: # Linux/X11 fonts
534 basefont = '' # unspecified - use system defaults
546 'MONOSPACE' : 'ArdourMono',
549 # Set up font substitution dictionary
551 for style in ['', 'BOLD', 'ITALIC']:
552 for sizename,points in iter(font_sizes.items()):
554 key = "_".join (['FONT',style,sizename])
555 fontstyle = " ".join ([basefont,style.lower(),points])
557 key = "_".join (['FONT',sizename])
558 fontstyle = " ".join ([basefont,points])
560 dark_rc_subst_dict[key] = fontstyle
561 light_rc_subst_dict[key] = fontstyle
564 for sizename,points in iter(font_sizes.items()):
565 key = "_".join (['FONT_SIZE',sizename])
566 dark_rc_subst_dict[key] = points
567 light_rc_subst_dict[key] = points
569 # various font names, eg @BOLD_MONOSPACE@
570 for font_sym,text in iter(font_names.items()):
572 dark_rc_subst_dict[key] = text
573 light_rc_subst_dict[key] = text
576 dark_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
577 'gtk2_ardour/ardour3_ui_dark.rc.in', 'ARDOUR_DARK')
578 dark_rc_subst_dict['COLPREFIX'] = 'ARDOUR_DARK'
579 light_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
580 'gtk2_ardour/ardour3_ui_light.rc.in', 'ARDOUR_LIGHT')
581 light_rc_subst_dict['COLPREFIX'] = 'ARDOUR_LIGHT'
583 obj = bld(features = 'subst')
584 obj.source = [ 'ardour3_ui_dark.rc.in' ]
585 obj.target = 'ardour3_ui_dark.rc.pre'
586 obj.install_path = None
587 set_subst_dict(obj, dark_rc_subst_dict)
589 obj = bld(features = 'subst')
590 obj.source = [ 'ardour3_ui_light.rc.in' ]
591 obj.target = 'ardour3_ui_light.rc.pre'
592 obj.install_path = None
593 set_subst_dict(obj, light_rc_subst_dict)
595 obj = bld(features = 'subst')
596 obj.source = [ 'ardour3_styles.rc.in' ]
597 obj.target = 'ardour3_dark_styles.rc'
598 obj.install_path = None
599 set_subst_dict(obj, dark_rc_subst_dict)
601 obj = bld(features = 'subst')
602 obj.source = [ 'ardour3_styles.rc.in' ]
603 obj.target = 'ardour3_light_styles.rc'
604 obj.install_path = None
605 set_subst_dict(obj, light_rc_subst_dict)
607 obj = bld(features = 'subst')
608 obj.source = [ 'ardour3_fonts.rc.in' ]
609 obj.target = 'ardour3_dark_fonts.rc'
610 obj.install_path = None
611 set_subst_dict(obj, dark_rc_subst_dict)
613 obj = bld(features = 'subst')
614 obj.source = [ 'ardour3_fonts.rc.in' ]
615 obj.target = 'ardour3_light_fonts.rc'
616 obj.install_path = None
617 set_subst_dict(obj, light_rc_subst_dict)
619 obj = bld(rule = 'cp ${SRC} ${TGT}')
620 obj.source = [ 'ardour3_widget_list.rc' ]
621 obj.target = 'ardour3_widgets.rc'
622 obj.install_path = None
624 obj = bld (rule = include_processor)
625 obj.source = [ 'ardour3_ui_dark.rc.pre' ]
626 # find and add all ##include dependencies as sources
627 obj.source += _doPyp (bld.path.find_resource ('ardour3_ui_dark.rc.in').srcpath(), True)
628 obj.target = 'ardour3_ui_dark.rc'
629 obj.install_path = '${SYSCONFDIR}/ardour3'
631 obj = bld (rule = include_processor)
632 obj.source = [ 'ardour3_ui_light.rc.pre' ]
633 # find and add all ##include dependencies as sources
634 obj.source += _doPyp (bld.path.find_resource ('ardour3_ui_light.rc.in').srcpath(), True)
635 obj.target = 'ardour3_ui_light.rc'
636 obj.install_path = '${SYSCONFDIR}/ardour3'
640 if bld.is_defined('GTKOSX'):
641 menus_argv = [ '-E', '-P', '-DGTKOSX' ]
643 menus_argv = [ '-E', '-P' ]
645 obj = bld(features = 'command-output')
647 obj.command_is_external = True
649 obj.argv = menus_argv
650 obj.stdin = 'ardour.menus.in'
651 obj.stdout = 'ardour.menus'
652 obj.dep_vars = ['GTKOSX']
653 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
658 # 'SAE-de-keypad', 'SAE-de-nokeypad', 'SAE-us-keypad',
659 # 'SAE-us-nokeypad', 'ergonomic-us'
661 for b in [ 'mnemonic-us' ] :
663 target = b + '.bindings',
664 source = b + '.bindings.in',
665 rule = '../tools/fmt-bindings --platform="%s" --winkey="%s" --accelmap <${SRC} >${TGT}' % (sys.platform, bld.env['WINDOWS_KEY'] )
667 obj.install_path = os.path.join(bld.env['SYSCONFDIR'], 'ardour3')
669 # not modified at present
670 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
671 'step_editing.bindings')
672 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
676 bld.install_files('${DATADIR}/ardour3/icons', bld.path.ant_glob('icons/*.png'))
677 bld.install_files('${DATADIR}/ardour3/pixmaps', bld.path.ant_glob('pixmaps/*.xpm'))
678 bld.install_files('${DATADIR}/ardour3', 'splash.png')
679 bld.install_files('${DATADIR}/ardour3', 'ArdourMono.ttf')
681 # Default UI configuration
682 bld.install_files('${SYSCONFDIR}/ardour3', 'ardour3_ui_default.conf')
684 # Default export stuff
685 bld.install_files('${SYSCONFDIR}/ardour3/export', bld.path.ant_glob('export/*.format'))
688 if bld.is_defined('ENABLE_NLS'):
689 mo_files = bld.path.ant_glob('po/*.mo')
691 lang = os.path.basename(mo.srcpath()).replace('.mo', '')
692 bld.install_as(os.path.join(bld.env['PREFIX'], 'share', 'locale',
693 lang, 'LC_MESSAGES', I18N_PACKAGE + '.mo'),
697 autowaf.build_i18n(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
701 autowaf.build_i18n_pot(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
705 autowaf.build_i18n_po(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
709 autowaf.build_i18n_mo(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,