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 # Version of this package (even if built as a child)
13 GTK2_ARDOUR_VERSION = "%s.%s.%s" % (MAJOR, MINOR, MICRO)
15 # Variables for 'waf dist'
16 APPNAME = 'gtk2_ardour'
17 VERSION = GTK2_ARDOUR_VERSION
23 path_prefix = 'gtk2_ardour/'
25 gtk2_ardour_sources = [
28 'add_midi_cc_track_dialog.cc',
29 'add_route_dialog.cc',
30 'ambiguous_file_dialog.cc',
35 'ardour_ui_dependents.cc',
36 'ardour_ui_dialogs.cc',
39 'ardour_ui_options.cc',
41 'audio_region_editor.cc',
42 'audio_region_view.cc',
43 'audio_streamview.cc',
45 'automation_controller.cc',
47 'automation_region_view.cc',
48 'automation_streamview.cc',
49 'automation_time_axis.cc',
55 'canvas-note-event.cc',
57 'canvas_patch_change.cc',
58 'canvas-simpleline.c',
59 'canvas-simplerect.c',
65 'control_point_dialog.cc',
71 'edit_note_dialog.cc',
75 'editor_audio_import.cc',
76 'editor_audiotrack.cc',
78 'editor_canvas_events.cc',
79 'editor_component.cc',
82 'editor_route_groups.cc',
83 'editor_export_audio.cc',
84 'editor_group_tabs.cc',
86 'editor_locations.cc',
96 'editor_selection.cc',
97 'editor_snapshots.cc',
99 'editor_tempodisplay.cc',
103 'export_channel_selector.cc',
105 'export_file_notebook.cc',
106 'export_filename_selector.cc',
107 'export_format_dialog.cc',
108 'export_format_selector.cc',
109 'export_preset_selector.cc',
110 'export_timespan_selector.cc',
115 'generic_pluginui.cc',
117 'global_port_matrix.cc',
119 'gtk-custom-hruler.c',
120 'gtk-custom-ruler.c',
121 'gtk_pianokeyboard.c',
123 'insert_time_dialog.cc',
124 'interthread_progress_window.cc',
135 'midi_automation_line.cc',
136 'midi_channel_dialog.cc',
137 'midi_channel_selector.cc',
138 'midi_cut_buffer.cc',
139 'midi_list_editor.cc',
140 'midi_port_dialog.cc',
141 'midi_region_view.cc',
143 'midi_streamview.cc',
146 'missing_file_dialog.cc',
147 'missing_plugin_dialog.cc',
148 'mixer_group_tabs.cc',
151 'monitor_section.cc',
155 'new_plugin_preset_dialog.cc',
156 'normalize_dialog.cc',
162 'piano_roll_header.cc',
163 'playlist_selector.cc',
165 'plugin_selector.cc',
170 'port_matrix_body.cc',
171 'port_matrix_column_labels.cc',
172 'port_matrix_component.cc',
173 'port_matrix_grid.cc',
174 'port_matrix_labels.cc',
175 'port_matrix_row_labels.cc',
177 'patch_change_dialog.cc',
178 'progress_reporter.cc',
181 'quantize_dialog.cc',
182 'rc_option_editor.cc',
184 'region_gain_line.cc',
185 'region_layering_order_editor.cc',
186 'region_selection.cc',
190 'route_group_dialog.cc',
191 'route_group_menu.cc',
192 'route_params_ui.cc',
193 'route_processor_selection.cc',
194 'route_time_axis.cc',
196 'search_path_option.cc',
199 'session_import_dialog.cc',
200 'session_metadata_dialog.cc',
201 'session_option_editor.cc',
203 'shuttle_control.cc',
213 'strip_silence_dialog.cc',
214 'tape_region_view.cc',
219 'time_axis_view_item.cc',
223 'track_selection.cc',
224 'track_view_list.cc',
225 'transpose_dialog.cc',
230 'volume_controller.cc',
236 autowaf.set_options(opt)
240 conf.load('compiler_cxx')
241 autowaf.build_version_files(
242 path_prefix + 'version.h',
243 path_prefix + 'version.cc',
244 'gtk2_ardour', MAJOR, MINOR, MICRO)
245 autowaf.configure(conf)
247 if re.search ("linux", sys.platform) != None:
248 autowaf.check_pkg(conf, 'alsa', uselib_store='ALSA')
250 # TODO: Insert a sanity check for on OS X to ensure CoreAudio is present
252 autowaf.check_pkg(conf, 'flac', uselib_store='FLAC',
253 atleast_version='1.2.1')
254 autowaf.check_pkg(conf, 'gthread-2.0', uselib_store='GTHREAD',
255 atleast_version='2.10.1')
256 autowaf.check_pkg(conf, 'gtk+-2.0', uselib_store='GTK',
257 atleast_version='2.18')
258 autowaf.check_pkg(conf, 'gtkmm-2.4', uselib_store='GTKMM',
259 atleast_version='2.18')
260 autowaf.check_pkg(conf, 'libgnomecanvasmm-2.6',
261 uselib_store='GNOMECANVASMM', atleast_version='2.16')
262 autowaf.check_pkg(conf, 'ogg', uselib_store='OGG', atleast_version='1.1.2')
264 conf.write_config_header('gtk2ardour-config.h', remove=False)
267 autowaf.check_header(conf, 'cxx', 'boost/shared_ptr.hpp')
268 autowaf.check_header(conf, 'cxx', 'boost/weak_ptr.hpp')
270 # Add a waf `feature' to allow compilation of things using winegcc
271 from waflib.TaskGen import feature
273 def set_winegcc(self):
274 self.env.LINK_CXX = self.env.LINK_CC = 'wineg++'
275 self.env.CC = 'winegcc'
277 #pre-processor-like operation to merge GTK RC files
278 re_spaces = re.compile("\s+")
280 def _doPyp(infileName):
282 Does the main work of preprocessing.
283 Takes 'infileName' as a filename, opens and processes it,
284 and returns the processed file as a string
286 Note - this works recursively.
289 if infileName == '-':
292 fd = file(infileName)
293 inLines = fd.readlines()
298 bits = re_spaces.split(line)
299 if bits[0] == '##include':
301 # assume included file comes from same place as source file
302 incName = os.path.join (os.path.dirname (infileName), incName);
303 outStr += _doPyp(incName)
310 def include_processor(task):
311 infileName = task.inputs[0].srcpath()
312 outfileName = os.path.join(out, task.outputs[0].bldpath())
313 fdOut = file (outfileName, "w")
314 fdOut.write (_doPyp(infileName))
318 def build_color_scheme(path, prefix):
322 if re.search ('^#@color', line):
323 line.strip() # remove newline
325 if len(color_scheme):
327 color_scheme += prefix
329 color_scheme += words[1]
331 color_scheme += words[2]
337 # GTK front-end; if we're using VST we build this as a shared library,
338 # otherwise it's a normal executabale
339 if bld.env['VST_SUPPORT']:
340 obj = bld(features = 'cxx c cxxshlib')
342 obj = bld(features = 'cxx c cxxprogram')
345 obj.source = gtk2_ardour_sources
346 obj.name = 'gtk2_ardour'
348 if bld.env['VST_SUPPORT']:
349 obj.target = 'gtk2_ardour'
350 obj.includes += ['../libs/fst']
352 obj.target = 'ardour-3.0'
353 obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
354 obj.uselib = 'UUID FLAC GLIBMM GTHREAD GTK OGG ALSA CURL DL'
355 obj.uselib += ' GTKMM GNOMECANVASMM '
356 obj.uselib += ' AUDIOUNITS OSX GTKOSX '
357 obj.use = '''libpbd libmidipp libtaglib libardour libardour_cp
358 libgtkmm2ext libtaglib libgnomecanvas-2'''
359 if sys.platform == 'darwin':
360 obj.use += ' libappleutility'
362 'PACKAGE="gtk2_ardour"',
363 'VERSIONSTRING="' + bld.env['VERSION'] + '"',
364 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
365 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
366 'MODULE_DIR="' + os.path.normpath(bld.env['LIBDIR']) + '"',
367 'LOCALEDIR="' + os.path.join(os.path.normpath(bld.env['DATADIR']),
369 'PROGRAM_NAME="' + bld.env['PROGRAM_NAME'] + '"'
371 obj.includes += ['../libs']
373 if bld.is_defined('HAVE_SUIL'):
374 obj.source += [ 'lv2_plugin_ui.cc' ]
375 obj.uselib += ' SUIL '
376 elif bld.is_defined('HAVE_SLV2'):
377 obj.source += [ 'lv2_plugin_ui.cc' ]
378 obj.uselib += ' SLV2 '
380 if bld.env['FREESOUND']:
381 obj.source += [ 'sfdb_freesound_mootcher.cc' ]
383 if bld.env['VST_SUPPORT']:
384 obj.source += [ 'vst_pluginui.cc' ]
385 obj.defines += [ 'VST_SUPPORT' ]
386 bld.env.append ('LINKFLAGS', '-lX11')
388 if bld.env['LXVST_SUPPORT']:
389 obj.source += [ 'lxvst_pluginui.cc' ]
390 obj.defines += [ 'LXVST_SUPPORT' ]
391 obj.linkflags += [ '-lX11' ]
393 if bld.env['PHONE_HOME']:
394 obj.defines += [ 'PHONE_HOME' ]
396 if bld.env['COREAUDIO']:
397 TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cc']
398 obj.source += [ 'cocoacarbon.mm', 'au_pluginui.mm' ]
399 obj.use += ' libappleutility '
401 if bld.env['VST_SUPPORT']:
402 # If we require VST support we build a stub main() and the FST library
403 # here using winegcc, and link it to the GTK front-end library
404 obj = bld(features = 'cxx c cxxprogram wine')
407 ../libs/fst/fstinfofile.c
412 obj.includes = '../libs/fst'
413 obj.target = 'ardour-3.0-vst'
414 obj.linkflags += ['-mwindows', '-Wl,--export-dynamic', '-lpthread']
415 obj.defines = ['_POSIX_SOURCE', 'USE_WS_PREFIX']
417 obj.use = ['libpbd','libmidipp','libtaglib','libardour',
418 'libardour_cp','libgtkmm2ext','libtaglib',
423 wrapper_subst_dict = {
424 'INSTALL_PREFIX' : bld.env['PREFIX'],
425 'LIBDIR' : os.path.normpath(bld.env['LIBDIR']),
426 'LIBS' : 'build/libs',
428 'EXECUTABLE' : 'build/gtk2_ardour/ardour-3.0'
431 def set_subst_dict(obj, dict):
433 setattr(obj, i, dict[i])
435 obj = bld(features = 'subst', rule= 'chmod 0755 ${TGT}')
436 obj.source = 'ardev_common.sh.in'
437 obj.target = 'ardev_common_waf.sh'
438 obj.chmod = Utils.O755
439 obj.dict = wrapper_subst_dict
440 set_subst_dict(obj, wrapper_subst_dict)
442 obj = bld(features = 'subst')
443 obj.source = 'ardour.sh.in'
444 obj.target = 'ardour3'
445 obj.chmod = Utils.O755
446 obj.dict = wrapper_subst_dict
447 obj.install_path = bld.env['BINDIR']
448 set_subst_dict(obj, wrapper_subst_dict)
452 dark_rc_subst_dict = {}
453 light_rc_subst_dict = {}
458 if bld.env['IS_OSX']: # OS X fonts
459 basefont = "Lucida Grande"
472 else: # Linux/X11 fonts
473 basefont = '' # unspecified - use system defaults
487 # Set up font substitution dictionary
489 for style in ['', 'BOLD', 'ITALIC']:
490 for sizename,points in iter(font_sizes.items()):
492 key = "_".join (['FONT',style,sizename])
493 fontstyle = " ".join ([basefont,style.lower(),points])
495 key = "_".join (['FONT',sizename])
496 fontstyle = " ".join ([basefont,points])
498 dark_rc_subst_dict[key] = fontstyle
499 light_rc_subst_dict[key] = fontstyle
502 for sizename,points in iter(font_sizes.items()):
503 key = "_".join (['FONT_SIZE',sizename])
504 dark_rc_subst_dict[key] = points
505 light_rc_subst_dict[key] = points
508 dark_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
509 'gtk2_ardour/ardour3_ui_dark.rc.in', 'ARDOUR_DARK')
510 dark_rc_subst_dict['COLPREFIX'] = 'ARDOUR_DARK'
511 light_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
512 'gtk2_ardour/ardour3_ui_light.rc.in', 'ARDOUR_LIGHT')
513 light_rc_subst_dict['COLPREFIX'] = 'ARDOUR_LIGHT'
515 obj = bld(features = 'subst')
516 obj.source = [ 'ardour3_ui_dark.rc.in' ]
517 obj.target = 'ardour3_ui_dark.rc.pre'
518 obj.install_path = None
519 set_subst_dict(obj, dark_rc_subst_dict)
521 obj = bld(features = 'subst')
522 obj.source = [ 'ardour3_ui_light.rc.in' ]
523 obj.target = 'ardour3_ui_light.rc.pre'
524 obj.install_path = None
525 set_subst_dict(obj, light_rc_subst_dict)
527 obj = bld(features = 'subst')
528 obj.source = [ 'ardour3_styles.rc.in' ]
529 obj.target = 'ardour3_dark_styles.rc'
530 obj.install_path = None
531 set_subst_dict(obj, dark_rc_subst_dict)
533 obj = bld(features = 'subst')
534 obj.source = [ 'ardour3_styles.rc.in' ]
535 obj.target = 'ardour3_light_styles.rc'
536 obj.install_path = None
537 set_subst_dict(obj, light_rc_subst_dict)
539 obj = bld(features = 'subst')
540 obj.source = [ 'ardour3_fonts.rc.in' ]
541 obj.target = 'ardour3_dark_fonts.rc'
542 obj.install_path = None
543 set_subst_dict(obj, dark_rc_subst_dict)
545 obj = bld(features = 'subst')
546 obj.source = [ 'ardour3_fonts.rc.in' ]
547 obj.target = 'ardour3_light_fonts.rc'
548 obj.install_path = None
549 set_subst_dict(obj, light_rc_subst_dict)
551 obj = bld(rule = 'cp ${SRC} ${TGT}')
552 obj.source = [ 'ardour3_widget_list.rc' ]
553 obj.target = 'ardour3_widgets.rc'
554 obj.install_path = None
557 rule = include_processor,
558 source = 'ardour3_ui_dark.rc.pre',
559 target = 'ardour3_ui_dark.rc'
563 rule = include_processor,
564 source = 'ardour3_ui_light.rc.pre',
565 target = 'ardour3_ui_light.rc'
570 if bld.env['GTKOSX']:
571 menus_argv = [ '-E', '-P', '-DGTKOSX' ]
573 menus_argv = [ '-E', '-P' ]
574 obj = bld(features = 'command-output')
576 obj.command_is_external = True
578 obj.argv = menus_argv
579 obj.stdin = 'ardour.menus.in'
580 obj.stdout = 'ardour.menus'
581 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
586 # 'SAE-de-keypad', 'SAE-de-nokeypad', 'SAE-us-keypad',
587 # 'SAE-us-nokeypad', 'ergonomic-us'
589 for b in [ 'mnemonic-us' ] :
591 target = b + '.bindings',
592 source = b + '.bindings.in',
593 rule = '../tools/fmt-bindings --winkey="%s" --accelmap <${SRC} >${TGT}' % bld.env['WINDOWS_KEY']
595 obj.install_path = os.path.join(bld.env['SYSCONFDIR'], 'ardour3')
597 # not modified at present
598 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
599 'step_editing.bindings')
602 bld.install_files('${DATADIR}/ardour3/icons', 'icons/*.png')
603 bld.install_files('${DATADIR}/ardour3/pixmaps', 'pixmaps/*.xpm')
604 bld.install_files('${DATADIR}/ardour3', 'splash.png')
606 # Default UI configuration
607 bld.install_files('${SYSCONFDIR}/ardour3', 'ardour3_ui_default.conf')
608 # Generic widget style mappings
609 bld.install_files('${SYSCONFDIR}/ardour3', 'ardour3_widgets.rc')
611 # Default export stuff
612 bld.install_files('${SYSCONFDIR}/ardour3/export', 'export/*.format')
615 if bld.env['ENABLE_NLS']:
616 mo_files = bld.path.ant_glob ('po/*.mo')
618 lang = os.path.basename (mo).replace ('.mo', '')
619 bld.install_as (os.path.join(bld.env['PREFIX'], 'share', 'locale',
620 lang, 'LC_MESSAGES', APPNAME + '.mo'),
624 autowaf.build_i18n(bld, srcdir, 'gtk2_ardour', APPNAME, gtk2_ardour_sources)