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',
52 'canvas-note-event.cc',
54 'canvas_patch_change.cc',
55 'canvas-simpleline.c',
56 'canvas-simplerect.c',
62 'control_point_dialog.cc',
66 'edit_note_dialog.cc',
70 'editor_audio_import.cc',
71 'editor_audiotrack.cc',
73 'editor_canvas_events.cc',
74 'editor_component.cc',
77 'editor_route_groups.cc',
78 'editor_export_audio.cc',
79 'editor_group_tabs.cc',
81 'editor_locations.cc',
89 'editor_selection.cc',
90 'editor_snapshots.cc',
92 'editor_tempodisplay.cc',
96 'export_channel_selector.cc',
98 'export_file_notebook.cc',
99 'export_filename_selector.cc',
100 'export_format_dialog.cc',
101 'export_format_selector.cc',
102 'export_preset_selector.cc',
103 'export_timespan_selector.cc',
107 'sfdb_freesound_mootcher.cc',
109 'generic_pluginui.cc',
111 'global_port_matrix.cc',
113 'gtk-custom-hruler.c',
114 'gtk-custom-ruler.c',
115 'gtk_pianokeyboard.c',
117 'insert_time_dialog.cc',
118 'interthread_progress_window.cc',
130 'midi_automation_line.cc',
131 'midi_channel_dialog.cc',
132 'midi_channel_selector.cc',
133 'midi_cut_buffer.cc',
134 'midi_export_dialog.cc',
135 'midi_list_editor.cc',
136 'midi_port_dialog.cc',
137 'midi_region_view.cc',
140 'midi_streamview.cc',
143 'midi_velocity_dialog.cc',
144 'missing_file_dialog.cc',
145 'missing_plugin_dialog.cc',
147 'mixer_group_tabs.cc',
153 'monitor_section.cc',
155 'mono_panner_editor.cc',
158 'new_plugin_preset_dialog.cc',
159 'normalize_dialog.cc',
167 'panner_interface.cc',
169 'piano_roll_header.cc',
171 'playlist_selector.cc',
173 'plugin_selector.cc',
178 'port_matrix_body.cc',
179 'port_matrix_column_labels.cc',
180 'port_matrix_component.cc',
181 'port_matrix_grid.cc',
182 'port_matrix_labels.cc',
183 'port_matrix_row_labels.cc',
185 'patch_change_dialog.cc',
186 'progress_reporter.cc',
189 'quantize_dialog.cc',
190 'rc_option_editor.cc',
192 'region_gain_line.cc',
193 'region_layering_order_editor.cc',
194 'region_selection.cc',
198 'route_group_dialog.cc',
199 'route_group_menu.cc',
200 'route_params_ui.cc',
201 'route_processor_selection.cc',
202 'route_time_axis.cc',
204 'search_path_option.cc',
208 'session_import_dialog.cc',
209 'session_metadata_dialog.cc',
210 'session_option_editor.cc',
212 'shuttle_control.cc',
221 'stereo_panner_editor.cc',
223 'strip_silence_dialog.cc',
224 'tape_region_view.cc',
229 'time_axis_view_item.cc',
233 'track_selection.cc',
234 'track_view_list.cc',
235 'transpose_dialog.cc',
240 'visibility_group.cc',
241 'volume_controller.cc',
244 # video-timeline related sources:
245 'video_image_frame.cc',
246 'add_video_dialog.cc',
247 'editor_videotimeline.cc',
251 'transcode_ffmpeg.cc',
252 'transcode_video_dialog.cc',
253 'video_server_dialog.cc',
255 'export_video_dialog.cc',
256 'export_video_infobox.cc'
260 autowaf.set_options(opt)
264 conf.load('compiler_cxx')
265 # we don't use hard-coded micro versions with ardour, so hard code it to zero
266 autowaf.build_version_files(
267 path_prefix + 'version.h',
268 path_prefix + 'version.cc',
269 'gtk2_ardour', conf.env['MAJOR'], conf.env['MINOR'], 0)
270 autowaf.configure(conf)
272 if Options.options.dist_target == 'auto':
273 if re.search ("linux", sys.platform) != None:
274 autowaf.check_pkg(conf, 'alsa', uselib_store='ALSA')
276 # TODO: Insert a sanity check for on OS X to ensure CoreAudio is present
278 autowaf.check_pkg(conf, 'fftw3f', uselib_store='FFTW3F',
280 autowaf.check_pkg(conf, 'flac', uselib_store='FLAC',
281 atleast_version='1.2.1')
282 autowaf.check_pkg(conf, 'gthread-2.0', uselib_store='GTHREAD',
283 atleast_version='2.10.1')
284 autowaf.check_pkg(conf, 'gtk+-2.0', uselib_store='GTK',
285 atleast_version='2.18')
286 autowaf.check_pkg(conf, 'gtkmm-2.4', uselib_store='GTKMM',
287 atleast_version='2.18')
288 autowaf.check_pkg(conf, 'libgnomecanvas-2.0',
289 uselib_store='GNOMECANVAS', atleast_version='2.30')
290 autowaf.check_pkg(conf, 'libgnomecanvasmm-2.6',
291 uselib_store='GNOMECANVASMM', atleast_version='2.16')
292 autowaf.check_pkg(conf, 'ogg', uselib_store='OGG', atleast_version='1.1.2')
293 autowaf.check_pkg(conf, 'x11', uselib_store='X11', atleast_version='1.1', mandatory=False)
294 autowaf.check_pkg(conf, 'fontconfig', uselib_store='FONTCONFIG')
296 conf.write_config_header('gtk2ardour-config.h', remove=False)
299 autowaf.check_header(conf, 'cxx', 'boost/shared_ptr.hpp')
300 autowaf.check_header(conf, 'cxx', 'boost/weak_ptr.hpp')
302 # Add a waf `feature' to allow compilation of things using winegcc
303 from waflib.TaskGen import feature
305 def set_winegcc(self):
306 self.env.LINK_CXX = self.env.LINK_CC = 'wineg++'
307 self.env.CC = 'winegcc'
309 def _doPyp(infileName, deps = False):
312 re_spaces = re.compile("\s+")
314 if infileName == '-':
317 fd = open(infileName)
318 inLines = fd.readlines()
324 bits = re_spaces.split(line)
325 if bits[0] == '##include':
330 # assume included file comes from same place as source file
331 incName = os.path.join (os.path.dirname (infileName), incName);
332 outStr += _doPyp(incName)
343 def include_processor(task):
344 infileName = task.inputs[0].srcpath()
345 outfileName = os.path.join(out, task.outputs[0].bldpath())
346 fdOut = open (outfileName, "w")
347 fdOut.write (_doPyp(infileName))
351 def build_color_scheme(path, prefix):
355 if re.search ('^#@color', line):
356 line.strip() # remove newline
358 if len(color_scheme):
360 color_scheme += prefix
362 color_scheme += words[1]
364 color_scheme += words[2]
369 src = task.inputs[0].abspath()
370 tgt = task.outputs[0].abspath()
371 shutil.copy2 (src, tgt)
375 VERSION = "%s.%s" % (bld.env['MAJOR'], bld.env['MINOR'])
377 if bld.is_defined('WINDOWS_VST_SUPPORT'):
378 # If we require VST support we build a stub main() and the FST library
379 # here using winegcc, and link it to the GTK front-end library
380 obj = bld(features = 'cxx c cxxprogram wine')
383 ../libs/fst/fstinfofile.c
388 obj.use = [ 'libpbd',
398 obj.target = 'ardour-' + bld.env['VERSION'] + '-vst.exe.so'
399 obj.includes = [ '../libs/fst', '.' ]
400 obj.linkflags = ['-mwindows', '-Wl,--export-dynamic']
401 obj.defines = ['_POSIX_SOURCE', 'USE_WS_PREFIX']
402 obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
403 # end of the wine executable
405 # now the shared library containing the GTK GUI for ardour
406 obj = bld (features = 'cxx c cxxshlib')
407 obj.source = gtk2_ardour_sources
408 obj.includes = [ '../libs/fst', '.' ]
409 obj.name = 'libgtk2_ardour'
410 obj.target = 'gtk2_ardour'
412 # just the normal executable version of the GTK GUI
413 obj = bld(features = 'cxx c cxxprogram')
414 obj.source = gtk2_ardour_sources
415 obj.target = 'ardour-' + bld.env['VERSION']
417 obj.use = [ 'libpbd',
426 # continue with setup of obj, which could be a shared library
429 obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
430 obj.uselib = 'UUID FLAC FONTCONFIG GLIBMM GTHREAD GTK OGG CURL DL'
431 obj.uselib += ' GTKMM GNOMECANVASMM GNOMECANVAS FFTW3F'
432 obj.uselib += ' AUDIOUNITS OSX GTKOSX LO '
434 if bld.env['build_target'] == 'mingw':
435 if bld.env['DEBUG'] == False:
436 obj.linkflags = ['-mwindows']
438 if bld.is_defined('USE_EXTERNAL_LIBS'):
439 obj.uselib += ' TAGLIB'
441 obj.use.append('libtaglib')
443 if sys.platform == 'darwin':
444 obj.use += ' libappleutility'
446 'PACKAGE="' + I18N_PACKAGE + '"',
447 'VERSIONSTRING="' + bld.env['VERSION'] + '"',
448 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
449 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
450 'LOCALEDIR="' + os.path.join(os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
451 'PROGRAM_NAME="' + bld.env['PROGRAM_NAME'] + '"'
453 obj.includes += ['../libs']
455 if bld.is_defined('HAVE_SUIL'):
456 obj.source += [ 'lv2_plugin_ui.cc' ]
457 obj.use += [ 'SUIL' ]
459 if bld.is_defined('NEED_INTL'):
460 obj.linkflags = ' -lintl'
462 if bld.is_defined('WINDOWS_VST_SUPPORT'):
463 obj.source += [ 'windows_vst_plugin_ui.cc' ]
464 obj.defines += [ 'WINDOWS_VST_SUPPORT' ]
467 if bld.is_defined('LXVST_SUPPORT'):
468 obj.source += [ 'linux_vst_gui_support.cc', 'lxvst_plugin_ui.cc' ]
469 obj.defines += [ 'LXVST_SUPPORT' ]
472 if bld.is_defined('WINDOWS_VST_SUPPORT') or bld.is_defined('LXVST_SUPPORT'):
473 obj.source += [ 'vst_plugin_ui.cc' ]
475 if bld.is_defined('PHONE_HOME'):
476 obj.defines += [ 'PHONE_HOME' ]
478 if bld.is_defined('HAVE_COREAUDIO'):
479 TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cc']
480 obj.source += [ 'cocoacarbon.mm' ]
481 obj.use += ' libappleutility '
483 if bld.is_defined('AUDIOUNIT_SUPPORT'):
484 obj.source += [ 'au_pluginui.mm' ]
488 wrapper_subst_dict = {
489 'INSTALL_PREFIX' : bld.env['PREFIX'],
490 'LIBDIR' : os.path.normpath(bld.env['LIBDIR']),
491 'DATADIR' : os.path.normpath(bld.env['DATADIR']),
492 'SYSCONFDIR' : os.path.normpath(bld.env['SYSCONFDIR']),
493 'LIBS' : 'build/libs',
494 'VERSION' : bld.env['VERSION'],
495 'EXECUTABLE' : 'build/gtk2_ardour/ardour-' + bld.env['VERSION']
498 def set_subst_dict(obj, dict):
500 setattr(obj, i, dict[i])
502 obj = bld(features = 'subst', rule= 'chmod 0755 ${TGT}')
503 obj.source = 'ardev_common.sh.in'
504 obj.target = 'ardev_common_waf.sh'
505 obj.chmod = Utils.O755
506 obj.dict = wrapper_subst_dict
507 set_subst_dict(obj, wrapper_subst_dict)
509 obj = bld(features = 'subst')
510 obj.source = 'ardour.sh.in'
511 obj.target = 'ardour3'
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)
517 if bld.is_defined('WINDOWS_VST_SUPPORT'):
518 obj = bld(features = 'subst')
519 obj.source = '../vst/ardourvst.in'
520 obj.target = 'ardourvst3'
521 obj.chmod = Utils.O755
522 obj.dict = wrapper_subst_dict
523 obj.install_path = bld.env['BINDIR']
524 set_subst_dict(obj, wrapper_subst_dict)
528 dark_rc_subst_dict = {}
529 light_rc_subst_dict = {}
534 if bld.is_defined('GTKOSX'): # OS X fonts
548 # There is no acceptable monospace font available on older versions of OS X
549 # and no API on those versions to load TTF files that will work with
550 # GTK/fontconfig/pango.
552 # In addition, the ArdourMono font gets clipped for some reason on OS X
554 # Moreover, Lucida Grande just seems to work even though it is not monospace
558 'MONOSPACE' : 'Lucida Grande',
560 else: # Linux/X11 fonts
561 basefont = '' # unspecified - use system defaults
574 'MONOSPACE' : 'ArdourMono',
577 # Set up font substitution dictionary
579 for style in ['', 'BOLD', 'ITALIC']:
580 for sizename,points in iter(font_sizes.items()):
582 key = "_".join (['FONT',style,sizename])
583 fontstyle = " ".join ([basefont,style.lower(),points])
585 key = "_".join (['FONT',sizename])
586 fontstyle = " ".join ([basefont,points])
588 dark_rc_subst_dict[key] = fontstyle
589 light_rc_subst_dict[key] = fontstyle
592 for sizename,points in iter(font_sizes.items()):
593 key = "_".join (['FONT_SIZE',sizename])
594 dark_rc_subst_dict[key] = points
595 light_rc_subst_dict[key] = points
597 # various font names, eg @BOLD_MONOSPACE@
598 for font_sym,text in iter(font_names.items()):
600 dark_rc_subst_dict[key] = text
601 light_rc_subst_dict[key] = text
604 dark_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
605 'gtk2_ardour/ardour3_ui_dark.rc.in', 'ARDOUR_DARK')
606 dark_rc_subst_dict['COLPREFIX'] = 'ARDOUR_DARK'
607 light_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
608 'gtk2_ardour/ardour3_ui_light.rc.in', 'ARDOUR_LIGHT')
609 light_rc_subst_dict['COLPREFIX'] = 'ARDOUR_LIGHT'
611 obj = bld(features = 'subst')
612 obj.source = [ 'ardour3_ui_dark.rc.in' ]
613 obj.target = 'ardour3_ui_dark.rc.pre'
614 obj.install_path = None
615 set_subst_dict(obj, dark_rc_subst_dict)
617 obj = bld(features = 'subst')
618 obj.source = [ 'ardour3_ui_light.rc.in' ]
619 obj.target = 'ardour3_ui_light.rc.pre'
620 obj.install_path = None
621 set_subst_dict(obj, light_rc_subst_dict)
623 obj = bld(features = 'subst')
624 obj.source = [ 'ardour3_styles.rc.in' ]
625 obj.target = 'ardour3_dark_styles.rc'
626 obj.install_path = None
627 set_subst_dict(obj, dark_rc_subst_dict)
629 obj = bld(features = 'subst')
630 obj.source = [ 'ardour3_styles.rc.in' ]
631 obj.target = 'ardour3_light_styles.rc'
632 obj.install_path = None
633 set_subst_dict(obj, light_rc_subst_dict)
635 obj = bld(features = 'subst')
636 obj.source = [ 'ardour3_fonts.rc.in' ]
637 obj.target = 'ardour3_dark_fonts.rc'
638 obj.install_path = None
639 set_subst_dict(obj, dark_rc_subst_dict)
641 obj = bld(features = 'subst')
642 obj.source = [ 'ardour3_fonts.rc.in' ]
643 obj.target = 'ardour3_light_fonts.rc'
644 obj.install_path = None
645 set_subst_dict(obj, light_rc_subst_dict)
647 obj = bld(rule = copyfile)
648 obj.source = [ 'ardour3_widget_list.rc' ]
649 obj.target = 'ardour3_widgets.rc'
650 obj.install_path = None
652 obj = bld (rule = include_processor)
653 obj.source = [ 'ardour3_ui_dark.rc.pre' ]
654 # find and add all ##include dependencies as sources
655 obj.source += _doPyp (bld.path.find_resource ('ardour3_ui_dark.rc.in').srcpath(), True)
656 obj.target = 'ardour3_ui_dark.rc'
657 obj.install_path = '${SYSCONFDIR}/ardour3'
659 obj = bld (rule = include_processor)
660 obj.source = [ 'ardour3_ui_light.rc.pre' ]
661 # find and add all ##include dependencies as sources
662 obj.source += _doPyp (bld.path.find_resource ('ardour3_ui_light.rc.in').srcpath(), True)
663 obj.target = 'ardour3_ui_light.rc'
664 obj.install_path = '${SYSCONFDIR}/ardour3'
668 if bld.is_defined('GTKOSX'):
669 menus_argv = [ '-E', '-P', '-DGTKOSX' ]
671 menus_argv = [ '-E', '-P' ]
673 obj = bld(features = 'command-output')
675 obj.command_is_external = True
677 obj.argv = menus_argv
678 obj.stdin = 'ardour.menus.in'
679 obj.stdout = 'ardour.menus'
680 obj.dep_vars = ['GTKOSX']
681 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
686 # 'SAE-de-keypad', 'SAE-de-nokeypad', 'SAE-us-keypad',
687 # 'SAE-us-nokeypad', 'ergonomic-us'
690 # explicitly state the use of perl here so that it works on windows too
692 a_rule = 'perl ../tools/fmt-bindings --platform="%s" --winkey="%s" --accelmap <${SRC} >${TGT}' % (sys.platform, bld.env['WINDOWS_KEY'] )
693 for b in [ 'mnemonic-us' ] :
695 target = b + '.bindings',
696 source = b + '.bindings.in',
699 obj.install_path = os.path.join(bld.env['SYSCONFDIR'], 'ardour3')
701 # not modified at present
702 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
703 'step_editing.bindings')
704 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
708 bld.install_files('${DATADIR}/ardour3/icons', bld.path.ant_glob('icons/*.png'))
709 bld.install_files('${DATADIR}/ardour3/pixmaps', bld.path.ant_glob('pixmaps/*.xpm'))
710 bld.install_files('${DATADIR}/ardour3', 'splash.png')
711 bld.install_files('${DATADIR}/ardour3', 'ArdourMono.ttf')
713 # Default UI configuration
714 bld.install_files('${SYSCONFDIR}/ardour3', 'ardour3_ui_default.conf')
716 # Default export stuff
717 bld.install_files('${SYSCONFDIR}/ardour3/export', bld.path.ant_glob('export/*.format'))
720 if bld.is_defined('ENABLE_NLS'):
721 mo_files = bld.path.ant_glob('po/*.mo')
723 lang = os.path.basename(mo.srcpath()).replace('.mo', '')
724 bld.install_as(os.path.join(bld.env['PREFIX'], 'share', 'locale',
725 lang, 'LC_MESSAGES', I18N_PACKAGE + '.mo'),
729 autowaf.build_i18n(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
733 autowaf.build_i18n_pot(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
737 autowaf.build_i18n_po(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
741 autowaf.build_i18n_mo(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,