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 'duplicate_routes_dialog.cc',
60 'edit_note_dialog.cc',
64 'editor_audio_import.cc',
65 'editor_pt_import.cc',
66 'editor_audiotrack.cc',
68 'editor_canvas_events.cc',
69 'editor_component.cc',
72 'editor_route_groups.cc',
73 'editor_export_audio.cc',
74 'editor_group_tabs.cc',
76 'editor_locations.cc',
84 'editor_selection.cc',
85 'editor_snapshots.cc',
87 'editor_tempodisplay.cc',
91 'export_channel_selector.cc',
93 'export_file_notebook.cc',
94 'export_filename_selector.cc',
95 'export_format_dialog.cc',
96 'export_format_selector.cc',
97 'export_preset_selector.cc',
98 'export_timespan_selector.cc',
102 'floating_text_entry.cc',
103 'sfdb_freesound_mootcher.cc',
105 'generic_pluginui.cc',
107 'global_port_matrix.cc',
109 'gtk_pianokeyboard.c',
111 'insert_remove_time_dialog.cc',
112 'instrument_selector.cc',
113 'interthread_progress_window.cc',
125 'midi_automation_line.cc',
126 'midi_channel_dialog.cc',
127 'midi_channel_selector.cc',
128 'midi_cut_buffer.cc',
129 'midi_export_dialog.cc',
130 'midi_list_editor.cc',
131 'midi_port_dialog.cc',
132 'midi_region_view.cc',
135 'midi_streamview.cc',
138 'midi_velocity_dialog.cc',
139 'missing_file_dialog.cc',
140 'missing_plugin_dialog.cc',
142 'mixer_group_tabs.cc',
148 'monitor_section.cc',
149 'monitor_selector.cc',
151 'mono_panner_editor.cc',
154 'new_plugin_preset_dialog.cc',
155 'normalize_dialog.cc',
159 'note_select_dialog.cc',
166 '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',
206 'search_path_option.cc',
208 'selection_memento.cc',
211 'session_import_dialog.cc',
212 'session_metadata_dialog.cc',
213 'session_option_editor.cc',
215 'shuttle_control.cc',
216 'soundcloud_export_selector.cc',
223 'stereo_panner_editor.cc',
225 'strip_silence_dialog.cc',
227 'tape_region_view.cc',
232 'time_axis_view_item.cc',
238 'track_selection.cc',
239 'track_view_list.cc',
240 'transform_dialog.cc',
241 'transpose_dialog.cc',
245 'visibility_group.cc',
246 'volume_controller.cc',
248 # video-timeline related sources:
249 'video_image_frame.cc',
250 'add_video_dialog.cc',
251 'editor_videotimeline.cc',
254 'transcode_ffmpeg.cc',
255 'transcode_video_dialog.cc',
256 'video_server_dialog.cc',
258 'export_video_dialog.cc',
259 'export_video_infobox.cc',
260 'video_tool_paths.cc'
263 def enoify (major, minor):
265 return "\\n\\\"E-No\\\""
268 return "\\n\\\"No Pussyfooting\\\""
270 return "\\n\\\"Here Come the Warm Jets\\\""
272 return "\\n\\\"Taking Tiger Mountain\\\""
274 return "\\n\\\"Lady June's Linguistic Leprosy\\\""
276 return "\\n\\\"Discreet Music\\\""
278 return "\\n\\\"Another Green World\\\""
280 return "\\n\\\"Evening Star\\\""
284 autowaf.set_options(opt)
288 conf.load('compiler_cxx')
289 autowaf.configure(conf)
291 # TODO: Insert a sanity check for on OS X to ensure CoreAudio is present
293 autowaf.check_pkg(conf, 'fftw3f', uselib_store='FFTW3F',
295 autowaf.check_pkg(conf, 'fftw3f', uselib_store='FFTW35F',
296 atleast_version='3.3.5', mandatory=False)
297 autowaf.check_pkg(conf, 'flac', uselib_store='FLAC',
298 atleast_version='1.2.1')
299 autowaf.check_pkg(conf, 'gthread-2.0', uselib_store='GTHREAD',
300 atleast_version='2.10.1')
301 autowaf.check_pkg(conf, 'gtk+-2.0', uselib_store='GTK',
302 atleast_version='2.18')
303 autowaf.check_pkg(conf, 'gtkmm-2.4', uselib_store='GTKMM',
304 atleast_version='2.18')
305 autowaf.check_pkg(conf, 'ogg', uselib_store='OGG', atleast_version='1.1.2')
306 autowaf.check_pkg(conf, 'x11', uselib_store='X11', atleast_version='1.1', mandatory=False)
307 autowaf.check_pkg(conf, 'fontconfig', uselib_store='FONTCONFIG')
309 conf.write_config_header('gtk2ardour-config.h', remove=False)
311 bak = conf.env['define_key']
312 conf.define('VERSIONSTRING', str (conf.env['VERSION']))
313 conf.define('CODENAME', enoify(int(conf.env['MAJOR']), int(conf.env['MINOR'])))
314 conf.env['define_key'] = ['VERSIONSTRING', 'CODENAME' ]
315 conf.write_config_header('gtk2ardour-version.h')
316 conf.env['define_key'] = bak;
319 autowaf.check_header(conf, 'cxx', 'boost/shared_ptr.hpp')
320 autowaf.check_header(conf, 'cxx', 'boost/weak_ptr.hpp')
322 # Add a waf `feature' to allow compilation of things using winegcc
323 from waflib.TaskGen import feature
325 def set_winegcc(self):
326 self.env.LINK_CXX = self.env.LINK_CC = 'wineg++'
327 self.env.CC = 'winegcc'
329 def _doPyp(infileName, deps = False):
332 re_spaces = re.compile("\s+")
334 if infileName == '-':
337 fd = open(infileName)
338 inLines = fd.readlines()
344 bits = re_spaces.split(line)
345 if bits[0] == '##include':
350 # assume included file comes from same place as source file
351 incName = os.path.join (os.path.dirname (infileName), incName);
352 outStr += _doPyp(incName)
363 def include_processor(task):
364 infileName = task.inputs[0].srcpath()
365 outfileName = os.path.join(out, task.outputs[0].bldpath())
366 fdOut = open (outfileName, "w")
367 fdOut.write (_doPyp(infileName))
371 def build_color_scheme(path, prefix):
375 if re.search ('^#@color', line):
376 line.strip() # remove newline
378 if len(color_scheme):
380 color_scheme += prefix
382 color_scheme += words[1]
384 color_scheme += words[2]
390 VERSION = "%s.%s" % (bld.env['MAJOR'], bld.env['MINOR'])
391 I18N_PACKAGE = 'gtk2_ardour' + bld.env['MAJOR']
393 if bld.is_defined('WINDOWS_VST_SUPPORT') and bld.env['build_target'] != 'mingw':
394 # Windows VST support w/wine
395 # If we require VST support we build a stub main() and the FST library
396 # here using winegcc, and link it to the GTK front-end library
397 obj = bld (features = 'cxx c cxxprogram wine')
398 obj.source = ( '../libs/fst/vstwin.c', '../vst/winmain.c' )
400 # XXX do we really need to explicitly link to all of these for the wine executable?
402 obj.use = [ 'libpbd',
413 obj.target = 'ardour-' + str (bld.env['VERSION']) + '-vst.exe.so'
414 obj.includes = [ '../libs/fst', '.' ]
415 obj.linkflags = ['-mwindows', '-Wl,--export-dynamic']
416 obj.linkflags += bld.env['LDFLAGS']
417 obj.defines = ['_POSIX_SOURCE', 'USE_WS_PREFIX']
418 obj.install_path = bld.env['DLLDIR']
419 # end of the wine executable
421 # now the shared library containing the GTK GUI for ardour
422 obj = bld (features = 'cxx c cxxshlib')
423 obj.source = gtk2_ardour_sources
424 obj.includes = [ '../libs/fst', '.' ]
425 obj.name = 'libgtk2_ardour'
426 obj.target = 'gtk2_ardour'
429 # just the normal executable version of the GTK GUI
430 if bld.env['build_target'] == 'mingw':
431 obj = bld (features = 'cxx c cxxprogram winres')
433 obj = bld (features = 'cxx c cxxprogram')
434 obj.source = gtk2_ardour_sources
435 obj.target = 'ardour-' + str (bld.env['VERSION'])
437 obj.ldflags = ['-no-undefined']
439 if bld.is_defined('WINDOWS_VST_SUPPORT'):
440 # Windows VST support mingw
441 obj.includes += [ '../libs/fst' ]
443 # at this point, "obj" refers to either the normal native executable
444 # OR the shared library built for use with wine on linux.
446 obj.use = [ 'libpbd',
457 'PACKAGE="' + I18N_PACKAGE + '"',
458 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
459 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
460 'LOCALEDIR="' + os.path.normpath(bld.env['LOCALEDIR']) + '"',
462 obj.install_path = bld.env['DLLDIR']
464 obj.uselib = 'UUID FLAC FONTCONFIG GLIBMM GTHREAD GTK OGG CURL DL'
465 obj.uselib += ' GTKMM CANVAS FFTW3F'
466 obj.uselib += ' AUDIOUNITS OSX GTKOSX LO '
467 obj.uselib += ' TAGLIB '
469 if sys.platform == 'darwin':
470 obj.uselib += ' AUDIOUNITS OSX GTKOSX'
471 obj.use += ' libappleutility'
472 obj.source += [ 'cocoacarbon.mm', 'bundle_env_cocoa.cc' ]
473 elif bld.env['build_target'] == 'mingw':
474 obj.source += [ 'bundle_env_mingw.cc' ]
475 obj.source += [ 'windows_icon.rc' ]
477 obj.source += [ 'bundle_env_linux.cc' ]
479 obj.includes += ['../libs']
481 obj.use += 'libptformat'
483 if bld.env['build_target'] == 'mingw':
484 obj.linkflags += ' -mwindows'
486 if bld.is_defined('HAVE_SUIL'):
487 obj.source += [ 'lv2_plugin_ui.cc' ]
488 obj.use += [ 'SUIL' ]
490 if bld.is_defined('HAVE_FFTW35F') and bld.env['build_target'] != 'mingw':
491 obj.linkflags += ' -lfftw3f_threads'
493 if bld.is_defined('NEED_INTL'):
494 obj.linkflags += ' -lintl'
496 if bld.is_defined('WINDOWS_VST_SUPPORT'):
497 obj.source += [ 'windows_vst_plugin_ui.cc' ]
498 obj.defines += [ 'WINDOWS_VST_SUPPORT' ]
499 if bld.env['build_target'] != 'mingw':
502 if bld.is_defined('LXVST_SUPPORT'):
503 obj.source += [ 'linux_vst_gui_support.cc', 'lxvst_plugin_ui.cc' ]
504 obj.defines += [ 'LXVST_SUPPORT' ]
507 if bld.is_defined('WINDOWS_VST_SUPPORT') or bld.is_defined('LXVST_SUPPORT'):
508 obj.source += [ 'vst_plugin_ui.cc' ]
510 if bld.is_defined('PHONE_HOME'):
511 obj.defines += [ 'PHONE_HOME' ]
513 if bld.is_defined('HAVE_COREAUDIO'):
514 TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cc']
515 obj.use += ' libappleutility '
517 if bld.is_defined('AUDIOUNIT_SUPPORT'):
518 obj.source += [ 'au_pluginui.mm' ]
522 wrapper_subst_dict = {
523 'INSTALL_PREFIX' : bld.env['PREFIX'],
524 'LIBDIR' : os.path.normpath(bld.env['DLLDIR']),
525 'DATADIR' : os.path.normpath(bld.env['DATADIR']),
526 'CONFDIR' : os.path.normpath(bld.env['CONFDIR']),
527 'LIBS' : 'build/libs',
528 'VERSION' : str (bld.env['VERSION']),
529 'EXECUTABLE' : 'build/gtk2_ardour/ardour-' + str (bld.env['VERSION'])
532 def set_subst_dict(obj, dict):
534 setattr(obj, i, dict[i])
536 obj = bld(features = 'subst')
537 obj.source = 'ardev_common.sh.in'
538 obj.target = 'ardev_common_waf.sh'
539 obj.chmod = Utils.O755
540 obj.dict = wrapper_subst_dict
541 set_subst_dict(obj, wrapper_subst_dict)
543 obj = bld(features = 'subst')
544 obj.source = 'ardour.sh.in'
545 obj.target = 'ardour' + str (bld.env['MAJOR'])
546 obj.chmod = Utils.O755
547 obj.dict = wrapper_subst_dict
548 obj.install_path = bld.env['BINDIR']
549 set_subst_dict(obj, wrapper_subst_dict)
551 if bld.is_defined('WINDOWS_VST_SUPPORT'):
552 obj = bld(features = 'subst')
553 obj.source = '../vst/ardourvst.in'
554 obj.target = 'ardourvst' + str (bld.env['MAJOR'])
555 obj.chmod = Utils.O755
556 obj.dict = wrapper_subst_dict
557 obj.install_path = bld.env['BINDIR']
558 set_subst_dict(obj, wrapper_subst_dict)
567 if bld.is_defined('GTKOSX'): # OS X fonts
581 # There is no acceptable monospace font available on older versions of OS X
582 # and no API on those versions to load TTF files that will work with
583 # GTK/fontconfig/pango.
585 # In addition, the ArdourMono font gets clipped for some reason on OS X
587 # Moreover, Lucida Grande just seems to work even though it is not monospace
591 'MONOSPACE' : 'Monaco',
592 'CLOCKFONT' : 'Lucida Grande',
594 else: # Linux/X11 fonts
595 basefont = '' # unspecified - use system defaults
608 'MONOSPACE' : 'ArdourMono',
609 'CLOCKFONT' : 'ArdourMono',
612 # Set up font substitution dictionary
614 for style in ['', 'BOLD', 'ITALIC']:
615 for sizename,points in iter(font_sizes.items()):
617 key = "_".join (['FONT',style,sizename])
618 fontstyle = " ".join ([basefont,style.lower(),points])
620 key = "_".join (['FONT',sizename])
621 fontstyle = " ".join ([basefont,points])
623 font_subst_dict[key] = fontstyle
626 for sizename,points in iter(font_sizes.items()):
627 key = "_".join (['FONT_SIZE',sizename])
628 font_subst_dict[key] = points
630 # various font names, eg @BOLD_MONOSPACE@
631 for font_sym,text in iter(font_names.items()):
633 font_subst_dict[key] = text
637 obj = bld(features = 'subst')
638 obj.source = [ 'clearlooks.rc.in' ]
639 obj.target = 'clearlooks.rc'
640 obj.install_path = bld.env['CONFDIR']
641 set_subst_dict(obj, font_subst_dict)
643 obj = bld(features = 'subst')
644 obj.source = [ 'default_ui_config.in' ]
645 obj.target = 'default_ui_config'
646 obj.install_path = bld.env['CONFDIR']
647 set_subst_dict(obj, font_subst_dict)
651 if bld.is_defined('GTKOSX'):
652 menus_argv = [ '-E', '-P', '-DGTKOSX' ]
654 menus_argv = [ '-E', '-P' ]
656 if bld.is_defined('PTFORMAT'):
657 menus_argv += [ '-DPTFORMAT' ]
659 # always build all versions of the menu definitions
660 # so that we can try them out with different program builds.
661 for program in [ 'ardour', 'trx' ]:
662 obj = bld(features = 'command-output')
664 obj.command_is_external = True
666 obj.argv = menus_argv
667 obj.dep_vars = ['PTFORMAT', 'GTKOSX', 'WINDOWS']
668 obj.stdin = program + '.menus.in'
669 obj.stdout = program + '.menus'
670 bld.install_files (bld.env['CONFDIR'], program + '.menus')
673 freedesktop_subst_dict = {
674 'ARDOUR_EXEC' : str (bld.env['lwrcase_dirname']),
675 'ARDOUR_ICON' : str (bld.env['lwrcase_dirname'])
678 if bld.env['FREEDESKTOP']:
679 obj = bld(features = 'subst')
680 obj.source = 'ardour.desktop.in'
681 obj.target = str (bld.env['lwrcase_dirname']) + '.desktop'
682 obj.chmod = Utils.O644
683 obj.dict = freedesktop_subst_dict
684 set_subst_dict(obj, freedesktop_subst_dict)
686 obj = bld(features = 'subst')
687 obj.source = 'ardour-mime-info.xml'
688 obj.target = 'ardour.xml'
689 obj.chmod = Utils.O644
693 # 'SAE-de-keypad', 'SAE-de-nokeypad', 'SAE-us-keypad',
694 # 'SAE-us-nokeypad', 'ergonomic-us'
697 # explicitly state the use of perl here so that it works on windows too
699 a_rule = 'perl ../tools/fmt-bindings --platform="%s" --winkey="%s" --accelmap <${SRC} >${TGT}' % (sys.platform, bld.env['WINDOWS_KEY'] )
700 for b in [ 'mnemonic-us' ] :
702 target = b + '.bindings',
703 source = b + '.bindings.in',
706 obj.install_path = bld.env['CONFDIR']
708 # not modified at present
709 bld.install_files(bld.env['CONFDIR'], 'dark.colors')
710 bld.install_files(bld.env['CONFDIR'], 'step_editing.bindings')
711 bld.install_files(bld.env['CONFDIR'], 'mixer.bindings')
714 bld.install_files(os.path.join (bld.env['DATADIR'], 'icons'), bld.path.ant_glob('icons/*.png'))
715 bld.install_files(os.path.join (bld.env['DATADIR'], 'pixmaps'), bld.path.ant_glob('pixmaps/*.xpm'))
716 bld.install_files(bld.env['DATADIR'], 'splash.png')
717 bld.install_files(bld.env['DATADIR'], 'small-splash.png')
718 bld.install_files(bld.env['DATADIR'], 'ArdourMono.ttf')
720 if bld.env['build_target'] == 'mingw':
721 # These icons need to overwrite the files already installed in the icons
722 # directory above. Do this in the external packaging scripts for now.
723 #bld.install_files(os.path.join (bld.env['DATADIR'], 'icons'), bld.path.ant_glob('icons/cursor_square/*.png'))
724 bld.install_files(os.path.join (bld.env['DATADIR'], 'icons'), 'icons/cursor_square/hotspots')
726 # Default UI configuration
727 bld.install_files(bld.env['CONFDIR'], 'default_ui_config')
729 bld.install_files(bld.env['CONFDIR'], 'dark.colors')
731 # Default export stuff
732 bld.install_files(os.path.join(bld.env['CONFDIR'], 'export'), bld.path.ant_glob('export/*.format'))
735 if bld.is_defined('ENABLE_NLS'):
736 mo_files = bld.path.ant_glob('po/*.mo')
738 lang = os.path.basename(mo.srcpath()).replace('.mo', '')
739 bld.install_as (os.path.join(os.path.normpath(bld.env['LOCALEDIR']), lang, 'LC_MESSAGES', I18N_PACKAGE + '.mo'),
743 I18N_PACKAGE = 'gtk2_ardour' + bld.env['MAJOR']
744 autowaf.build_i18n(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
748 I18N_PACKAGE = 'gtk2_ardour' + bld.env['MAJOR']
749 autowaf.build_i18n_pot(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
753 I18N_PACKAGE = 'gtk2_ardour' + bld.env['MAJOR']
754 autowaf.build_i18n_po(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
758 I18N_PACKAGE = 'gtk2_ardour' + bld.env['MAJOR']
759 autowaf.build_i18n_mo(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,