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 # Variables for 'waf dist'
16 VERSION = "%s.%s" % (MAJOR, MINOR)
17 I18N_PACKAGE = 'gtk2_ardour3'
23 path_prefix = 'gtk2_ardour/'
25 gtk2_ardour_sources = [
28 'add_route_dialog.cc',
29 'ambiguous_file_dialog.cc',
35 'ardour_ui_dependents.cc',
36 'ardour_ui_dialogs.cc',
39 'ardour_ui_options.cc',
42 'audio_region_editor.cc',
43 'audio_region_view.cc',
44 'audio_streamview.cc',
46 'automation_controller.cc',
48 'automation_region_view.cc',
49 'automation_streamview.cc',
50 'automation_time_axis.cc',
52 'big_clock_window.cc',
57 'canvas-note-event.cc',
59 'canvas_patch_change.cc',
60 'canvas-simpleline.c',
61 'canvas-simplerect.c',
67 'control_point_dialog.cc',
71 'edit_note_dialog.cc',
75 'editor_audio_import.cc',
76 'editor_audiotrack.cc',
78 'editor_canvas_events.cc',
79 'editor_component.cc',
82 'editor_route_groups.cc',
83 'editor_export_audio.cc',
84 'editor_group_tabs.cc',
86 'editor_locations.cc',
94 'editor_selection.cc',
95 'editor_snapshots.cc',
97 'editor_tempodisplay.cc',
101 'export_channel_selector.cc',
103 'export_file_notebook.cc',
104 'export_filename_selector.cc',
105 'export_format_dialog.cc',
106 'export_format_selector.cc',
107 'export_preset_selector.cc',
108 'export_timespan_selector.cc',
113 'generic_pluginui.cc',
115 'global_port_matrix.cc',
117 'gtk-custom-hruler.c',
118 'gtk-custom-ruler.c',
119 'gtk_pianokeyboard.c',
121 'insert_time_dialog.cc',
122 'interthread_progress_window.cc',
134 'midi_automation_line.cc',
135 'midi_channel_dialog.cc',
136 'midi_channel_selector.cc',
137 'midi_cut_buffer.cc',
138 'midi_export_dialog.cc',
139 'midi_list_editor.cc',
140 'midi_port_dialog.cc',
141 'midi_region_view.cc',
144 'midi_streamview.cc',
147 'midi_velocity_dialog.cc',
148 'missing_file_dialog.cc',
149 'missing_plugin_dialog.cc',
151 'mixer_group_tabs.cc',
154 'monitor_section.cc',
156 'mono_panner_editor.cc',
159 'new_plugin_preset_dialog.cc',
160 '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',
244 # video-timeline related sources:
245 'video_image_frame.cc',
246 'add_video_dialog.cc',
247 'editor_videotimeline.cc',
251 'transcode_ffmpeg.cc',
252 'transcode_video_dialog.cc',
253 'video_server_dialog.cc',
255 'export_video_dialog.cc',
256 'export_video_infobox.cc'
260 autowaf.set_options(opt)
264 conf.load('compiler_cxx')
265 # we don't use hard-coded micro versions with ardour, so hard code it to zero
266 autowaf.build_version_files(
267 path_prefix + 'version.h',
268 path_prefix + 'version.cc',
269 'gtk2_ardour', MAJOR, MINOR, 0)
270 autowaf.configure(conf)
272 if re.search ("linux", sys.platform) != None:
273 autowaf.check_pkg(conf, 'alsa', uselib_store='ALSA')
275 # TODO: Insert a sanity check for on OS X to ensure CoreAudio is present
277 autowaf.check_pkg(conf, 'flac', uselib_store='FLAC',
278 atleast_version='1.2.1')
279 autowaf.check_pkg(conf, 'gthread-2.0', uselib_store='GTHREAD',
280 atleast_version='2.10.1')
281 autowaf.check_pkg(conf, 'gtk+-2.0', uselib_store='GTK',
282 atleast_version='2.18')
283 autowaf.check_pkg(conf, 'gtkmm-2.4', uselib_store='GTKMM',
284 atleast_version='2.18')
285 autowaf.check_pkg(conf, 'libgnomecanvas-2.0',
286 uselib_store='GNOMECANVAS', atleast_version='2.30')
287 autowaf.check_pkg(conf, 'libgnomecanvasmm-2.6',
288 uselib_store='GNOMECANVASMM', atleast_version='2.16')
289 autowaf.check_pkg(conf, 'ogg', uselib_store='OGG', atleast_version='1.1.2')
290 autowaf.check_pkg(conf, 'x11', uselib_store='X11', atleast_version='1.1', mandatory=False)
291 autowaf.check_pkg(conf, 'fontconfig', uselib_store='FONTCONFIG')
293 conf.write_config_header('gtk2ardour-config.h', remove=False)
296 autowaf.check_header(conf, 'cxx', 'boost/shared_ptr.hpp')
297 autowaf.check_header(conf, 'cxx', 'boost/weak_ptr.hpp')
299 # Add a waf `feature' to allow compilation of things using winegcc
300 from waflib.TaskGen import feature
302 def set_winegcc(self):
303 self.env.LINK_CXX = self.env.LINK_CC = 'wineg++'
304 self.env.CC = 'winegcc'
306 def _doPyp(infileName, deps = False):
309 re_spaces = re.compile("\s+")
311 if infileName == '-':
314 fd = open(infileName)
315 inLines = fd.readlines()
321 bits = re_spaces.split(line)
322 if bits[0] == '##include':
327 # assume included file comes from same place as source file
328 incName = os.path.join (os.path.dirname (infileName), incName);
329 outStr += _doPyp(incName)
340 def include_processor(task):
341 infileName = task.inputs[0].srcpath()
342 outfileName = os.path.join(out, task.outputs[0].bldpath())
343 fdOut = open (outfileName, "w")
344 fdOut.write (_doPyp(infileName))
348 def build_color_scheme(path, prefix):
352 if re.search ('^#@color', line):
353 line.strip() # remove newline
355 if len(color_scheme):
357 color_scheme += prefix
359 color_scheme += words[1]
361 color_scheme += words[2]
367 if bld.is_defined('WINDOWS_VST_SUPPORT'):
368 # If we require VST support we build a stub main() and the FST library
369 # here using winegcc, and link it to the GTK front-end library
370 obj = bld(features = 'cxx c cxxprogram wine')
373 ../libs/fst/fstinfofile.c
379 obj.use = [ 'libpbd',
387 obj.target = 'ardour-' + bld.env['VERSION'] + '-vst.exe.so'
388 obj.includes = [ '../libs/fst', '.' ]
389 obj.linkflags = ['-mwindows', '-Wl,--export-dynamic']
390 obj.defines = ['_POSIX_SOURCE', 'USE_WS_PREFIX']
391 obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
392 # end of the wine executable
394 # now the shared library containing the GTK GUI for ardour
395 obj = bld (features = 'cxx c cxxshlib')
396 obj.source = gtk2_ardour_sources
397 obj.includes = [ '../libs/fst', '.' ]
398 obj.name = 'libgtk2_ardour'
399 obj.target = 'gtk2_ardour'
401 # just the normal executable version of the GTK GUI
402 obj = bld(features = 'cxx c cxxprogram')
403 obj.source = gtk2_ardour_sources
404 obj.target = 'ardour-' + bld.env['VERSION']
407 # continue with setup of obj, which could be a shared library
410 obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
412 obj.uselib = 'UUID FLAC FONTCONFIG GLIBMM GTHREAD GTK OGG ALSA CURL DL'
413 obj.uselib += ' GTKMM GNOMECANVASMM GNOMECANVAS '
414 obj.uselib += ' AUDIOUNITS OSX GTKOSX LO '
415 obj.use = [ 'libpbd',
422 if sys.platform == 'darwin':
423 obj.use += ' libappleutility'
425 'PACKAGE="' + I18N_PACKAGE + '"',
426 'VERSIONSTRING="' + bld.env['VERSION'] + '"',
427 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
428 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
429 'LOCALEDIR="' + os.path.join(os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
430 'PROGRAM_NAME="' + bld.env['PROGRAM_NAME'] + '"'
432 obj.includes += ['../libs']
434 if bld.is_defined('HAVE_SUIL'):
435 obj.source += [ 'lv2_plugin_ui.cc' ]
436 obj.use += [ 'SUIL' ]
438 if bld.is_defined('FREESOUND'):
439 obj.source += [ 'sfdb_freesound_mootcher.cc' ]
440 obj.defines += [ 'FREESOUND' ]
442 if bld.is_defined('NEED_INTL'):
443 obj.linkflags = ' -lintl'
445 if bld.is_defined('WINDOWS_VST_SUPPORT'):
446 obj.source += [ 'windows_vst_plugin_ui.cc' ]
447 obj.defines += [ 'WINDOWS_VST_SUPPORT' ]
450 if bld.is_defined('LXVST_SUPPORT'):
451 obj.source += [ 'linux_vst_gui_support.cc', 'lxvst_plugin_ui.cc' ]
452 obj.defines += [ 'LXVST_SUPPORT' ]
455 if bld.is_defined('WINDOWS_VST_SUPPORT') or bld.is_defined('LXVST_SUPPORT'):
456 obj.source += [ 'vst_plugin_ui.cc' ]
458 if bld.is_defined('PHONE_HOME'):
459 obj.defines += [ 'PHONE_HOME' ]
461 if bld.is_defined('HAVE_COREAUDIO'):
462 TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cc']
463 obj.source += [ 'cocoacarbon.mm' ]
464 obj.use += ' libappleutility '
466 if bld.is_defined('AUDIOUNIT_SUPPORT'):
467 obj.source += [ 'au_pluginui.mm' ]
471 wrapper_subst_dict = {
472 'INSTALL_PREFIX' : bld.env['PREFIX'],
473 'LIBDIR' : os.path.normpath(bld.env['LIBDIR']),
474 'DATADIR' : os.path.normpath(bld.env['DATADIR']),
475 'SYSCONFDIR' : os.path.normpath(bld.env['SYSCONFDIR']),
476 'LIBS' : 'build/libs',
477 'VERSION' : bld.env['VERSION'],
478 'EXECUTABLE' : 'build/gtk2_ardour/ardour-' + bld.env['VERSION']
481 def set_subst_dict(obj, dict):
483 setattr(obj, i, dict[i])
485 obj = bld(features = 'subst', rule= 'chmod 0755 ${TGT}')
486 obj.source = 'ardev_common.sh.in'
487 obj.target = 'ardev_common_waf.sh'
488 obj.chmod = Utils.O755
489 obj.dict = wrapper_subst_dict
490 set_subst_dict(obj, wrapper_subst_dict)
492 obj = bld(features = 'subst')
493 obj.source = 'ardour.sh.in'
494 obj.target = 'ardour3'
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)
500 if bld.is_defined('WINDOWS_VST_SUPPORT'):
501 obj = bld(features = 'subst')
502 obj.source = '../vst/ardourvst.in'
503 obj.target = 'ardourvst3'
504 obj.chmod = Utils.O755
505 obj.dict = wrapper_subst_dict
506 obj.install_path = bld.env['BINDIR']
507 set_subst_dict(obj, wrapper_subst_dict)
511 dark_rc_subst_dict = {}
512 light_rc_subst_dict = {}
517 if bld.is_defined('GTKOSX'): # OS X fonts
530 # There is no acceptable monospace font available on older versions of OS X
531 # and no API on those versions to load TTF files that will work with
532 # GTK/fontconfig/pango.
534 # In addition, the ArdourMono font gets clipped for some reason on OS X
536 # Moreover, Lucida Grande just seems to work even though it is not monospace
540 'MONOSPACE' : 'Lucida Grande',
542 else: # Linux/X11 fonts
543 basefont = '' # unspecified - use system defaults
555 'MONOSPACE' : 'ArdourMono',
558 # Set up font substitution dictionary
560 for style in ['', 'BOLD', 'ITALIC']:
561 for sizename,points in iter(font_sizes.items()):
563 key = "_".join (['FONT',style,sizename])
564 fontstyle = " ".join ([basefont,style.lower(),points])
566 key = "_".join (['FONT',sizename])
567 fontstyle = " ".join ([basefont,points])
569 dark_rc_subst_dict[key] = fontstyle
570 light_rc_subst_dict[key] = fontstyle
573 for sizename,points in iter(font_sizes.items()):
574 key = "_".join (['FONT_SIZE',sizename])
575 dark_rc_subst_dict[key] = points
576 light_rc_subst_dict[key] = points
578 # various font names, eg @BOLD_MONOSPACE@
579 for font_sym,text in iter(font_names.items()):
581 dark_rc_subst_dict[key] = text
582 light_rc_subst_dict[key] = text
585 dark_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
586 'gtk2_ardour/ardour3_ui_dark.rc.in', 'ARDOUR_DARK')
587 dark_rc_subst_dict['COLPREFIX'] = 'ARDOUR_DARK'
588 light_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
589 'gtk2_ardour/ardour3_ui_light.rc.in', 'ARDOUR_LIGHT')
590 light_rc_subst_dict['COLPREFIX'] = 'ARDOUR_LIGHT'
592 obj = bld(features = 'subst')
593 obj.source = [ 'ardour3_ui_dark.rc.in' ]
594 obj.target = 'ardour3_ui_dark.rc.pre'
595 obj.install_path = None
596 set_subst_dict(obj, dark_rc_subst_dict)
598 obj = bld(features = 'subst')
599 obj.source = [ 'ardour3_ui_light.rc.in' ]
600 obj.target = 'ardour3_ui_light.rc.pre'
601 obj.install_path = None
602 set_subst_dict(obj, light_rc_subst_dict)
604 obj = bld(features = 'subst')
605 obj.source = [ 'ardour3_styles.rc.in' ]
606 obj.target = 'ardour3_dark_styles.rc'
607 obj.install_path = None
608 set_subst_dict(obj, dark_rc_subst_dict)
610 obj = bld(features = 'subst')
611 obj.source = [ 'ardour3_styles.rc.in' ]
612 obj.target = 'ardour3_light_styles.rc'
613 obj.install_path = None
614 set_subst_dict(obj, light_rc_subst_dict)
616 obj = bld(features = 'subst')
617 obj.source = [ 'ardour3_fonts.rc.in' ]
618 obj.target = 'ardour3_dark_fonts.rc'
619 obj.install_path = None
620 set_subst_dict(obj, dark_rc_subst_dict)
622 obj = bld(features = 'subst')
623 obj.source = [ 'ardour3_fonts.rc.in' ]
624 obj.target = 'ardour3_light_fonts.rc'
625 obj.install_path = None
626 set_subst_dict(obj, light_rc_subst_dict)
628 obj = bld(rule = 'cp ${SRC} ${TGT}')
629 obj.source = [ 'ardour3_widget_list.rc' ]
630 obj.target = 'ardour3_widgets.rc'
631 obj.install_path = None
633 obj = bld (rule = include_processor)
634 obj.source = [ 'ardour3_ui_dark.rc.pre' ]
635 # find and add all ##include dependencies as sources
636 obj.source += _doPyp (bld.path.find_resource ('ardour3_ui_dark.rc.in').srcpath(), True)
637 obj.target = 'ardour3_ui_dark.rc'
638 obj.install_path = '${SYSCONFDIR}/ardour3'
640 obj = bld (rule = include_processor)
641 obj.source = [ 'ardour3_ui_light.rc.pre' ]
642 # find and add all ##include dependencies as sources
643 obj.source += _doPyp (bld.path.find_resource ('ardour3_ui_light.rc.in').srcpath(), True)
644 obj.target = 'ardour3_ui_light.rc'
645 obj.install_path = '${SYSCONFDIR}/ardour3'
649 if bld.is_defined('GTKOSX'):
650 menus_argv = [ '-E', '-P', '-DGTKOSX', '-DNOVIDEOTIMELINE' ]
652 menus_argv = [ '-E', '-P' ]
654 obj = bld(features = 'command-output')
656 obj.command_is_external = True
658 obj.argv = menus_argv
659 obj.stdin = 'ardour.menus.in'
660 obj.stdout = 'ardour.menus'
661 obj.dep_vars = ['GTKOSX']
662 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
667 # 'SAE-de-keypad', 'SAE-de-nokeypad', 'SAE-us-keypad',
668 # 'SAE-us-nokeypad', 'ergonomic-us'
670 for b in [ 'mnemonic-us' ] :
672 target = b + '.bindings',
673 source = b + '.bindings.in',
674 rule = '../tools/fmt-bindings --platform="%s" --winkey="%s" --accelmap <${SRC} >${TGT}' % (sys.platform, bld.env['WINDOWS_KEY'] )
676 obj.install_path = os.path.join(bld.env['SYSCONFDIR'], 'ardour3')
678 # not modified at present
679 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
680 'step_editing.bindings')
681 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
685 bld.install_files('${DATADIR}/ardour3/icons', bld.path.ant_glob('icons/*.png'))
686 bld.install_files('${DATADIR}/ardour3/pixmaps', bld.path.ant_glob('pixmaps/*.xpm'))
687 bld.install_files('${DATADIR}/ardour3', 'splash.png')
688 bld.install_files('${DATADIR}/ardour3', 'ArdourMono.ttf')
690 # Default UI configuration
691 bld.install_files('${SYSCONFDIR}/ardour3', 'ardour3_ui_default.conf')
693 # Default export stuff
694 bld.install_files('${SYSCONFDIR}/ardour3/export', bld.path.ant_glob('export/*.format'))
697 if bld.is_defined('ENABLE_NLS'):
698 mo_files = bld.path.ant_glob('po/*.mo')
700 lang = os.path.basename(mo.srcpath()).replace('.mo', '')
701 bld.install_as(os.path.join(bld.env['PREFIX'], 'share', 'locale',
702 lang, 'LC_MESSAGES', I18N_PACKAGE + '.mo'),
706 autowaf.build_i18n(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
710 autowaf.build_i18n_pot(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
714 autowaf.build_i18n_po(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
718 autowaf.build_i18n_mo(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,