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',
96 'sfdb_freesound_mootcher.cc',
98 'generic_pluginui.cc',
100 'global_port_matrix.cc',
102 'gtk-custom-hruler.c',
103 'gtk-custom-ruler.c',
104 'gtk_pianokeyboard.c',
106 'insert_time_dialog.cc',
107 'interthread_progress_window.cc',
119 'midi_automation_line.cc',
120 'midi_channel_dialog.cc',
121 'midi_channel_selector.cc',
122 'midi_cut_buffer.cc',
123 'midi_export_dialog.cc',
124 'midi_list_editor.cc',
125 'midi_port_dialog.cc',
126 'midi_region_view.cc',
129 'midi_streamview.cc',
132 'midi_velocity_dialog.cc',
133 'missing_file_dialog.cc',
134 'missing_plugin_dialog.cc',
136 'mixer_group_tabs.cc',
142 'monitor_section.cc',
144 'mono_panner_editor.cc',
147 'new_plugin_preset_dialog.cc',
148 'normalize_dialog.cc',
158 'panner_interface.cc',
161 'piano_roll_header.cc',
163 'playlist_selector.cc',
165 'plugin_selector.cc',
170 'port_matrix_body.cc',
171 'port_matrix_column_labels.cc',
172 'port_matrix_component.cc',
173 'port_matrix_grid.cc',
174 'port_matrix_labels.cc',
175 'port_matrix_row_labels.cc',
177 'patch_change_dialog.cc',
178 'progress_reporter.cc',
181 'quantize_dialog.cc',
182 'rc_option_editor.cc',
184 'region_gain_line.cc',
185 'region_layering_order_editor.cc',
186 'region_selection.cc',
190 'route_group_dialog.cc',
191 'route_group_menu.cc',
192 'route_params_ui.cc',
193 'route_processor_selection.cc',
194 'route_time_axis.cc',
196 'search_path_option.cc',
200 'session_import_dialog.cc',
201 'session_metadata_dialog.cc',
202 'session_option_editor.cc',
204 'shuttle_control.cc',
211 'stereo_panner_editor.cc',
213 'strip_silence_dialog.cc',
215 'tape_region_view.cc',
220 'time_axis_view_item.cc',
224 'track_selection.cc',
225 'track_view_list.cc',
226 'transpose_dialog.cc',
231 'visibility_group.cc',
232 'volume_controller.cc',
234 # video-timeline related sources:
235 'video_image_frame.cc',
236 'add_video_dialog.cc',
237 'editor_videotimeline.cc',
241 'transcode_ffmpeg.cc',
242 'transcode_video_dialog.cc',
243 'video_server_dialog.cc',
245 'export_video_dialog.cc',
246 'export_video_infobox.cc'
250 autowaf.set_options(opt)
254 conf.load('compiler_cxx')
255 # we don't use hard-coded micro versions with ardour, so hard code it to zero
256 autowaf.build_version_files(
257 path_prefix + 'version.h',
258 path_prefix + 'version.cc',
259 'gtk2_ardour', conf.env['MAJOR'], conf.env['MINOR'], 0)
260 autowaf.configure(conf)
262 if Options.options.dist_target == 'auto':
263 if re.search ("linux", sys.platform) != None:
264 autowaf.check_pkg(conf, 'alsa', uselib_store='ALSA')
266 # TODO: Insert a sanity check for on OS X to ensure CoreAudio is present
268 autowaf.check_pkg(conf, 'flac', uselib_store='FLAC',
269 atleast_version='1.2.1')
270 autowaf.check_pkg(conf, 'gthread-2.0', uselib_store='GTHREAD',
271 atleast_version='2.10.1')
272 autowaf.check_pkg(conf, 'gtk+-2.0', uselib_store='GTK',
273 atleast_version='2.18')
274 autowaf.check_pkg(conf, 'gtkmm-2.4', uselib_store='GTKMM',
275 atleast_version='2.18')
276 autowaf.check_pkg(conf, 'ogg', uselib_store='OGG', atleast_version='1.1.2')
277 autowaf.check_pkg(conf, 'x11', uselib_store='X11', atleast_version='1.1', mandatory=False)
278 autowaf.check_pkg(conf, 'fontconfig', uselib_store='FONTCONFIG')
280 conf.write_config_header('gtk2ardour-config.h', remove=False)
283 autowaf.check_header(conf, 'cxx', 'boost/shared_ptr.hpp')
284 autowaf.check_header(conf, 'cxx', 'boost/weak_ptr.hpp')
286 # Add a waf `feature' to allow compilation of things using winegcc
287 from waflib.TaskGen import feature
289 def set_winegcc(self):
290 self.env.LINK_CXX = self.env.LINK_CC = 'wineg++'
291 self.env.CC = 'winegcc'
293 def _doPyp(infileName, deps = False):
296 re_spaces = re.compile("\s+")
298 if infileName == '-':
301 fd = open(infileName)
302 inLines = fd.readlines()
308 bits = re_spaces.split(line)
309 if bits[0] == '##include':
314 # assume included file comes from same place as source file
315 incName = os.path.join (os.path.dirname (infileName), incName);
316 outStr += _doPyp(incName)
327 def include_processor(task):
328 infileName = task.inputs[0].srcpath()
329 outfileName = os.path.join(out, task.outputs[0].bldpath())
330 fdOut = open (outfileName, "w")
331 fdOut.write (_doPyp(infileName))
335 def build_color_scheme(path, prefix):
339 if re.search ('^#@color', line):
340 line.strip() # remove newline
342 if len(color_scheme):
344 color_scheme += prefix
346 color_scheme += words[1]
348 color_scheme += words[2]
354 VERSION = "%s.%s" % (bld.env['MAJOR'], bld.env['MINOR'])
356 if bld.is_defined('WINDOWS_VST_SUPPORT'):
357 # If we require VST support we build a stub main() and the FST library
358 # here using winegcc, and link it to the GTK front-end library
359 obj = bld(features = 'cxx c cxxprogram wine')
362 ../libs/fst/fstinfofile.c
368 obj.use = [ 'libpbd',
378 obj.target = 'ardour-' + bld.env['VERSION'] + '-vst.exe.so'
379 obj.includes = [ '../libs/fst', '.' ]
380 obj.linkflags = ['-mwindows', '-Wl,--export-dynamic']
381 obj.defines = ['_POSIX_SOURCE', 'USE_WS_PREFIX']
382 obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
383 # end of the wine executable
385 # now the shared library containing the GTK GUI for ardour
386 obj = bld (features = 'cxx c cxxshlib')
387 obj.source = gtk2_ardour_sources
388 obj.includes = [ '../libs/fst', '.' ]
389 obj.name = 'libgtk2_ardour'
390 obj.target = 'gtk2_ardour'
392 # just the normal executable version of the GTK GUI
393 obj = bld(features = 'cxx c cxxprogram')
394 obj.source = gtk2_ardour_sources
395 obj.target = 'ardour-' + bld.env['VERSION']
398 # continue with setup of obj, which could be a shared library
401 obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
403 obj.uselib = 'UUID FLAC FONTCONFIG GLIBMM GTHREAD GTK OGG ALSA CURL DL GTKMM LO'
404 obj.use = [ 'libpbd',
413 if bld.env['build_target'] == 'mingw':
414 if bld.env['DEBUG'] == False:
415 obj.linkflags = ['-mwindows']
416 if sys.platform == 'darwin':
417 obj.uselib += ' AUDIOUNITS OSX GTKOSX'
418 obj.use += ' libappleutility'
420 'PACKAGE="' + I18N_PACKAGE + '"',
421 'VERSIONSTRING="' + bld.env['VERSION'] + '"',
422 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
423 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
424 'LOCALEDIR="' + os.path.join(os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
425 'PROGRAM_NAME="' + bld.env['PROGRAM_NAME'] + '"'
427 obj.includes += ['../libs']
429 if bld.is_defined('HAVE_SUIL'):
430 obj.source += [ 'lv2_plugin_ui.cc' ]
431 obj.use += [ 'SUIL' ]
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',
468 'VERSION' : bld.env['VERSION'],
469 'EXECUTABLE' : 'build/gtk2_ardour/ardour-' + bld.env['VERSION']
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
522 # There is no acceptable monospace font available on older versions of OS X
523 # and no API on those versions to load TTF files that will work with
524 # GTK/fontconfig/pango.
526 # In addition, the ArdourMono font gets clipped for some reason on OS X
528 # Moreover, Lucida Grande just seems to work even though it is not monospace
532 'MONOSPACE' : 'Lucida Grande',
534 else: # Linux/X11 fonts
535 basefont = '' # unspecified - use system defaults
548 'MONOSPACE' : 'ArdourMono',
551 # Set up font substitution dictionary
553 for style in ['', 'BOLD', 'ITALIC']:
554 for sizename,points in iter(font_sizes.items()):
556 key = "_".join (['FONT',style,sizename])
557 fontstyle = " ".join ([basefont,style.lower(),points])
559 key = "_".join (['FONT',sizename])
560 fontstyle = " ".join ([basefont,points])
562 dark_rc_subst_dict[key] = fontstyle
563 light_rc_subst_dict[key] = fontstyle
566 for sizename,points in iter(font_sizes.items()):
567 key = "_".join (['FONT_SIZE',sizename])
568 dark_rc_subst_dict[key] = points
569 light_rc_subst_dict[key] = points
571 # various font names, eg @BOLD_MONOSPACE@
572 for font_sym,text in iter(font_names.items()):
574 dark_rc_subst_dict[key] = text
575 light_rc_subst_dict[key] = text
578 dark_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
579 'gtk2_ardour/ardour3_ui_dark.rc.in', 'ARDOUR_DARK')
580 dark_rc_subst_dict['COLPREFIX'] = 'ARDOUR_DARK'
581 light_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
582 'gtk2_ardour/ardour3_ui_light.rc.in', 'ARDOUR_LIGHT')
583 light_rc_subst_dict['COLPREFIX'] = 'ARDOUR_LIGHT'
585 obj = bld(features = 'subst')
586 obj.source = [ 'ardour3_ui_dark.rc.in' ]
587 obj.target = 'ardour3_ui_dark.rc.pre'
588 obj.install_path = None
589 set_subst_dict(obj, dark_rc_subst_dict)
591 obj = bld(features = 'subst')
592 obj.source = [ 'ardour3_ui_light.rc.in' ]
593 obj.target = 'ardour3_ui_light.rc.pre'
594 obj.install_path = None
595 set_subst_dict(obj, light_rc_subst_dict)
597 obj = bld(features = 'subst')
598 obj.source = [ 'ardour3_styles.rc.in' ]
599 obj.target = 'ardour3_dark_styles.rc'
600 obj.install_path = None
601 set_subst_dict(obj, dark_rc_subst_dict)
603 obj = bld(features = 'subst')
604 obj.source = [ 'ardour3_styles.rc.in' ]
605 obj.target = 'ardour3_light_styles.rc'
606 obj.install_path = None
607 set_subst_dict(obj, light_rc_subst_dict)
609 obj = bld(features = 'subst')
610 obj.source = [ 'ardour3_fonts.rc.in' ]
611 obj.target = 'ardour3_dark_fonts.rc'
612 obj.install_path = None
613 set_subst_dict(obj, dark_rc_subst_dict)
615 obj = bld(features = 'subst')
616 obj.source = [ 'ardour3_fonts.rc.in' ]
617 obj.target = 'ardour3_light_fonts.rc'
618 obj.install_path = None
619 set_subst_dict(obj, light_rc_subst_dict)
621 obj = bld(rule = 'cp ${SRC} ${TGT}')
622 obj.source = [ 'ardour3_widget_list.rc' ]
623 obj.target = 'ardour3_widgets.rc'
624 obj.install_path = None
626 obj = bld (rule = include_processor)
627 obj.source = [ 'ardour3_ui_dark.rc.pre' ]
628 # find and add all ##include dependencies as sources
629 obj.source += _doPyp (bld.path.find_resource ('ardour3_ui_dark.rc.in').srcpath(), True)
630 obj.target = 'ardour3_ui_dark.rc'
631 obj.install_path = '${SYSCONFDIR}/ardour3'
633 obj = bld (rule = include_processor)
634 obj.source = [ 'ardour3_ui_light.rc.pre' ]
635 # find and add all ##include dependencies as sources
636 obj.source += _doPyp (bld.path.find_resource ('ardour3_ui_light.rc.in').srcpath(), True)
637 obj.target = 'ardour3_ui_light.rc'
638 obj.install_path = '${SYSCONFDIR}/ardour3'
642 if bld.is_defined('GTKOSX'):
643 menus_argv = [ '-E', '-P', '-DGTKOSX' ]
645 menus_argv = [ '-E', '-P' ]
647 obj = bld(features = 'command-output')
649 obj.command_is_external = True
651 obj.argv = menus_argv
652 obj.stdin = 'ardour.menus.in'
653 obj.stdout = 'ardour.menus'
654 obj.dep_vars = ['GTKOSX']
655 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
660 # 'SAE-de-keypad', 'SAE-de-nokeypad', 'SAE-us-keypad',
661 # 'SAE-us-nokeypad', 'ergonomic-us'
663 for b in [ 'mnemonic-us' ] :
665 target = b + '.bindings',
666 source = b + '.bindings.in',
667 rule = '../tools/fmt-bindings --platform="%s" --winkey="%s" --accelmap <${SRC} >${TGT}' % (sys.platform, bld.env['WINDOWS_KEY'] )
669 obj.install_path = os.path.join(bld.env['SYSCONFDIR'], 'ardour3')
671 # not modified at present
672 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
673 'step_editing.bindings')
674 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
678 bld.install_files('${DATADIR}/ardour3/icons', bld.path.ant_glob('icons/*.png'))
679 bld.install_files('${DATADIR}/ardour3/pixmaps', bld.path.ant_glob('pixmaps/*.xpm'))
680 bld.install_files('${DATADIR}/ardour3', 'splash.png')
681 bld.install_files('${DATADIR}/ardour3', 'ArdourMono.ttf')
683 # Default UI configuration
684 bld.install_files('${SYSCONFDIR}/ardour3', 'ardour3_ui_default.conf')
686 # Default export stuff
687 bld.install_files('${SYSCONFDIR}/ardour3/export', bld.path.ant_glob('export/*.format'))
690 if bld.is_defined('ENABLE_NLS'):
691 mo_files = bld.path.ant_glob('po/*.mo')
693 lang = os.path.basename(mo.srcpath()).replace('.mo', '')
694 bld.install_as(os.path.join(bld.env['PREFIX'], 'share', 'locale',
695 lang, 'LC_MESSAGES', I18N_PACKAGE + '.mo'),
699 autowaf.build_i18n(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
703 autowaf.build_i18n_pot(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
707 autowaf.build_i18n_po(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
711 autowaf.build_i18n_mo(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,