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',
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',
75 'edit_note_dialog.cc',
79 'editor_audio_import.cc',
80 'editor_audiotrack.cc',
82 'editor_canvas_events.cc',
83 'editor_component.cc',
86 'editor_route_groups.cc',
87 'editor_export_audio.cc',
88 'editor_group_tabs.cc',
90 'editor_locations.cc',
100 'editor_selection.cc',
101 'editor_snapshots.cc',
103 'editor_tempodisplay.cc',
107 'export_channel_selector.cc',
109 'export_file_notebook.cc',
110 'export_filename_selector.cc',
111 'export_format_dialog.cc',
112 'export_format_selector.cc',
113 'export_preset_selector.cc',
114 'export_timespan_selector.cc',
119 'generic_pluginui.cc',
121 'global_port_matrix.cc',
123 'gtk-custom-hruler.c',
124 'gtk-custom-ruler.c',
125 'gtk_pianokeyboard.c',
127 'insert_time_dialog.cc',
128 'interthread_progress_window.cc',
139 'midi_automation_line.cc',
140 'midi_channel_dialog.cc',
141 'midi_channel_selector.cc',
142 'midi_cut_buffer.cc',
143 'midi_list_editor.cc',
144 'midi_port_dialog.cc',
145 'midi_region_view.cc',
147 'midi_streamview.cc',
150 'missing_file_dialog.cc',
151 'missing_plugin_dialog.cc',
153 'mixer_group_tabs.cc',
156 'monitor_section.cc',
160 'new_plugin_preset_dialog.cc',
161 'normalize_dialog.cc',
167 'piano_roll_header.cc',
168 'playlist_selector.cc',
170 'plugin_selector.cc',
175 'port_matrix_body.cc',
176 'port_matrix_column_labels.cc',
177 'port_matrix_component.cc',
178 'port_matrix_grid.cc',
179 'port_matrix_labels.cc',
180 'port_matrix_row_labels.cc',
182 'patch_change_dialog.cc',
183 'progress_reporter.cc',
186 'quantize_dialog.cc',
187 'rc_option_editor.cc',
189 'region_gain_line.cc',
190 'region_layering_order_editor.cc',
191 'region_selection.cc',
195 'route_group_dialog.cc',
196 'route_group_menu.cc',
197 'route_params_ui.cc',
198 'route_processor_selection.cc',
199 'route_time_axis.cc',
201 'search_path_option.cc',
204 'session_import_dialog.cc',
205 'session_metadata_dialog.cc',
206 'session_option_editor.cc',
208 'shuttle_control.cc',
218 'strip_silence_dialog.cc',
219 'tape_region_view.cc',
224 'time_axis_view_item.cc',
228 'track_selection.cc',
229 'track_view_list.cc',
230 'transpose_dialog.cc',
235 'visibility_group.cc',
236 'volume_controller.cc',
242 autowaf.set_options(opt)
246 conf.load('compiler_cxx')
247 autowaf.build_version_files(
248 path_prefix + 'version.h',
249 path_prefix + 'version.cc',
250 'gtk2_ardour', MAJOR, MINOR, MICRO)
251 autowaf.configure(conf)
253 if re.search ("linux", sys.platform) != None:
254 autowaf.check_pkg(conf, 'alsa', uselib_store='ALSA')
256 # TODO: Insert a sanity check for on OS X to ensure CoreAudio is present
258 autowaf.check_pkg(conf, 'flac', uselib_store='FLAC',
259 atleast_version='1.2.1')
260 autowaf.check_pkg(conf, 'gthread-2.0', uselib_store='GTHREAD',
261 atleast_version='2.10.1')
262 autowaf.check_pkg(conf, 'gtk+-2.0', uselib_store='GTK',
263 atleast_version='2.18')
264 autowaf.check_pkg(conf, 'gtkmm-2.4', uselib_store='GTKMM',
265 atleast_version='2.18')
266 autowaf.check_pkg(conf, 'libgnomecanvas-2.0',
267 uselib_store='GNOMECANVAS', atleast_version='2.30')
268 autowaf.check_pkg(conf, 'libgnomecanvasmm-2.6',
269 uselib_store='GNOMECANVASMM', atleast_version='2.16')
270 autowaf.check_pkg(conf, 'ogg', uselib_store='OGG', atleast_version='1.1.2')
271 autowaf.check_pkg(conf, 'x11', uselib_store='X11', atleast_version='1.3', mandatory=False)
273 conf.write_config_header('gtk2ardour-config.h', remove=False)
276 autowaf.check_header(conf, 'cxx', 'boost/shared_ptr.hpp')
277 autowaf.check_header(conf, 'cxx', 'boost/weak_ptr.hpp')
279 # Add a waf `feature' to allow compilation of things using winegcc
280 from waflib.TaskGen import feature
282 def set_winegcc(self):
283 self.env.LINK_CXX = self.env.LINK_CC = 'wineg++'
284 self.env.CC = 'winegcc'
286 def _doPyp(infileName, deps = False):
289 re_spaces = re.compile("\s+")
291 if infileName == '-':
294 fd = open(infileName)
295 inLines = fd.readlines()
301 bits = re_spaces.split(line)
302 if bits[0] == '##include':
307 # assume included file comes from same place as source file
308 incName = os.path.join (os.path.dirname (infileName), incName);
309 outStr += _doPyp(incName)
320 def include_processor(task):
321 infileName = task.inputs[0].srcpath()
322 outfileName = os.path.join(out, task.outputs[0].bldpath())
323 fdOut = open (outfileName, "w")
324 fdOut.write (_doPyp(infileName))
328 def build_color_scheme(path, prefix):
332 if re.search ('^#@color', line):
333 line.strip() # remove newline
335 if len(color_scheme):
337 color_scheme += prefix
339 color_scheme += words[1]
341 color_scheme += words[2]
346 # GTK front-end; if we're using VST we build this as a shared library,
347 # otherwise it's a normal executabale
348 if bld.is_defined('VST_SUPPORT'):
349 obj = bld(features = 'cxx c cxxshlib')
351 obj = bld(features = 'cxx c cxxprogram')
354 obj.source = gtk2_ardour_sources
355 obj.name = 'gtk2_ardour'
357 if bld.is_defined('VST_SUPPORT'):
358 obj.target = 'gtk2_ardour'
359 obj.includes += ['../libs/fst']
361 obj.target = 'ardour-3.0'
362 obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
363 obj.uselib = 'UUID FLAC GLIBMM GTHREAD GTK OGG ALSA CURL DL'
364 obj.uselib += ' GTKMM GNOMECANVASMM GNOMECANVAS '
365 obj.uselib += ' AUDIOUNITS OSX GTKOSX '
366 obj.use = [ 'libpbd',
373 if sys.platform == 'darwin':
374 obj.use += ' libappleutility'
376 'PACKAGE="gtk2_ardour3"',
377 'VERSIONSTRING="' + bld.env['VERSION'] + '"',
378 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
379 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
380 'MODULE_DIR="' + os.path.normpath(bld.env['LIBDIR']) + '"',
381 'LOCALEDIR="' + os.path.join(os.path.normpath(bld.env['DATADIR']),
383 'PROGRAM_NAME="' + bld.env['PROGRAM_NAME'] + '"'
385 obj.includes += ['../libs']
387 if bld.is_defined('HAVE_SUIL'):
388 obj.source += [ 'lv2_plugin_ui.cc' ]
389 obj.uselib += ' SUIL '
391 if bld.is_defined('FREESOUND'):
392 obj.source += [ 'sfdb_freesound_mootcher.cc' ]
393 obj.defines += [ 'FREESOUND' ]
395 if bld.is_defined('VST_SUPPORT'):
396 obj.source += [ 'vst_pluginui.cc' ]
397 obj.defines += [ 'VST_SUPPORT' ]
398 obj.uselib += ' X11 '
400 if bld.is_defined('LXVST_SUPPORT'):
401 obj.source += [ 'vstfxwin.cc', 'lxvst_pluginui.cc' ]
402 obj.defines += [ 'LXVST_SUPPORT' ]
403 obj.uselib += ' X11 '
405 if bld.is_defined('PHONE_HOME'):
406 obj.defines += [ 'PHONE_HOME' ]
408 if bld.is_defined('HAVE_COREAUDIO'):
409 TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cc']
410 obj.source += [ 'cocoacarbon.mm', 'au_pluginui.mm' ]
411 obj.use += ' libappleutility '
413 if bld.is_defined('VST_SUPPORT'):
414 # If we require VST support we build a stub main() and the FST library
415 # here using winegcc, and link it to the GTK front-end library
416 obj = bld(features = 'cxx c cxxprogram wine')
419 ../libs/fst/fstinfofile.c
424 obj.includes = '../libs/fst'
425 obj.target = 'ardour-3.0-vst'
426 obj.linkflags += ['-mwindows', '-Wl,--export-dynamic', '-lpthread']
427 obj.defines = ['_POSIX_SOURCE', 'USE_WS_PREFIX']
429 obj.use = ['libpbd','libmidipp','libtaglib','libardour',
430 'libardour_cp','libgtkmm2ext','libtaglib',
435 wrapper_subst_dict = {
436 'INSTALL_PREFIX' : bld.env['PREFIX'],
437 'LIBDIR' : os.path.normpath(bld.env['LIBDIR']),
438 'LIBS' : 'build/libs',
440 'EXECUTABLE' : 'build/gtk2_ardour/ardour-3.0'
443 def set_subst_dict(obj, dict):
445 setattr(obj, i, dict[i])
447 obj = bld(features = 'subst', rule= 'chmod 0755 ${TGT}')
448 obj.source = 'ardev_common.sh.in'
449 obj.target = 'ardev_common_waf.sh'
450 obj.chmod = Utils.O755
451 obj.dict = wrapper_subst_dict
452 set_subst_dict(obj, wrapper_subst_dict)
454 obj = bld(features = 'subst')
455 obj.source = 'ardour.sh.in'
456 obj.target = 'ardour3'
457 obj.chmod = Utils.O755
458 obj.dict = wrapper_subst_dict
459 obj.install_path = bld.env['BINDIR']
460 set_subst_dict(obj, wrapper_subst_dict)
464 dark_rc_subst_dict = {}
465 light_rc_subst_dict = {}
470 if bld.is_defined('GTKOSX'): # OS X fonts
471 basefont = "Lucida Grande"
484 else: # Linux/X11 fonts
485 basefont = '' # unspecified - use system defaults
499 # Set up font substitution dictionary
501 for style in ['', 'BOLD', 'ITALIC']:
502 for sizename,points in iter(font_sizes.items()):
504 key = "_".join (['FONT',style,sizename])
505 fontstyle = " ".join ([basefont,style.lower(),points])
507 key = "_".join (['FONT',sizename])
508 fontstyle = " ".join ([basefont,points])
510 dark_rc_subst_dict[key] = fontstyle
511 light_rc_subst_dict[key] = fontstyle
514 for sizename,points in iter(font_sizes.items()):
515 key = "_".join (['FONT_SIZE',sizename])
516 dark_rc_subst_dict[key] = points
517 light_rc_subst_dict[key] = points
520 dark_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
521 'gtk2_ardour/ardour3_ui_dark.rc.in', 'ARDOUR_DARK')
522 dark_rc_subst_dict['COLPREFIX'] = 'ARDOUR_DARK'
523 light_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
524 'gtk2_ardour/ardour3_ui_light.rc.in', 'ARDOUR_LIGHT')
525 light_rc_subst_dict['COLPREFIX'] = 'ARDOUR_LIGHT'
527 obj = bld(features = 'subst')
528 obj.source = [ 'ardour3_ui_dark.rc.in' ]
529 obj.target = 'ardour3_ui_dark.rc.pre'
530 obj.install_path = None
531 set_subst_dict(obj, dark_rc_subst_dict)
533 obj = bld(features = 'subst')
534 obj.source = [ 'ardour3_ui_light.rc.in' ]
535 obj.target = 'ardour3_ui_light.rc.pre'
536 obj.install_path = None
537 set_subst_dict(obj, light_rc_subst_dict)
539 obj = bld(features = 'subst')
540 obj.source = [ 'ardour3_styles.rc.in' ]
541 obj.target = 'ardour3_dark_styles.rc'
542 obj.install_path = None
543 set_subst_dict(obj, dark_rc_subst_dict)
545 obj = bld(features = 'subst')
546 obj.source = [ 'ardour3_styles.rc.in' ]
547 obj.target = 'ardour3_light_styles.rc'
548 obj.install_path = None
549 set_subst_dict(obj, light_rc_subst_dict)
551 obj = bld(features = 'subst')
552 obj.source = [ 'ardour3_fonts.rc.in' ]
553 obj.target = 'ardour3_dark_fonts.rc'
554 obj.install_path = None
555 set_subst_dict(obj, dark_rc_subst_dict)
557 obj = bld(features = 'subst')
558 obj.source = [ 'ardour3_fonts.rc.in' ]
559 obj.target = 'ardour3_light_fonts.rc'
560 obj.install_path = None
561 set_subst_dict(obj, light_rc_subst_dict)
563 obj = bld(rule = 'cp ${SRC} ${TGT}')
564 obj.source = [ 'ardour3_widget_list.rc' ]
565 obj.target = 'ardour3_widgets.rc'
566 obj.install_path = None
568 obj = bld (rule = include_processor)
569 obj.source = [ 'ardour3_ui_dark.rc.pre' ]
570 # find and add all ##include dependencies as sources
571 obj.source += _doPyp (bld.path.find_resource ('ardour3_ui_dark.rc.in').srcpath(), True)
572 obj.target = 'ardour3_ui_dark.rc'
573 obj.install_path = '${SYSCONFDIR}/ardour3'
575 obj = bld (rule = include_processor)
576 obj.source = [ 'ardour3_ui_light.rc.pre' ]
577 # find and add all ##include dependencies as sources
578 obj.source += _doPyp (bld.path.find_resource ('ardour3_ui_light.rc.in').srcpath(), True)
579 obj.target = 'ardour3_ui_light.rc'
580 obj.install_path = '${SYSCONFDIR}/ardour3'
584 if bld.is_defined('GTKOSX'):
585 menus_argv = [ '-E', '-P', '-DGTKOSX' ]
587 menus_argv = [ '-E', '-P' ]
588 obj = bld(features = 'command-output')
590 obj.command_is_external = True
592 obj.argv = menus_argv
593 obj.stdin = 'ardour.menus.in'
594 obj.stdout = 'ardour.menus'
595 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
600 # 'SAE-de-keypad', 'SAE-de-nokeypad', 'SAE-us-keypad',
601 # 'SAE-us-nokeypad', 'ergonomic-us'
603 for b in [ 'mnemonic-us' ] :
605 target = b + '.bindings',
606 source = b + '.bindings.in',
607 rule = '../tools/fmt-bindings --platform="%s" --winkey="%s" --accelmap <${SRC} >${TGT}' % (sys.platform, bld.env['WINDOWS_KEY'] )
609 obj.install_path = os.path.join(bld.env['SYSCONFDIR'], 'ardour3')
611 # not modified at present
612 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
613 'step_editing.bindings')
614 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
618 bld.install_files('${DATADIR}/ardour3/icons', bld.path.ant_glob('icons/*.png'))
619 bld.install_files('${DATADIR}/ardour3/pixmaps', bld.path.ant_glob('pixmaps/*.xpm'))
620 bld.install_files('${DATADIR}/ardour3', 'splash.png')
622 # Default UI configuration
623 bld.install_files('${SYSCONFDIR}/ardour3', 'ardour3_ui_default.conf')
624 # Generic widget style mappings
625 bld.install_files('${SYSCONFDIR}/ardour3', 'ardour3_widgets.rc')
627 # Default export stuff
628 bld.install_files('${SYSCONFDIR}/ardour3/export', bld.path.ant_glob('export/*.format'))
631 if bld.is_defined('ENABLE_NLS'):
632 mo_files = bld.path.ant_glob('po/*.mo')
634 lang = os.path.basename(mo.srcpath()).replace('.mo', '')
635 bld.install_as(os.path.join(bld.env['PREFIX'], 'share', 'locale',
636 lang, 'LC_MESSAGES', APPNAME + '.mo'),
640 autowaf.build_i18n(bld, top, 'gtk2_ardour', APPNAME, gtk2_ardour_sources,