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',
30 'ardour_ui_dependents.cc',
31 'ardour_ui_dialogs.cc',
34 'ardour_ui_options.cc',
37 'audio_region_editor.cc',
38 'audio_region_view.cc',
39 'audio_streamview.cc',
41 'automation_controller.cc',
43 'automation_region_view.cc',
44 'automation_streamview.cc',
45 'automation_time_axis.cc',
47 'big_clock_window.cc',
53 'control_point_dialog.cc',
56 'edit_note_dialog.cc',
60 'editor_audio_import.cc',
61 'editor_audiotrack.cc',
63 'editor_canvas_events.cc',
64 'editor_component.cc',
67 'editor_route_groups.cc',
68 'editor_export_audio.cc',
69 'editor_group_tabs.cc',
71 'editor_locations.cc',
79 'editor_selection.cc',
80 'editor_snapshots.cc',
82 'editor_tempodisplay.cc',
86 'export_channel_selector.cc',
88 'export_file_notebook.cc',
89 'export_filename_selector.cc',
90 'export_format_dialog.cc',
91 'export_format_selector.cc',
92 'export_preset_selector.cc',
93 'export_timespan_selector.cc',
97 'sfdb_freesound_mootcher.cc',
99 'generic_pluginui.cc',
101 'global_port_matrix.cc',
103 'gtk-custom-hruler.c',
104 'gtk-custom-ruler.c',
105 'gtk_pianokeyboard.c',
107 'insert_time_dialog.cc',
108 'interthread_progress_window.cc',
120 'midi_automation_line.cc',
121 'midi_channel_dialog.cc',
122 'midi_channel_selector.cc',
123 'midi_cut_buffer.cc',
124 'midi_export_dialog.cc',
125 'midi_list_editor.cc',
126 'midi_port_dialog.cc',
127 'midi_region_view.cc',
130 'midi_streamview.cc',
133 'midi_velocity_dialog.cc',
134 'missing_file_dialog.cc',
135 'missing_plugin_dialog.cc',
137 'mixer_group_tabs.cc',
143 'monitor_section.cc',
145 'mono_panner_editor.cc',
148 'new_plugin_preset_dialog.cc',
149 'normalize_dialog.cc',
159 'panner_interface.cc',
162 'piano_roll_header.cc',
164 'playlist_selector.cc',
166 'plugin_selector.cc',
171 'port_matrix_body.cc',
172 'port_matrix_column_labels.cc',
173 'port_matrix_component.cc',
174 'port_matrix_grid.cc',
175 'port_matrix_labels.cc',
176 'port_matrix_row_labels.cc',
178 'patch_change_dialog.cc',
179 'progress_reporter.cc',
182 'quantize_dialog.cc',
183 'rc_option_editor.cc',
185 'region_gain_line.cc',
186 'region_layering_order_editor.cc',
187 'region_selection.cc',
191 'route_group_dialog.cc',
192 'route_group_menu.cc',
193 'route_params_ui.cc',
194 'route_processor_selection.cc',
195 'route_time_axis.cc',
197 'search_path_option.cc',
201 'session_import_dialog.cc',
202 'session_metadata_dialog.cc',
203 'session_option_editor.cc',
205 'shuttle_control.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 if Options.options.dist_target == 'auto':
264 if re.search ("linux", sys.platform) != None:
265 autowaf.check_pkg(conf, 'alsa', uselib_store='ALSA')
267 # TODO: Insert a sanity check for on OS X to ensure CoreAudio is present
269 autowaf.check_pkg(conf, 'fftw3f', uselib_store='FFTW3F',
271 autowaf.check_pkg(conf, 'flac', uselib_store='FLAC',
272 atleast_version='1.2.1')
273 autowaf.check_pkg(conf, 'gthread-2.0', uselib_store='GTHREAD',
274 atleast_version='2.10.1')
275 autowaf.check_pkg(conf, 'gtk+-2.0', uselib_store='GTK',
276 atleast_version='2.18')
277 autowaf.check_pkg(conf, 'gtkmm-2.4', uselib_store='GTKMM',
278 atleast_version='2.18')
279 autowaf.check_pkg(conf, 'ogg', uselib_store='OGG', atleast_version='1.1.2')
280 autowaf.check_pkg(conf, 'x11', uselib_store='X11', atleast_version='1.1', mandatory=False)
281 autowaf.check_pkg(conf, 'fontconfig', uselib_store='FONTCONFIG')
283 conf.write_config_header('gtk2ardour-config.h', remove=False)
286 autowaf.check_header(conf, 'cxx', 'boost/shared_ptr.hpp')
287 autowaf.check_header(conf, 'cxx', 'boost/weak_ptr.hpp')
289 # Add a waf `feature' to allow compilation of things using winegcc
290 from waflib.TaskGen import feature
292 def set_winegcc(self):
293 self.env.LINK_CXX = self.env.LINK_CC = 'wineg++'
294 self.env.CC = 'winegcc'
296 def _doPyp(infileName, deps = False):
299 re_spaces = re.compile("\s+")
301 if infileName == '-':
304 fd = open(infileName)
305 inLines = fd.readlines()
311 bits = re_spaces.split(line)
312 if bits[0] == '##include':
317 # assume included file comes from same place as source file
318 incName = os.path.join (os.path.dirname (infileName), incName);
319 outStr += _doPyp(incName)
330 def include_processor(task):
331 infileName = task.inputs[0].srcpath()
332 outfileName = os.path.join(out, task.outputs[0].bldpath())
333 fdOut = open (outfileName, "w")
334 fdOut.write (_doPyp(infileName))
338 def build_color_scheme(path, prefix):
342 if re.search ('^#@color', line):
343 line.strip() # remove newline
345 if len(color_scheme):
347 color_scheme += prefix
349 color_scheme += words[1]
351 color_scheme += words[2]
357 VERSION = "%s.%s" % (bld.env['MAJOR'], bld.env['MINOR'])
359 if bld.is_defined('WINDOWS_VST_SUPPORT'):
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')
365 '../libs/fst/fstinfofile.c',
366 '../libs/fst/vsti.c',
367 '../libs/fst/vstwin.c',
371 # XXX do we really need to explicitly link to all of these for the wine executable?
373 obj.use = [ 'libpbd',
383 obj.target = 'ardour-' + bld.env['VERSION'] + '-vst.exe.so'
384 obj.includes = [ '../libs/fst', '.' ]
385 obj.linkflags = ['-mwindows', '-Wl,--export-dynamic']
386 obj.defines = ['_POSIX_SOURCE', 'USE_WS_PREFIX']
387 obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
388 # end of the wine executable
390 # now the shared library containing the GTK GUI for ardour
391 obj = bld (features = 'cxx c cxxshlib')
392 obj.source = gtk2_ardour_sources
393 obj.includes = [ '../libs/fst', '.' ]
394 obj.name = 'libgtk2_ardour'
395 obj.target = 'gtk2_ardour'
397 # just the normal executable version of the GTK GUI
398 obj = bld (features = 'cxx c cxxprogram')
399 obj.source = gtk2_ardour_sources
400 obj.target = 'ardour-' + bld.env['VERSION']
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') + '"',
421 'PROGRAM_NAME="' + bld.env['PROGRAM_NAME'] + '"'
423 obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
424 obj.uselib = 'UUID FLAC FONTCONFIG GLIBMM GTHREAD GTK OGG CURL DL'
425 obj.uselib += ' GTKMM CANVAS FFTW3F'
426 obj.uselib += ' AUDIOUNITS OSX GTKOSX LO '
427 obj.uselib += ' TAGLIB '
429 if sys.platform == 'darwin':
430 obj.uselib += ' AUDIOUNITS OSX GTKOSX'
431 obj.use += ' libappleutility'
432 obj.includes += ['../libs']
434 if bld.env['build_target'] == 'mingw':
435 if bld.env['DEBUG'] == False:
436 obj.linkflags = ['-mwindows']
438 if bld.is_defined('HAVE_SUIL'):
439 obj.source += [ 'lv2_plugin_ui.cc' ]
440 obj.use += [ 'SUIL' ]
442 if bld.is_defined('NEED_INTL'):
443 obj.linkflags = ' -lintl'
445 if bld.is_defined('WINDOWS_VST_SUPPORT'):
446 obj.source += [ 'windows_vst_plugin_ui.cc' ]
447 obj.defines += [ 'WINDOWS_VST_SUPPORT' ]
450 if bld.is_defined('LXVST_SUPPORT'):
451 obj.source += [ 'linux_vst_gui_support.cc', 'lxvst_plugin_ui.cc' ]
452 obj.defines += [ 'LXVST_SUPPORT' ]
455 if bld.is_defined('WINDOWS_VST_SUPPORT') or bld.is_defined('LXVST_SUPPORT'):
456 obj.source += [ 'vst_plugin_ui.cc' ]
458 if bld.is_defined('PHONE_HOME'):
459 obj.defines += [ 'PHONE_HOME' ]
461 if bld.is_defined('HAVE_COREAUDIO'):
462 TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cc']
463 obj.source += [ 'cocoacarbon.mm' ]
464 obj.use += ' libappleutility '
466 if bld.is_defined('AUDIOUNIT_SUPPORT'):
467 obj.source += [ 'au_pluginui.mm' ]
471 wrapper_subst_dict = {
472 'INSTALL_PREFIX' : bld.env['PREFIX'],
473 'LIBDIR' : os.path.normpath(bld.env['LIBDIR']),
474 'DATADIR' : os.path.normpath(bld.env['DATADIR']),
475 'SYSCONFDIR' : os.path.normpath(bld.env['SYSCONFDIR']),
476 'LIBS' : 'build/libs',
477 'VERSION' : bld.env['VERSION'],
478 'EXECUTABLE' : 'build/gtk2_ardour/ardour-' + bld.env['VERSION']
481 def set_subst_dict(obj, dict):
483 setattr(obj, i, dict[i])
485 obj = bld(features = 'subst', rule= 'chmod 0755 ${TGT}')
486 obj.source = 'ardev_common.sh.in'
487 obj.target = 'ardev_common_waf.sh'
488 obj.chmod = Utils.O755
489 obj.dict = wrapper_subst_dict
490 set_subst_dict(obj, wrapper_subst_dict)
492 obj = bld(features = 'subst')
493 obj.source = 'ardour.sh.in'
494 obj.target = 'ardour3'
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)
500 if bld.is_defined('WINDOWS_VST_SUPPORT'):
501 obj = bld(features = 'subst')
502 obj.source = '../vst/ardourvst.in'
503 obj.target = 'ardourvst3'
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)
511 dark_rc_subst_dict = {}
512 light_rc_subst_dict = {}
517 if bld.is_defined('GTKOSX'): # OS X fonts
531 # There is no acceptable monospace font available on older versions of OS X
532 # and no API on those versions to load TTF files that will work with
533 # GTK/fontconfig/pango.
535 # In addition, the ArdourMono font gets clipped for some reason on OS X
537 # Moreover, Lucida Grande just seems to work even though it is not monospace
541 'MONOSPACE' : 'Lucida Grande',
543 else: # Linux/X11 fonts
544 basefont = '' # unspecified - use system defaults
557 'MONOSPACE' : 'ArdourMono',
560 # Set up font substitution dictionary
562 for style in ['', 'BOLD', 'ITALIC']:
563 for sizename,points in iter(font_sizes.items()):
565 key = "_".join (['FONT',style,sizename])
566 fontstyle = " ".join ([basefont,style.lower(),points])
568 key = "_".join (['FONT',sizename])
569 fontstyle = " ".join ([basefont,points])
571 dark_rc_subst_dict[key] = fontstyle
572 light_rc_subst_dict[key] = fontstyle
575 for sizename,points in iter(font_sizes.items()):
576 key = "_".join (['FONT_SIZE',sizename])
577 dark_rc_subst_dict[key] = points
578 light_rc_subst_dict[key] = points
580 # various font names, eg @BOLD_MONOSPACE@
581 for font_sym,text in iter(font_names.items()):
583 dark_rc_subst_dict[key] = text
584 light_rc_subst_dict[key] = text
587 dark_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
588 'gtk2_ardour/ardour3_ui_dark.rc.in', 'ARDOUR_DARK')
589 dark_rc_subst_dict['COLPREFIX'] = 'ARDOUR_DARK'
590 light_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
591 'gtk2_ardour/ardour3_ui_light.rc.in', 'ARDOUR_LIGHT')
592 light_rc_subst_dict['COLPREFIX'] = 'ARDOUR_LIGHT'
594 obj = bld(features = 'subst')
595 obj.source = [ 'ardour3_ui_dark.rc.in' ]
596 obj.target = 'ardour3_ui_dark.rc.pre'
597 obj.install_path = None
598 set_subst_dict(obj, dark_rc_subst_dict)
600 obj = bld(features = 'subst')
601 obj.source = [ 'ardour3_ui_light.rc.in' ]
602 obj.target = 'ardour3_ui_light.rc.pre'
603 obj.install_path = None
604 set_subst_dict(obj, light_rc_subst_dict)
606 obj = bld(features = 'subst')
607 obj.source = [ 'ardour3_styles.rc.in' ]
608 obj.target = 'ardour3_dark_styles.rc'
609 obj.install_path = None
610 set_subst_dict(obj, dark_rc_subst_dict)
612 obj = bld(features = 'subst')
613 obj.source = [ 'ardour3_styles.rc.in' ]
614 obj.target = 'ardour3_light_styles.rc'
615 obj.install_path = None
616 set_subst_dict(obj, light_rc_subst_dict)
618 obj = bld(features = 'subst')
619 obj.source = [ 'ardour3_fonts.rc.in' ]
620 obj.target = 'ardour3_dark_fonts.rc'
621 obj.install_path = None
622 set_subst_dict(obj, dark_rc_subst_dict)
624 obj = bld(features = 'subst')
625 obj.source = [ 'ardour3_fonts.rc.in' ]
626 obj.target = 'ardour3_light_fonts.rc'
627 obj.install_path = None
628 set_subst_dict(obj, light_rc_subst_dict)
630 obj = bld(rule = autowaf.copyfile)
631 obj.source = [ 'ardour3_widget_list.rc' ]
632 obj.target = 'ardour3_widgets.rc'
633 obj.install_path = None
635 obj = bld (rule = include_processor)
636 obj.source = [ 'ardour3_ui_dark.rc.pre' ]
637 # find and add all ##include dependencies as sources
638 obj.source += _doPyp (bld.path.find_resource ('ardour3_ui_dark.rc.in').srcpath(), True)
639 obj.target = 'ardour3_ui_dark.rc'
640 obj.install_path = '${SYSCONFDIR}/ardour3'
642 obj = bld (rule = include_processor)
643 obj.source = [ 'ardour3_ui_light.rc.pre' ]
644 # find and add all ##include dependencies as sources
645 obj.source += _doPyp (bld.path.find_resource ('ardour3_ui_light.rc.in').srcpath(), True)
646 obj.target = 'ardour3_ui_light.rc'
647 obj.install_path = '${SYSCONFDIR}/ardour3'
651 if bld.is_defined('GTKOSX'):
652 menus_argv = [ '-E', '-P', '-DGTKOSX' ]
654 menus_argv = [ '-E', '-P' ]
656 obj = bld(features = 'command-output')
658 obj.command_is_external = True
660 obj.argv = menus_argv
661 obj.stdin = 'ardour.menus.in'
662 obj.stdout = 'ardour.menus'
663 obj.dep_vars = ['GTKOSX']
664 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
669 # 'SAE-de-keypad', 'SAE-de-nokeypad', 'SAE-us-keypad',
670 # 'SAE-us-nokeypad', 'ergonomic-us'
673 # explicitly state the use of perl here so that it works on windows too
675 a_rule = 'perl ../tools/fmt-bindings --platform="%s" --winkey="%s" --accelmap <${SRC} >${TGT}' % (sys.platform, bld.env['WINDOWS_KEY'] )
676 for b in [ 'mnemonic-us' ] :
678 target = b + '.bindings',
679 source = b + '.bindings.in',
682 obj.install_path = os.path.join(bld.env['SYSCONFDIR'], 'ardour3')
684 # not modified at present
685 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
686 'step_editing.bindings')
687 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
691 bld.install_files('${DATADIR}/ardour3/icons', bld.path.ant_glob('icons/*.png'))
692 bld.install_files('${DATADIR}/ardour3/pixmaps', bld.path.ant_glob('pixmaps/*.xpm'))
693 bld.install_files('${DATADIR}/ardour3', 'splash.png')
694 bld.install_files('${DATADIR}/ardour3', 'ArdourMono.ttf')
696 # Default UI configuration
697 bld.install_files('${SYSCONFDIR}/ardour3', 'ardour3_ui_default.conf')
699 # Default export stuff
700 bld.install_files('${SYSCONFDIR}/ardour3/export', bld.path.ant_glob('export/*.format'))
703 if bld.is_defined('ENABLE_NLS'):
704 mo_files = bld.path.ant_glob('po/*.mo')
706 lang = os.path.basename(mo.srcpath()).replace('.mo', '')
707 bld.install_as(os.path.join(bld.env['PREFIX'], 'share', 'locale',
708 lang, 'LC_MESSAGES', I18N_PACKAGE + '.mo'),
712 autowaf.build_i18n(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
716 autowaf.build_i18n_pot(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
720 autowaf.build_i18n_po(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
724 autowaf.build_i18n_mo(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,