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',
51 'canvas-note-event.cc',
53 'canvas_patch_change.cc',
54 'canvas-simpleline.c',
55 'canvas-simplerect.c',
61 'control_point_dialog.cc',
65 'edit_note_dialog.cc',
69 'editor_audio_import.cc',
70 'editor_audiotrack.cc',
72 'editor_canvas_events.cc',
73 'editor_component.cc',
76 'editor_route_groups.cc',
77 'editor_export_audio.cc',
78 'editor_group_tabs.cc',
80 'editor_locations.cc',
88 'editor_selection.cc',
89 'editor_snapshots.cc',
91 'editor_tempodisplay.cc',
95 'export_channel_selector.cc',
97 'export_file_notebook.cc',
98 'export_filename_selector.cc',
99 'export_format_dialog.cc',
100 'export_format_selector.cc',
101 'export_preset_selector.cc',
102 'export_timespan_selector.cc',
107 'generic_pluginui.cc',
109 'global_port_matrix.cc',
111 'gtk-custom-hruler.c',
112 'gtk-custom-ruler.c',
113 'gtk_pianokeyboard.c',
115 'insert_time_dialog.cc',
116 'interthread_progress_window.cc',
128 'midi_automation_line.cc',
129 'midi_channel_dialog.cc',
130 'midi_channel_selector.cc',
131 'midi_cut_buffer.cc',
132 'midi_export_dialog.cc',
133 'midi_list_editor.cc',
134 'midi_port_dialog.cc',
135 'midi_region_view.cc',
138 'midi_streamview.cc',
141 'midi_velocity_dialog.cc',
142 'missing_file_dialog.cc',
143 'missing_plugin_dialog.cc',
145 'mixer_group_tabs.cc',
151 'monitor_section.cc',
153 'mono_panner_editor.cc',
156 'new_plugin_preset_dialog.cc',
157 'normalize_dialog.cc',
165 'panner_interface.cc',
167 'piano_roll_header.cc',
169 'playlist_selector.cc',
171 'plugin_selector.cc',
176 'port_matrix_body.cc',
177 'port_matrix_column_labels.cc',
178 'port_matrix_component.cc',
179 'port_matrix_grid.cc',
180 'port_matrix_labels.cc',
181 'port_matrix_row_labels.cc',
183 'patch_change_dialog.cc',
184 'progress_reporter.cc',
187 'quantize_dialog.cc',
188 'rc_option_editor.cc',
190 'region_gain_line.cc',
191 'region_layering_order_editor.cc',
192 'region_selection.cc',
196 'route_group_dialog.cc',
197 'route_group_menu.cc',
198 'route_params_ui.cc',
199 'route_processor_selection.cc',
200 'route_time_axis.cc',
202 'search_path_option.cc',
205 'session_import_dialog.cc',
206 'session_metadata_dialog.cc',
207 'session_option_editor.cc',
209 'shuttle_control.cc',
218 'stereo_panner_editor.cc',
220 'strip_silence_dialog.cc',
221 'tape_region_view.cc',
226 'time_axis_view_item.cc',
230 'track_selection.cc',
231 'track_view_list.cc',
232 'transpose_dialog.cc',
237 'visibility_group.cc',
238 'volume_controller.cc',
241 # video-timeline related sources:
242 'video_image_frame.cc',
243 'add_video_dialog.cc',
244 'editor_videotimeline.cc',
248 'transcode_ffmpeg.cc',
249 'transcode_video_dialog.cc',
250 'video_server_dialog.cc',
252 'export_video_dialog.cc',
253 'export_video_infobox.cc'
257 autowaf.set_options(opt)
261 conf.load('compiler_cxx')
262 # we don't use hard-coded micro versions with ardour, so hard code it to zero
263 autowaf.build_version_files(
264 path_prefix + 'version.h',
265 path_prefix + 'version.cc',
266 'gtk2_ardour', conf.env['MAJOR'], conf.env['MINOR'], 0)
267 autowaf.configure(conf)
269 if re.search ("linux", sys.platform) != None:
270 autowaf.check_pkg(conf, 'alsa', uselib_store='ALSA')
272 # TODO: Insert a sanity check for on OS X to ensure CoreAudio is present
274 autowaf.check_pkg(conf, 'flac', uselib_store='FLAC',
275 atleast_version='1.2.1')
276 autowaf.check_pkg(conf, 'gthread-2.0', uselib_store='GTHREAD',
277 atleast_version='2.10.1')
278 autowaf.check_pkg(conf, 'gtk+-2.0', uselib_store='GTK',
279 atleast_version='2.18')
280 autowaf.check_pkg(conf, 'gtkmm-2.4', uselib_store='GTKMM',
281 atleast_version='2.18')
282 autowaf.check_pkg(conf, 'libgnomecanvas-2.0',
283 uselib_store='GNOMECANVAS', atleast_version='2.30')
284 autowaf.check_pkg(conf, 'libgnomecanvasmm-2.6',
285 uselib_store='GNOMECANVASMM', atleast_version='2.16')
286 autowaf.check_pkg(conf, 'ogg', uselib_store='OGG', atleast_version='1.1.2')
287 autowaf.check_pkg(conf, 'x11', uselib_store='X11', atleast_version='1.1', mandatory=False)
288 autowaf.check_pkg(conf, 'fontconfig', uselib_store='FONTCONFIG')
290 conf.write_config_header('gtk2ardour-config.h', remove=False)
293 autowaf.check_header(conf, 'cxx', 'boost/shared_ptr.hpp')
294 autowaf.check_header(conf, 'cxx', 'boost/weak_ptr.hpp')
296 # Add a waf `feature' to allow compilation of things using winegcc
297 from waflib.TaskGen import feature
299 def set_winegcc(self):
300 self.env.LINK_CXX = self.env.LINK_CC = 'wineg++'
301 self.env.CC = 'winegcc'
303 def _doPyp(infileName, deps = False):
306 re_spaces = re.compile("\s+")
308 if infileName == '-':
311 fd = open(infileName)
312 inLines = fd.readlines()
318 bits = re_spaces.split(line)
319 if bits[0] == '##include':
324 # assume included file comes from same place as source file
325 incName = os.path.join (os.path.dirname (infileName), incName);
326 outStr += _doPyp(incName)
337 def include_processor(task):
338 infileName = task.inputs[0].srcpath()
339 outfileName = os.path.join(out, task.outputs[0].bldpath())
340 fdOut = open (outfileName, "w")
341 fdOut.write (_doPyp(infileName))
345 def build_color_scheme(path, prefix):
349 if re.search ('^#@color', line):
350 line.strip() # remove newline
352 if len(color_scheme):
354 color_scheme += prefix
356 color_scheme += words[1]
358 color_scheme += words[2]
364 VERSION = "%s.%s" % (bld.env['MAJOR'], bld.env['MINOR'])
366 if bld.is_defined('WINDOWS_VST_SUPPORT'):
367 # If we require VST support we build a stub main() and the FST library
368 # here using winegcc, and link it to the GTK front-end library
369 obj = bld(features = 'cxx c cxxprogram wine')
372 ../libs/fst/fstinfofile.c
378 obj.use = [ 'libpbd',
386 obj.target = 'ardour-' + bld.env['VERSION'] + '-vst.exe.so'
387 obj.includes = [ '../libs/fst', '.' ]
388 obj.linkflags = ['-mwindows', '-Wl,--export-dynamic']
389 obj.defines = ['_POSIX_SOURCE', 'USE_WS_PREFIX']
390 obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
391 # end of the wine executable
393 # now the shared library containing the GTK GUI for ardour
394 obj = bld (features = 'cxx c cxxshlib')
395 obj.source = gtk2_ardour_sources
396 obj.includes = [ '../libs/fst', '.' ]
397 obj.name = 'libgtk2_ardour'
398 obj.target = 'gtk2_ardour'
400 # just the normal executable version of the GTK GUI
401 obj = bld(features = 'cxx c cxxprogram')
402 obj.source = gtk2_ardour_sources
403 obj.target = 'ardour-' + bld.env['VERSION']
406 # continue with setup of obj, which could be a shared library
409 obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
411 obj.uselib = 'UUID FLAC FONTCONFIG GLIBMM GTHREAD GTK OGG ALSA CURL DL'
412 obj.uselib += ' GTKMM GNOMECANVASMM GNOMECANVAS '
413 obj.uselib += ' AUDIOUNITS OSX GTKOSX LO '
414 obj.use = [ 'libpbd',
421 if sys.platform == 'darwin':
422 obj.use += ' libappleutility'
424 'PACKAGE="' + I18N_PACKAGE + '"',
425 'VERSIONSTRING="' + bld.env['VERSION'] + '"',
426 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
427 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
428 'LOCALEDIR="' + os.path.join(os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
429 'PROGRAM_NAME="' + bld.env['PROGRAM_NAME'] + '"'
431 obj.includes += ['../libs']
433 if bld.is_defined('HAVE_SUIL'):
434 obj.source += [ 'lv2_plugin_ui.cc' ]
435 obj.use += [ 'SUIL' ]
437 if bld.is_defined('FREESOUND'):
438 obj.source += [ 'sfdb_freesound_mootcher.cc' ]
439 obj.defines += [ 'FREESOUND' ]
441 if bld.is_defined('NEED_INTL'):
442 obj.linkflags = ' -lintl'
444 if bld.is_defined('WINDOWS_VST_SUPPORT'):
445 obj.source += [ 'windows_vst_plugin_ui.cc' ]
446 obj.defines += [ 'WINDOWS_VST_SUPPORT' ]
449 if bld.is_defined('LXVST_SUPPORT'):
450 obj.source += [ 'linux_vst_gui_support.cc', 'lxvst_plugin_ui.cc' ]
451 obj.defines += [ 'LXVST_SUPPORT' ]
454 if bld.is_defined('WINDOWS_VST_SUPPORT') or bld.is_defined('LXVST_SUPPORT'):
455 obj.source += [ 'vst_plugin_ui.cc' ]
457 if bld.is_defined('PHONE_HOME'):
458 obj.defines += [ 'PHONE_HOME' ]
460 if bld.is_defined('HAVE_COREAUDIO'):
461 TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cc']
462 obj.source += [ 'cocoacarbon.mm' ]
463 obj.use += ' libappleutility '
465 if bld.is_defined('AUDIOUNIT_SUPPORT'):
466 obj.source += [ 'au_pluginui.mm' ]
470 wrapper_subst_dict = {
471 'INSTALL_PREFIX' : bld.env['PREFIX'],
472 'LIBDIR' : os.path.normpath(bld.env['LIBDIR']),
473 'DATADIR' : os.path.normpath(bld.env['DATADIR']),
474 'SYSCONFDIR' : os.path.normpath(bld.env['SYSCONFDIR']),
475 'LIBS' : 'build/libs',
476 'VERSION' : bld.env['VERSION'],
477 'EXECUTABLE' : 'build/gtk2_ardour/ardour-' + bld.env['VERSION']
480 def set_subst_dict(obj, dict):
482 setattr(obj, i, dict[i])
484 obj = bld(features = 'subst', rule= 'chmod 0755 ${TGT}')
485 obj.source = 'ardev_common.sh.in'
486 obj.target = 'ardev_common_waf.sh'
487 obj.chmod = Utils.O755
488 obj.dict = wrapper_subst_dict
489 set_subst_dict(obj, wrapper_subst_dict)
491 obj = bld(features = 'subst')
492 obj.source = 'ardour.sh.in'
493 obj.target = 'ardour3'
494 obj.chmod = Utils.O755
495 obj.dict = wrapper_subst_dict
496 obj.install_path = bld.env['BINDIR']
497 set_subst_dict(obj, wrapper_subst_dict)
499 if bld.is_defined('WINDOWS_VST_SUPPORT'):
500 obj = bld(features = 'subst')
501 obj.source = '../vst/ardourvst.in'
502 obj.target = 'ardourvst3'
503 obj.chmod = Utils.O755
504 obj.dict = wrapper_subst_dict
505 obj.install_path = bld.env['BINDIR']
506 set_subst_dict(obj, wrapper_subst_dict)
510 dark_rc_subst_dict = {}
511 light_rc_subst_dict = {}
516 if bld.is_defined('GTKOSX'): # OS X fonts
529 # There is no acceptable monospace font available on older versions of OS X
530 # and no API on those versions to load TTF files that will work with
531 # GTK/fontconfig/pango.
533 # In addition, the ArdourMono font gets clipped for some reason on OS X
535 # Moreover, Lucida Grande just seems to work even though it is not monospace
539 'MONOSPACE' : 'Lucida Grande',
541 else: # Linux/X11 fonts
542 basefont = '' # unspecified - use system defaults
554 'MONOSPACE' : 'ArdourMono',
557 # Set up font substitution dictionary
559 for style in ['', 'BOLD', 'ITALIC']:
560 for sizename,points in iter(font_sizes.items()):
562 key = "_".join (['FONT',style,sizename])
563 fontstyle = " ".join ([basefont,style.lower(),points])
565 key = "_".join (['FONT',sizename])
566 fontstyle = " ".join ([basefont,points])
568 dark_rc_subst_dict[key] = fontstyle
569 light_rc_subst_dict[key] = fontstyle
572 for sizename,points in iter(font_sizes.items()):
573 key = "_".join (['FONT_SIZE',sizename])
574 dark_rc_subst_dict[key] = points
575 light_rc_subst_dict[key] = points
577 # various font names, eg @BOLD_MONOSPACE@
578 for font_sym,text in iter(font_names.items()):
580 dark_rc_subst_dict[key] = text
581 light_rc_subst_dict[key] = text
584 dark_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
585 'gtk2_ardour/ardour3_ui_dark.rc.in', 'ARDOUR_DARK')
586 dark_rc_subst_dict['COLPREFIX'] = 'ARDOUR_DARK'
587 light_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
588 'gtk2_ardour/ardour3_ui_light.rc.in', 'ARDOUR_LIGHT')
589 light_rc_subst_dict['COLPREFIX'] = 'ARDOUR_LIGHT'
591 obj = bld(features = 'subst')
592 obj.source = [ 'ardour3_ui_dark.rc.in' ]
593 obj.target = 'ardour3_ui_dark.rc.pre'
594 obj.install_path = None
595 set_subst_dict(obj, dark_rc_subst_dict)
597 obj = bld(features = 'subst')
598 obj.source = [ 'ardour3_ui_light.rc.in' ]
599 obj.target = 'ardour3_ui_light.rc.pre'
600 obj.install_path = None
601 set_subst_dict(obj, light_rc_subst_dict)
603 obj = bld(features = 'subst')
604 obj.source = [ 'ardour3_styles.rc.in' ]
605 obj.target = 'ardour3_dark_styles.rc'
606 obj.install_path = None
607 set_subst_dict(obj, dark_rc_subst_dict)
609 obj = bld(features = 'subst')
610 obj.source = [ 'ardour3_styles.rc.in' ]
611 obj.target = 'ardour3_light_styles.rc'
612 obj.install_path = None
613 set_subst_dict(obj, light_rc_subst_dict)
615 obj = bld(features = 'subst')
616 obj.source = [ 'ardour3_fonts.rc.in' ]
617 obj.target = 'ardour3_dark_fonts.rc'
618 obj.install_path = None
619 set_subst_dict(obj, dark_rc_subst_dict)
621 obj = bld(features = 'subst')
622 obj.source = [ 'ardour3_fonts.rc.in' ]
623 obj.target = 'ardour3_light_fonts.rc'
624 obj.install_path = None
625 set_subst_dict(obj, light_rc_subst_dict)
627 obj = bld(rule = 'cp ${SRC} ${TGT}')
628 obj.source = [ 'ardour3_widget_list.rc' ]
629 obj.target = 'ardour3_widgets.rc'
630 obj.install_path = None
632 obj = bld (rule = include_processor)
633 obj.source = [ 'ardour3_ui_dark.rc.pre' ]
634 # find and add all ##include dependencies as sources
635 obj.source += _doPyp (bld.path.find_resource ('ardour3_ui_dark.rc.in').srcpath(), True)
636 obj.target = 'ardour3_ui_dark.rc'
637 obj.install_path = '${SYSCONFDIR}/ardour3'
639 obj = bld (rule = include_processor)
640 obj.source = [ 'ardour3_ui_light.rc.pre' ]
641 # find and add all ##include dependencies as sources
642 obj.source += _doPyp (bld.path.find_resource ('ardour3_ui_light.rc.in').srcpath(), True)
643 obj.target = 'ardour3_ui_light.rc'
644 obj.install_path = '${SYSCONFDIR}/ardour3'
648 if bld.is_defined('GTKOSX'):
649 menus_argv = [ '-E', '-P', '-DGTKOSX', '-DNOVIDEOTIMELINE' ]
651 menus_argv = [ '-E', '-P' ]
653 obj = bld(features = 'command-output')
655 obj.command_is_external = True
657 obj.argv = menus_argv
658 obj.stdin = 'ardour.menus.in'
659 obj.stdout = 'ardour.menus'
660 obj.dep_vars = ['GTKOSX']
661 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
666 # 'SAE-de-keypad', 'SAE-de-nokeypad', 'SAE-us-keypad',
667 # 'SAE-us-nokeypad', 'ergonomic-us'
669 for b in [ 'mnemonic-us' ] :
671 target = b + '.bindings',
672 source = b + '.bindings.in',
673 rule = '../tools/fmt-bindings --platform="%s" --winkey="%s" --accelmap <${SRC} >${TGT}' % (sys.platform, bld.env['WINDOWS_KEY'] )
675 obj.install_path = os.path.join(bld.env['SYSCONFDIR'], 'ardour3')
677 # not modified at present
678 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
679 'step_editing.bindings')
680 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
684 bld.install_files('${DATADIR}/ardour3/icons', bld.path.ant_glob('icons/*.png'))
685 bld.install_files('${DATADIR}/ardour3/pixmaps', bld.path.ant_glob('pixmaps/*.xpm'))
686 bld.install_files('${DATADIR}/ardour3', 'splash.png')
687 bld.install_files('${DATADIR}/ardour3', 'ArdourMono.ttf')
689 # Default UI configuration
690 bld.install_files('${SYSCONFDIR}/ardour3', 'ardour3_ui_default.conf')
692 # Default export stuff
693 bld.install_files('${SYSCONFDIR}/ardour3/export', bld.path.ant_glob('export/*.format'))
696 if bld.is_defined('ENABLE_NLS'):
697 mo_files = bld.path.ant_glob('po/*.mo')
699 lang = os.path.basename(mo.srcpath()).replace('.mo', '')
700 bld.install_as(os.path.join(bld.env['PREFIX'], 'share', 'locale',
701 lang, 'LC_MESSAGES', I18N_PACKAGE + '.mo'),
705 autowaf.build_i18n(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
709 autowaf.build_i18n_pot(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
713 autowaf.build_i18n_po(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
717 autowaf.build_i18n_mo(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,