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-custom-hruler.c',
105 'gtk-custom-ruler.c',
106 'gtk_pianokeyboard.c',
108 'insert_time_dialog.cc',
109 'interthread_progress_window.cc',
121 'midi_automation_line.cc',
122 'midi_channel_dialog.cc',
123 'midi_channel_selector.cc',
124 'midi_cut_buffer.cc',
125 'midi_export_dialog.cc',
126 'midi_list_editor.cc',
127 'midi_port_dialog.cc',
128 'midi_region_view.cc',
131 'midi_streamview.cc',
134 'midi_velocity_dialog.cc',
135 'missing_file_dialog.cc',
136 'missing_plugin_dialog.cc',
138 'mixer_group_tabs.cc',
144 'monitor_section.cc',
146 'mono_panner_editor.cc',
149 'new_plugin_preset_dialog.cc',
150 'normalize_dialog.cc',
160 'panner_interface.cc',
163 'piano_roll_header.cc',
165 'playlist_selector.cc',
167 'plugin_selector.cc',
172 'port_matrix_body.cc',
173 'port_matrix_column_labels.cc',
174 'port_matrix_component.cc',
175 'port_matrix_grid.cc',
176 'port_matrix_labels.cc',
177 'port_matrix_row_labels.cc',
179 'patch_change_dialog.cc',
180 'progress_reporter.cc',
183 'quantize_dialog.cc',
184 'rc_option_editor.cc',
186 'region_gain_line.cc',
187 'region_layering_order_editor.cc',
188 'region_selection.cc',
192 'route_group_dialog.cc',
193 'route_group_menu.cc',
194 'route_params_ui.cc',
195 'route_processor_selection.cc',
196 'route_time_axis.cc',
198 'search_path_option.cc',
202 'session_import_dialog.cc',
203 'session_metadata_dialog.cc',
204 'session_option_editor.cc',
206 'shuttle_control.cc',
213 'stereo_panner_editor.cc',
215 'strip_silence_dialog.cc',
217 'tape_region_view.cc',
222 'time_axis_view_item.cc',
226 'track_selection.cc',
227 'track_view_list.cc',
228 'transpose_dialog.cc',
233 'visibility_group.cc',
234 'volume_controller.cc',
236 # video-timeline related sources:
237 'video_image_frame.cc',
238 'add_video_dialog.cc',
239 'editor_videotimeline.cc',
242 'transcode_ffmpeg.cc',
243 'transcode_video_dialog.cc',
244 'video_server_dialog.cc',
246 'export_video_dialog.cc',
247 'export_video_infobox.cc'
251 autowaf.set_options(opt)
255 conf.load('compiler_cxx')
256 # we don't use hard-coded micro versions with ardour, so hard code it to zero
257 autowaf.build_version_files(
258 path_prefix + 'version.h',
259 path_prefix + 'version.cc',
260 'gtk2_ardour', conf.env['MAJOR'], conf.env['MINOR'], 0,
262 autowaf.configure(conf)
264 if Options.options.dist_target == 'auto':
265 if re.search ("linux", sys.platform) != None:
266 autowaf.check_pkg(conf, 'alsa', uselib_store='ALSA')
268 # TODO: Insert a sanity check for on OS X to ensure CoreAudio is present
270 autowaf.check_pkg(conf, 'fftw3f', uselib_store='FFTW3F',
272 autowaf.check_pkg(conf, 'flac', uselib_store='FLAC',
273 atleast_version='1.2.1')
274 autowaf.check_pkg(conf, 'gthread-2.0', uselib_store='GTHREAD',
275 atleast_version='2.10.1')
276 autowaf.check_pkg(conf, 'gtk+-2.0', uselib_store='GTK',
277 atleast_version='2.18')
278 autowaf.check_pkg(conf, 'gtkmm-2.4', uselib_store='GTKMM',
279 atleast_version='2.18')
280 autowaf.check_pkg(conf, 'ogg', uselib_store='OGG', atleast_version='1.1.2')
281 autowaf.check_pkg(conf, 'x11', uselib_store='X11', atleast_version='1.1', mandatory=False)
282 autowaf.check_pkg(conf, 'fontconfig', uselib_store='FONTCONFIG')
284 conf.write_config_header('gtk2ardour-config.h', remove=False)
287 autowaf.check_header(conf, 'cxx', 'boost/shared_ptr.hpp')
288 autowaf.check_header(conf, 'cxx', 'boost/weak_ptr.hpp')
290 # Add a waf `feature' to allow compilation of things using winegcc
291 from waflib.TaskGen import feature
293 def set_winegcc(self):
294 self.env.LINK_CXX = self.env.LINK_CC = 'wineg++'
295 self.env.CC = 'winegcc'
297 def _doPyp(infileName, deps = False):
300 re_spaces = re.compile("\s+")
302 if infileName == '-':
305 fd = open(infileName)
306 inLines = fd.readlines()
312 bits = re_spaces.split(line)
313 if bits[0] == '##include':
318 # assume included file comes from same place as source file
319 incName = os.path.join (os.path.dirname (infileName), incName);
320 outStr += _doPyp(incName)
331 def include_processor(task):
332 infileName = task.inputs[0].srcpath()
333 outfileName = os.path.join(out, task.outputs[0].bldpath())
334 fdOut = open (outfileName, "w")
335 fdOut.write (_doPyp(infileName))
339 def build_color_scheme(path, prefix):
343 if re.search ('^#@color', line):
344 line.strip() # remove newline
346 if len(color_scheme):
348 color_scheme += prefix
350 color_scheme += words[1]
352 color_scheme += words[2]
358 VERSION = "%s.%s" % (bld.env['MAJOR'], bld.env['MINOR'])
360 if bld.is_defined('WINDOWS_VST_SUPPORT') and bld.env['build_target'] != 'mingw':
361 # Windows VST support w/wine
362 # If we require VST support we build a stub main() and the FST library
363 # here using winegcc, and link it to the GTK front-end library
364 obj = bld (features = 'cxx c cxxprogram wine')
366 '../libs/fst/vstwin.c',
370 # XXX do we really need to explicitly link to all of these for the wine executable?
372 obj.use = [ 'libpbd',
382 obj.target = 'ardour-' + bld.env['VERSION'] + '-vst.exe.so'
383 obj.includes = [ '../libs/fst', '.' ]
384 obj.linkflags = ['-mwindows', '-Wl,--export-dynamic']
385 obj.defines = ['_POSIX_SOURCE', 'USE_WS_PREFIX']
386 obj.install_path = bld.env['DLLDIR']
387 # end of the wine executable
389 # now the shared library containing the GTK GUI for ardour
390 obj = bld (features = 'cxx c cxxshlib')
391 obj.source = gtk2_ardour_sources
392 obj.includes = [ '../libs/fst', '.' ]
393 obj.name = 'libgtk2_ardour'
394 obj.target = 'gtk2_ardour'
396 # just the normal executable version of the GTK GUI
397 obj = bld (features = 'cxx c cxxprogram')
398 obj.source = gtk2_ardour_sources
399 obj.target = 'ardour-' + bld.env['VERSION']
401 obj.ldflags = ['-no-undefined']
403 if bld.is_defined('WINDOWS_VST_SUPPORT'):
404 # Windows VST support mingw
405 obj.source += [ '../vst/winmain.c' ]
406 obj.includes += [ '../libs/fst' ]
408 # at this point, "obj" refers to either the normal native executable
409 # OR the shared library built for use with wine on linux.
411 obj.use = [ 'libpbd',
421 'PACKAGE="' + I18N_PACKAGE + '"',
422 'VERSIONSTRING="' + bld.env['VERSION'] + '"',
423 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
424 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
425 'LOCALEDIR="' + os.path.join(os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
427 obj.install_path = bld.env['DLLDIR']
428 obj.uselib = 'UUID FLAC FONTCONFIG GLIBMM GTHREAD GTK OGG CURL DL'
429 obj.uselib += ' GTKMM CANVAS FFTW3F'
430 obj.uselib += ' AUDIOUNITS OSX GTKOSX LO '
431 obj.uselib += ' TAGLIB '
433 if sys.platform == 'darwin':
434 obj.uselib += ' AUDIOUNITS OSX GTKOSX'
435 obj.use += ' libappleutility'
436 obj.source += [ 'cocoacarbon.mm', 'bundle_env_cocoa.cc' ]
437 elif bld.env['build_target'] == 'mingw':
438 obj.source += [ 'bundle_env_mingw.cc' ]
440 obj.source += [ 'bundle_env_linux.cc' ]
442 obj.includes += ['../libs']
444 if bld.env['build_target'] == 'mingw':
445 if bld.env['DEBUG'] == False:
446 obj.linkflags = ['-mwindows']
448 if bld.is_defined('HAVE_SUIL'):
449 obj.source += [ 'lv2_plugin_ui.cc' ]
450 obj.use += [ 'SUIL' ]
452 if bld.is_defined('NEED_INTL'):
453 obj.linkflags = ' -lintl'
455 if bld.is_defined('WINDOWS_VST_SUPPORT'):
456 obj.source += [ 'windows_vst_plugin_ui.cc' ]
457 obj.defines += [ 'WINDOWS_VST_SUPPORT' ]
458 if bld.env['build_target'] != 'mingw':
461 if bld.is_defined('LXVST_SUPPORT'):
462 obj.source += [ 'linux_vst_gui_support.cc', 'lxvst_plugin_ui.cc' ]
463 obj.defines += [ 'LXVST_SUPPORT' ]
466 if bld.is_defined('WINDOWS_VST_SUPPORT') or bld.is_defined('LXVST_SUPPORT'):
467 obj.source += [ 'vst_plugin_ui.cc' ]
469 if bld.is_defined('PHONE_HOME'):
470 obj.defines += [ 'PHONE_HOME' ]
472 if bld.is_defined('HAVE_COREAUDIO'):
473 TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cc']
474 obj.use += ' libappleutility '
476 if bld.is_defined('AUDIOUNIT_SUPPORT'):
477 obj.source += [ 'au_pluginui.mm' ]
481 print 'DLL = ' + bld.env['DLLDIR'], '\n'
482 print 'DATADIR = ' + bld.env['DATADIR'], '\n'
483 print 'CONF = ' + bld.env['CONFDIR'], '\n'
485 wrapper_subst_dict = {
486 'INSTALL_PREFIX' : bld.env['PREFIX'],
487 'LIBDIR' : os.path.normpath(bld.env['DLLDIR']),
488 'DATADIR' : os.path.normpath(bld.env['DATADIR']),
489 'SYSCONFDIR' : os.path.normpath(bld.env['CONFDIR']),
490 'LIBS' : 'build/libs',
491 'VERSION' : bld.env['VERSION'],
492 'EXECUTABLE' : 'build/gtk2_ardour/ardour-' + bld.env['VERSION']
495 def set_subst_dict(obj, dict):
497 setattr(obj, i, dict[i])
499 obj = bld(features = 'subst', rule= 'chmod 0755 ${TGT}')
500 obj.source = 'ardev_common.sh.in'
501 obj.target = 'ardev_common_waf.sh'
502 obj.chmod = Utils.O755
503 obj.dict = wrapper_subst_dict
504 set_subst_dict(obj, wrapper_subst_dict)
506 obj = bld(features = 'subst')
507 obj.source = 'ardour.sh.in'
508 obj.target = 'ardour3'
509 obj.chmod = Utils.O755
510 obj.dict = wrapper_subst_dict
511 obj.install_path = bld.env['BINDIR']
512 set_subst_dict(obj, wrapper_subst_dict)
514 if bld.is_defined('WINDOWS_VST_SUPPORT'):
515 obj = bld(features = 'subst')
516 obj.source = '../vst/ardourvst.in'
517 obj.target = 'ardourvst3'
518 obj.chmod = Utils.O755
519 obj.dict = wrapper_subst_dict
520 obj.install_path = bld.env['BINDIR']
521 set_subst_dict(obj, wrapper_subst_dict)
525 dark_rc_subst_dict = {}
526 light_rc_subst_dict = {}
531 if bld.is_defined('GTKOSX'): # OS X fonts
545 # There is no acceptable monospace font available on older versions of OS X
546 # and no API on those versions to load TTF files that will work with
547 # GTK/fontconfig/pango.
549 # In addition, the ArdourMono font gets clipped for some reason on OS X
551 # Moreover, Lucida Grande just seems to work even though it is not monospace
555 'MONOSPACE' : 'Lucida Grande',
557 else: # Linux/X11 fonts
558 basefont = '' # unspecified - use system defaults
571 'MONOSPACE' : 'ArdourMono',
574 # Set up font substitution dictionary
576 for style in ['', 'BOLD', 'ITALIC']:
577 for sizename,points in iter(font_sizes.items()):
579 key = "_".join (['FONT',style,sizename])
580 fontstyle = " ".join ([basefont,style.lower(),points])
582 key = "_".join (['FONT',sizename])
583 fontstyle = " ".join ([basefont,points])
585 dark_rc_subst_dict[key] = fontstyle
586 light_rc_subst_dict[key] = fontstyle
589 for sizename,points in iter(font_sizes.items()):
590 key = "_".join (['FONT_SIZE',sizename])
591 dark_rc_subst_dict[key] = points
592 light_rc_subst_dict[key] = points
594 # various font names, eg @BOLD_MONOSPACE@
595 for font_sym,text in iter(font_names.items()):
597 dark_rc_subst_dict[key] = text
598 light_rc_subst_dict[key] = text
601 dark_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
602 'gtk2_ardour/ardour3_ui_dark.rc.in', 'ARDOUR_DARK')
603 dark_rc_subst_dict['COLPREFIX'] = 'ARDOUR_DARK'
604 light_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
605 'gtk2_ardour/ardour3_ui_light.rc.in', 'ARDOUR_LIGHT')
606 light_rc_subst_dict['COLPREFIX'] = 'ARDOUR_LIGHT'
608 obj = bld(features = 'subst')
609 obj.source = [ 'ardour3_ui_dark.rc.in' ]
610 obj.target = 'ardour3_ui_dark.rc.pre'
611 obj.install_path = None
612 set_subst_dict(obj, dark_rc_subst_dict)
614 obj = bld(features = 'subst')
615 obj.source = [ 'ardour3_ui_light.rc.in' ]
616 obj.target = 'ardour3_ui_light.rc.pre'
617 obj.install_path = None
618 set_subst_dict(obj, light_rc_subst_dict)
620 obj = bld(features = 'subst')
621 obj.source = [ 'ardour3_styles.rc.in' ]
622 obj.target = 'ardour3_dark_styles.rc'
623 obj.install_path = None
624 set_subst_dict(obj, dark_rc_subst_dict)
626 obj = bld(features = 'subst')
627 obj.source = [ 'ardour3_styles.rc.in' ]
628 obj.target = 'ardour3_light_styles.rc'
629 obj.install_path = None
630 set_subst_dict(obj, light_rc_subst_dict)
632 obj = bld(features = 'subst')
633 obj.source = [ 'ardour3_fonts.rc.in' ]
634 obj.target = 'ardour3_dark_fonts.rc'
635 obj.install_path = None
636 set_subst_dict(obj, dark_rc_subst_dict)
638 obj = bld(features = 'subst')
639 obj.source = [ 'ardour3_fonts.rc.in' ]
640 obj.target = 'ardour3_light_fonts.rc'
641 obj.install_path = None
642 set_subst_dict(obj, light_rc_subst_dict)
644 obj = bld(rule = autowaf.copyfile)
645 obj.source = [ 'ardour3_widget_list.rc' ]
646 obj.target = 'ardour3_widgets.rc'
647 obj.install_path = None
649 obj = bld (rule = include_processor)
650 obj.source = [ 'ardour3_ui_dark.rc.pre' ]
651 # find and add all ##include dependencies as sources
652 obj.source += _doPyp (bld.path.find_resource ('ardour3_ui_dark.rc.in').srcpath(), True)
653 obj.target = 'ardour3_ui_dark.rc'
654 obj.install_path = bld.env['CONFDIR']
656 obj = bld (rule = include_processor)
657 obj.source = [ 'ardour3_ui_light.rc.pre' ]
658 # find and add all ##include dependencies as sources
659 obj.source += _doPyp (bld.path.find_resource ('ardour3_ui_light.rc.in').srcpath(), True)
660 obj.target = 'ardour3_ui_light.rc'
661 obj.install_path = bld.env['CONFDIR']
665 if bld.is_defined('GTKOSX'):
666 menus_argv = [ '-E', '-P', '-DGTKOSX' ]
668 menus_argv = [ '-E', '-P' ]
670 # always build all versions of the menu definitions
671 # so that we can try them out with different program builds.
672 for program in [ 'ardour', 'trx' ]:
673 obj = bld(features = 'command-output')
675 obj.command_is_external = True
677 obj.argv = menus_argv
678 obj.dep_vars = ['GTKOSX']
679 obj.stdin = program + '.menus.in'
680 obj.stdout = program + '.menus'
681 bld.install_files (bld.env['CONFDIR'], program + '.menus')
685 # 'SAE-de-keypad', 'SAE-de-nokeypad', 'SAE-us-keypad',
686 # 'SAE-us-nokeypad', 'ergonomic-us'
689 # explicitly state the use of perl here so that it works on windows too
691 a_rule = 'perl ../tools/fmt-bindings --platform="%s" --winkey="%s" --accelmap <${SRC} >${TGT}' % (sys.platform, bld.env['WINDOWS_KEY'] )
692 for b in [ 'mnemonic-us' ] :
694 target = b + '.bindings',
695 source = b + '.bindings.in',
698 obj.install_path = bld.env['CONFDIR']
700 # not modified at present
701 bld.install_files(bld.env['CONFDIR'], 'step_editing.bindings')
702 bld.install_files(bld.env['CONFDIR'], 'mixer.bindings')
705 bld.install_files(os.path.join (bld.env['DATADIR'], 'icons'), bld.path.ant_glob('icons/*.png'))
706 bld.install_files(os.path.join (bld.env['DATADIR'], 'pixmaps'), bld.path.ant_glob('pixmaps/*.xpm'))
707 bld.install_files(bld.env['DATADIR'], 'splash.png')
708 bld.install_files(bld.env['DATADIR'], 'small-splash.png')
709 bld.install_files(bld.env['DATADIR'], 'ArdourMono.ttf')
711 # Default UI configuration
712 bld.install_files(bld.env['CONFDIR'], 'ardour3_ui_default.conf')
714 # Default export stuff
715 bld.install_files(os.path.join(bld.env['CONFDIR'],' export'), bld.path.ant_glob('export/*.format'))
718 if bld.is_defined('ENABLE_NLS'):
719 mo_files = bld.path.ant_glob('po/*.mo')
721 lang = os.path.basename(mo.srcpath()).replace('.mo', '')
722 bld.install_as(os.path.join(bld.env['PREFIX'], 'share', 'locale',
723 lang, 'LC_MESSAGES', I18N_PACKAGE + '.mo'),
727 autowaf.build_i18n(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
731 autowaf.build_i18n_pot(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
735 autowaf.build_i18n_po(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
739 autowaf.build_i18n_mo(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,