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
11 from waflib.Tools import winres
13 I18N_PACKAGE = 'gtk2_ardour3'
19 path_prefix = 'gtk2_ardour/'
21 gtk2_ardour_sources = [
24 'add_route_dialog.cc',
25 'ambiguous_file_dialog.cc',
34 'ardour_ui_dependents.cc',
35 'ardour_ui_dialogs.cc',
38 'ardour_ui_options.cc',
41 'audio_region_editor.cc',
42 'audio_region_view.cc',
43 'audio_streamview.cc',
45 'automation_controller.cc',
47 'automation_region_view.cc',
48 'automation_streamview.cc',
49 'automation_time_axis.cc',
51 'big_clock_window.cc',
57 'control_point_dialog.cc',
61 'edit_note_dialog.cc',
65 'editor_audio_import.cc',
66 'editor_audiotrack.cc',
68 'editor_canvas_events.cc',
69 'editor_component.cc',
72 'editor_route_groups.cc',
73 'editor_export_audio.cc',
74 'editor_group_tabs.cc',
76 'editor_locations.cc',
84 'editor_selection.cc',
85 'editor_snapshots.cc',
87 'editor_tempodisplay.cc',
91 'export_channel_selector.cc',
93 'export_file_notebook.cc',
94 'export_filename_selector.cc',
95 'export_format_dialog.cc',
96 'export_format_selector.cc',
97 'export_preset_selector.cc',
98 'export_timespan_selector.cc',
102 'floating_text_entry.cc',
103 'sfdb_freesound_mootcher.cc',
105 'generic_pluginui.cc',
107 'global_port_matrix.cc',
109 'gtk_pianokeyboard.c',
111 'insert_time_dialog.cc',
112 'instrument_selector.cc',
113 'interthread_progress_window.cc',
125 'midi_automation_line.cc',
126 'midi_channel_dialog.cc',
127 'midi_channel_selector.cc',
128 'midi_cut_buffer.cc',
129 'midi_export_dialog.cc',
130 'midi_list_editor.cc',
131 'midi_port_dialog.cc',
132 'midi_region_view.cc',
135 'midi_streamview.cc',
138 'midi_velocity_dialog.cc',
139 'missing_file_dialog.cc',
140 'missing_plugin_dialog.cc',
142 'mixer_group_tabs.cc',
148 'monitor_section.cc',
150 'mono_panner_editor.cc',
153 'new_plugin_preset_dialog.cc',
154 'normalize_dialog.cc',
158 'note_select_dialog.cc',
165 'panner_interface.cc',
168 'piano_roll_header.cc',
170 'playlist_selector.cc',
172 'plugin_selector.cc',
177 'port_matrix_body.cc',
178 'port_matrix_column_labels.cc',
179 'port_matrix_component.cc',
180 'port_matrix_grid.cc',
181 'port_matrix_labels.cc',
182 'port_matrix_row_labels.cc',
184 'patch_change_dialog.cc',
185 'progress_reporter.cc',
188 'quantize_dialog.cc',
189 'rc_option_editor.cc',
191 'region_gain_line.cc',
192 'region_layering_order_editor.cc',
193 'region_selection.cc',
197 'route_group_dialog.cc',
198 'route_group_menu.cc',
199 'route_params_ui.cc',
200 'route_processor_selection.cc',
201 'route_time_axis.cc',
204 'search_path_option.cc',
206 'selection_memento.cc',
209 'session_import_dialog.cc',
210 'session_metadata_dialog.cc',
211 'session_option_editor.cc',
213 'shuttle_control.cc',
214 'soundcloud_export_selector.cc',
221 'stereo_panner_editor.cc',
223 'strip_silence_dialog.cc',
225 'tape_region_view.cc',
230 'time_axis_view_item.cc',
235 'track_selection.cc',
236 'track_view_list.cc',
237 'transform_dialog.cc',
238 'transpose_dialog.cc',
243 'visibility_group.cc',
244 'volume_controller.cc',
246 # video-timeline related sources:
247 'video_image_frame.cc',
248 'add_video_dialog.cc',
249 'editor_videotimeline.cc',
252 'transcode_ffmpeg.cc',
253 'transcode_video_dialog.cc',
254 'video_server_dialog.cc',
256 'export_video_dialog.cc',
257 'export_video_infobox.cc',
258 'video_tool_paths.cc'
262 autowaf.set_options(opt)
266 conf.load('compiler_cxx')
267 # we don't use hard-coded micro versions with ardour, so hard code it to zero
268 autowaf.build_version_files(
269 path_prefix + 'version.h',
270 path_prefix + 'version.cc',
271 'gtk2_ardour', conf.env['MAJOR'], conf.env['MINOR'], 0,
273 autowaf.configure(conf)
275 # TODO: Insert a sanity check for on OS X to ensure CoreAudio is present
277 autowaf.check_pkg(conf, 'fftw3f', uselib_store='FFTW3F',
279 autowaf.check_pkg(conf, 'flac', uselib_store='FLAC',
280 atleast_version='1.2.1')
281 autowaf.check_pkg(conf, 'gthread-2.0', uselib_store='GTHREAD',
282 atleast_version='2.10.1')
283 autowaf.check_pkg(conf, 'gtk+-2.0', uselib_store='GTK',
284 atleast_version='2.18')
285 autowaf.check_pkg(conf, 'gtkmm-2.4', uselib_store='GTKMM',
286 atleast_version='2.18')
287 autowaf.check_pkg(conf, 'ogg', uselib_store='OGG', atleast_version='1.1.2')
288 autowaf.check_pkg(conf, 'x11', uselib_store='X11', atleast_version='1.1', mandatory=False)
289 autowaf.check_pkg(conf, 'fontconfig', uselib_store='FONTCONFIG')
291 conf.write_config_header('gtk2ardour-config.h', remove=False)
293 bak = conf.env['define_key']
294 conf.define('VERSIONSTRING', str (conf.env['VERSION']))
295 conf.env['define_key'] = ['VERSIONSTRING']
296 conf.write_config_header('gtk2ardour-version.h')
297 conf.env['define_key'] = bak;
300 autowaf.check_header(conf, 'cxx', 'boost/shared_ptr.hpp')
301 autowaf.check_header(conf, 'cxx', 'boost/weak_ptr.hpp')
303 # Add a waf `feature' to allow compilation of things using winegcc
304 from waflib.TaskGen import feature
306 def set_winegcc(self):
307 self.env.LINK_CXX = self.env.LINK_CC = 'wineg++'
308 self.env.CC = 'winegcc'
310 def _doPyp(infileName, deps = False):
313 re_spaces = re.compile("\s+")
315 if infileName == '-':
318 fd = open(infileName)
319 inLines = fd.readlines()
325 bits = re_spaces.split(line)
326 if bits[0] == '##include':
331 # assume included file comes from same place as source file
332 incName = os.path.join (os.path.dirname (infileName), incName);
333 outStr += _doPyp(incName)
344 def include_processor(task):
345 infileName = task.inputs[0].srcpath()
346 outfileName = os.path.join(out, task.outputs[0].bldpath())
347 fdOut = open (outfileName, "w")
348 fdOut.write (_doPyp(infileName))
352 def build_color_scheme(path, prefix):
356 if re.search ('^#@color', line):
357 line.strip() # remove newline
359 if len(color_scheme):
361 color_scheme += prefix
363 color_scheme += words[1]
365 color_scheme += words[2]
371 VERSION = "%s.%s" % (bld.env['MAJOR'], bld.env['MINOR'])
373 if bld.is_defined('WINDOWS_VST_SUPPORT') and bld.env['build_target'] != 'mingw':
374 # Windows VST support w/wine
375 # If we require VST support we build a stub main() and the FST library
376 # here using winegcc, and link it to the GTK front-end library
377 obj = bld (features = 'cxx c cxxprogram wine')
379 '../libs/fst/vstwin.c',
383 # XXX do we really need to explicitly link to all of these for the wine executable?
385 obj.use = [ 'libpbd',
395 obj.target = 'ardour-' + str (bld.env['VERSION']) + '-vst.exe.so'
396 obj.includes = [ '../libs/fst', '.' ]
397 obj.linkflags = ['-mwindows', '-Wl,--export-dynamic']
398 obj.linkflags += bld.env['LDFLAGS']
399 obj.defines = ['_POSIX_SOURCE', 'USE_WS_PREFIX']
400 obj.install_path = bld.env['DLLDIR']
401 # end of the wine executable
403 # now the shared library containing the GTK GUI for ardour
404 obj = bld (features = 'cxx c cxxshlib')
405 obj.source = gtk2_ardour_sources
406 obj.includes = [ '../libs/fst', '.' ]
407 obj.name = 'libgtk2_ardour'
408 obj.target = 'gtk2_ardour'
410 # just the normal executable version of the GTK GUI
411 if bld.env['build_target'] == 'mingw':
412 obj = bld (features = 'cxx c cxxprogram winres')
414 obj = bld (features = 'cxx c cxxprogram')
415 obj.source = gtk2_ardour_sources
416 obj.target = 'ardour-' + str (bld.env['VERSION'])
418 obj.ldflags = ['-no-undefined']
420 if bld.is_defined('WINDOWS_VST_SUPPORT'):
421 # Windows VST support mingw
422 obj.includes += [ '../libs/fst' ]
424 # at this point, "obj" refers to either the normal native executable
425 # OR the shared library built for use with wine on linux.
427 obj.use = [ 'libpbd',
437 'PACKAGE="' + I18N_PACKAGE + '"',
438 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
439 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
440 'LOCALEDIR="' + os.path.normpath(bld.env['LOCALEDIR']) + '"',
442 obj.install_path = bld.env['DLLDIR']
443 obj.uselib = 'UUID FLAC FONTCONFIG GLIBMM GTHREAD GTK OGG CURL DL'
444 obj.uselib += ' GTKMM CANVAS FFTW3F'
445 obj.uselib += ' AUDIOUNITS OSX GTKOSX LO '
446 obj.uselib += ' TAGLIB '
448 if sys.platform == 'darwin':
449 obj.uselib += ' AUDIOUNITS OSX GTKOSX'
450 obj.use += ' libappleutility'
451 obj.source += [ 'cocoacarbon.mm', 'bundle_env_cocoa.cc' ]
452 elif bld.env['build_target'] == 'mingw':
453 obj.source += [ 'bundle_env_mingw.cc' ]
454 obj.source += [ 'windows_icon.rc' ]
456 obj.source += [ 'bundle_env_linux.cc' ]
458 obj.includes += ['../libs']
460 if bld.env['build_target'] == 'mingw':
461 obj.linkflags = ['-mwindows']
463 if bld.is_defined('HAVE_SUIL'):
464 obj.source += [ 'lv2_plugin_ui.cc' ]
465 obj.use += [ 'SUIL' ]
467 if bld.is_defined('NEED_INTL'):
468 obj.linkflags = ' -lintl'
470 if bld.is_defined('WINDOWS_VST_SUPPORT'):
471 obj.source += [ 'windows_vst_plugin_ui.cc' ]
472 obj.defines += [ 'WINDOWS_VST_SUPPORT' ]
473 if bld.env['build_target'] != 'mingw':
476 if bld.is_defined('LXVST_SUPPORT'):
477 obj.source += [ 'linux_vst_gui_support.cc', 'lxvst_plugin_ui.cc' ]
478 obj.defines += [ 'LXVST_SUPPORT' ]
481 if bld.is_defined('WINDOWS_VST_SUPPORT') or bld.is_defined('LXVST_SUPPORT'):
482 obj.source += [ 'vst_plugin_ui.cc' ]
484 if bld.is_defined('PHONE_HOME'):
485 obj.defines += [ 'PHONE_HOME' ]
487 if bld.is_defined('HAVE_COREAUDIO'):
488 TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cc']
489 obj.use += ' libappleutility '
491 if bld.is_defined('AUDIOUNIT_SUPPORT'):
492 obj.source += [ 'au_pluginui.mm' ]
496 wrapper_subst_dict = {
497 'INSTALL_PREFIX' : bld.env['PREFIX'],
498 'LIBDIR' : os.path.normpath(bld.env['DLLDIR']),
499 'DATADIR' : os.path.normpath(bld.env['DATADIR']),
500 'CONFDIR' : os.path.normpath(bld.env['CONFDIR']),
501 'LIBS' : 'build/libs',
502 'VERSION' : bld.env['VERSION'],
503 'EXECUTABLE' : 'build/gtk2_ardour/ardour-' + str (bld.env['VERSION'])
506 def set_subst_dict(obj, dict):
508 setattr(obj, i, dict[i])
510 obj = bld(features = 'subst')
511 obj.source = 'ardev_common.sh.in'
512 obj.target = 'ardev_common_waf.sh'
513 obj.chmod = Utils.O755
514 obj.dict = wrapper_subst_dict
515 set_subst_dict(obj, wrapper_subst_dict)
517 obj = bld(features = 'subst')
518 obj.source = 'ardour.sh.in'
519 obj.target = 'ardour3'
520 obj.chmod = Utils.O755
521 obj.dict = wrapper_subst_dict
522 obj.install_path = bld.env['BINDIR']
523 set_subst_dict(obj, wrapper_subst_dict)
525 if bld.is_defined('WINDOWS_VST_SUPPORT'):
526 obj = bld(features = 'subst')
527 obj.source = '../vst/ardourvst.in'
528 obj.target = 'ardourvst3'
529 obj.chmod = Utils.O755
530 obj.dict = wrapper_subst_dict
531 obj.install_path = bld.env['BINDIR']
532 set_subst_dict(obj, wrapper_subst_dict)
541 if bld.is_defined('GTKOSX'): # OS X fonts
555 # There is no acceptable monospace font available on older versions of OS X
556 # and no API on those versions to load TTF files that will work with
557 # GTK/fontconfig/pango.
559 # In addition, the ArdourMono font gets clipped for some reason on OS X
561 # Moreover, Lucida Grande just seems to work even though it is not monospace
565 'MONOSPACE' : 'Lucida Grande',
567 else: # Linux/X11 fonts
568 basefont = '' # unspecified - use system defaults
581 'MONOSPACE' : 'ArdourMono',
584 # Set up font substitution dictionary
586 for style in ['', 'BOLD', 'ITALIC']:
587 for sizename,points in iter(font_sizes.items()):
589 key = "_".join (['FONT',style,sizename])
590 fontstyle = " ".join ([basefont,style.lower(),points])
592 key = "_".join (['FONT',sizename])
593 fontstyle = " ".join ([basefont,points])
595 font_subst_dict[key] = fontstyle
598 for sizename,points in iter(font_sizes.items()):
599 key = "_".join (['FONT_SIZE',sizename])
600 font_subst_dict[key] = points
602 # various font names, eg @BOLD_MONOSPACE@
603 for font_sym,text in iter(font_names.items()):
605 font_subst_dict[key] = text
609 obj = bld(features = 'subst')
610 obj.source = [ 'clearlooks.rc.in' ]
611 obj.target = 'clearlooks.rc'
612 obj.install_path = bld.env['CONFDIR']
613 set_subst_dict(obj, font_subst_dict)
615 obj = bld(features = 'subst')
616 obj.source = [ 'default_ui_config.in' ]
617 obj.target = 'default_ui_config'
618 obj.install_path = bld.env['CONFDIR']
619 set_subst_dict(obj, font_subst_dict)
623 if bld.is_defined('GTKOSX'):
624 menus_argv = [ '-E', '-P', '-DGTKOSX' ]
626 menus_argv = [ '-E', '-P' ]
628 # always build all versions of the menu definitions
629 # so that we can try them out with different program builds.
630 for program in [ 'ardour', 'trx' ]:
631 obj = bld(features = 'command-output')
633 obj.command_is_external = True
635 obj.argv = menus_argv
636 obj.dep_vars = ['GTKOSX']
637 obj.stdin = program + '.menus.in'
638 obj.stdout = program + '.menus'
639 bld.install_files (bld.env['CONFDIR'], program + '.menus')
643 # 'SAE-de-keypad', 'SAE-de-nokeypad', 'SAE-us-keypad',
644 # 'SAE-us-nokeypad', 'ergonomic-us'
647 # explicitly state the use of perl here so that it works on windows too
649 a_rule = 'perl ../tools/fmt-bindings --platform="%s" --winkey="%s" --accelmap <${SRC} >${TGT}' % (sys.platform, bld.env['WINDOWS_KEY'] )
650 for b in [ 'mnemonic-us' ] :
652 target = b + '.bindings',
653 source = b + '.bindings.in',
656 obj.install_path = bld.env['CONFDIR']
658 # not modified at present
659 bld.install_files(bld.env['CONFDIR'], 'dark.colors')
660 bld.install_files(bld.env['CONFDIR'], 'step_editing.bindings')
661 bld.install_files(bld.env['CONFDIR'], 'mixer.bindings')
664 bld.install_files(os.path.join (bld.env['DATADIR'], 'icons'), bld.path.ant_glob('icons/*.png'))
665 bld.install_files(os.path.join (bld.env['DATADIR'], 'pixmaps'), bld.path.ant_glob('pixmaps/*.xpm'))
666 bld.install_files(bld.env['DATADIR'], 'splash.png')
667 bld.install_files(bld.env['DATADIR'], 'small-splash.png')
668 bld.install_files(bld.env['DATADIR'], 'ArdourMono.ttf')
670 # Default UI configuration
671 bld.install_files(bld.env['CONFDIR'], 'default_ui_config')
673 bld.install_files(bld.env['CONFDIR'], 'dark.colors')
675 # Default export stuff
676 bld.install_files(os.path.join(bld.env['CONFDIR'],' export'), bld.path.ant_glob('export/*.format'))
679 if bld.is_defined('ENABLE_NLS'):
680 mo_files = bld.path.ant_glob('po/*.mo')
682 lang = os.path.basename(mo.srcpath()).replace('.mo', '')
683 bld.install_as (os.path.join(os.path.normpath(bld.env['LOCALEDIR']), lang, 'LC_MESSAGES', I18N_PACKAGE + '.mo'),
687 autowaf.build_i18n(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
691 autowaf.build_i18n_pot(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
695 autowaf.build_i18n_po(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
699 autowaf.build_i18n_mo(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,