2 from waflib.extras import autowaf as autowaf
3 from waflib import Options, TaskGen
4 import waflib.Logs as Logs, waflib.Utils as Utils
10 from waflib.Task import Task
12 I18N_PACKAGE = 'gtk2_ardour3'
18 path_prefix = 'gtk2_ardour/'
20 gtk2_ardour_sources = [
23 'add_route_dialog.cc',
24 'ambiguous_file_dialog.cc',
31 'ardour_ui_dependents.cc',
32 'ardour_ui_dialogs.cc',
35 'ardour_ui_options.cc',
38 'audio_region_editor.cc',
39 'audio_region_view.cc',
40 'audio_streamview.cc',
42 'automation_controller.cc',
44 'automation_region_view.cc',
45 'automation_streamview.cc',
46 'automation_time_axis.cc',
48 'big_clock_window.cc',
54 'control_point_dialog.cc',
57 'edit_note_dialog.cc',
61 'editor_audio_import.cc',
62 'editor_audiotrack.cc',
64 'editor_canvas_events.cc',
65 'editor_component.cc',
68 'editor_route_groups.cc',
69 'editor_export_audio.cc',
70 'editor_group_tabs.cc',
72 'editor_locations.cc',
80 'editor_selection.cc',
81 'editor_snapshots.cc',
83 'editor_tempodisplay.cc',
87 'export_channel_selector.cc',
89 'export_file_notebook.cc',
90 'export_filename_selector.cc',
91 'export_format_dialog.cc',
92 'export_format_selector.cc',
93 'export_preset_selector.cc',
94 'export_timespan_selector.cc',
98 'sfdb_freesound_mootcher.cc',
100 'generic_pluginui.cc',
102 'global_port_matrix.cc',
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',
205 'soundcloud_export_selector.cc',
212 'stereo_panner_editor.cc',
214 'strip_silence_dialog.cc',
216 'tape_region_view.cc',
221 'time_axis_view_item.cc',
225 'track_selection.cc',
226 'track_view_list.cc',
227 'transpose_dialog.cc',
232 'visibility_group.cc',
233 'volume_controller.cc',
235 # video-timeline related sources:
236 'video_image_frame.cc',
237 'add_video_dialog.cc',
238 '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,
261 autowaf.configure(conf)
263 # TODO: Insert a sanity check for on OS X to ensure CoreAudio is present
265 autowaf.check_pkg(conf, 'fftw3f', uselib_store='FFTW3F',
267 autowaf.check_pkg(conf, 'flac', uselib_store='FLAC',
268 atleast_version='1.2.1')
269 autowaf.check_pkg(conf, 'gthread-2.0', uselib_store='GTHREAD',
270 atleast_version='2.10.1')
271 autowaf.check_pkg(conf, 'gtk+-2.0', uselib_store='GTK',
272 atleast_version='2.18')
273 autowaf.check_pkg(conf, 'gtkmm-2.4', uselib_store='GTKMM',
274 atleast_version='2.18')
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 VERSION = "%s.%s" % (bld.env['MAJOR'], bld.env['MINOR'])
355 if bld.is_defined('WINDOWS_VST_SUPPORT') and bld.env['build_target'] != 'mingw':
356 # Windows VST support w/wine
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')
361 '../libs/fst/vstwin.c',
365 # XXX do we really need to explicitly link to all of these for the wine executable?
367 obj.use = [ 'libpbd',
377 obj.target = 'ardour-' + bld.env['VERSION'] + '-vst.exe.so'
378 obj.includes = [ '../libs/fst', '.' ]
379 obj.linkflags = ['-mwindows', '-Wl,--export-dynamic']
380 obj.defines = ['_POSIX_SOURCE', 'USE_WS_PREFIX']
381 obj.install_path = bld.env['DLLDIR']
382 # end of the wine executable
384 # now the shared library containing the GTK GUI for ardour
385 obj = bld (features = 'cxx c cxxshlib')
386 obj.source = gtk2_ardour_sources
387 obj.includes = [ '../libs/fst', '.' ]
388 obj.name = 'libgtk2_ardour'
389 obj.target = 'gtk2_ardour'
391 # just the normal executable version of the GTK GUI
392 obj = bld (features = 'cxx c cxxprogram')
393 obj.source = gtk2_ardour_sources
394 obj.target = 'ardour-' + bld.env['VERSION']
396 obj.ldflags = ['-no-undefined']
398 if bld.is_defined('WINDOWS_VST_SUPPORT'):
399 # Windows VST support mingw
400 obj.source += [ '../vst/winmain.c' ]
401 obj.includes += [ '../libs/fst' ]
403 # at this point, "obj" refers to either the normal native executable
404 # OR the shared library built for use with wine on linux.
406 obj.use = [ 'libpbd',
416 'PACKAGE="' + I18N_PACKAGE + '"',
417 'VERSIONSTRING="' + bld.env['VERSION'] + '"',
418 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
419 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
420 'LOCALEDIR="' + os.path.join(os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
422 obj.install_path = bld.env['DLLDIR']
423 obj.uselib = 'UUID FLAC FONTCONFIG GLIBMM GTHREAD GTK OGG CURL DL'
424 obj.uselib += ' GTKMM CANVAS FFTW3F'
425 obj.uselib += ' AUDIOUNITS OSX GTKOSX LO '
426 obj.uselib += ' TAGLIB '
428 if sys.platform == 'darwin':
429 obj.uselib += ' AUDIOUNITS OSX GTKOSX'
430 obj.use += ' libappleutility'
431 obj.source += [ 'cocoacarbon.mm', 'bundle_env_cocoa.cc' ]
432 elif bld.env['build_target'] == 'mingw':
433 obj.source += [ 'bundle_env_mingw.cc' ]
435 obj.source += [ 'bundle_env_linux.cc' ]
437 obj.includes += ['../libs']
439 if bld.env['build_target'] == 'mingw':
440 if bld.env['DEBUG'] == False:
441 obj.linkflags = ['-mwindows']
443 if bld.is_defined('HAVE_SUIL'):
444 obj.source += [ 'lv2_plugin_ui.cc' ]
445 obj.use += [ 'SUIL' ]
447 if bld.is_defined('NEED_INTL'):
448 obj.linkflags = ' -lintl'
450 if bld.is_defined('WINDOWS_VST_SUPPORT'):
451 obj.source += [ 'windows_vst_plugin_ui.cc' ]
452 obj.defines += [ 'WINDOWS_VST_SUPPORT' ]
453 if bld.env['build_target'] != 'mingw':
456 if bld.is_defined('LXVST_SUPPORT'):
457 obj.source += [ 'linux_vst_gui_support.cc', 'lxvst_plugin_ui.cc' ]
458 obj.defines += [ 'LXVST_SUPPORT' ]
461 if bld.is_defined('WINDOWS_VST_SUPPORT') or bld.is_defined('LXVST_SUPPORT'):
462 obj.source += [ 'vst_plugin_ui.cc' ]
464 if bld.is_defined('PHONE_HOME'):
465 obj.defines += [ 'PHONE_HOME' ]
467 if bld.is_defined('HAVE_COREAUDIO'):
468 TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cc']
469 obj.use += ' libappleutility '
471 if bld.is_defined('AUDIOUNIT_SUPPORT'):
472 obj.source += [ 'au_pluginui.mm' ]
476 print 'DLL = ' + bld.env['DLLDIR'], '\n'
477 print 'DATADIR = ' + bld.env['DATADIR'], '\n'
478 print 'CONF = ' + bld.env['CONFDIR'], '\n'
480 wrapper_subst_dict = {
481 'INSTALL_PREFIX' : bld.env['PREFIX'],
482 'LIBDIR' : os.path.normpath(bld.env['DLLDIR']),
483 'DATADIR' : os.path.normpath(bld.env['DATADIR']),
484 'CONFDIR' : os.path.normpath(bld.env['CONFDIR']),
485 'LIBS' : 'build/libs',
486 'VERSION' : bld.env['VERSION'],
487 'EXECUTABLE' : 'build/gtk2_ardour/ardour-' + bld.env['VERSION']
490 def set_subst_dict(obj, dict):
492 setattr(obj, i, dict[i])
494 obj = bld(features = 'subst', rule= 'chmod 0755 ${TGT}')
495 obj.source = 'ardev_common.sh.in'
496 obj.target = 'ardev_common_waf.sh'
497 obj.chmod = Utils.O755
498 obj.dict = wrapper_subst_dict
499 set_subst_dict(obj, wrapper_subst_dict)
501 obj = bld(features = 'subst')
502 obj.source = 'ardour.sh.in'
503 obj.target = 'ardour3'
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)
509 if bld.is_defined('WINDOWS_VST_SUPPORT'):
510 obj = bld(features = 'subst')
511 obj.source = '../vst/ardourvst.in'
512 obj.target = 'ardourvst3'
513 obj.chmod = Utils.O755
514 obj.dict = wrapper_subst_dict
515 obj.install_path = bld.env['BINDIR']
516 set_subst_dict(obj, wrapper_subst_dict)
520 dark_rc_subst_dict = {}
521 light_rc_subst_dict = {}
527 if bld.is_defined('GTKOSX'): # OS X fonts
541 # There is no acceptable monospace font available on older versions of OS X
542 # and no API on those versions to load TTF files that will work with
543 # GTK/fontconfig/pango.
545 # In addition, the ArdourMono font gets clipped for some reason on OS X
547 # Moreover, Lucida Grande just seems to work even though it is not monospace
551 'MONOSPACE' : 'Lucida Grande',
553 else: # Linux/X11 fonts
554 basefont = '' # unspecified - use system defaults
567 'MONOSPACE' : 'ArdourMono',
570 # Set up font substitution dictionary
572 for style in ['', 'BOLD', 'ITALIC']:
573 for sizename,points in iter(font_sizes.items()):
575 key = "_".join (['FONT',style,sizename])
576 fontstyle = " ".join ([basefont,style.lower(),points])
578 key = "_".join (['FONT',sizename])
579 fontstyle = " ".join ([basefont,points])
581 dark_rc_subst_dict[key] = fontstyle
582 light_rc_subst_dict[key] = fontstyle
583 ui_conf_dict[key] = points
586 for sizename,points in iter(font_sizes.items()):
587 key = "_".join (['FONT_SIZE',sizename])
588 dark_rc_subst_dict[key] = points
589 light_rc_subst_dict[key] = points
590 ui_conf_dict[key] = points
592 # various font names, eg @BOLD_MONOSPACE@
593 for font_sym,text in iter(font_names.items()):
595 dark_rc_subst_dict[key] = text
596 light_rc_subst_dict[key] = text
597 ui_conf_dict[key] = text
600 dark_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
601 'gtk2_ardour/ardour3_ui_dark.rc.in', 'ARDOUR_DARK')
602 dark_rc_subst_dict['COLPREFIX'] = 'ARDOUR_DARK'
603 light_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
604 'gtk2_ardour/ardour3_ui_light.rc.in', 'ARDOUR_LIGHT')
605 light_rc_subst_dict['COLPREFIX'] = 'ARDOUR_LIGHT'
607 obj = bld(features = 'subst')
608 obj.source = [ 'ardour3_ui_dark.rc.in' ]
609 obj.target = 'ardour3_ui_dark.rc.pre'
610 obj.install_path = None
611 set_subst_dict(obj, dark_rc_subst_dict)
613 obj = bld(features = 'subst')
614 obj.source = [ 'ardour3_ui_light.rc.in' ]
615 obj.target = 'ardour3_ui_light.rc.pre'
616 obj.install_path = None
617 set_subst_dict(obj, light_rc_subst_dict)
619 obj = bld(features = 'subst')
620 obj.source = [ 'ardour3_styles.rc.in' ]
621 obj.target = 'ardour3_dark_styles.rc'
622 obj.install_path = None
623 set_subst_dict(obj, dark_rc_subst_dict)
625 obj = bld(features = 'subst')
626 obj.source = [ 'ardour3_styles.rc.in' ]
627 obj.target = 'ardour3_light_styles.rc'
628 obj.install_path = None
629 set_subst_dict(obj, light_rc_subst_dict)
631 obj = bld(features = 'subst')
632 obj.source = [ 'ardour3_fonts.rc.in' ]
633 obj.target = 'ardour3_dark_fonts.rc'
634 obj.install_path = None
635 set_subst_dict(obj, dark_rc_subst_dict)
637 obj = bld(features = 'subst')
638 obj.source = [ 'ardour3_fonts.rc.in' ]
639 obj.target = 'ardour3_light_fonts.rc'
640 obj.install_path = None
641 set_subst_dict(obj, light_rc_subst_dict)
643 obj = bld(rule = autowaf.copyfile)
644 obj.source = [ 'ardour3_widget_list.rc' ]
645 obj.target = 'ardour3_widgets.rc'
646 obj.install_path = None
648 obj = bld (rule = include_processor)
649 obj.source = [ 'ardour3_ui_dark.rc.pre' ]
650 # find and add all ##include dependencies as sources
651 obj.source += _doPyp (bld.path.find_resource ('ardour3_ui_dark.rc.in').srcpath(), True)
652 obj.target = 'ardour3_ui_dark.rc'
653 obj.install_path = bld.env['CONFDIR']
655 obj = bld (rule = include_processor)
656 obj.source = [ 'ardour3_ui_light.rc.pre' ]
657 # find and add all ##include dependencies as sources
658 obj.source += _doPyp (bld.path.find_resource ('ardour3_ui_light.rc.in').srcpath(), True)
659 obj.target = 'ardour3_ui_light.rc'
660 obj.install_path = bld.env['CONFDIR']
662 obj = bld(features = 'subst')
663 obj.source = [ 'ardour3_ui_default.conf.in' ]
664 obj.target = 'ardour3_ui_default.conf'
665 obj.install_path = None
666 set_subst_dict(obj, ui_conf_dict)
670 if bld.is_defined('GTKOSX'):
671 menus_argv = [ '-E', '-P', '-DGTKOSX' ]
673 menus_argv = [ '-E', '-P' ]
675 # always build all versions of the menu definitions
676 # so that we can try them out with different program builds.
677 for program in [ 'ardour', 'trx' ]:
678 obj = bld(features = 'command-output')
680 obj.command_is_external = True
682 obj.argv = menus_argv
683 obj.dep_vars = ['GTKOSX']
684 obj.stdin = program + '.menus.in'
685 obj.stdout = program + '.menus'
686 bld.install_files (bld.env['CONFDIR'], program + '.menus')
690 # 'SAE-de-keypad', 'SAE-de-nokeypad', 'SAE-us-keypad',
691 # 'SAE-us-nokeypad', 'ergonomic-us'
694 # explicitly state the use of perl here so that it works on windows too
696 a_rule = 'perl ../tools/fmt-bindings --platform="%s" --winkey="%s" --accelmap <${SRC} >${TGT}' % (sys.platform, bld.env['WINDOWS_KEY'] )
697 for b in [ 'mnemonic-us' ] :
699 target = b + '.bindings',
700 source = b + '.bindings.in',
703 obj.install_path = bld.env['CONFDIR']
705 # not modified at present
706 bld.install_files(bld.env['CONFDIR'], 'step_editing.bindings')
707 bld.install_files(bld.env['CONFDIR'], 'mixer.bindings')
710 bld.install_files(os.path.join (bld.env['DATADIR'], 'icons'), bld.path.ant_glob('icons/*.png'))
711 bld.install_files(os.path.join (bld.env['DATADIR'], 'pixmaps'), bld.path.ant_glob('pixmaps/*.xpm'))
712 bld.install_files(bld.env['DATADIR'], 'splash.png')
713 bld.install_files(bld.env['DATADIR'], 'small-splash.png')
714 bld.install_files(bld.env['DATADIR'], 'ArdourMono.ttf')
716 # Default UI configuration
717 bld.install_files(bld.env['CONFDIR'], 'ardour3_ui_default.conf')
719 # Default export stuff
720 bld.install_files(os.path.join(bld.env['CONFDIR'],' export'), bld.path.ant_glob('export/*.format'))
723 if bld.is_defined('ENABLE_NLS'):
724 mo_files = bld.path.ant_glob('po/*.mo')
726 lang = os.path.basename(mo.srcpath()).replace('.mo', '')
727 bld.install_as(os.path.join(bld.env['PREFIX'], 'share', 'locale',
728 lang, 'LC_MESSAGES', I18N_PACKAGE + '.mo'),
732 autowaf.build_i18n(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
736 autowaf.build_i18n_pot(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
740 autowaf.build_i18n_po(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
744 autowaf.build_i18n_mo(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,