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
11 from waflib.Tools import winres
17 path_prefix = 'gtk2_ardour/'
19 gtk2_ardour_sources = [
22 'add_route_dialog.cc',
23 'ambiguous_file_dialog.cc',
32 'ardour_ui_dependents.cc',
33 'ardour_ui_dialogs.cc',
36 'ardour_ui_options.cc',
39 'audio_region_editor.cc',
40 'audio_region_view.cc',
41 'audio_streamview.cc',
43 'automation_controller.cc',
45 'automation_region_view.cc',
46 'automation_streamview.cc',
47 'automation_time_axis.cc',
49 'big_clock_window.cc',
55 'control_point_dialog.cc',
59 'edit_note_dialog.cc',
63 'editor_audio_import.cc',
64 'editor_pt_import.cc',
65 'editor_audiotrack.cc',
67 'editor_canvas_events.cc',
68 'editor_component.cc',
71 'editor_route_groups.cc',
72 'editor_export_audio.cc',
73 'editor_group_tabs.cc',
75 'editor_locations.cc',
83 'editor_selection.cc',
84 'editor_snapshots.cc',
86 'editor_tempodisplay.cc',
90 'export_channel_selector.cc',
92 'export_file_notebook.cc',
93 'export_filename_selector.cc',
94 'export_format_dialog.cc',
95 'export_format_selector.cc',
96 'export_preset_selector.cc',
97 'export_timespan_selector.cc',
101 'floating_text_entry.cc',
102 'sfdb_freesound_mootcher.cc',
104 'generic_pluginui.cc',
106 'global_port_matrix.cc',
108 'gtk_pianokeyboard.c',
110 'insert_remove_time_dialog.cc',
111 'instrument_selector.cc',
112 'interthread_progress_window.cc',
124 'midi_automation_line.cc',
125 'midi_channel_dialog.cc',
126 'midi_channel_selector.cc',
127 'midi_cut_buffer.cc',
128 'midi_export_dialog.cc',
129 'midi_list_editor.cc',
130 'midi_port_dialog.cc',
131 'midi_region_view.cc',
134 'midi_streamview.cc',
137 'midi_velocity_dialog.cc',
138 'missing_file_dialog.cc',
139 'missing_plugin_dialog.cc',
141 'mixer_group_tabs.cc',
147 'monitor_section.cc',
148 'monitor_selector.cc',
150 'mono_panner_editor.cc',
153 'new_plugin_preset_dialog.cc',
154 'normalize_dialog.cc',
158 'note_select_dialog.cc',
165 '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',
205 'search_path_option.cc',
207 'selection_memento.cc',
210 'session_import_dialog.cc',
211 'session_metadata_dialog.cc',
212 'session_option_editor.cc',
214 'shuttle_control.cc',
215 'soundcloud_export_selector.cc',
222 'stereo_panner_editor.cc',
224 'strip_silence_dialog.cc',
226 'tape_region_view.cc',
231 'time_axis_view_item.cc',
237 'track_selection.cc',
238 'track_view_list.cc',
239 'transform_dialog.cc',
240 'transpose_dialog.cc',
244 'visibility_group.cc',
245 'volume_controller.cc',
247 # video-timeline related sources:
248 'video_image_frame.cc',
249 'add_video_dialog.cc',
250 'editor_videotimeline.cc',
253 'transcode_ffmpeg.cc',
254 'transcode_video_dialog.cc',
255 'video_server_dialog.cc',
257 'export_video_dialog.cc',
258 'export_video_infobox.cc',
259 'video_tool_paths.cc'
262 def enoify (major, minor):
264 return "\\n\\\"E-No\\\""
267 return "\\n\\\"No Pussyfooting\\\""
269 return "\\n\\\"Here Come the Warm Jets\\\""
271 return "\\n\\\"Taking Tiger Mountain\\\""
273 return "\\n\\\"Lady June's Linguistic Leprosy\\\""
275 return "\\n\\\"Discreet Music\\\""
277 return "\\n\\\"Another Green World\\\""
279 return "\\n\\\"Evening Star\\\""
283 autowaf.set_options(opt)
287 conf.load('compiler_cxx')
288 autowaf.configure(conf)
290 # TODO: Insert a sanity check for on OS X to ensure CoreAudio is present
292 autowaf.check_pkg(conf, 'fftw3f', uselib_store='FFTW3F',
294 autowaf.check_pkg(conf, 'fftw3f', uselib_store='FFTW35F',
295 atleast_version='3.3.5', mandatory=False)
296 autowaf.check_pkg(conf, 'flac', uselib_store='FLAC',
297 atleast_version='1.2.1')
298 autowaf.check_pkg(conf, 'gthread-2.0', uselib_store='GTHREAD',
299 atleast_version='2.10.1')
300 autowaf.check_pkg(conf, 'gtk+-2.0', uselib_store='GTK',
301 atleast_version='2.18')
302 autowaf.check_pkg(conf, 'gtkmm-2.4', uselib_store='GTKMM',
303 atleast_version='2.18')
304 autowaf.check_pkg(conf, 'ogg', uselib_store='OGG', atleast_version='1.1.2')
305 autowaf.check_pkg(conf, 'x11', uselib_store='X11', atleast_version='1.1', mandatory=False)
306 autowaf.check_pkg(conf, 'fontconfig', uselib_store='FONTCONFIG')
308 conf.write_config_header('gtk2ardour-config.h', remove=False)
310 bak = conf.env['define_key']
311 conf.define('VERSIONSTRING', str (conf.env['VERSION']))
312 conf.define('CODENAME', enoify(int(conf.env['MAJOR']), int(conf.env['MINOR'])))
313 conf.env['define_key'] = ['VERSIONSTRING', 'CODENAME' ]
314 conf.write_config_header('gtk2ardour-version.h')
315 conf.env['define_key'] = bak;
318 autowaf.check_header(conf, 'cxx', 'boost/shared_ptr.hpp')
319 autowaf.check_header(conf, 'cxx', 'boost/weak_ptr.hpp')
321 # Add a waf `feature' to allow compilation of things using winegcc
322 from waflib.TaskGen import feature
324 def set_winegcc(self):
325 self.env.LINK_CXX = self.env.LINK_CC = 'wineg++'
326 self.env.CC = 'winegcc'
328 def _doPyp(infileName, deps = False):
331 re_spaces = re.compile("\s+")
333 if infileName == '-':
336 fd = open(infileName)
337 inLines = fd.readlines()
343 bits = re_spaces.split(line)
344 if bits[0] == '##include':
349 # assume included file comes from same place as source file
350 incName = os.path.join (os.path.dirname (infileName), incName);
351 outStr += _doPyp(incName)
362 def include_processor(task):
363 infileName = task.inputs[0].srcpath()
364 outfileName = os.path.join(out, task.outputs[0].bldpath())
365 fdOut = open (outfileName, "w")
366 fdOut.write (_doPyp(infileName))
370 def build_color_scheme(path, prefix):
374 if re.search ('^#@color', line):
375 line.strip() # remove newline
377 if len(color_scheme):
379 color_scheme += prefix
381 color_scheme += words[1]
383 color_scheme += words[2]
389 VERSION = "%s.%s" % (bld.env['MAJOR'], bld.env['MINOR'])
390 I18N_PACKAGE = 'gtk2_ardour' + bld.env['MAJOR']
392 if bld.is_defined('WINDOWS_VST_SUPPORT') and bld.env['build_target'] != 'mingw':
393 # Windows VST support w/wine
394 # If we require VST support we build a stub main() and the FST library
395 # here using winegcc, and link it to the GTK front-end library
396 obj = bld (features = 'cxx c cxxprogram wine')
397 obj.source = ( '../libs/fst/vstwin.c', '../vst/winmain.c' )
399 # XXX do we really need to explicitly link to all of these for the wine executable?
401 obj.use = [ 'libpbd',
412 obj.target = 'ardour-' + str (bld.env['VERSION']) + '-vst.exe.so'
413 obj.includes = [ '../libs/fst', '.' ]
414 obj.linkflags = ['-mwindows', '-Wl,--export-dynamic']
415 obj.linkflags += bld.env['LDFLAGS']
416 obj.defines = ['_POSIX_SOURCE', 'USE_WS_PREFIX']
417 obj.install_path = bld.env['DLLDIR']
418 # end of the wine executable
420 # now the shared library containing the GTK GUI for ardour
421 obj = bld (features = 'cxx c cxxshlib')
422 obj.source = gtk2_ardour_sources
423 obj.includes = [ '../libs/fst', '.' ]
424 obj.name = 'libgtk2_ardour'
425 obj.target = 'gtk2_ardour'
428 # just the normal executable version of the GTK GUI
429 if bld.env['build_target'] == 'mingw':
430 obj = bld (features = 'cxx c cxxprogram winres')
432 obj = bld (features = 'cxx c cxxprogram')
433 obj.source = gtk2_ardour_sources
434 obj.target = 'ardour-' + str (bld.env['VERSION'])
436 obj.ldflags = ['-no-undefined']
438 if bld.is_defined('WINDOWS_VST_SUPPORT'):
439 # Windows VST support mingw
440 obj.includes += [ '../libs/fst' ]
442 # at this point, "obj" refers to either the normal native executable
443 # OR the shared library built for use with wine on linux.
445 obj.use = [ 'libpbd',
456 'PACKAGE="' + I18N_PACKAGE + '"',
457 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
458 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
459 'LOCALEDIR="' + os.path.normpath(bld.env['LOCALEDIR']) + '"',
461 obj.install_path = bld.env['DLLDIR']
463 obj.uselib = 'UUID FLAC FONTCONFIG GLIBMM GTHREAD GTK OGG CURL DL'
464 obj.uselib += ' GTKMM CANVAS FFTW3F'
465 obj.uselib += ' AUDIOUNITS OSX GTKOSX LO '
466 obj.uselib += ' TAGLIB '
468 if sys.platform == 'darwin':
469 obj.uselib += ' AUDIOUNITS OSX GTKOSX'
470 obj.use += ' libappleutility'
471 obj.source += [ 'cocoacarbon.mm', 'bundle_env_cocoa.cc' ]
472 elif bld.env['build_target'] == 'mingw':
473 obj.source += [ 'bundle_env_mingw.cc' ]
474 obj.source += [ 'windows_icon.rc' ]
476 obj.source += [ 'bundle_env_linux.cc' ]
478 obj.includes += ['../libs']
480 obj.use += 'libptformat'
482 if bld.env['build_target'] == 'mingw':
483 obj.linkflags += ' -mwindows'
485 if bld.is_defined('HAVE_SUIL'):
486 obj.source += [ 'lv2_plugin_ui.cc' ]
487 obj.use += [ 'SUIL' ]
489 if bld.is_defined('HAVE_FFTW35F') and bld.env['build_target'] != 'mingw':
490 obj.linkflags += ' -lfftw3f_threads'
492 if bld.is_defined('NEED_INTL'):
493 obj.linkflags += ' -lintl'
495 if bld.is_defined('WINDOWS_VST_SUPPORT'):
496 obj.source += [ 'windows_vst_plugin_ui.cc' ]
497 obj.defines += [ 'WINDOWS_VST_SUPPORT' ]
498 if bld.env['build_target'] != 'mingw':
501 if bld.is_defined('LXVST_SUPPORT'):
502 obj.source += [ 'linux_vst_gui_support.cc', 'lxvst_plugin_ui.cc' ]
503 obj.defines += [ 'LXVST_SUPPORT' ]
506 if bld.is_defined('WINDOWS_VST_SUPPORT') or bld.is_defined('LXVST_SUPPORT'):
507 obj.source += [ 'vst_plugin_ui.cc' ]
509 if bld.is_defined('PHONE_HOME'):
510 obj.defines += [ 'PHONE_HOME' ]
512 if bld.is_defined('HAVE_COREAUDIO'):
513 TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cc']
514 obj.use += ' libappleutility '
516 if bld.is_defined('AUDIOUNIT_SUPPORT'):
517 obj.source += [ 'au_pluginui.mm' ]
521 wrapper_subst_dict = {
522 'INSTALL_PREFIX' : bld.env['PREFIX'],
523 'LIBDIR' : os.path.normpath(bld.env['DLLDIR']),
524 'DATADIR' : os.path.normpath(bld.env['DATADIR']),
525 'CONFDIR' : os.path.normpath(bld.env['CONFDIR']),
526 'LIBS' : 'build/libs',
527 'VERSION' : str (bld.env['VERSION']),
528 'EXECUTABLE' : 'build/gtk2_ardour/ardour-' + str (bld.env['VERSION'])
531 def set_subst_dict(obj, dict):
533 setattr(obj, i, dict[i])
535 obj = bld(features = 'subst')
536 obj.source = 'ardev_common.sh.in'
537 obj.target = 'ardev_common_waf.sh'
538 obj.chmod = Utils.O755
539 obj.dict = wrapper_subst_dict
540 set_subst_dict(obj, wrapper_subst_dict)
542 obj = bld(features = 'subst')
543 obj.source = 'ardour.sh.in'
544 obj.target = 'ardour' + str (bld.env['MAJOR'])
545 obj.chmod = Utils.O755
546 obj.dict = wrapper_subst_dict
547 obj.install_path = bld.env['BINDIR']
548 set_subst_dict(obj, wrapper_subst_dict)
550 if bld.is_defined('WINDOWS_VST_SUPPORT'):
551 obj = bld(features = 'subst')
552 obj.source = '../vst/ardourvst.in'
553 obj.target = 'ardourvst' + str (bld.env['MAJOR'])
554 obj.chmod = Utils.O755
555 obj.dict = wrapper_subst_dict
556 obj.install_path = bld.env['BINDIR']
557 set_subst_dict(obj, wrapper_subst_dict)
566 if bld.is_defined('GTKOSX'): # OS X fonts
580 # There is no acceptable monospace font available on older versions of OS X
581 # and no API on those versions to load TTF files that will work with
582 # GTK/fontconfig/pango.
584 # In addition, the ArdourMono font gets clipped for some reason on OS X
586 # Moreover, Lucida Grande just seems to work even though it is not monospace
590 'MONOSPACE' : 'Monaco',
591 'CLOCKFONT' : 'Lucida Grande',
593 else: # Linux/X11 fonts
594 basefont = '' # unspecified - use system defaults
607 'MONOSPACE' : 'ArdourMono',
608 'CLOCKFONT' : 'ArdourMono',
611 # Set up font substitution dictionary
613 for style in ['', 'BOLD', 'ITALIC']:
614 for sizename,points in iter(font_sizes.items()):
616 key = "_".join (['FONT',style,sizename])
617 fontstyle = " ".join ([basefont,style.lower(),points])
619 key = "_".join (['FONT',sizename])
620 fontstyle = " ".join ([basefont,points])
622 font_subst_dict[key] = fontstyle
625 for sizename,points in iter(font_sizes.items()):
626 key = "_".join (['FONT_SIZE',sizename])
627 font_subst_dict[key] = points
629 # various font names, eg @BOLD_MONOSPACE@
630 for font_sym,text in iter(font_names.items()):
632 font_subst_dict[key] = text
636 obj = bld(features = 'subst')
637 obj.source = [ 'clearlooks.rc.in' ]
638 obj.target = 'clearlooks.rc'
639 obj.install_path = bld.env['CONFDIR']
640 set_subst_dict(obj, font_subst_dict)
642 obj = bld(features = 'subst')
643 obj.source = [ 'default_ui_config.in' ]
644 obj.target = 'default_ui_config'
645 obj.install_path = bld.env['CONFDIR']
646 set_subst_dict(obj, font_subst_dict)
650 if bld.is_defined('GTKOSX'):
651 menus_argv = [ '-E', '-P', '-DGTKOSX' ]
653 menus_argv = [ '-E', '-P' ]
655 if bld.is_defined('PTFORMAT'):
656 menus_argv += [ '-DPTFORMAT' ]
658 # always build all versions of the menu definitions
659 # so that we can try them out with different program builds.
660 for program in [ 'ardour', 'trx' ]:
661 obj = bld(features = 'command-output')
663 obj.command_is_external = True
665 obj.argv = menus_argv
666 obj.dep_vars = ['PTFORMAT', 'GTKOSX', 'WINDOWS']
667 obj.stdin = program + '.menus.in'
668 obj.stdout = program + '.menus'
669 bld.install_files (bld.env['CONFDIR'], program + '.menus')
672 freedesktop_subst_dict = {
673 'ARDOUR_EXEC' : str (bld.env['lwrcase_dirname']),
674 'ARDOUR_ICON' : str (bld.env['lwrcase_dirname'])
677 if bld.env['FREEDESKTOP']:
678 obj = bld(features = 'subst')
679 obj.source = 'ardour.desktop.in'
680 obj.target = str (bld.env['lwrcase_dirname']) + '.desktop'
681 obj.chmod = Utils.O644
682 obj.dict = freedesktop_subst_dict
683 set_subst_dict(obj, freedesktop_subst_dict)
685 obj = bld(features = 'subst')
686 obj.source = 'ardour-mime-info.xml'
687 obj.target = 'ardour.xml'
688 obj.chmod = Utils.O644
692 # 'SAE-de-keypad', 'SAE-de-nokeypad', 'SAE-us-keypad',
693 # 'SAE-us-nokeypad', 'ergonomic-us'
696 # explicitly state the use of perl here so that it works on windows too
698 a_rule = 'perl ../tools/fmt-bindings --platform="%s" --winkey="%s" --accelmap <${SRC} >${TGT}' % (sys.platform, bld.env['WINDOWS_KEY'] )
699 for b in [ 'mnemonic-us' ] :
701 target = b + '.bindings',
702 source = b + '.bindings.in',
705 obj.install_path = bld.env['CONFDIR']
707 # not modified at present
708 bld.install_files(bld.env['CONFDIR'], 'dark.colors')
709 bld.install_files(bld.env['CONFDIR'], 'step_editing.bindings')
710 bld.install_files(bld.env['CONFDIR'], 'mixer.bindings')
713 bld.install_files(os.path.join (bld.env['DATADIR'], 'icons'), bld.path.ant_glob('icons/*.png'))
714 bld.install_files(os.path.join (bld.env['DATADIR'], 'pixmaps'), bld.path.ant_glob('pixmaps/*.xpm'))
715 bld.install_files(bld.env['DATADIR'], 'splash.png')
716 bld.install_files(bld.env['DATADIR'], 'small-splash.png')
717 bld.install_files(bld.env['DATADIR'], 'ArdourMono.ttf')
719 if bld.env['build_target'] == 'mingw':
720 # These icons need to overwrite the files already installed in the icons
721 # directory above. Do this in the external packaging scripts for now.
722 #bld.install_files(os.path.join (bld.env['DATADIR'], 'icons'), bld.path.ant_glob('icons/cursor_square/*.png'))
723 bld.install_files(os.path.join (bld.env['DATADIR'], 'icons'), 'icons/cursor_square/hotspots')
725 # Default UI configuration
726 bld.install_files(bld.env['CONFDIR'], 'default_ui_config')
728 bld.install_files(bld.env['CONFDIR'], 'dark.colors')
730 # Default export stuff
731 bld.install_files(os.path.join(bld.env['CONFDIR'], 'export'), bld.path.ant_glob('export/*.format'))
734 if bld.is_defined('ENABLE_NLS'):
735 mo_files = bld.path.ant_glob('po/*.mo')
737 lang = os.path.basename(mo.srcpath()).replace('.mo', '')
738 bld.install_as (os.path.join(os.path.normpath(bld.env['LOCALEDIR']), lang, 'LC_MESSAGES', I18N_PACKAGE + '.mo'),
742 I18N_PACKAGE = 'gtk2_ardour' + bld.env['MAJOR']
743 autowaf.build_i18n(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
747 I18N_PACKAGE = 'gtk2_ardour' + bld.env['MAJOR']
748 autowaf.build_i18n_pot(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
752 I18N_PACKAGE = 'gtk2_ardour' + bld.env['MAJOR']
753 autowaf.build_i18n_po(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
757 I18N_PACKAGE = 'gtk2_ardour' + bld.env['MAJOR']
758 autowaf.build_i18n_mo(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,