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',
33 'ardour_ui_dependents.cc',
34 'ardour_ui_dialogs.cc',
37 'ardour_ui_options.cc',
40 'audio_region_editor.cc',
41 'audio_region_view.cc',
42 'audio_streamview.cc',
44 'automation_controller.cc',
46 'automation_region_view.cc',
47 'automation_streamview.cc',
48 'automation_time_axis.cc',
50 'big_clock_window.cc',
56 'control_point_dialog.cc',
59 'edit_note_dialog.cc',
63 'editor_audio_import.cc',
64 'editor_audiotrack.cc',
66 'editor_canvas_events.cc',
67 'editor_component.cc',
70 'editor_route_groups.cc',
71 'editor_export_audio.cc',
72 'editor_group_tabs.cc',
74 'editor_locations.cc',
82 'editor_selection.cc',
83 'editor_snapshots.cc',
85 'editor_tempodisplay.cc',
89 'export_channel_selector.cc',
91 'export_file_notebook.cc',
92 'export_filename_selector.cc',
93 'export_format_dialog.cc',
94 'export_format_selector.cc',
95 'export_preset_selector.cc',
96 'export_timespan_selector.cc',
100 'sfdb_freesound_mootcher.cc',
102 'generic_pluginui.cc',
104 'global_port_matrix.cc',
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',
199 'search_path_option.cc',
203 'session_import_dialog.cc',
204 'session_metadata_dialog.cc',
205 'session_option_editor.cc',
207 'shuttle_control.cc',
208 'soundcloud_export_selector.cc',
215 'stereo_panner_editor.cc',
217 'strip_silence_dialog.cc',
219 'tape_region_view.cc',
224 'time_axis_view_item.cc',
228 'track_selection.cc',
229 'track_view_list.cc',
230 'transpose_dialog.cc',
235 'visibility_group.cc',
236 'volume_controller.cc',
238 # video-timeline related sources:
239 'video_image_frame.cc',
240 'add_video_dialog.cc',
241 'editor_videotimeline.cc',
244 'transcode_ffmpeg.cc',
245 'transcode_video_dialog.cc',
246 'video_server_dialog.cc',
248 'export_video_dialog.cc',
249 'export_video_infobox.cc'
253 autowaf.set_options(opt)
257 conf.load('compiler_cxx')
258 # we don't use hard-coded micro versions with ardour, so hard code it to zero
259 autowaf.build_version_files(
260 path_prefix + 'version.h',
261 path_prefix + 'version.cc',
262 'gtk2_ardour', conf.env['MAJOR'], conf.env['MINOR'], 0,
264 autowaf.configure(conf)
266 # TODO: Insert a sanity check for on OS X to ensure CoreAudio is present
268 autowaf.check_pkg(conf, 'fftw3f', uselib_store='FFTW3F',
270 autowaf.check_pkg(conf, 'flac', uselib_store='FLAC',
271 atleast_version='1.2.1')
272 autowaf.check_pkg(conf, 'gthread-2.0', uselib_store='GTHREAD',
273 atleast_version='2.10.1')
274 autowaf.check_pkg(conf, 'gtk+-2.0', uselib_store='GTK',
275 atleast_version='2.18')
276 autowaf.check_pkg(conf, 'gtkmm-2.4', uselib_store='GTKMM',
277 atleast_version='2.18')
278 autowaf.check_pkg(conf, 'ogg', uselib_store='OGG', atleast_version='1.1.2')
279 autowaf.check_pkg(conf, 'x11', uselib_store='X11', atleast_version='1.1', mandatory=False)
280 autowaf.check_pkg(conf, 'fontconfig', uselib_store='FONTCONFIG')
282 conf.write_config_header('gtk2ardour-config.h', remove=False)
285 autowaf.check_header(conf, 'cxx', 'boost/shared_ptr.hpp')
286 autowaf.check_header(conf, 'cxx', 'boost/weak_ptr.hpp')
288 # Add a waf `feature' to allow compilation of things using winegcc
289 from waflib.TaskGen import feature
291 def set_winegcc(self):
292 self.env.LINK_CXX = self.env.LINK_CC = 'wineg++'
293 self.env.CC = 'winegcc'
295 def _doPyp(infileName, deps = False):
298 re_spaces = re.compile("\s+")
300 if infileName == '-':
303 fd = open(infileName)
304 inLines = fd.readlines()
310 bits = re_spaces.split(line)
311 if bits[0] == '##include':
316 # assume included file comes from same place as source file
317 incName = os.path.join (os.path.dirname (infileName), incName);
318 outStr += _doPyp(incName)
329 def include_processor(task):
330 infileName = task.inputs[0].srcpath()
331 outfileName = os.path.join(out, task.outputs[0].bldpath())
332 fdOut = open (outfileName, "w")
333 fdOut.write (_doPyp(infileName))
337 def build_color_scheme(path, prefix):
341 if re.search ('^#@color', line):
342 line.strip() # remove newline
344 if len(color_scheme):
346 color_scheme += prefix
348 color_scheme += words[1]
350 color_scheme += words[2]
356 VERSION = "%s.%s" % (bld.env['MAJOR'], bld.env['MINOR'])
358 if bld.is_defined('WINDOWS_VST_SUPPORT') and bld.env['build_target'] != 'mingw':
359 # Windows VST support w/wine
360 # If we require VST support we build a stub main() and the FST library
361 # here using winegcc, and link it to the GTK front-end library
362 obj = bld (features = 'cxx c cxxprogram wine')
364 '../libs/fst/vstwin.c',
368 # XXX do we really need to explicitly link to all of these for the wine executable?
370 obj.use = [ 'libpbd',
380 obj.target = 'ardour-' + str (bld.env['VERSION']) + '-vst.exe.so'
381 obj.includes = [ '../libs/fst', '.' ]
382 obj.linkflags = ['-mwindows', '-Wl,--export-dynamic']
383 obj.defines = ['_POSIX_SOURCE', 'USE_WS_PREFIX']
384 obj.install_path = bld.env['DLLDIR']
385 # end of the wine executable
387 # now the shared library containing the GTK GUI for ardour
388 obj = bld (features = 'cxx c cxxshlib')
389 obj.source = gtk2_ardour_sources
390 obj.includes = [ '../libs/fst', '.' ]
391 obj.name = 'libgtk2_ardour'
392 obj.target = 'gtk2_ardour'
394 # just the normal executable version of the GTK GUI
395 obj = bld (features = 'cxx c cxxprogram')
396 obj.source = gtk2_ardour_sources
397 obj.target = 'ardour-' + str (bld.env['VERSION'])
399 obj.ldflags = ['-no-undefined']
401 if bld.is_defined('WINDOWS_VST_SUPPORT'):
402 # Windows VST support mingw
403 obj.source += [ '../vst/winmain.c' ]
404 obj.includes += [ '../libs/fst' ]
406 # at this point, "obj" refers to either the normal native executable
407 # OR the shared library built for use with wine on linux.
409 obj.use = [ 'libpbd',
419 'PACKAGE="' + I18N_PACKAGE + '"',
420 'VERSIONSTRING="' + str (bld.env['VERSION']) + '"',
421 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
422 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
423 'LOCALEDIR="' + os.path.join(os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
425 obj.install_path = bld.env['DLLDIR']
426 obj.uselib = 'UUID FLAC FONTCONFIG GLIBMM GTHREAD GTK OGG CURL DL'
427 obj.uselib += ' GTKMM CANVAS FFTW3F'
428 obj.uselib += ' AUDIOUNITS OSX GTKOSX LO '
429 obj.uselib += ' TAGLIB '
431 if sys.platform == 'darwin':
432 obj.uselib += ' AUDIOUNITS OSX GTKOSX'
433 obj.use += ' libappleutility'
434 obj.source += [ 'cocoacarbon.mm', 'bundle_env_cocoa.cc' ]
435 elif bld.env['build_target'] == 'mingw':
436 obj.source += [ 'bundle_env_mingw.cc' ]
438 obj.source += [ 'bundle_env_linux.cc' ]
440 obj.includes += ['../libs']
442 if bld.env['build_target'] == 'mingw':
443 if bld.env['DEBUG'] == False:
444 obj.linkflags = ['-mwindows']
446 if bld.is_defined('HAVE_SUIL'):
447 obj.source += [ 'lv2_plugin_ui.cc' ]
448 obj.use += [ 'SUIL' ]
450 if bld.is_defined('NEED_INTL'):
451 obj.linkflags = ' -lintl'
453 if bld.is_defined('WINDOWS_VST_SUPPORT'):
454 obj.source += [ 'windows_vst_plugin_ui.cc' ]
455 obj.defines += [ 'WINDOWS_VST_SUPPORT' ]
456 if bld.env['build_target'] != 'mingw':
459 if bld.is_defined('LXVST_SUPPORT'):
460 obj.source += [ 'linux_vst_gui_support.cc', 'lxvst_plugin_ui.cc' ]
461 obj.defines += [ 'LXVST_SUPPORT' ]
464 if bld.is_defined('WINDOWS_VST_SUPPORT') or bld.is_defined('LXVST_SUPPORT'):
465 obj.source += [ 'vst_plugin_ui.cc' ]
467 if bld.is_defined('PHONE_HOME'):
468 obj.defines += [ 'PHONE_HOME' ]
470 if bld.is_defined('HAVE_COREAUDIO'):
471 TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cc']
472 obj.use += ' libappleutility '
474 if bld.is_defined('AUDIOUNIT_SUPPORT'):
475 obj.source += [ 'au_pluginui.mm' ]
479 wrapper_subst_dict = {
480 'INSTALL_PREFIX' : bld.env['PREFIX'],
481 'LIBDIR' : os.path.normpath(bld.env['DLLDIR']),
482 'DATADIR' : os.path.normpath(bld.env['DATADIR']),
483 'CONFDIR' : os.path.normpath(bld.env['CONFDIR']),
484 'LIBS' : 'build/libs',
485 'VERSION' : bld.env['VERSION'],
486 'EXECUTABLE' : 'build/gtk2_ardour/ardour-' + str (bld.env['VERSION'])
489 def set_subst_dict(obj, dict):
491 setattr(obj, i, dict[i])
493 obj = bld(features = 'subst', rule= 'chmod 0755 ${TGT}')
494 obj.source = 'ardev_common.sh.in'
495 obj.target = 'ardev_common_waf.sh'
496 obj.chmod = Utils.O755
497 obj.dict = wrapper_subst_dict
498 set_subst_dict(obj, wrapper_subst_dict)
500 obj = bld(features = 'subst')
501 obj.source = 'ardour.sh.in'
502 obj.target = 'ardour3'
503 obj.chmod = Utils.O755
504 obj.dict = wrapper_subst_dict
505 obj.install_path = bld.env['BINDIR']
506 set_subst_dict(obj, wrapper_subst_dict)
508 if bld.is_defined('WINDOWS_VST_SUPPORT'):
509 obj = bld(features = 'subst')
510 obj.source = '../vst/ardourvst.in'
511 obj.target = 'ardourvst3'
512 obj.chmod = Utils.O755
513 obj.dict = wrapper_subst_dict
514 obj.install_path = bld.env['BINDIR']
515 set_subst_dict(obj, wrapper_subst_dict)
519 dark_rc_subst_dict = {}
520 light_rc_subst_dict = {}
526 if bld.is_defined('GTKOSX'): # OS X fonts
540 # There is no acceptable monospace font available on older versions of OS X
541 # and no API on those versions to load TTF files that will work with
542 # GTK/fontconfig/pango.
544 # In addition, the ArdourMono font gets clipped for some reason on OS X
546 # Moreover, Lucida Grande just seems to work even though it is not monospace
550 'MONOSPACE' : 'Lucida Grande',
552 else: # Linux/X11 fonts
553 basefont = '' # unspecified - use system defaults
566 'MONOSPACE' : 'ArdourMono',
569 # Set up font substitution dictionary
571 for style in ['', 'BOLD', 'ITALIC']:
572 for sizename,points in iter(font_sizes.items()):
574 key = "_".join (['FONT',style,sizename])
575 fontstyle = " ".join ([basefont,style.lower(),points])
577 key = "_".join (['FONT',sizename])
578 fontstyle = " ".join ([basefont,points])
580 dark_rc_subst_dict[key] = fontstyle
581 light_rc_subst_dict[key] = fontstyle
582 ui_conf_dict[key] = points
585 for sizename,points in iter(font_sizes.items()):
586 key = "_".join (['FONT_SIZE',sizename])
587 dark_rc_subst_dict[key] = points
588 light_rc_subst_dict[key] = points
589 ui_conf_dict[key] = points
591 # various font names, eg @BOLD_MONOSPACE@
592 for font_sym,text in iter(font_names.items()):
594 dark_rc_subst_dict[key] = text
595 light_rc_subst_dict[key] = text
596 ui_conf_dict[key] = text
599 dark_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
600 'gtk2_ardour/ardour3_ui_dark.rc.in', 'ARDOUR_DARK')
601 dark_rc_subst_dict['COLPREFIX'] = 'ARDOUR_DARK'
602 light_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
603 'gtk2_ardour/ardour3_ui_light.rc.in', 'ARDOUR_LIGHT')
604 light_rc_subst_dict['COLPREFIX'] = 'ARDOUR_LIGHT'
606 obj = bld(features = 'subst')
607 obj.source = [ 'ardour3_ui_dark.rc.in' ]
608 obj.target = 'ardour3_ui_dark.rc.pre'
609 obj.install_path = None
610 set_subst_dict(obj, dark_rc_subst_dict)
612 obj = bld(features = 'subst')
613 obj.source = [ 'ardour3_ui_light.rc.in' ]
614 obj.target = 'ardour3_ui_light.rc.pre'
615 obj.install_path = None
616 set_subst_dict(obj, light_rc_subst_dict)
618 obj = bld(features = 'subst')
619 obj.source = [ 'ardour3_styles.rc.in' ]
620 obj.target = 'ardour3_dark_styles.rc'
621 obj.install_path = None
622 set_subst_dict(obj, dark_rc_subst_dict)
624 obj = bld(features = 'subst')
625 obj.source = [ 'ardour3_styles.rc.in' ]
626 obj.target = 'ardour3_light_styles.rc'
627 obj.install_path = None
628 set_subst_dict(obj, light_rc_subst_dict)
630 obj = bld(features = 'subst')
631 obj.source = [ 'ardour3_fonts.rc.in' ]
632 obj.target = 'ardour3_dark_fonts.rc'
633 obj.install_path = None
634 set_subst_dict(obj, dark_rc_subst_dict)
636 obj = bld(features = 'subst')
637 obj.source = [ 'ardour3_fonts.rc.in' ]
638 obj.target = 'ardour3_light_fonts.rc'
639 obj.install_path = None
640 set_subst_dict(obj, light_rc_subst_dict)
642 obj = bld(rule = autowaf.copyfile)
643 obj.source = [ 'ardour3_widget_list.rc' ]
644 obj.target = 'ardour3_widgets.rc'
645 obj.install_path = None
647 obj = bld (rule = include_processor)
648 obj.source = [ 'ardour3_ui_dark.rc.pre' ]
649 # find and add all ##include dependencies as sources
650 obj.source += _doPyp (bld.path.find_resource ('ardour3_ui_dark.rc.in').srcpath(), True)
651 obj.target = 'ardour3_ui_dark.rc'
652 obj.install_path = bld.env['CONFDIR']
654 obj = bld (rule = include_processor)
655 obj.source = [ 'ardour3_ui_light.rc.pre' ]
656 # find and add all ##include dependencies as sources
657 obj.source += _doPyp (bld.path.find_resource ('ardour3_ui_light.rc.in').srcpath(), True)
658 obj.target = 'ardour3_ui_light.rc'
659 obj.install_path = bld.env['CONFDIR']
661 obj = bld(features = 'subst')
662 obj.source = [ 'ardour3_ui_default.conf.in' ]
663 obj.target = 'ardour3_ui_default.conf'
664 obj.install_path = None
665 set_subst_dict(obj, ui_conf_dict)
669 if bld.is_defined('GTKOSX'):
670 menus_argv = [ '-E', '-P', '-DGTKOSX' ]
672 menus_argv = [ '-E', '-P' ]
674 # always build all versions of the menu definitions
675 # so that we can try them out with different program builds.
676 for program in [ 'ardour', 'trx' ]:
677 obj = bld(features = 'command-output')
679 obj.command_is_external = True
681 obj.argv = menus_argv
682 obj.dep_vars = ['GTKOSX']
683 obj.stdin = program + '.menus.in'
684 obj.stdout = program + '.menus'
685 bld.install_files (bld.env['CONFDIR'], program + '.menus')
689 # 'SAE-de-keypad', 'SAE-de-nokeypad', 'SAE-us-keypad',
690 # 'SAE-us-nokeypad', 'ergonomic-us'
693 # explicitly state the use of perl here so that it works on windows too
695 a_rule = 'perl ../tools/fmt-bindings --platform="%s" --winkey="%s" --accelmap <${SRC} >${TGT}' % (sys.platform, bld.env['WINDOWS_KEY'] )
696 for b in [ 'mnemonic-us' ] :
698 target = b + '.bindings',
699 source = b + '.bindings.in',
702 obj.install_path = bld.env['CONFDIR']
704 # not modified at present
705 bld.install_files(bld.env['CONFDIR'], 'step_editing.bindings')
706 bld.install_files(bld.env['CONFDIR'], 'mixer.bindings')
709 bld.install_files(os.path.join (bld.env['DATADIR'], 'icons'), bld.path.ant_glob('icons/*.png'))
710 bld.install_files(os.path.join (bld.env['DATADIR'], 'pixmaps'), bld.path.ant_glob('pixmaps/*.xpm'))
711 bld.install_files(bld.env['DATADIR'], 'splash.png')
712 bld.install_files(bld.env['DATADIR'], 'small-splash.png')
713 bld.install_files(bld.env['DATADIR'], 'ArdourMono.ttf')
715 # Default UI configuration
716 bld.install_files(bld.env['CONFDIR'], 'ardour3_ui_default.conf')
718 # Default export stuff
719 bld.install_files(os.path.join(bld.env['CONFDIR'],' export'), bld.path.ant_glob('export/*.format'))
722 if bld.is_defined('ENABLE_NLS'):
723 mo_files = bld.path.ant_glob('po/*.mo')
725 lang = os.path.basename(mo.srcpath()).replace('.mo', '')
726 bld.install_as(os.path.join(bld.env['PREFIX'], 'share', 'locale',
727 lang, 'LC_MESSAGES', I18N_PACKAGE + '.mo'),
731 autowaf.build_i18n(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
735 autowaf.build_i18n_pot(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
739 autowaf.build_i18n_po(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
743 autowaf.build_i18n_mo(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,