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_ardour'
19 VERSION = GTK2_ARDOUR_VERSION
25 path_prefix = 'gtk2_ardour/'
27 gtk2_ardour_sources = [
30 'add_midi_cc_track_dialog.cc',
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',
44 'audio_region_editor.cc',
45 'audio_region_view.cc',
46 'audio_streamview.cc',
48 'automation_controller.cc',
50 'automation_region_view.cc',
51 'automation_streamview.cc',
52 'automation_time_axis.cc',
58 'canvas-note-event.cc',
60 'canvas_patch_change.cc',
61 'canvas-simpleline.c',
62 'canvas-simplerect.c',
68 'control_point_dialog.cc',
74 'edit_note_dialog.cc',
78 'editor_audio_import.cc',
79 'editor_audiotrack.cc',
81 'editor_canvas_events.cc',
82 'editor_component.cc',
85 'editor_route_groups.cc',
86 'editor_export_audio.cc',
87 'editor_group_tabs.cc',
89 'editor_locations.cc',
99 'editor_selection.cc',
100 'editor_snapshots.cc',
102 'editor_tempodisplay.cc',
106 'export_channel_selector.cc',
108 'export_file_notebook.cc',
109 'export_filename_selector.cc',
110 'export_format_dialog.cc',
111 'export_format_selector.cc',
112 'export_preset_selector.cc',
113 'export_timespan_selector.cc',
118 'generic_pluginui.cc',
120 'global_port_matrix.cc',
122 'gtk-custom-hruler.c',
123 'gtk-custom-ruler.c',
124 'gtk_pianokeyboard.c',
126 'insert_time_dialog.cc',
127 'interthread_progress_window.cc',
138 'midi_automation_line.cc',
139 'midi_channel_dialog.cc',
140 'midi_channel_selector.cc',
141 'midi_cut_buffer.cc',
142 'midi_list_editor.cc',
143 'midi_port_dialog.cc',
144 'midi_region_view.cc',
146 'midi_streamview.cc',
149 'missing_file_dialog.cc',
150 'missing_plugin_dialog.cc',
151 'mixer_group_tabs.cc',
154 'monitor_section.cc',
158 'new_plugin_preset_dialog.cc',
159 'normalize_dialog.cc',
165 'piano_roll_header.cc',
166 'playlist_selector.cc',
168 'plugin_selector.cc',
173 'port_matrix_body.cc',
174 'port_matrix_column_labels.cc',
175 'port_matrix_component.cc',
176 'port_matrix_grid.cc',
177 'port_matrix_labels.cc',
178 'port_matrix_row_labels.cc',
180 'patch_change_dialog.cc',
181 'progress_reporter.cc',
184 'quantize_dialog.cc',
185 'rc_option_editor.cc',
187 'region_gain_line.cc',
188 'region_layering_order_editor.cc',
189 'region_selection.cc',
193 'route_group_dialog.cc',
194 'route_group_menu.cc',
195 'route_params_ui.cc',
196 'route_processor_selection.cc',
197 'route_time_axis.cc',
199 'search_path_option.cc',
202 'session_import_dialog.cc',
203 'session_metadata_dialog.cc',
204 'session_option_editor.cc',
206 'shuttle_control.cc',
216 'strip_silence_dialog.cc',
217 'tape_region_view.cc',
222 'time_axis_view_item.cc',
226 'track_selection.cc',
227 'track_view_list.cc',
228 'transpose_dialog.cc',
233 'visibility_group.cc',
234 'volume_controller.cc',
240 autowaf.set_options(opt)
244 conf.load('compiler_cxx')
245 autowaf.build_version_files(
246 path_prefix + 'version.h',
247 path_prefix + 'version.cc',
248 'gtk2_ardour', MAJOR, MINOR, MICRO)
249 autowaf.configure(conf)
251 if re.search ("linux", sys.platform) != None:
252 autowaf.check_pkg(conf, 'alsa', uselib_store='ALSA')
254 # TODO: Insert a sanity check for on OS X to ensure CoreAudio is present
256 autowaf.check_pkg(conf, 'flac', uselib_store='FLAC',
257 atleast_version='1.2.1')
258 autowaf.check_pkg(conf, 'gthread-2.0', uselib_store='GTHREAD',
259 atleast_version='2.10.1')
260 autowaf.check_pkg(conf, 'gtk+-2.0', uselib_store='GTK',
261 atleast_version='2.18')
262 autowaf.check_pkg(conf, 'gtkmm-2.4', uselib_store='GTKMM',
263 atleast_version='2.18')
264 autowaf.check_pkg(conf, 'libgnomecanvas-2.0',
265 uselib_store='GNOMECANVAS', atleast_version='2.30')
266 autowaf.check_pkg(conf, 'libgnomecanvasmm-2.6',
267 uselib_store='GNOMECANVASMM', atleast_version='2.16')
268 autowaf.check_pkg(conf, 'ogg', uselib_store='OGG', atleast_version='1.1.2')
270 conf.write_config_header('gtk2ardour-config.h', remove=False)
273 autowaf.check_header(conf, 'cxx', 'boost/shared_ptr.hpp')
274 autowaf.check_header(conf, 'cxx', 'boost/weak_ptr.hpp')
276 # Add a waf `feature' to allow compilation of things using winegcc
277 from waflib.TaskGen import feature
279 def set_winegcc(self):
280 self.env.LINK_CXX = self.env.LINK_CC = 'wineg++'
281 self.env.CC = 'winegcc'
283 def _doPyp(infileName, deps = False):
286 re_spaces = re.compile("\s+")
288 if infileName == '-':
291 fd = open(infileName)
292 inLines = fd.readlines()
298 bits = re_spaces.split(line)
299 if bits[0] == '##include':
304 # assume included file comes from same place as source file
305 incName = os.path.join (os.path.dirname (infileName), incName);
306 outStr += _doPyp(incName)
317 def include_processor(task):
318 infileName = task.inputs[0].srcpath()
319 outfileName = os.path.join(out, task.outputs[0].bldpath())
320 fdOut = open (outfileName, "w")
321 fdOut.write (_doPyp(infileName))
325 def build_color_scheme(path, prefix):
329 if re.search ('^#@color', line):
330 line.strip() # remove newline
332 if len(color_scheme):
334 color_scheme += prefix
336 color_scheme += words[1]
338 color_scheme += words[2]
343 # GTK front-end; if we're using VST we build this as a shared library,
344 # otherwise it's a normal executabale
345 if bld.is_defined('VST_SUPPORT'):
346 obj = bld(features = 'cxx c cxxshlib')
348 obj = bld(features = 'cxx c cxxprogram')
351 obj.source = gtk2_ardour_sources
352 obj.name = 'gtk2_ardour'
354 if bld.is_defined('VST_SUPPORT'):
355 obj.target = 'gtk2_ardour'
356 obj.includes += ['../libs/fst']
358 obj.target = 'ardour-3.0'
359 obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
360 obj.uselib = 'UUID FLAC GLIBMM GTHREAD GTK OGG ALSA CURL DL'
361 obj.uselib += ' GTKMM GNOMECANVASMM GNOMECANVAS '
362 obj.uselib += ' AUDIOUNITS OSX GTKOSX '
363 obj.use = [ 'libpbd',
370 if sys.platform == 'darwin':
371 obj.use += ' libappleutility'
373 'PACKAGE="gtk2_ardour"',
374 'VERSIONSTRING="' + bld.env['VERSION'] + '"',
375 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
376 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
377 'MODULE_DIR="' + os.path.normpath(bld.env['LIBDIR']) + '"',
378 'LOCALEDIR="' + os.path.join(os.path.normpath(bld.env['DATADIR']),
380 'PROGRAM_NAME="' + bld.env['PROGRAM_NAME'] + '"'
382 obj.includes += ['../libs']
384 if bld.is_defined('HAVE_SUIL'):
385 obj.source += [ 'lv2_plugin_ui.cc' ]
386 obj.uselib += ' SUIL '
388 if bld.is_defined('FREESOUND'):
389 obj.source += [ 'sfdb_freesound_mootcher.cc' ]
391 if bld.is_defined('VST_SUPPORT'):
392 obj.source += [ 'vst_pluginui.cc' ]
393 obj.defines += [ 'VST_SUPPORT' ]
394 bld.env.append ('LINKFLAGS', '-lX11')
396 if bld.is_defined('LXVST_SUPPORT'):
397 obj.source += [ 'lxvst_pluginui.cc' ]
398 obj.defines += [ 'LXVST_SUPPORT' ]
399 obj.linkflags += [ '-lX11' ]
401 if bld.is_defined('PHONE_HOME'):
402 obj.defines += [ 'PHONE_HOME' ]
404 if bld.is_defined('HAVE_COREAUDIO'):
405 TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cc']
406 obj.source += [ 'cocoacarbon.mm', 'au_pluginui.mm' ]
407 obj.use += ' libappleutility '
409 if bld.is_defined('VST_SUPPORT'):
410 # If we require VST support we build a stub main() and the FST library
411 # here using winegcc, and link it to the GTK front-end library
412 obj = bld(features = 'cxx c cxxprogram wine')
415 ../libs/fst/fstinfofile.c
420 obj.includes = '../libs/fst'
421 obj.target = 'ardour-3.0-vst'
422 obj.linkflags += ['-mwindows', '-Wl,--export-dynamic', '-lpthread']
423 obj.defines = ['_POSIX_SOURCE', 'USE_WS_PREFIX']
425 obj.use = ['libpbd','libmidipp','libtaglib','libardour',
426 'libardour_cp','libgtkmm2ext','libtaglib',
431 wrapper_subst_dict = {
432 'INSTALL_PREFIX' : bld.env['PREFIX'],
433 'LIBDIR' : os.path.normpath(bld.env['LIBDIR']),
434 'LIBS' : 'build/libs',
436 'EXECUTABLE' : 'build/gtk2_ardour/ardour-3.0'
439 def set_subst_dict(obj, dict):
441 setattr(obj, i, dict[i])
443 obj = bld(features = 'subst', rule= 'chmod 0755 ${TGT}')
444 obj.source = 'ardev_common.sh.in'
445 obj.target = 'ardev_common_waf.sh'
446 obj.chmod = Utils.O755
447 obj.dict = wrapper_subst_dict
448 set_subst_dict(obj, wrapper_subst_dict)
450 obj = bld(features = 'subst')
451 obj.source = 'ardour.sh.in'
452 obj.target = 'ardour3'
453 obj.chmod = Utils.O755
454 obj.dict = wrapper_subst_dict
455 obj.install_path = bld.env['BINDIR']
456 set_subst_dict(obj, wrapper_subst_dict)
460 dark_rc_subst_dict = {}
461 light_rc_subst_dict = {}
466 if bld.is_defined('GTKOSX'): # OS X fonts
467 basefont = "Lucida Grande"
480 else: # Linux/X11 fonts
481 basefont = '' # unspecified - use system defaults
495 # Set up font substitution dictionary
497 for style in ['', 'BOLD', 'ITALIC']:
498 for sizename,points in iter(font_sizes.items()):
500 key = "_".join (['FONT',style,sizename])
501 fontstyle = " ".join ([basefont,style.lower(),points])
503 key = "_".join (['FONT',sizename])
504 fontstyle = " ".join ([basefont,points])
506 dark_rc_subst_dict[key] = fontstyle
507 light_rc_subst_dict[key] = fontstyle
510 for sizename,points in iter(font_sizes.items()):
511 key = "_".join (['FONT_SIZE',sizename])
512 dark_rc_subst_dict[key] = points
513 light_rc_subst_dict[key] = points
516 dark_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
517 'gtk2_ardour/ardour3_ui_dark.rc.in', 'ARDOUR_DARK')
518 dark_rc_subst_dict['COLPREFIX'] = 'ARDOUR_DARK'
519 light_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
520 'gtk2_ardour/ardour3_ui_light.rc.in', 'ARDOUR_LIGHT')
521 light_rc_subst_dict['COLPREFIX'] = 'ARDOUR_LIGHT'
523 obj = bld(features = 'subst')
524 obj.source = [ 'ardour3_ui_dark.rc.in' ]
525 obj.target = 'ardour3_ui_dark.rc.pre'
526 obj.install_path = None
527 set_subst_dict(obj, dark_rc_subst_dict)
529 obj = bld(features = 'subst')
530 obj.source = [ 'ardour3_ui_light.rc.in' ]
531 obj.target = 'ardour3_ui_light.rc.pre'
532 obj.install_path = None
533 set_subst_dict(obj, light_rc_subst_dict)
535 obj = bld(features = 'subst')
536 obj.source = [ 'ardour3_styles.rc.in' ]
537 obj.target = 'ardour3_dark_styles.rc'
538 obj.install_path = None
539 set_subst_dict(obj, dark_rc_subst_dict)
541 obj = bld(features = 'subst')
542 obj.source = [ 'ardour3_styles.rc.in' ]
543 obj.target = 'ardour3_light_styles.rc'
544 obj.install_path = None
545 set_subst_dict(obj, light_rc_subst_dict)
547 obj = bld(features = 'subst')
548 obj.source = [ 'ardour3_fonts.rc.in' ]
549 obj.target = 'ardour3_dark_fonts.rc'
550 obj.install_path = None
551 set_subst_dict(obj, dark_rc_subst_dict)
553 obj = bld(features = 'subst')
554 obj.source = [ 'ardour3_fonts.rc.in' ]
555 obj.target = 'ardour3_light_fonts.rc'
556 obj.install_path = None
557 set_subst_dict(obj, light_rc_subst_dict)
559 obj = bld(rule = 'cp ${SRC} ${TGT}')
560 obj.source = [ 'ardour3_widget_list.rc' ]
561 obj.target = 'ardour3_widgets.rc'
562 obj.install_path = None
564 obj = bld (rule = include_processor)
565 obj.source = [ 'ardour3_ui_dark.rc.pre' ]
566 # find and add all ##include dependencies as sources
567 obj.source += _doPyp (bld.path.find_resource ('ardour3_ui_dark.rc.in').srcpath(), True)
568 obj.target = 'ardour3_ui_dark.rc'
569 obj.install_path = '${SYSCONFDIR}/ardour3'
571 obj = bld (rule = include_processor)
572 obj.source = [ 'ardour3_ui_light.rc.pre' ]
573 # find and add all ##include dependencies as sources
574 obj.source += _doPyp (bld.path.find_resource ('ardour3_ui_light.rc.in').srcpath(), True)
575 obj.target = 'ardour3_ui_light.rc'
576 obj.install_path = '${SYSCONFDIR}/ardour3'
580 if bld.is_defined('GTKOSX'):
581 menus_argv = [ '-E', '-P', '-DGTKOSX' ]
583 menus_argv = [ '-E', '-P' ]
584 obj = bld(features = 'command-output')
586 obj.command_is_external = True
588 obj.argv = menus_argv
589 obj.stdin = 'ardour.menus.in'
590 obj.stdout = 'ardour.menus'
591 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
596 # 'SAE-de-keypad', 'SAE-de-nokeypad', 'SAE-us-keypad',
597 # 'SAE-us-nokeypad', 'ergonomic-us'
599 for b in [ 'mnemonic-us' ] :
601 target = b + '.bindings',
602 source = b + '.bindings.in',
603 rule = '../tools/fmt-bindings --platform="%s" --winkey="%s" --accelmap <${SRC} >${TGT}' % (sys.platform, bld.env['WINDOWS_KEY'] )
605 obj.install_path = os.path.join(bld.env['SYSCONFDIR'], 'ardour3')
607 # not modified at present
608 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
609 'step_editing.bindings')
612 bld.install_files('${DATADIR}/ardour3/icons', bld.path.ant_glob('icons/*.png'))
613 bld.install_files('${DATADIR}/ardour3/pixmaps', bld.path.ant_glob('pixmaps/*.xpm'))
614 bld.install_files('${DATADIR}/ardour3', 'splash.png')
616 # Default UI configuration
617 bld.install_files('${SYSCONFDIR}/ardour3', 'ardour3_ui_default.conf')
618 # Generic widget style mappings
619 bld.install_files('${SYSCONFDIR}/ardour3', 'ardour3_widgets.rc')
621 # Default export stuff
622 bld.install_files('${SYSCONFDIR}/ardour3/export', bld.path.ant_glob('export/*.format'))
625 if bld.is_defined('ENABLE_NLS'):
626 mo_files = bld.path.ant_glob ('po/*.mo')
628 lang = os.path.basename (mo).replace ('.mo', '')
629 bld.install_as (os.path.join(bld.env['PREFIX'], 'share', 'locale',
630 lang, 'LC_MESSAGES', APPNAME + '.mo'),
634 autowaf.build_i18n(bld, srcdir, 'gtk2_ardour', APPNAME, gtk2_ardour_sources)