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',
59 'canvas-note-event.cc',
61 'canvas_patch_change.cc',
62 'canvas-simpleline.c',
63 'canvas-simplerect.c',
69 'control_point_dialog.cc',
73 'edit_note_dialog.cc',
77 'editor_audio_import.cc',
78 'editor_audiotrack.cc',
80 'editor_canvas_events.cc',
81 'editor_component.cc',
84 'editor_route_groups.cc',
85 'editor_export_audio.cc',
86 'editor_group_tabs.cc',
88 'editor_locations.cc',
96 'editor_selection.cc',
97 'editor_snapshots.cc',
99 'editor_tempodisplay.cc',
103 'export_channel_selector.cc',
105 'export_file_notebook.cc',
106 'export_filename_selector.cc',
107 'export_format_dialog.cc',
108 'export_format_selector.cc',
109 'export_preset_selector.cc',
110 'export_timespan_selector.cc',
115 'generic_pluginui.cc',
117 'global_port_matrix.cc',
119 'gtk-custom-hruler.c',
120 'gtk-custom-ruler.c',
121 'gtk_pianokeyboard.c',
123 'insert_time_dialog.cc',
124 'interthread_progress_window.cc',
136 'midi_automation_line.cc',
137 'midi_channel_dialog.cc',
138 'midi_channel_selector.cc',
139 'midi_cut_buffer.cc',
140 'midi_export_dialog.cc',
141 'midi_list_editor.cc',
142 'midi_port_dialog.cc',
143 'midi_region_view.cc',
146 'midi_streamview.cc',
149 'midi_velocity_dialog.cc',
150 'missing_file_dialog.cc',
151 'missing_plugin_dialog.cc',
153 'mixer_group_tabs.cc',
156 'monitor_section.cc',
158 'mono_panner_editor.cc',
161 'new_plugin_preset_dialog.cc',
162 'normalize_dialog.cc',
168 'panner_interface.cc',
170 'piano_roll_header.cc',
172 'playlist_selector.cc',
174 'plugin_selector.cc',
179 'port_matrix_body.cc',
180 'port_matrix_column_labels.cc',
181 'port_matrix_component.cc',
182 'port_matrix_grid.cc',
183 'port_matrix_labels.cc',
184 'port_matrix_row_labels.cc',
186 'patch_change_dialog.cc',
187 'progress_reporter.cc',
190 'quantize_dialog.cc',
191 'rc_option_editor.cc',
193 'region_gain_line.cc',
194 'region_layering_order_editor.cc',
195 'region_selection.cc',
199 'route_group_dialog.cc',
200 'route_group_menu.cc',
201 'route_params_ui.cc',
202 'route_processor_selection.cc',
203 'route_time_axis.cc',
205 'search_path_option.cc',
208 'session_import_dialog.cc',
209 'session_metadata_dialog.cc',
210 'session_option_editor.cc',
212 'shuttle_control.cc',
221 'stereo_panner_editor.cc',
223 'strip_silence_dialog.cc',
224 'tape_region_view.cc',
229 'time_axis_view_item.cc',
233 'track_selection.cc',
234 'track_view_list.cc',
235 'transpose_dialog.cc',
240 'visibility_group.cc',
241 'volume_controller.cc',
247 autowaf.set_options(opt)
251 conf.load('compiler_cxx')
252 autowaf.build_version_files(
253 path_prefix + 'version.h',
254 path_prefix + 'version.cc',
255 'gtk2_ardour', MAJOR, MINOR, MICRO)
256 autowaf.configure(conf)
258 if re.search ("linux", sys.platform) != None:
259 autowaf.check_pkg(conf, 'alsa', uselib_store='ALSA')
261 # TODO: Insert a sanity check for on OS X to ensure CoreAudio is present
263 autowaf.check_pkg(conf, 'flac', uselib_store='FLAC',
264 atleast_version='1.2.1')
265 autowaf.check_pkg(conf, 'gthread-2.0', uselib_store='GTHREAD',
266 atleast_version='2.10.1')
267 autowaf.check_pkg(conf, 'gtk+-2.0', uselib_store='GTK',
268 atleast_version='2.18')
269 autowaf.check_pkg(conf, 'gtkmm-2.4', uselib_store='GTKMM',
270 atleast_version='2.18')
271 autowaf.check_pkg(conf, 'libgnomecanvas-2.0',
272 uselib_store='GNOMECANVAS', atleast_version='2.30')
273 autowaf.check_pkg(conf, 'libgnomecanvasmm-2.6',
274 uselib_store='GNOMECANVASMM', atleast_version='2.16')
275 autowaf.check_pkg(conf, 'ogg', uselib_store='OGG', atleast_version='1.1.2')
276 autowaf.check_pkg(conf, 'x11', uselib_store='X11', atleast_version='1.1', mandatory=False)
277 autowaf.check_pkg(conf, 'fontconfig', uselib_store='FONTCONFIG')
279 conf.write_config_header('gtk2ardour-config.h', remove=False)
282 autowaf.check_header(conf, 'cxx', 'boost/shared_ptr.hpp')
283 autowaf.check_header(conf, 'cxx', 'boost/weak_ptr.hpp')
285 # Add a waf `feature' to allow compilation of things using winegcc
286 from waflib.TaskGen import feature
288 def set_winegcc(self):
289 self.env.LINK_CXX = self.env.LINK_CC = 'wineg++'
290 self.env.CC = 'winegcc'
292 def _doPyp(infileName, deps = False):
295 re_spaces = re.compile("\s+")
297 if infileName == '-':
300 fd = open(infileName)
301 inLines = fd.readlines()
307 bits = re_spaces.split(line)
308 if bits[0] == '##include':
313 # assume included file comes from same place as source file
314 incName = os.path.join (os.path.dirname (infileName), incName);
315 outStr += _doPyp(incName)
326 def include_processor(task):
327 infileName = task.inputs[0].srcpath()
328 outfileName = os.path.join(out, task.outputs[0].bldpath())
329 fdOut = open (outfileName, "w")
330 fdOut.write (_doPyp(infileName))
334 def build_color_scheme(path, prefix):
338 if re.search ('^#@color', line):
339 line.strip() # remove newline
341 if len(color_scheme):
343 color_scheme += prefix
345 color_scheme += words[1]
347 color_scheme += words[2]
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',
373 obj.target = 'ardour-3.0-vst.exe.so'
374 obj.includes = [ '../libs/fst', '.' ]
375 obj.linkflags = ['-mwindows', '-Wl,--export-dynamic']
376 obj.defines = ['_POSIX_SOURCE', 'USE_WS_PREFIX']
377 obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
378 # end of the wine executable
380 # now the shared library containing the GTK GUI for ardour
381 obj = bld (features = 'cxx c cxxshlib')
382 obj.source = gtk2_ardour_sources
383 obj.includes = [ '../libs/fst', '.' ]
384 obj.name = 'libgtk2_ardour'
385 obj.target = 'gtk2_ardour'
387 # just the normal executable version of the GTK GUI
388 obj = bld(features = 'cxx c cxxprogram')
389 obj.source = gtk2_ardour_sources
390 obj.target = 'ardour-3.0'
393 # continue with setup of obj, which could be a shared library
396 obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
398 obj.uselib = 'UUID FLAC FONTCONFIG GLIBMM GTHREAD GTK OGG ALSA CURL DL'
399 obj.uselib += ' GTKMM GNOMECANVASMM GNOMECANVAS '
400 obj.uselib += ' AUDIOUNITS OSX GTKOSX '
401 obj.use = [ 'libpbd',
408 if sys.platform == 'darwin':
409 obj.use += ' libappleutility'
411 'PACKAGE="' + I18N_PACKAGE + '"',
412 'VERSIONSTRING="' + bld.env['VERSION'] + '"',
413 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
414 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
415 'LOCALEDIR="' + os.path.join(os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
416 'PROGRAM_NAME="' + bld.env['PROGRAM_NAME'] + '"'
418 obj.includes += ['../libs']
420 if bld.env['VIDEOTIMELINE']:
422 'video_image_frame.cc',
423 'add_video_dialog.cc',
424 'editor_videotimeline.cc',
428 'open_video_monitor_dialog.cc',
429 'transcode_ffmpeg.cc',
430 'transcode_video_dialog.cc',
431 'video_server_dialog.cc',
432 'video_copy_dialog.cc',
434 'export_video_dialog.cc',
435 'export_video_infobox.cc'
438 if bld.is_defined('HAVE_SUIL'):
439 obj.source += [ 'lv2_plugin_ui.cc' ]
440 obj.use += [ 'SUIL' ]
442 if bld.is_defined('FREESOUND'):
443 obj.source += [ 'sfdb_freesound_mootcher.cc' ]
444 obj.defines += [ 'FREESOUND' ]
446 if bld.is_defined('NEED_INTL'):
447 obj.linkflags = ' -lintl'
449 if bld.is_defined('WINDOWS_VST_SUPPORT'):
450 obj.source += [ 'windows_vst_plugin_ui.cc' ]
451 obj.defines += [ 'WINDOWS_VST_SUPPORT' ]
454 if bld.is_defined('LXVST_SUPPORT'):
455 obj.source += [ 'linux_vst_gui_support.cc', 'lxvst_plugin_ui.cc' ]
456 obj.defines += [ 'LXVST_SUPPORT' ]
459 if bld.is_defined('WINDOWS_VST_SUPPORT') or bld.is_defined('LXVST_SUPPORT'):
460 obj.source += [ 'vst_plugin_ui.cc' ]
462 if bld.is_defined('PHONE_HOME'):
463 obj.defines += [ 'PHONE_HOME' ]
465 if bld.is_defined('HAVE_COREAUDIO'):
466 TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cc']
467 obj.source += [ 'cocoacarbon.mm' ]
468 obj.use += ' libappleutility '
470 if bld.is_defined('AUDIOUNIT_SUPPORT'):
471 obj.source += [ 'au_pluginui.mm' ]
475 wrapper_subst_dict = {
476 'INSTALL_PREFIX' : bld.env['PREFIX'],
477 'LIBDIR' : os.path.normpath(bld.env['LIBDIR']),
478 'DATADIR' : os.path.normpath(bld.env['DATADIR']),
479 'SYSCONFDIR' : os.path.normpath(bld.env['SYSCONFDIR']),
480 'LIBS' : 'build/libs',
482 'EXECUTABLE' : 'build/gtk2_ardour/ardour-3.0'
485 def set_subst_dict(obj, dict):
487 setattr(obj, i, dict[i])
489 obj = bld(features = 'subst', rule= 'chmod 0755 ${TGT}')
490 obj.source = 'ardev_common.sh.in'
491 obj.target = 'ardev_common_waf.sh'
492 obj.chmod = Utils.O755
493 obj.dict = wrapper_subst_dict
494 set_subst_dict(obj, wrapper_subst_dict)
496 obj = bld(features = 'subst')
497 obj.source = 'ardour.sh.in'
498 obj.target = 'ardour3'
499 obj.chmod = Utils.O755
500 obj.dict = wrapper_subst_dict
501 obj.install_path = bld.env['BINDIR']
502 set_subst_dict(obj, wrapper_subst_dict)
504 if bld.is_defined('WINDOWS_VST_SUPPORT'):
505 obj = bld(features = 'subst')
506 obj.source = '../vst/ardourvst.in'
507 obj.target = 'ardourvst3'
508 obj.chmod = Utils.O755
509 obj.dict = wrapper_subst_dict
510 obj.install_path = bld.env['BINDIR']
511 set_subst_dict(obj, wrapper_subst_dict)
515 dark_rc_subst_dict = {}
516 light_rc_subst_dict = {}
521 if bld.is_defined('GTKOSX'): # OS X fonts
534 # There is no acceptable monospace font available on older versions of OS X
535 # and no API on those versions to load TTF files that will work with
536 # GTK/fontconfig/pango.
538 # In addition, the ArdourMono font gets clipped for some reason on OS X
540 # Moreover, Lucida Grande just seems to work even though it is not monospace
544 'MONOSPACE' : 'Lucida Grande',
546 else: # Linux/X11 fonts
547 basefont = '' # unspecified - use system defaults
559 'MONOSPACE' : 'ArdourMono',
562 # Set up font substitution dictionary
564 for style in ['', 'BOLD', 'ITALIC']:
565 for sizename,points in iter(font_sizes.items()):
567 key = "_".join (['FONT',style,sizename])
568 fontstyle = " ".join ([basefont,style.lower(),points])
570 key = "_".join (['FONT',sizename])
571 fontstyle = " ".join ([basefont,points])
573 dark_rc_subst_dict[key] = fontstyle
574 light_rc_subst_dict[key] = fontstyle
577 for sizename,points in iter(font_sizes.items()):
578 key = "_".join (['FONT_SIZE',sizename])
579 dark_rc_subst_dict[key] = points
580 light_rc_subst_dict[key] = points
582 # various font names, eg @BOLD_MONOSPACE@
583 for font_sym,text in iter(font_names.items()):
585 dark_rc_subst_dict[key] = text
586 light_rc_subst_dict[key] = text
589 dark_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
590 'gtk2_ardour/ardour3_ui_dark.rc.in', 'ARDOUR_DARK')
591 dark_rc_subst_dict['COLPREFIX'] = 'ARDOUR_DARK'
592 light_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
593 'gtk2_ardour/ardour3_ui_light.rc.in', 'ARDOUR_LIGHT')
594 light_rc_subst_dict['COLPREFIX'] = 'ARDOUR_LIGHT'
596 obj = bld(features = 'subst')
597 obj.source = [ 'ardour3_ui_dark.rc.in' ]
598 obj.target = 'ardour3_ui_dark.rc.pre'
599 obj.install_path = None
600 set_subst_dict(obj, dark_rc_subst_dict)
602 obj = bld(features = 'subst')
603 obj.source = [ 'ardour3_ui_light.rc.in' ]
604 obj.target = 'ardour3_ui_light.rc.pre'
605 obj.install_path = None
606 set_subst_dict(obj, light_rc_subst_dict)
608 obj = bld(features = 'subst')
609 obj.source = [ 'ardour3_styles.rc.in' ]
610 obj.target = 'ardour3_dark_styles.rc'
611 obj.install_path = None
612 set_subst_dict(obj, dark_rc_subst_dict)
614 obj = bld(features = 'subst')
615 obj.source = [ 'ardour3_styles.rc.in' ]
616 obj.target = 'ardour3_light_styles.rc'
617 obj.install_path = None
618 set_subst_dict(obj, light_rc_subst_dict)
620 obj = bld(features = 'subst')
621 obj.source = [ 'ardour3_fonts.rc.in' ]
622 obj.target = 'ardour3_dark_fonts.rc'
623 obj.install_path = None
624 set_subst_dict(obj, dark_rc_subst_dict)
626 obj = bld(features = 'subst')
627 obj.source = [ 'ardour3_fonts.rc.in' ]
628 obj.target = 'ardour3_light_fonts.rc'
629 obj.install_path = None
630 set_subst_dict(obj, light_rc_subst_dict)
632 obj = bld(rule = 'cp ${SRC} ${TGT}')
633 obj.source = [ 'ardour3_widget_list.rc' ]
634 obj.target = 'ardour3_widgets.rc'
635 obj.install_path = None
637 obj = bld (rule = include_processor)
638 obj.source = [ 'ardour3_ui_dark.rc.pre' ]
639 # find and add all ##include dependencies as sources
640 obj.source += _doPyp (bld.path.find_resource ('ardour3_ui_dark.rc.in').srcpath(), True)
641 obj.target = 'ardour3_ui_dark.rc'
642 obj.install_path = '${SYSCONFDIR}/ardour3'
644 obj = bld (rule = include_processor)
645 obj.source = [ 'ardour3_ui_light.rc.pre' ]
646 # find and add all ##include dependencies as sources
647 obj.source += _doPyp (bld.path.find_resource ('ardour3_ui_light.rc.in').srcpath(), True)
648 obj.target = 'ardour3_ui_light.rc'
649 obj.install_path = '${SYSCONFDIR}/ardour3'
653 if bld.is_defined('GTKOSX'):
654 menus_argv = [ '-E', '-P', '-DGTKOSX' ]
656 menus_argv = [ '-E', '-P' ]
658 if bld.env['VIDEOTIMELINE']:
659 menus_argv.append ('-DWITH_VIDEOTIMELINE')
660 obj = bld(features = 'command-output')
662 obj.command_is_external = True
664 obj.argv = menus_argv
665 obj.stdin = 'ardour.menus.in'
666 obj.stdout = 'ardour.menus'
667 obj.dep_vars = ['GTKOSX', 'VIDEOTIMELINE']
668 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
673 # 'SAE-de-keypad', 'SAE-de-nokeypad', 'SAE-us-keypad',
674 # 'SAE-us-nokeypad', 'ergonomic-us'
676 for b in [ 'mnemonic-us' ] :
678 target = b + '.bindings',
679 source = b + '.bindings.in',
680 rule = '../tools/fmt-bindings --platform="%s" --winkey="%s" --accelmap <${SRC} >${TGT}' % (sys.platform, bld.env['WINDOWS_KEY'] )
682 obj.install_path = os.path.join(bld.env['SYSCONFDIR'], 'ardour3')
684 # not modified at present
685 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
686 'step_editing.bindings')
687 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
691 bld.install_files('${DATADIR}/ardour3/icons', bld.path.ant_glob('icons/*.png'))
692 bld.install_files('${DATADIR}/ardour3/pixmaps', bld.path.ant_glob('pixmaps/*.xpm'))
693 bld.install_files('${DATADIR}/ardour3', 'splash.png')
694 bld.install_files('${DATADIR}/ardour3', 'ArdourMono.ttf')
696 # Default UI configuration
697 bld.install_files('${SYSCONFDIR}/ardour3', 'ardour3_ui_default.conf')
699 # Default export stuff
700 bld.install_files('${SYSCONFDIR}/ardour3/export', bld.path.ant_glob('export/*.format'))
703 if bld.is_defined('ENABLE_NLS'):
704 mo_files = bld.path.ant_glob('po/*.mo')
706 lang = os.path.basename(mo.srcpath()).replace('.mo', '')
707 bld.install_as(os.path.join(bld.env['PREFIX'], 'share', 'locale',
708 lang, 'LC_MESSAGES', I18N_PACKAGE + '.mo'),
712 autowaf.build_i18n(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
716 autowaf.build_i18n_pot(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
720 autowaf.build_i18n_po(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
724 autowaf.build_i18n_mo(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,