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 # Version of this package (even if built as a child)
15 GTK2_ARDOUR_VERSION = "%s.%s.%s" % (MAJOR, MINOR, MICRO)
17 # Variables for 'waf dist'
18 APPNAME = 'gtk2_ardour3'
19 VERSION = GTK2_ARDOUR_VERSION
20 I18N_PACKAGE = 'gtk2_ardour3'
26 path_prefix = 'gtk2_ardour/'
28 gtk2_ardour_sources = [
31 'add_route_dialog.cc',
32 'ambiguous_file_dialog.cc',
38 'ardour_ui_dependents.cc',
39 'ardour_ui_dialogs.cc',
42 'ardour_ui_options.cc',
45 'audio_region_editor.cc',
46 'audio_region_view.cc',
47 'audio_streamview.cc',
49 'automation_controller.cc',
51 'automation_region_view.cc',
52 'automation_streamview.cc',
53 'automation_time_axis.cc',
59 'canvas-note-event.cc',
61 'canvas_patch_change.cc',
62 'canvas-simpleline.c',
63 'canvas-simplerect.c',
69 'control_point_dialog.cc',
73 'edit_note_dialog.cc',
77 'editor_audio_import.cc',
78 'editor_audiotrack.cc',
80 'editor_canvas_events.cc',
81 'editor_component.cc',
84 'editor_route_groups.cc',
85 'editor_export_audio.cc',
86 'editor_group_tabs.cc',
88 'editor_locations.cc',
97 'editor_selection.cc',
98 'editor_snapshots.cc',
100 'editor_tempodisplay.cc',
104 'export_channel_selector.cc',
106 'export_file_notebook.cc',
107 'export_filename_selector.cc',
108 'export_format_dialog.cc',
109 'export_format_selector.cc',
110 'export_preset_selector.cc',
111 'export_timespan_selector.cc',
116 'generic_pluginui.cc',
118 'global_port_matrix.cc',
120 'gtk-custom-hruler.c',
121 'gtk-custom-ruler.c',
122 'gtk_pianokeyboard.c',
124 'insert_time_dialog.cc',
125 'interthread_progress_window.cc',
137 'midi_automation_line.cc',
138 'midi_channel_dialog.cc',
139 'midi_channel_selector.cc',
140 'midi_cut_buffer.cc',
141 'midi_export_dialog.cc',
142 'midi_list_editor.cc',
143 'midi_port_dialog.cc',
144 'midi_region_view.cc',
147 'midi_streamview.cc',
150 'midi_velocity_dialog.cc',
151 'missing_file_dialog.cc',
152 'missing_plugin_dialog.cc',
154 'mixer_group_tabs.cc',
157 'monitor_section.cc',
159 'mono_panner_editor.cc',
162 'new_plugin_preset_dialog.cc',
163 'normalize_dialog.cc',
169 'panner_interface.cc',
171 'piano_roll_header.cc',
172 'playlist_selector.cc',
174 'plugin_selector.cc',
179 'port_matrix_body.cc',
180 'port_matrix_column_labels.cc',
181 'port_matrix_component.cc',
182 'port_matrix_grid.cc',
183 'port_matrix_labels.cc',
184 'port_matrix_row_labels.cc',
186 'patch_change_dialog.cc',
187 'progress_reporter.cc',
190 'quantize_dialog.cc',
191 'rc_option_editor.cc',
193 'region_gain_line.cc',
194 'region_layering_order_editor.cc',
195 'region_selection.cc',
199 'route_group_dialog.cc',
200 'route_group_menu.cc',
201 'route_params_ui.cc',
202 'route_processor_selection.cc',
203 'route_time_axis.cc',
205 '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',
247 autowaf.set_options(opt)
251 conf.load('compiler_cxx')
252 autowaf.build_version_files(
253 path_prefix + 'version.h',
254 path_prefix + 'version.cc',
255 'gtk2_ardour', MAJOR, MINOR, MICRO)
256 autowaf.configure(conf)
258 if re.search ("linux", sys.platform) != None:
259 autowaf.check_pkg(conf, 'alsa', uselib_store='ALSA')
261 # TODO: Insert a sanity check for on OS X to ensure CoreAudio is present
263 autowaf.check_pkg(conf, 'flac', uselib_store='FLAC',
264 atleast_version='1.2.1')
265 autowaf.check_pkg(conf, 'gthread-2.0', uselib_store='GTHREAD',
266 atleast_version='2.10.1')
267 autowaf.check_pkg(conf, 'gtk+-2.0', uselib_store='GTK',
268 atleast_version='2.18')
269 autowaf.check_pkg(conf, 'gtkmm-2.4', uselib_store='GTKMM',
270 atleast_version='2.18')
271 autowaf.check_pkg(conf, 'libgnomecanvas-2.0',
272 uselib_store='GNOMECANVAS', atleast_version='2.30')
273 autowaf.check_pkg(conf, 'libgnomecanvasmm-2.6',
274 uselib_store='GNOMECANVASMM', atleast_version='2.16')
275 autowaf.check_pkg(conf, 'ogg', uselib_store='OGG', atleast_version='1.1.2')
276 autowaf.check_pkg(conf, 'x11', uselib_store='X11', atleast_version='1.1', mandatory=False)
278 conf.write_config_header('gtk2ardour-config.h', remove=False)
281 autowaf.check_header(conf, 'cxx', 'boost/shared_ptr.hpp')
282 autowaf.check_header(conf, 'cxx', 'boost/weak_ptr.hpp')
284 # Add a waf `feature' to allow compilation of things using winegcc
285 from waflib.TaskGen import feature
287 def set_winegcc(self):
288 self.env.LINK_CXX = self.env.LINK_CC = 'wineg++'
289 self.env.CC = 'winegcc'
291 def _doPyp(infileName, deps = False):
294 re_spaces = re.compile("\s+")
296 if infileName == '-':
299 fd = open(infileName)
300 inLines = fd.readlines()
306 bits = re_spaces.split(line)
307 if bits[0] == '##include':
312 # assume included file comes from same place as source file
313 incName = os.path.join (os.path.dirname (infileName), incName);
314 outStr += _doPyp(incName)
325 def include_processor(task):
326 infileName = task.inputs[0].srcpath()
327 outfileName = os.path.join(out, task.outputs[0].bldpath())
328 fdOut = open (outfileName, "w")
329 fdOut.write (_doPyp(infileName))
333 def build_color_scheme(path, prefix):
337 if re.search ('^#@color', line):
338 line.strip() # remove newline
340 if len(color_scheme):
342 color_scheme += prefix
344 color_scheme += words[1]
346 color_scheme += words[2]
352 if bld.is_defined('WINDOWS_VST_SUPPORT'):
353 # If we require VST support we build a stub main() and the FST library
354 # here using winegcc, and link it to the GTK front-end library
355 obj = bld(features = 'cxx c cxxprogram wine')
358 ../libs/fst/fstinfofile.c
364 obj.use = [ 'libpbd',
372 obj.target = 'ardour-3.0-vst.exe.so'
373 obj.includes = [ '../libs/fst', '.' ]
374 obj.linkflags = ['-mwindows', '-Wl,--export-dynamic', '-lpthread']
375 obj.defines = ['_POSIX_SOURCE', 'USE_WS_PREFIX']
376 obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
377 # end of the wine executable
379 # now the shared library containing the GTK GUI for ardour
380 obj = bld (features = 'cxx c cxxshlib')
381 obj.source = gtk2_ardour_sources
382 obj.includes = [ '../libs/fst', '.' ]
383 obj.name = 'libgtk2_ardour'
384 obj.target = 'gtk2_ardour'
386 # just the normal executable version of the GTK GUI
387 obj = bld(features = 'cxx c cxxprogram')
388 obj.source = gtk2_ardour_sources
389 obj.target = 'ardour-3.0'
392 # continue with setup of obj, which could be a shared library
395 obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
397 obj.uselib = 'UUID FLAC GLIBMM GTHREAD GTK OGG ALSA CURL DL'
398 obj.uselib += ' GTKMM GNOMECANVASMM GNOMECANVAS '
399 obj.uselib += ' AUDIOUNITS OSX GTKOSX '
400 obj.use = [ 'libpbd',
407 if sys.platform == 'darwin':
408 obj.use += ' libappleutility'
410 'PACKAGE="' + I18N_PACKAGE + '"',
411 'VERSIONSTRING="' + bld.env['VERSION'] + '"',
412 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
413 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
414 'LOCALEDIR="' + os.path.join(os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
415 'PROGRAM_NAME="' + bld.env['PROGRAM_NAME'] + '"'
417 obj.includes += ['../libs']
419 if bld.is_defined('HAVE_SUIL'):
420 obj.source += [ 'lv2_plugin_ui.cc' ]
421 obj.use += [ 'SUIL' ]
423 if bld.is_defined('FREESOUND'):
424 obj.source += [ 'sfdb_freesound_mootcher.cc' ]
425 obj.defines += [ 'FREESOUND' ]
427 if bld.is_defined('NEED_INTL'):
428 obj.linkflags = ' -lintl'
430 if bld.is_defined('WINDOWS_VST_SUPPORT'):
431 obj.source += [ 'windows_vst_plugin_ui.cc' ]
432 obj.defines += [ 'WINDOWS_VST_SUPPORT' ]
435 if bld.is_defined('LXVST_SUPPORT'):
436 obj.source += [ 'linux_vst_gui_support.cc', 'lxvst_plugin_ui.cc' ]
437 obj.defines += [ 'LXVST_SUPPORT' ]
440 if bld.is_defined('WINDOWS_VST_SUPPORT') or bld.is_defined('LXVST_SUPPORT'):
441 obj.source += [ 'vst_plugin_ui.cc' ]
443 if bld.is_defined('PHONE_HOME'):
444 obj.defines += [ 'PHONE_HOME' ]
446 if bld.is_defined('HAVE_COREAUDIO'):
447 TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cc']
448 obj.source += [ 'cocoacarbon.mm' ]
449 obj.use += ' libappleutility '
451 if bld.is_defined('AUDIOUNIT_SUPPORT'):
452 obj.source += [ 'au_pluginui.mm' ]
456 wrapper_subst_dict = {
457 'INSTALL_PREFIX' : bld.env['PREFIX'],
458 'LIBDIR' : os.path.normpath(bld.env['LIBDIR']),
459 'DATADIR' : os.path.normpath(bld.env['DATADIR']),
460 'SYSCONFDIR' : os.path.normpath(bld.env['SYSCONFDIR']),
461 'LIBS' : 'build/libs',
463 'EXECUTABLE' : 'build/gtk2_ardour/ardour-3.0'
466 def set_subst_dict(obj, dict):
468 setattr(obj, i, dict[i])
470 obj = bld(features = 'subst', rule= 'chmod 0755 ${TGT}')
471 obj.source = 'ardev_common.sh.in'
472 obj.target = 'ardev_common_waf.sh'
473 obj.chmod = Utils.O755
474 obj.dict = wrapper_subst_dict
475 set_subst_dict(obj, wrapper_subst_dict)
477 obj = bld(features = 'subst')
478 obj.source = 'ardour.sh.in'
479 obj.target = 'ardour3'
480 obj.chmod = Utils.O755
481 obj.dict = wrapper_subst_dict
482 obj.install_path = bld.env['BINDIR']
483 set_subst_dict(obj, wrapper_subst_dict)
485 if bld.is_defined('WINDOWS_VST_SUPPORT'):
486 obj = bld(features = 'subst')
487 obj.source = '../vst/ardourvst.in'
488 obj.target = 'ardourvst3'
489 obj.chmod = Utils.O755
490 obj.dict = wrapper_subst_dict
491 obj.install_path = bld.env['BINDIR']
492 set_subst_dict(obj, wrapper_subst_dict)
496 dark_rc_subst_dict = {}
497 light_rc_subst_dict = {}
502 if bld.is_defined('GTKOSX'): # OS X fonts
516 'BOLD_MONOSPACE' : 'monospace'
518 else: # Linux/X11 fonts
519 basefont = '' # unspecified - use system defaults
532 'BOLD_MONOSPACE' : 'bold monospace'
535 # Set up font substitution dictionary
537 for style in ['', 'BOLD', 'ITALIC']:
538 for sizename,points in iter(font_sizes.items()):
540 key = "_".join (['FONT',style,sizename])
541 fontstyle = " ".join ([basefont,style.lower(),points])
543 key = "_".join (['FONT',sizename])
544 fontstyle = " ".join ([basefont,points])
546 dark_rc_subst_dict[key] = fontstyle
547 light_rc_subst_dict[key] = fontstyle
550 for sizename,points in iter(font_sizes.items()):
551 key = "_".join (['FONT_SIZE',sizename])
552 dark_rc_subst_dict[key] = points
553 light_rc_subst_dict[key] = points
555 # various font names, eg @BOLD_MONOSPACE@
556 for font_sym,text in iter(font_names.items()):
558 dark_rc_subst_dict[key] = text
559 light_rc_subst_dict[key] = text
562 dark_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
563 'gtk2_ardour/ardour3_ui_dark.rc.in', 'ARDOUR_DARK')
564 dark_rc_subst_dict['COLPREFIX'] = 'ARDOUR_DARK'
565 light_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
566 'gtk2_ardour/ardour3_ui_light.rc.in', 'ARDOUR_LIGHT')
567 light_rc_subst_dict['COLPREFIX'] = 'ARDOUR_LIGHT'
569 obj = bld(features = 'subst')
570 obj.source = [ 'ardour3_ui_dark.rc.in' ]
571 obj.target = 'ardour3_ui_dark.rc.pre'
572 obj.install_path = None
573 set_subst_dict(obj, dark_rc_subst_dict)
575 obj = bld(features = 'subst')
576 obj.source = [ 'ardour3_ui_light.rc.in' ]
577 obj.target = 'ardour3_ui_light.rc.pre'
578 obj.install_path = None
579 set_subst_dict(obj, light_rc_subst_dict)
581 obj = bld(features = 'subst')
582 obj.source = [ 'ardour3_styles.rc.in' ]
583 obj.target = 'ardour3_dark_styles.rc'
584 obj.install_path = None
585 set_subst_dict(obj, dark_rc_subst_dict)
587 obj = bld(features = 'subst')
588 obj.source = [ 'ardour3_styles.rc.in' ]
589 obj.target = 'ardour3_light_styles.rc'
590 obj.install_path = None
591 set_subst_dict(obj, light_rc_subst_dict)
593 obj = bld(features = 'subst')
594 obj.source = [ 'ardour3_fonts.rc.in' ]
595 obj.target = 'ardour3_dark_fonts.rc'
596 obj.install_path = None
597 set_subst_dict(obj, dark_rc_subst_dict)
599 obj = bld(features = 'subst')
600 obj.source = [ 'ardour3_fonts.rc.in' ]
601 obj.target = 'ardour3_light_fonts.rc'
602 obj.install_path = None
603 set_subst_dict(obj, light_rc_subst_dict)
605 obj = bld(rule = 'cp ${SRC} ${TGT}')
606 obj.source = [ 'ardour3_widget_list.rc' ]
607 obj.target = 'ardour3_widgets.rc'
608 obj.install_path = None
610 obj = bld (rule = include_processor)
611 obj.source = [ 'ardour3_ui_dark.rc.pre' ]
612 # find and add all ##include dependencies as sources
613 obj.source += _doPyp (bld.path.find_resource ('ardour3_ui_dark.rc.in').srcpath(), True)
614 obj.target = 'ardour3_ui_dark.rc'
615 obj.install_path = '${SYSCONFDIR}/ardour3'
617 obj = bld (rule = include_processor)
618 obj.source = [ 'ardour3_ui_light.rc.pre' ]
619 # find and add all ##include dependencies as sources
620 obj.source += _doPyp (bld.path.find_resource ('ardour3_ui_light.rc.in').srcpath(), True)
621 obj.target = 'ardour3_ui_light.rc'
622 obj.install_path = '${SYSCONFDIR}/ardour3'
626 if bld.is_defined('GTKOSX'):
627 menus_argv = [ '-E', '-P', '-DGTKOSX' ]
629 menus_argv = [ '-E', '-P' ]
630 obj = bld(features = 'command-output')
632 obj.command_is_external = True
634 obj.argv = menus_argv
635 obj.stdin = 'ardour.menus.in'
636 obj.stdout = 'ardour.menus'
637 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
642 # 'SAE-de-keypad', 'SAE-de-nokeypad', 'SAE-us-keypad',
643 # 'SAE-us-nokeypad', 'ergonomic-us'
645 for b in [ 'mnemonic-us' ] :
647 target = b + '.bindings',
648 source = b + '.bindings.in',
649 rule = '../tools/fmt-bindings --platform="%s" --winkey="%s" --accelmap <${SRC} >${TGT}' % (sys.platform, bld.env['WINDOWS_KEY'] )
651 obj.install_path = os.path.join(bld.env['SYSCONFDIR'], 'ardour3')
653 # not modified at present
654 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
655 'step_editing.bindings')
656 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
660 bld.install_files('${DATADIR}/ardour3/icons', bld.path.ant_glob('icons/*.png'))
661 bld.install_files('${DATADIR}/ardour3/pixmaps', bld.path.ant_glob('pixmaps/*.xpm'))
662 bld.install_files('${DATADIR}/ardour3', 'splash.png')
664 # Default UI configuration
665 bld.install_files('${SYSCONFDIR}/ardour3', 'ardour3_ui_default.conf')
667 # Default export stuff
668 bld.install_files('${SYSCONFDIR}/ardour3/export', bld.path.ant_glob('export/*.format'))
671 if bld.is_defined('ENABLE_NLS'):
672 mo_files = bld.path.ant_glob('po/*.mo')
674 lang = os.path.basename(mo.srcpath()).replace('.mo', '')
675 bld.install_as(os.path.join(bld.env['PREFIX'], 'share', 'locale',
676 lang, 'LC_MESSAGES', I18N_PACKAGE + '.mo'),
680 autowaf.build_i18n(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
684 autowaf.build_i18n_pot(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
688 autowaf.build_i18n_po(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
692 autowaf.build_i18n_mo(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,