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 I18N_PACKAGE = 'gtk2_ardour3'
17 path_prefix = 'gtk2_ardour/'
19 gtk2_ardour_sources = [
22 'add_route_dialog.cc',
23 'ambiguous_file_dialog.cc',
29 'ardour_ui_dependents.cc',
30 'ardour_ui_dialogs.cc',
33 'ardour_ui_options.cc',
36 'audio_region_editor.cc',
37 'audio_region_view.cc',
38 'audio_streamview.cc',
40 'automation_controller.cc',
42 'automation_region_view.cc',
43 'automation_streamview.cc',
44 'automation_time_axis.cc',
46 'big_clock_window.cc',
52 'control_point_dialog.cc',
55 'edit_note_dialog.cc',
59 'editor_audio_import.cc',
60 'editor_audiotrack.cc',
62 'editor_canvas_events.cc',
63 'editor_component.cc',
66 'editor_route_groups.cc',
67 'editor_export_audio.cc',
68 'editor_group_tabs.cc',
70 'editor_locations.cc',
78 'editor_selection.cc',
79 'editor_snapshots.cc',
81 'editor_tempodisplay.cc',
85 'export_channel_selector.cc',
87 'export_file_notebook.cc',
88 'export_filename_selector.cc',
89 'export_format_dialog.cc',
90 'export_format_selector.cc',
91 'export_preset_selector.cc',
92 'export_timespan_selector.cc',
97 'generic_pluginui.cc',
99 'global_port_matrix.cc',
101 'gtk-custom-hruler.c',
102 'gtk-custom-ruler.c',
103 'gtk_pianokeyboard.c',
105 'insert_time_dialog.cc',
106 'interthread_progress_window.cc',
118 'midi_automation_line.cc',
119 'midi_channel_dialog.cc',
120 'midi_channel_selector.cc',
121 'midi_cut_buffer.cc',
122 'midi_export_dialog.cc',
123 'midi_list_editor.cc',
124 'midi_port_dialog.cc',
125 'midi_region_view.cc',
128 'midi_streamview.cc',
131 'midi_velocity_dialog.cc',
132 'missing_file_dialog.cc',
133 'missing_plugin_dialog.cc',
135 'mixer_group_tabs.cc',
141 'monitor_section.cc',
143 'mono_panner_editor.cc',
146 'new_plugin_preset_dialog.cc',
147 'normalize_dialog.cc',
157 'panner_interface.cc',
160 'piano_roll_header.cc',
162 'playlist_selector.cc',
164 'plugin_selector.cc',
169 'port_matrix_body.cc',
170 'port_matrix_column_labels.cc',
171 'port_matrix_component.cc',
172 'port_matrix_grid.cc',
173 'port_matrix_labels.cc',
174 'port_matrix_row_labels.cc',
176 'patch_change_dialog.cc',
177 'progress_reporter.cc',
180 'quantize_dialog.cc',
181 'rc_option_editor.cc',
183 'region_gain_line.cc',
184 'region_layering_order_editor.cc',
185 'region_selection.cc',
189 'route_group_dialog.cc',
190 'route_group_menu.cc',
191 'route_params_ui.cc',
192 'route_processor_selection.cc',
193 'route_time_axis.cc',
195 'search_path_option.cc',
198 'session_import_dialog.cc',
199 'session_metadata_dialog.cc',
200 'session_option_editor.cc',
202 'shuttle_control.cc',
209 'stereo_panner_editor.cc',
211 'strip_silence_dialog.cc',
213 'tape_region_view.cc',
218 'time_axis_view_item.cc',
222 'track_selection.cc',
223 'track_view_list.cc',
224 'transpose_dialog.cc',
229 'visibility_group.cc',
230 'volume_controller.cc',
232 # video-timeline related sources:
233 'video_image_frame.cc',
234 'add_video_dialog.cc',
235 'editor_videotimeline.cc',
239 'transcode_ffmpeg.cc',
240 'transcode_video_dialog.cc',
241 'video_server_dialog.cc',
243 'export_video_dialog.cc',
244 'export_video_infobox.cc'
248 autowaf.set_options(opt)
252 conf.load('compiler_cxx')
253 # we don't use hard-coded micro versions with ardour, so hard code it to zero
254 autowaf.build_version_files(
255 path_prefix + 'version.h',
256 path_prefix + 'version.cc',
257 'gtk2_ardour', conf.env['MAJOR'], conf.env['MINOR'], 0)
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, 'ogg', uselib_store='OGG', atleast_version='1.1.2')
274 autowaf.check_pkg(conf, 'x11', uselib_store='X11', atleast_version='1.1', mandatory=False)
275 autowaf.check_pkg(conf, 'fontconfig', uselib_store='FONTCONFIG')
277 conf.write_config_header('gtk2ardour-config.h', remove=False)
280 autowaf.check_header(conf, 'cxx', 'boost/shared_ptr.hpp')
281 autowaf.check_header(conf, 'cxx', 'boost/weak_ptr.hpp')
283 # Add a waf `feature' to allow compilation of things using winegcc
284 from waflib.TaskGen import feature
286 def set_winegcc(self):
287 self.env.LINK_CXX = self.env.LINK_CC = 'wineg++'
288 self.env.CC = 'winegcc'
290 def _doPyp(infileName, deps = False):
293 re_spaces = re.compile("\s+")
295 if infileName == '-':
298 fd = open(infileName)
299 inLines = fd.readlines()
305 bits = re_spaces.split(line)
306 if bits[0] == '##include':
311 # assume included file comes from same place as source file
312 incName = os.path.join (os.path.dirname (infileName), incName);
313 outStr += _doPyp(incName)
324 def include_processor(task):
325 infileName = task.inputs[0].srcpath()
326 outfileName = os.path.join(out, task.outputs[0].bldpath())
327 fdOut = open (outfileName, "w")
328 fdOut.write (_doPyp(infileName))
332 def build_color_scheme(path, prefix):
336 if re.search ('^#@color', line):
337 line.strip() # remove newline
339 if len(color_scheme):
341 color_scheme += prefix
343 color_scheme += words[1]
345 color_scheme += words[2]
351 VERSION = "%s.%s" % (bld.env['MAJOR'], bld.env['MINOR'])
353 if bld.is_defined('WINDOWS_VST_SUPPORT'):
354 # If we require VST support we build a stub main() and the FST library
355 # here using winegcc, and link it to the GTK front-end library
356 obj = bld(features = 'cxx c cxxprogram wine')
359 ../libs/fst/fstinfofile.c
365 obj.use = [ 'libpbd',
375 obj.target = 'ardour-' + bld.env['VERSION'] + '-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-' + bld.env['VERSION']
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 GTKMM LO'
401 obj.use = [ 'libpbd',
410 if sys.platform == 'darwin':
411 obj.uselib += ' AUDIOUNITS OSX GTKOSX'
412 obj.use += ' libappleutility'
414 'PACKAGE="' + I18N_PACKAGE + '"',
415 'VERSIONSTRING="' + bld.env['VERSION'] + '"',
416 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
417 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
418 'LOCALEDIR="' + os.path.join(os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
419 'PROGRAM_NAME="' + bld.env['PROGRAM_NAME'] + '"'
421 obj.includes += ['../libs']
423 if bld.is_defined('HAVE_SUIL'):
424 obj.source += [ 'lv2_plugin_ui.cc' ]
425 obj.use += [ 'SUIL' ]
427 if bld.is_defined('FREESOUND'):
428 obj.source += [ 'sfdb_freesound_mootcher.cc' ]
429 obj.defines += [ 'FREESOUND' ]
431 if bld.is_defined('NEED_INTL'):
432 obj.linkflags = ' -lintl'
434 if bld.is_defined('WINDOWS_VST_SUPPORT'):
435 obj.source += [ 'windows_vst_plugin_ui.cc' ]
436 obj.defines += [ 'WINDOWS_VST_SUPPORT' ]
439 if bld.is_defined('LXVST_SUPPORT'):
440 obj.source += [ 'linux_vst_gui_support.cc', 'lxvst_plugin_ui.cc' ]
441 obj.defines += [ 'LXVST_SUPPORT' ]
444 if bld.is_defined('WINDOWS_VST_SUPPORT') or bld.is_defined('LXVST_SUPPORT'):
445 obj.source += [ 'vst_plugin_ui.cc' ]
447 if bld.is_defined('PHONE_HOME'):
448 obj.defines += [ 'PHONE_HOME' ]
450 if bld.is_defined('HAVE_COREAUDIO'):
451 TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cc']
452 obj.source += [ 'cocoacarbon.mm' ]
453 obj.use += ' libappleutility '
455 if bld.is_defined('AUDIOUNIT_SUPPORT'):
456 obj.source += [ 'au_pluginui.mm' ]
460 wrapper_subst_dict = {
461 'INSTALL_PREFIX' : bld.env['PREFIX'],
462 'LIBDIR' : os.path.normpath(bld.env['LIBDIR']),
463 'DATADIR' : os.path.normpath(bld.env['DATADIR']),
464 'SYSCONFDIR' : os.path.normpath(bld.env['SYSCONFDIR']),
465 'LIBS' : 'build/libs',
466 'VERSION' : bld.env['VERSION'],
467 'EXECUTABLE' : 'build/gtk2_ardour/ardour-' + bld.env['VERSION']
470 def set_subst_dict(obj, dict):
472 setattr(obj, i, dict[i])
474 obj = bld(features = 'subst', rule= 'chmod 0755 ${TGT}')
475 obj.source = 'ardev_common.sh.in'
476 obj.target = 'ardev_common_waf.sh'
477 obj.chmod = Utils.O755
478 obj.dict = wrapper_subst_dict
479 set_subst_dict(obj, wrapper_subst_dict)
481 obj = bld(features = 'subst')
482 obj.source = 'ardour.sh.in'
483 obj.target = 'ardour3'
484 obj.chmod = Utils.O755
485 obj.dict = wrapper_subst_dict
486 obj.install_path = bld.env['BINDIR']
487 set_subst_dict(obj, wrapper_subst_dict)
489 if bld.is_defined('WINDOWS_VST_SUPPORT'):
490 obj = bld(features = 'subst')
491 obj.source = '../vst/ardourvst.in'
492 obj.target = 'ardourvst3'
493 obj.chmod = Utils.O755
494 obj.dict = wrapper_subst_dict
495 obj.install_path = bld.env['BINDIR']
496 set_subst_dict(obj, wrapper_subst_dict)
500 dark_rc_subst_dict = {}
501 light_rc_subst_dict = {}
506 if bld.is_defined('GTKOSX'): # OS X fonts
519 # There is no acceptable monospace font available on older versions of OS X
520 # and no API on those versions to load TTF files that will work with
521 # GTK/fontconfig/pango.
523 # In addition, the ArdourMono font gets clipped for some reason on OS X
525 # Moreover, Lucida Grande just seems to work even though it is not monospace
529 'MONOSPACE' : 'Lucida Grande',
531 else: # Linux/X11 fonts
532 basefont = '' # unspecified - use system defaults
544 'MONOSPACE' : 'ArdourMono',
547 # Set up font substitution dictionary
549 for style in ['', 'BOLD', 'ITALIC']:
550 for sizename,points in iter(font_sizes.items()):
552 key = "_".join (['FONT',style,sizename])
553 fontstyle = " ".join ([basefont,style.lower(),points])
555 key = "_".join (['FONT',sizename])
556 fontstyle = " ".join ([basefont,points])
558 dark_rc_subst_dict[key] = fontstyle
559 light_rc_subst_dict[key] = fontstyle
562 for sizename,points in iter(font_sizes.items()):
563 key = "_".join (['FONT_SIZE',sizename])
564 dark_rc_subst_dict[key] = points
565 light_rc_subst_dict[key] = points
567 # various font names, eg @BOLD_MONOSPACE@
568 for font_sym,text in iter(font_names.items()):
570 dark_rc_subst_dict[key] = text
571 light_rc_subst_dict[key] = text
574 dark_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
575 'gtk2_ardour/ardour3_ui_dark.rc.in', 'ARDOUR_DARK')
576 dark_rc_subst_dict['COLPREFIX'] = 'ARDOUR_DARK'
577 light_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
578 'gtk2_ardour/ardour3_ui_light.rc.in', 'ARDOUR_LIGHT')
579 light_rc_subst_dict['COLPREFIX'] = 'ARDOUR_LIGHT'
581 obj = bld(features = 'subst')
582 obj.source = [ 'ardour3_ui_dark.rc.in' ]
583 obj.target = 'ardour3_ui_dark.rc.pre'
584 obj.install_path = None
585 set_subst_dict(obj, dark_rc_subst_dict)
587 obj = bld(features = 'subst')
588 obj.source = [ 'ardour3_ui_light.rc.in' ]
589 obj.target = 'ardour3_ui_light.rc.pre'
590 obj.install_path = None
591 set_subst_dict(obj, light_rc_subst_dict)
593 obj = bld(features = 'subst')
594 obj.source = [ 'ardour3_styles.rc.in' ]
595 obj.target = 'ardour3_dark_styles.rc'
596 obj.install_path = None
597 set_subst_dict(obj, dark_rc_subst_dict)
599 obj = bld(features = 'subst')
600 obj.source = [ 'ardour3_styles.rc.in' ]
601 obj.target = 'ardour3_light_styles.rc'
602 obj.install_path = None
603 set_subst_dict(obj, light_rc_subst_dict)
605 obj = bld(features = 'subst')
606 obj.source = [ 'ardour3_fonts.rc.in' ]
607 obj.target = 'ardour3_dark_fonts.rc'
608 obj.install_path = None
609 set_subst_dict(obj, dark_rc_subst_dict)
611 obj = bld(features = 'subst')
612 obj.source = [ 'ardour3_fonts.rc.in' ]
613 obj.target = 'ardour3_light_fonts.rc'
614 obj.install_path = None
615 set_subst_dict(obj, light_rc_subst_dict)
617 obj = bld(rule = 'cp ${SRC} ${TGT}')
618 obj.source = [ 'ardour3_widget_list.rc' ]
619 obj.target = 'ardour3_widgets.rc'
620 obj.install_path = None
622 obj = bld (rule = include_processor)
623 obj.source = [ 'ardour3_ui_dark.rc.pre' ]
624 # find and add all ##include dependencies as sources
625 obj.source += _doPyp (bld.path.find_resource ('ardour3_ui_dark.rc.in').srcpath(), True)
626 obj.target = 'ardour3_ui_dark.rc'
627 obj.install_path = '${SYSCONFDIR}/ardour3'
629 obj = bld (rule = include_processor)
630 obj.source = [ 'ardour3_ui_light.rc.pre' ]
631 # find and add all ##include dependencies as sources
632 obj.source += _doPyp (bld.path.find_resource ('ardour3_ui_light.rc.in').srcpath(), True)
633 obj.target = 'ardour3_ui_light.rc'
634 obj.install_path = '${SYSCONFDIR}/ardour3'
638 if bld.is_defined('GTKOSX'):
639 menus_argv = [ '-E', '-P', '-DGTKOSX', '-DNOVIDEOTIMELINE' ]
641 menus_argv = [ '-E', '-P' ]
643 obj = bld(features = 'command-output')
645 obj.command_is_external = True
647 obj.argv = menus_argv
648 obj.stdin = 'ardour.menus.in'
649 obj.stdout = 'ardour.menus'
650 obj.dep_vars = ['GTKOSX']
651 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
656 # 'SAE-de-keypad', 'SAE-de-nokeypad', 'SAE-us-keypad',
657 # 'SAE-us-nokeypad', 'ergonomic-us'
659 for b in [ 'mnemonic-us' ] :
661 target = b + '.bindings',
662 source = b + '.bindings.in',
663 rule = '../tools/fmt-bindings --platform="%s" --winkey="%s" --accelmap <${SRC} >${TGT}' % (sys.platform, bld.env['WINDOWS_KEY'] )
665 obj.install_path = os.path.join(bld.env['SYSCONFDIR'], 'ardour3')
667 # not modified at present
668 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
669 'step_editing.bindings')
670 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
674 bld.install_files('${DATADIR}/ardour3/icons', bld.path.ant_glob('icons/*.png'))
675 bld.install_files('${DATADIR}/ardour3/pixmaps', bld.path.ant_glob('pixmaps/*.xpm'))
676 bld.install_files('${DATADIR}/ardour3', 'splash.png')
677 bld.install_files('${DATADIR}/ardour3', 'ArdourMono.ttf')
679 # Default UI configuration
680 bld.install_files('${SYSCONFDIR}/ardour3', 'ardour3_ui_default.conf')
682 # Default export stuff
683 bld.install_files('${SYSCONFDIR}/ardour3/export', bld.path.ant_glob('export/*.format'))
686 if bld.is_defined('ENABLE_NLS'):
687 mo_files = bld.path.ant_glob('po/*.mo')
689 lang = os.path.basename(mo.srcpath()).replace('.mo', '')
690 bld.install_as(os.path.join(bld.env['PREFIX'], 'share', 'locale',
691 lang, 'LC_MESSAGES', I18N_PACKAGE + '.mo'),
695 autowaf.build_i18n(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
699 autowaf.build_i18n_pot(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
703 autowaf.build_i18n_po(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
707 autowaf.build_i18n_mo(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,