2 from waflib.extras import autowaf as autowaf
3 from waflib import Options, TaskGen
4 import waflib.Logs as Logs, waflib.Utils as Utils
9 from waflib.Task import Task
11 I18N_PACKAGE = 'gtk2_ardour3'
17 path_prefix = 'gtk2_ardour/'
19 gtk2_ardour_sources = [
22 'add_route_dialog.cc',
23 'ambiguous_file_dialog.cc',
29 'ardour_ui_dependents.cc',
30 'ardour_ui_dialogs.cc',
33 'ardour_ui_options.cc',
36 'audio_region_editor.cc',
37 'audio_region_view.cc',
38 'audio_streamview.cc',
40 'automation_controller.cc',
42 'automation_region_view.cc',
43 'automation_streamview.cc',
44 'automation_time_axis.cc',
46 'big_clock_window.cc',
51 'canvas-note-event.cc',
53 'canvas_patch_change.cc',
54 'canvas-simpleline.c',
55 'canvas-simplerect.c',
61 'control_point_dialog.cc',
65 'edit_note_dialog.cc',
69 'editor_audio_import.cc',
70 'editor_audiotrack.cc',
72 'editor_canvas_events.cc',
73 'editor_component.cc',
76 'editor_route_groups.cc',
77 'editor_export_audio.cc',
78 'editor_group_tabs.cc',
80 'editor_locations.cc',
88 'editor_selection.cc',
89 'editor_snapshots.cc',
91 'editor_tempodisplay.cc',
95 'export_channel_selector.cc',
97 'export_file_notebook.cc',
98 'export_filename_selector.cc',
99 'export_format_dialog.cc',
100 'export_format_selector.cc',
101 'export_preset_selector.cc',
102 'export_timespan_selector.cc',
106 'sfdb_freesound_mootcher.cc',
108 'generic_pluginui.cc',
110 'global_port_matrix.cc',
112 'gtk-custom-hruler.c',
113 'gtk-custom-ruler.c',
114 'gtk_pianokeyboard.c',
116 'insert_time_dialog.cc',
117 'interthread_progress_window.cc',
129 'midi_automation_line.cc',
130 'midi_channel_dialog.cc',
131 'midi_channel_selector.cc',
132 'midi_cut_buffer.cc',
133 'midi_export_dialog.cc',
134 'midi_list_editor.cc',
135 'midi_port_dialog.cc',
136 'midi_region_view.cc',
139 'midi_streamview.cc',
142 'midi_velocity_dialog.cc',
143 'missing_file_dialog.cc',
144 'missing_plugin_dialog.cc',
146 'mixer_group_tabs.cc',
152 'monitor_section.cc',
154 'mono_panner_editor.cc',
157 'new_plugin_preset_dialog.cc',
158 'normalize_dialog.cc',
166 'panner_interface.cc',
168 'piano_roll_header.cc',
170 'playlist_selector.cc',
172 'plugin_selector.cc',
177 'port_matrix_body.cc',
178 'port_matrix_column_labels.cc',
179 'port_matrix_component.cc',
180 'port_matrix_grid.cc',
181 'port_matrix_labels.cc',
182 'port_matrix_row_labels.cc',
184 'patch_change_dialog.cc',
185 'progress_reporter.cc',
188 'quantize_dialog.cc',
189 'rc_option_editor.cc',
191 'region_gain_line.cc',
192 'region_layering_order_editor.cc',
193 'region_selection.cc',
197 'route_group_dialog.cc',
198 'route_group_menu.cc',
199 'route_params_ui.cc',
200 'route_processor_selection.cc',
201 'route_time_axis.cc',
203 'search_path_option.cc',
207 'session_import_dialog.cc',
208 'session_metadata_dialog.cc',
209 'session_option_editor.cc',
211 'shuttle_control.cc',
220 'stereo_panner_editor.cc',
222 'strip_silence_dialog.cc',
223 'tape_region_view.cc',
228 'time_axis_view_item.cc',
232 'track_selection.cc',
233 'track_view_list.cc',
234 'transpose_dialog.cc',
239 'visibility_group.cc',
240 'volume_controller.cc',
243 # video-timeline related sources:
244 'video_image_frame.cc',
245 'add_video_dialog.cc',
246 'editor_videotimeline.cc',
250 'transcode_ffmpeg.cc',
251 'transcode_video_dialog.cc',
252 'video_server_dialog.cc',
254 'export_video_dialog.cc',
255 'export_video_infobox.cc'
259 autowaf.set_options(opt)
263 conf.load('compiler_cxx')
264 # we don't use hard-coded micro versions with ardour, so hard code it to zero
265 autowaf.build_version_files(
266 path_prefix + 'version.h',
267 path_prefix + 'version.cc',
268 'gtk2_ardour', conf.env['MAJOR'], conf.env['MINOR'], 0)
269 autowaf.configure(conf)
271 if re.search ("linux", sys.platform) != None:
272 autowaf.check_pkg(conf, 'alsa', uselib_store='ALSA')
274 # TODO: Insert a sanity check for on OS X to ensure CoreAudio is present
276 autowaf.check_pkg(conf, 'fftw3f', uselib_store='FFTW3F',
278 autowaf.check_pkg(conf, 'flac', uselib_store='FLAC',
279 atleast_version='1.2.1')
280 autowaf.check_pkg(conf, 'gthread-2.0', uselib_store='GTHREAD',
281 atleast_version='2.10.1')
282 autowaf.check_pkg(conf, 'gtk+-2.0', uselib_store='GTK',
283 atleast_version='2.18')
284 autowaf.check_pkg(conf, 'gtkmm-2.4', uselib_store='GTKMM',
285 atleast_version='2.18')
286 autowaf.check_pkg(conf, 'libgnomecanvas-2.0',
287 uselib_store='GNOMECANVAS', atleast_version='2.30')
288 autowaf.check_pkg(conf, 'libgnomecanvasmm-2.6',
289 uselib_store='GNOMECANVASMM', atleast_version='2.16')
290 autowaf.check_pkg(conf, 'ogg', uselib_store='OGG', atleast_version='1.1.2')
291 autowaf.check_pkg(conf, 'x11', uselib_store='X11', atleast_version='1.1', mandatory=False)
292 autowaf.check_pkg(conf, 'fontconfig', uselib_store='FONTCONFIG')
294 conf.write_config_header('gtk2ardour-config.h', remove=False)
297 autowaf.check_header(conf, 'cxx', 'boost/shared_ptr.hpp')
298 autowaf.check_header(conf, 'cxx', 'boost/weak_ptr.hpp')
300 # Add a waf `feature' to allow compilation of things using winegcc
301 from waflib.TaskGen import feature
303 def set_winegcc(self):
304 self.env.LINK_CXX = self.env.LINK_CC = 'wineg++'
305 self.env.CC = 'winegcc'
307 def _doPyp(infileName, deps = False):
310 re_spaces = re.compile("\s+")
312 if infileName == '-':
315 fd = open(infileName)
316 inLines = fd.readlines()
322 bits = re_spaces.split(line)
323 if bits[0] == '##include':
328 # assume included file comes from same place as source file
329 incName = os.path.join (os.path.dirname (infileName), incName);
330 outStr += _doPyp(incName)
341 def include_processor(task):
342 infileName = task.inputs[0].srcpath()
343 outfileName = os.path.join(out, task.outputs[0].bldpath())
344 fdOut = open (outfileName, "w")
345 fdOut.write (_doPyp(infileName))
349 def build_color_scheme(path, prefix):
353 if re.search ('^#@color', line):
354 line.strip() # remove newline
356 if len(color_scheme):
358 color_scheme += prefix
360 color_scheme += words[1]
362 color_scheme += words[2]
368 VERSION = "%s.%s" % (bld.env['MAJOR'], bld.env['MINOR'])
370 if bld.is_defined('WINDOWS_VST_SUPPORT'):
371 # If we require VST support we build a stub main() and the FST library
372 # here using winegcc, and link it to the GTK front-end library
373 obj = bld(features = 'cxx c cxxprogram wine')
376 ../libs/fst/fstinfofile.c
381 obj.use = [ 'libpbd',
391 obj.target = 'ardour-' + bld.env['VERSION'] + '-vst.exe.so'
392 obj.includes = [ '../libs/fst', '.' ]
393 obj.linkflags = ['-mwindows', '-Wl,--export-dynamic']
394 obj.defines = ['_POSIX_SOURCE', 'USE_WS_PREFIX']
395 obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
396 # end of the wine executable
398 # now the shared library containing the GTK GUI for ardour
399 obj = bld (features = 'cxx c cxxshlib')
400 obj.source = gtk2_ardour_sources
401 obj.includes = [ '../libs/fst', '.' ]
402 obj.name = 'libgtk2_ardour'
403 obj.target = 'gtk2_ardour'
405 # just the normal executable version of the GTK GUI
406 obj = bld(features = 'cxx c cxxprogram')
407 obj.source = gtk2_ardour_sources
408 obj.target = 'ardour-' + bld.env['VERSION']
410 obj.use = [ 'libpbd',
419 # continue with setup of obj, which could be a shared library
422 obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
423 obj.uselib = 'UUID FLAC FONTCONFIG GLIBMM GTHREAD GTK OGG CURL DL'
424 obj.uselib += ' GTKMM GNOMECANVASMM GNOMECANVAS FFTW3F'
425 obj.uselib += ' AUDIOUNITS OSX GTKOSX LO '
426 if bld.is_defined('USE_EXTERNAL_LIBS'):
427 obj.uselib += ' TAGLIB'
429 obj.use.append('libtaglib')
430 if sys.platform == 'darwin':
431 obj.use += ' libappleutility'
433 'PACKAGE="' + I18N_PACKAGE + '"',
434 'VERSIONSTRING="' + bld.env['VERSION'] + '"',
435 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
436 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
437 'LOCALEDIR="' + os.path.join(os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
438 'PROGRAM_NAME="' + bld.env['PROGRAM_NAME'] + '"'
440 obj.includes += ['../libs']
442 if bld.is_defined('HAVE_SUIL'):
443 obj.source += [ 'lv2_plugin_ui.cc' ]
444 obj.use += [ 'SUIL' ]
446 if bld.is_defined('NEED_INTL'):
447 obj.linkflags = ' -lintl'
449 if bld.is_defined('WINDOWS_VST_SUPPORT'):
450 obj.source += [ 'windows_vst_plugin_ui.cc' ]
451 obj.defines += [ 'WINDOWS_VST_SUPPORT' ]
454 if bld.is_defined('LXVST_SUPPORT'):
455 obj.source += [ 'linux_vst_gui_support.cc', 'lxvst_plugin_ui.cc' ]
456 obj.defines += [ 'LXVST_SUPPORT' ]
459 if bld.is_defined('WINDOWS_VST_SUPPORT') or bld.is_defined('LXVST_SUPPORT'):
460 obj.source += [ 'vst_plugin_ui.cc' ]
462 if bld.is_defined('PHONE_HOME'):
463 obj.defines += [ 'PHONE_HOME' ]
465 if bld.is_defined('HAVE_COREAUDIO'):
466 TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cc']
467 obj.source += [ 'cocoacarbon.mm' ]
468 obj.use += ' libappleutility '
470 if bld.is_defined('AUDIOUNIT_SUPPORT'):
471 obj.source += [ 'au_pluginui.mm' ]
475 wrapper_subst_dict = {
476 'INSTALL_PREFIX' : bld.env['PREFIX'],
477 'LIBDIR' : os.path.normpath(bld.env['LIBDIR']),
478 'DATADIR' : os.path.normpath(bld.env['DATADIR']),
479 'SYSCONFDIR' : os.path.normpath(bld.env['SYSCONFDIR']),
480 'LIBS' : 'build/libs',
481 'VERSION' : bld.env['VERSION'],
482 'EXECUTABLE' : 'build/gtk2_ardour/ardour-' + bld.env['VERSION']
485 def set_subst_dict(obj, dict):
487 setattr(obj, i, dict[i])
489 obj = bld(features = 'subst', rule= 'chmod 0755 ${TGT}')
490 obj.source = 'ardev_common.sh.in'
491 obj.target = 'ardev_common_waf.sh'
492 obj.chmod = Utils.O755
493 obj.dict = wrapper_subst_dict
494 set_subst_dict(obj, wrapper_subst_dict)
496 obj = bld(features = 'subst')
497 obj.source = 'ardour.sh.in'
498 obj.target = 'ardour3'
499 obj.chmod = Utils.O755
500 obj.dict = wrapper_subst_dict
501 obj.install_path = bld.env['BINDIR']
502 set_subst_dict(obj, wrapper_subst_dict)
504 if bld.is_defined('WINDOWS_VST_SUPPORT'):
505 obj = bld(features = 'subst')
506 obj.source = '../vst/ardourvst.in'
507 obj.target = 'ardourvst3'
508 obj.chmod = Utils.O755
509 obj.dict = wrapper_subst_dict
510 obj.install_path = bld.env['BINDIR']
511 set_subst_dict(obj, wrapper_subst_dict)
515 dark_rc_subst_dict = {}
516 light_rc_subst_dict = {}
521 if bld.is_defined('GTKOSX'): # OS X fonts
535 # There is no acceptable monospace font available on older versions of OS X
536 # and no API on those versions to load TTF files that will work with
537 # GTK/fontconfig/pango.
539 # In addition, the ArdourMono font gets clipped for some reason on OS X
541 # Moreover, Lucida Grande just seems to work even though it is not monospace
545 'MONOSPACE' : 'Lucida Grande',
547 else: # Linux/X11 fonts
548 basefont = '' # unspecified - use system defaults
561 'MONOSPACE' : 'ArdourMono',
564 # Set up font substitution dictionary
566 for style in ['', 'BOLD', 'ITALIC']:
567 for sizename,points in iter(font_sizes.items()):
569 key = "_".join (['FONT',style,sizename])
570 fontstyle = " ".join ([basefont,style.lower(),points])
572 key = "_".join (['FONT',sizename])
573 fontstyle = " ".join ([basefont,points])
575 dark_rc_subst_dict[key] = fontstyle
576 light_rc_subst_dict[key] = fontstyle
579 for sizename,points in iter(font_sizes.items()):
580 key = "_".join (['FONT_SIZE',sizename])
581 dark_rc_subst_dict[key] = points
582 light_rc_subst_dict[key] = points
584 # various font names, eg @BOLD_MONOSPACE@
585 for font_sym,text in iter(font_names.items()):
587 dark_rc_subst_dict[key] = text
588 light_rc_subst_dict[key] = text
591 dark_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
592 'gtk2_ardour/ardour3_ui_dark.rc.in', 'ARDOUR_DARK')
593 dark_rc_subst_dict['COLPREFIX'] = 'ARDOUR_DARK'
594 light_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
595 'gtk2_ardour/ardour3_ui_light.rc.in', 'ARDOUR_LIGHT')
596 light_rc_subst_dict['COLPREFIX'] = 'ARDOUR_LIGHT'
598 obj = bld(features = 'subst')
599 obj.source = [ 'ardour3_ui_dark.rc.in' ]
600 obj.target = 'ardour3_ui_dark.rc.pre'
601 obj.install_path = None
602 set_subst_dict(obj, dark_rc_subst_dict)
604 obj = bld(features = 'subst')
605 obj.source = [ 'ardour3_ui_light.rc.in' ]
606 obj.target = 'ardour3_ui_light.rc.pre'
607 obj.install_path = None
608 set_subst_dict(obj, light_rc_subst_dict)
610 obj = bld(features = 'subst')
611 obj.source = [ 'ardour3_styles.rc.in' ]
612 obj.target = 'ardour3_dark_styles.rc'
613 obj.install_path = None
614 set_subst_dict(obj, dark_rc_subst_dict)
616 obj = bld(features = 'subst')
617 obj.source = [ 'ardour3_styles.rc.in' ]
618 obj.target = 'ardour3_light_styles.rc'
619 obj.install_path = None
620 set_subst_dict(obj, light_rc_subst_dict)
622 obj = bld(features = 'subst')
623 obj.source = [ 'ardour3_fonts.rc.in' ]
624 obj.target = 'ardour3_dark_fonts.rc'
625 obj.install_path = None
626 set_subst_dict(obj, dark_rc_subst_dict)
628 obj = bld(features = 'subst')
629 obj.source = [ 'ardour3_fonts.rc.in' ]
630 obj.target = 'ardour3_light_fonts.rc'
631 obj.install_path = None
632 set_subst_dict(obj, light_rc_subst_dict)
634 obj = bld(rule = 'cp ${SRC} ${TGT}')
635 obj.source = [ 'ardour3_widget_list.rc' ]
636 obj.target = 'ardour3_widgets.rc'
637 obj.install_path = None
639 obj = bld (rule = include_processor)
640 obj.source = [ 'ardour3_ui_dark.rc.pre' ]
641 # find and add all ##include dependencies as sources
642 obj.source += _doPyp (bld.path.find_resource ('ardour3_ui_dark.rc.in').srcpath(), True)
643 obj.target = 'ardour3_ui_dark.rc'
644 obj.install_path = '${SYSCONFDIR}/ardour3'
646 obj = bld (rule = include_processor)
647 obj.source = [ 'ardour3_ui_light.rc.pre' ]
648 # find and add all ##include dependencies as sources
649 obj.source += _doPyp (bld.path.find_resource ('ardour3_ui_light.rc.in').srcpath(), True)
650 obj.target = 'ardour3_ui_light.rc'
651 obj.install_path = '${SYSCONFDIR}/ardour3'
655 if bld.is_defined('GTKOSX'):
656 menus_argv = [ '-E', '-P', '-DGTKOSX' ]
658 menus_argv = [ '-E', '-P' ]
660 obj = bld(features = 'command-output')
662 obj.command_is_external = True
664 obj.argv = menus_argv
665 obj.stdin = 'ardour.menus.in'
666 obj.stdout = 'ardour.menus'
667 obj.dep_vars = ['GTKOSX']
668 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
673 # 'SAE-de-keypad', 'SAE-de-nokeypad', 'SAE-us-keypad',
674 # 'SAE-us-nokeypad', 'ergonomic-us'
676 for b in [ 'mnemonic-us' ] :
678 target = b + '.bindings',
679 source = b + '.bindings.in',
680 rule = '../tools/fmt-bindings --platform="%s" --winkey="%s" --accelmap <${SRC} >${TGT}' % (sys.platform, bld.env['WINDOWS_KEY'] )
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,