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]
370 VERSION = "%s.%s" % (bld.env['MAJOR'], bld.env['MINOR'])
372 if bld.is_defined('WINDOWS_VST_SUPPORT'):
373 # If we require VST support we build a stub main() and the FST library
374 # here using winegcc, and link it to the GTK front-end library
375 obj = bld(features = 'cxx c cxxprogram wine')
378 ../libs/fst/fstinfofile.c
383 obj.use = [ 'libpbd',
393 obj.target = 'ardour-' + bld.env['VERSION'] + '-vst.exe.so'
394 obj.includes = [ '../libs/fst', '.' ]
395 obj.linkflags = ['-mwindows', '-Wl,--export-dynamic']
396 obj.defines = ['_POSIX_SOURCE', 'USE_WS_PREFIX']
397 obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
398 # end of the wine executable
400 # now the shared library containing the GTK GUI for ardour
401 obj = bld (features = 'cxx c cxxshlib')
402 obj.source = gtk2_ardour_sources
403 obj.includes = [ '../libs/fst', '.' ]
404 obj.name = 'libgtk2_ardour'
405 obj.target = 'gtk2_ardour'
407 # just the normal executable version of the GTK GUI
408 obj = bld(features = 'cxx c cxxprogram')
409 obj.source = gtk2_ardour_sources
410 obj.target = 'ardour-' + bld.env['VERSION']
412 obj.use = [ 'libpbd',
421 # continue with setup of obj, which could be a shared library
424 obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
425 obj.uselib = 'UUID FLAC FONTCONFIG GLIBMM GTHREAD GTK OGG CURL DL'
426 obj.uselib += ' GTKMM GNOMECANVASMM GNOMECANVAS FFTW3F'
427 obj.uselib += ' AUDIOUNITS OSX GTKOSX LO '
429 if bld.env['build_target'] == 'mingw':
430 if bld.env['DEBUG'] == False:
431 obj.linkflags = ['-mwindows']
433 if bld.is_defined('USE_EXTERNAL_LIBS'):
434 obj.uselib += ' TAGLIB'
436 obj.use.append('libtaglib')
438 if sys.platform == 'darwin':
439 obj.use += ' libappleutility'
441 'PACKAGE="' + I18N_PACKAGE + '"',
442 'VERSIONSTRING="' + bld.env['VERSION'] + '"',
443 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
444 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
445 'LOCALEDIR="' + os.path.join(os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
446 'PROGRAM_NAME="' + bld.env['PROGRAM_NAME'] + '"'
448 obj.includes += ['../libs']
450 if bld.is_defined('HAVE_SUIL'):
451 obj.source += [ 'lv2_plugin_ui.cc' ]
452 obj.use += [ 'SUIL' ]
454 if bld.is_defined('NEED_INTL'):
455 obj.linkflags = ' -lintl'
457 if bld.is_defined('WINDOWS_VST_SUPPORT'):
458 obj.source += [ 'windows_vst_plugin_ui.cc' ]
459 obj.defines += [ 'WINDOWS_VST_SUPPORT' ]
462 if bld.is_defined('LXVST_SUPPORT'):
463 obj.source += [ 'linux_vst_gui_support.cc', 'lxvst_plugin_ui.cc' ]
464 obj.defines += [ 'LXVST_SUPPORT' ]
467 if bld.is_defined('WINDOWS_VST_SUPPORT') or bld.is_defined('LXVST_SUPPORT'):
468 obj.source += [ 'vst_plugin_ui.cc' ]
470 if bld.is_defined('PHONE_HOME'):
471 obj.defines += [ 'PHONE_HOME' ]
473 if bld.is_defined('HAVE_COREAUDIO'):
474 TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cc']
475 obj.source += [ 'cocoacarbon.mm' ]
476 obj.use += ' libappleutility '
478 if bld.is_defined('AUDIOUNIT_SUPPORT'):
479 obj.source += [ 'au_pluginui.mm' ]
483 wrapper_subst_dict = {
484 'INSTALL_PREFIX' : bld.env['PREFIX'],
485 'LIBDIR' : os.path.normpath(bld.env['LIBDIR']),
486 'DATADIR' : os.path.normpath(bld.env['DATADIR']),
487 'SYSCONFDIR' : os.path.normpath(bld.env['SYSCONFDIR']),
488 'LIBS' : 'build/libs',
489 'VERSION' : bld.env['VERSION'],
490 'EXECUTABLE' : 'build/gtk2_ardour/ardour-' + bld.env['VERSION']
493 def set_subst_dict(obj, dict):
495 setattr(obj, i, dict[i])
497 obj = bld(features = 'subst', rule= 'chmod 0755 ${TGT}')
498 obj.source = 'ardev_common.sh.in'
499 obj.target = 'ardev_common_waf.sh'
500 obj.chmod = Utils.O755
501 obj.dict = wrapper_subst_dict
502 set_subst_dict(obj, wrapper_subst_dict)
504 obj = bld(features = 'subst')
505 obj.source = 'ardour.sh.in'
506 obj.target = 'ardour3'
507 obj.chmod = Utils.O755
508 obj.dict = wrapper_subst_dict
509 obj.install_path = bld.env['BINDIR']
510 set_subst_dict(obj, wrapper_subst_dict)
512 if bld.is_defined('WINDOWS_VST_SUPPORT'):
513 obj = bld(features = 'subst')
514 obj.source = '../vst/ardourvst.in'
515 obj.target = 'ardourvst3'
516 obj.chmod = Utils.O755
517 obj.dict = wrapper_subst_dict
518 obj.install_path = bld.env['BINDIR']
519 set_subst_dict(obj, wrapper_subst_dict)
523 dark_rc_subst_dict = {}
524 light_rc_subst_dict = {}
529 if bld.is_defined('GTKOSX'): # OS X fonts
543 # There is no acceptable monospace font available on older versions of OS X
544 # and no API on those versions to load TTF files that will work with
545 # GTK/fontconfig/pango.
547 # In addition, the ArdourMono font gets clipped for some reason on OS X
549 # Moreover, Lucida Grande just seems to work even though it is not monospace
553 'MONOSPACE' : 'Lucida Grande',
555 else: # Linux/X11 fonts
556 basefont = '' # unspecified - use system defaults
569 'MONOSPACE' : 'ArdourMono',
572 # Set up font substitution dictionary
574 for style in ['', 'BOLD', 'ITALIC']:
575 for sizename,points in iter(font_sizes.items()):
577 key = "_".join (['FONT',style,sizename])
578 fontstyle = " ".join ([basefont,style.lower(),points])
580 key = "_".join (['FONT',sizename])
581 fontstyle = " ".join ([basefont,points])
583 dark_rc_subst_dict[key] = fontstyle
584 light_rc_subst_dict[key] = fontstyle
587 for sizename,points in iter(font_sizes.items()):
588 key = "_".join (['FONT_SIZE',sizename])
589 dark_rc_subst_dict[key] = points
590 light_rc_subst_dict[key] = points
592 # various font names, eg @BOLD_MONOSPACE@
593 for font_sym,text in iter(font_names.items()):
595 dark_rc_subst_dict[key] = text
596 light_rc_subst_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 = '${SYSCONFDIR}/ardour3'
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 = '${SYSCONFDIR}/ardour3'
663 if bld.is_defined('GTKOSX'):
664 menus_argv = [ '-E', '-P', '-DGTKOSX' ]
666 menus_argv = [ '-E', '-P' ]
668 obj = bld(features = 'command-output')
670 obj.command_is_external = True
672 obj.argv = menus_argv
673 obj.stdin = 'ardour.menus.in'
674 obj.stdout = 'ardour.menus'
675 obj.dep_vars = ['GTKOSX']
676 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
681 # 'SAE-de-keypad', 'SAE-de-nokeypad', 'SAE-us-keypad',
682 # 'SAE-us-nokeypad', 'ergonomic-us'
685 # explicitly state the use of perl here so that it works on windows too
687 a_rule = 'perl ../tools/fmt-bindings --platform="%s" --winkey="%s" --accelmap <${SRC} >${TGT}' % (sys.platform, bld.env['WINDOWS_KEY'] )
688 for b in [ 'mnemonic-us' ] :
690 target = b + '.bindings',
691 source = b + '.bindings.in',
694 obj.install_path = os.path.join(bld.env['SYSCONFDIR'], 'ardour3')
696 # not modified at present
697 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
698 'step_editing.bindings')
699 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
703 bld.install_files('${DATADIR}/ardour3/icons', bld.path.ant_glob('icons/*.png'))
704 bld.install_files('${DATADIR}/ardour3/pixmaps', bld.path.ant_glob('pixmaps/*.xpm'))
705 bld.install_files('${DATADIR}/ardour3', 'splash.png')
706 bld.install_files('${DATADIR}/ardour3', 'ArdourMono.ttf')
708 # Default UI configuration
709 bld.install_files('${SYSCONFDIR}/ardour3', 'ardour3_ui_default.conf')
711 # Default export stuff
712 bld.install_files('${SYSCONFDIR}/ardour3/export', bld.path.ant_glob('export/*.format'))
715 if bld.is_defined('ENABLE_NLS'):
716 mo_files = bld.path.ant_glob('po/*.mo')
718 lang = os.path.basename(mo.srcpath()).replace('.mo', '')
719 bld.install_as(os.path.join(bld.env['PREFIX'], 'share', 'locale',
720 lang, 'LC_MESSAGES', I18N_PACKAGE + '.mo'),
724 autowaf.build_i18n(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
728 autowaf.build_i18n_pot(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
732 autowaf.build_i18n_po(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
736 autowaf.build_i18n_mo(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,