2 from waflib.extras import autowaf as autowaf
3 import waflib.Logs as Logs, waflib.Utils as Utils
10 # Version of this package (even if built as a child)
14 GTK2_ARDOUR_VERSION = "%s.%s.%s" % (MAJOR, MINOR, MICRO)
16 # Variables for 'waf dist'
17 APPNAME = 'gtk2_ardour'
18 VERSION = GTK2_ARDOUR_VERSION
24 path_prefix = 'gtk2_ardour/'
26 gtk2_ardour_sources = [
29 'add_midi_cc_track_dialog.cc',
30 'add_route_dialog.cc',
31 'ambiguous_file_dialog.cc',
36 'ardour_ui_dependents.cc',
37 'ardour_ui_dialogs.cc',
40 'ardour_ui_options.cc',
42 'audio_region_editor.cc',
43 'audio_region_view.cc',
44 'audio_streamview.cc',
46 'automation_controller.cc',
48 'automation_region_view.cc',
49 'automation_streamview.cc',
50 'automation_time_axis.cc',
56 'canvas-note-event.cc',
58 'canvas_patch_change.cc',
59 'canvas-simpleline.c',
60 'canvas-simplerect.c',
66 'control_point_dialog.cc',
72 'edit_note_dialog.cc',
76 'editor_audio_import.cc',
77 'editor_audiotrack.cc',
79 'editor_canvas_events.cc',
80 'editor_component.cc',
83 'editor_route_groups.cc',
84 'editor_export_audio.cc',
85 'editor_group_tabs.cc',
87 'editor_locations.cc',
97 'editor_selection.cc',
98 'editor_snapshots.cc',
100 'editor_tempodisplay.cc',
104 'export_channel_selector.cc',
106 'export_file_notebook.cc',
107 'export_filename_selector.cc',
108 'export_format_dialog.cc',
109 'export_format_selector.cc',
110 'export_preset_selector.cc',
111 'export_timespan_selector.cc',
116 'generic_pluginui.cc',
118 'global_port_matrix.cc',
120 'gtk-custom-hruler.c',
121 'gtk-custom-ruler.c',
122 'gtk_pianokeyboard.c',
124 'insert_time_dialog.cc',
125 'interthread_progress_window.cc',
136 'midi_automation_line.cc',
137 'midi_channel_dialog.cc',
138 'midi_channel_selector.cc',
139 'midi_cut_buffer.cc',
140 'midi_list_editor.cc',
141 'midi_port_dialog.cc',
142 'midi_region_view.cc',
144 'midi_streamview.cc',
147 'missing_file_dialog.cc',
148 'missing_plugin_dialog.cc',
149 'mixer_group_tabs.cc',
152 'monitor_section.cc',
156 'new_plugin_preset_dialog.cc',
157 'normalize_dialog.cc',
163 'piano_roll_header.cc',
164 'playlist_selector.cc',
166 'plugin_selector.cc',
171 'port_matrix_body.cc',
172 'port_matrix_column_labels.cc',
173 'port_matrix_component.cc',
174 'port_matrix_grid.cc',
175 'port_matrix_labels.cc',
176 'port_matrix_row_labels.cc',
178 'patch_change_dialog.cc',
179 'progress_reporter.cc',
182 'quantize_dialog.cc',
183 'rc_option_editor.cc',
185 'region_gain_line.cc',
186 'region_layering_order_editor.cc',
187 'region_selection.cc',
191 'route_group_dialog.cc',
192 'route_group_menu.cc',
193 'route_params_ui.cc',
194 'route_processor_selection.cc',
195 'route_time_axis.cc',
197 'search_path_option.cc',
200 'session_import_dialog.cc',
201 'session_metadata_dialog.cc',
202 'session_option_editor.cc',
204 'shuttle_control.cc',
214 'strip_silence_dialog.cc',
215 'tape_region_view.cc',
220 'time_axis_view_item.cc',
224 'track_selection.cc',
225 'track_view_list.cc',
226 'transpose_dialog.cc',
231 'volume_controller.cc',
237 autowaf.set_options(opt)
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)
246 conf.check_tool('compiler_cxx')
248 if re.search ("linux", sys.platform) != None:
249 autowaf.check_pkg(conf, 'alsa', uselib_store='ALSA')
251 # TODO: Insert a sanity check for on OS X to ensure CoreAudio is present
253 autowaf.check_pkg(conf, 'flac', uselib_store='FLAC',
254 atleast_version='1.2.1')
255 autowaf.check_pkg(conf, 'gthread', uselib_store='GTHREAD',
256 atleast_version='2.10.1')
257 autowaf.check_pkg(conf, 'gtk+-2.0', uselib_store='GTK',
258 atleast_version='2.18')
259 autowaf.check_pkg(conf, 'gtkmm-2.4', uselib_store='GTKMM',
260 atleast_version='2.18')
261 autowaf.check_pkg(conf, 'libgnomecanvasmm-2.6',
262 uselib_store='GNOMECANVASMM', atleast_version='2.16')
263 autowaf.check_pkg(conf, 'ogg', uselib_store='OGG', atleast_version='1.1.2')
265 conf.write_config_header('gtk2ardour-config.h', remove=False)
268 autowaf.check_header(conf, 'cxx', 'boost/shared_ptr.hpp')
269 autowaf.check_header(conf, 'cxx', 'boost/weak_ptr.hpp')
271 # Add a waf `feature' to allow compilation of things using winegcc
272 from TaskGen import feature
274 def set_winegcc(self):
275 self.env.LINK_CXX = self.env.LINK_CC = 'wineg++'
276 self.env.CC = 'winegcc'
278 #pre-processor-like operation to merge GTK RC files
279 re_spaces = re.compile("\s+")
281 def _doPyp(infileName):
283 Does the main work of preprocessing.
284 Takes 'infileName' as a filename, opens and processes it,
285 and returns the processed file as a string
287 Note - this works recursively.
290 if infileName == '-':
293 fd = file(infileName)
294 inLines = fd.readlines()
299 bits = re_spaces.split(line)
300 if bits[0] == '##include':
302 # assume included file comes from same place as source file
303 incName = os.path.join (os.path.dirname (infileName), incName);
304 outStr += _doPyp(incName)
311 def include_processor(task):
312 infileName = task.inputs[0].srcpath()
313 outfileName = os.path.join(out, task.outputs[0].bldpath())
314 fdOut = file (outfileName, "w")
315 fdOut.write (_doPyp(infileName))
319 def build_color_scheme(path, prefix):
323 if re.search ('^#@color', line):
324 line.strip() # remove newline
326 if len(color_scheme):
328 color_scheme += prefix
330 color_scheme += words[1]
332 color_scheme += words[2]
338 # GTK front-end; if we're using VST we build this as a shared library,
339 # otherwise it's a normal executabale
340 if bld.env['VST_SUPPORT']:
341 obj = bld(features = 'cxx c cxxshlib')
343 obj = bld(features = 'cxx c cxxprogram')
346 obj.source = gtk2_ardour_sources
347 obj.name = 'gtk2_ardour'
349 if bld.env['VST_SUPPORT']:
350 obj.target = 'gtk2_ardour'
351 obj.includes += ['../libs/fst']
353 obj.target = 'ardour-3.0'
354 obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
355 obj.uselib = 'UUID FLAC GLIBMM GTHREAD GTK OGG ALSA CURL DL'
356 obj.uselib += ' GTKMM GNOMECANVASMM '
357 obj.uselib += ' AUDIOUNITS OSX GTKOSX '
358 obj.use = '''libpbd libmidipp libtaglib libardour libardour_cp
359 libgtkmm2ext libtaglib libgnomecanvas-2'''
360 if sys.platform == 'darwin':
361 obj.use += ' libappleutility'
363 'PACKAGE="gtk2_ardour"',
364 'VERSIONSTRING="' + bld.env['VERSION'] + '"',
365 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
366 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
367 'MODULE_DIR="' + os.path.normpath(bld.env['LIBDIR']) + '"',
368 'LOCALEDIR="' + os.path.join(os.path.normpath(bld.env['DATADIR']),
370 'PROGRAM_NAME="' + bld.env['PROGRAM_NAME'] + '"'
372 obj.includes += ['../libs']
374 if bld.env['HAVE_SUIL']:
375 obj.source += [ 'lv2_plugin_ui.cc' ]
376 obj.uselib += ' SUIL '
377 elif bld.env['HAVE_SLV2']:
378 obj.source += [ 'lv2_plugin_ui.cc' ]
379 obj.uselib += ' SLV2 '
381 if bld.env['FREESOUND']:
382 obj.source += [ 'sfdb_freesound_mootcher.cc' ]
384 if bld.env['VST_SUPPORT']:
385 obj.source += [ 'vst_pluginui.cc' ]
386 obj.defines += [ 'VST_SUPPORT' ]
387 bld.env.append ('LINKFLAGS', '-lX11')
389 if bld.env['LXVST_SUPPORT']:
390 obj.source += [ 'lxvst_pluginui.cc' ]
391 obj.defines += [ 'LXVST_SUPPORT' ]
392 obj.linkflags += [ '-lX11' ]
394 if bld.env['PHONE_HOME']:
395 obj.defines += [ 'PHONE_HOME' ]
397 if bld.env['COREAUDIO']:
398 TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cc']
399 obj.source += [ 'cocoacarbon.mm', 'au_pluginui.mm' ]
400 obj.use += ' libappleutility '
402 if bld.env['VST_SUPPORT']:
403 # If we require VST support we build a stub main() and the FST library
404 # here using winegcc, and link it to the GTK front-end library
405 obj = bld(features = 'cxx c cxxprogram wine')
408 ../libs/fst/fstinfofile.c
413 obj.includes = '../libs/fst'
414 obj.target = 'ardour-3.0-vst'
415 obj.linkflags += ['-mwindows', '-Wl,--export-dynamic', '-lpthread']
416 obj.defines = ['_POSIX_SOURCE', 'USE_WS_PREFIX']
418 obj.use = ['libpbd','libmidipp','libtaglib','libardour',
419 'libardour_cp','libgtkmm2ext','libtaglib',
424 wrapper_subst_dict = {
425 'INSTALL_PREFIX' : bld.env['PREFIX'],
426 'LIBDIR' : os.path.normpath(bld.env['LIBDIR']),
427 'LIBS' : 'build/libs',
429 'EXECUTABLE' : 'build/gtk2_ardour/ardour-3.0'
432 def set_subst_dict(obj, dict):
434 setattr(obj, i, dict[i])
436 obj = bld(features = 'subst', rule= 'chmod 0755 ${TGT}')
437 obj.source = 'ardev_common.sh.in'
438 obj.target = 'ardev_common_waf.sh'
439 obj.chmod = Utils.O755
440 obj.dict = wrapper_subst_dict
441 set_subst_dict(obj, wrapper_subst_dict)
443 obj = bld(features = 'subst')
444 obj.source = 'ardour.sh.in'
445 obj.target = 'ardour3'
446 obj.chmod = Utils.O755
447 obj.dict = wrapper_subst_dict
448 obj.install_path = bld.env['BINDIR']
449 set_subst_dict(obj, wrapper_subst_dict)
453 dark_rc_subst_dict = {}
454 light_rc_subst_dict = {}
459 if bld.env['IS_OSX']: # OS X fonts
460 basefont = "Lucida Grande"
473 else: # Linux/X11 fonts
474 basefont = '' # unspecified - use system defaults
488 # Set up font substitution dictionary
490 for style in ['', 'BOLD', 'ITALIC']:
491 for sizename,points in iter(font_sizes.items()):
493 key = "_".join (['FONT',style,sizename])
494 fontstyle = " ".join ([basefont,style.lower(),points])
496 key = "_".join (['FONT',sizename])
497 fontstyle = " ".join ([basefont,points])
499 dark_rc_subst_dict[key] = fontstyle
500 light_rc_subst_dict[key] = fontstyle
503 for sizename,points in iter(font_sizes.items()):
504 key = "_".join (['FONT_SIZE',sizename])
505 dark_rc_subst_dict[key] = points
506 light_rc_subst_dict[key] = points
509 dark_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
510 'gtk2_ardour/ardour3_ui_dark.rc.in', 'ARDOUR_DARK')
511 dark_rc_subst_dict['COLPREFIX'] = 'ARDOUR_DARK'
512 light_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
513 'gtk2_ardour/ardour3_ui_light.rc.in', 'ARDOUR_LIGHT')
514 light_rc_subst_dict['COLPREFIX'] = 'ARDOUR_LIGHT'
516 obj = bld(features = 'subst')
517 obj.source = [ 'ardour3_ui_dark.rc.in' ]
518 obj.target = 'ardour3_ui_dark.rc.pre'
519 obj.install_path = None
520 set_subst_dict(obj, dark_rc_subst_dict)
522 obj = bld(features = 'subst')
523 obj.source = [ 'ardour3_ui_light.rc.in' ]
524 obj.target = 'ardour3_ui_light.rc.pre'
525 obj.install_path = None
526 set_subst_dict(obj, light_rc_subst_dict)
528 obj = bld(features = 'subst')
529 obj.source = [ 'ardour3_styles.rc.in' ]
530 obj.target = 'ardour3_dark_styles.rc'
531 obj.install_path = None
532 set_subst_dict(obj, dark_rc_subst_dict)
534 obj = bld(features = 'subst')
535 obj.source = [ 'ardour3_styles.rc.in' ]
536 obj.target = 'ardour3_light_styles.rc'
537 obj.install_path = None
538 set_subst_dict(obj, light_rc_subst_dict)
540 obj = bld(features = 'subst')
541 obj.source = [ 'ardour3_fonts.rc.in' ]
542 obj.target = 'ardour3_dark_fonts.rc'
543 obj.install_path = None
544 set_subst_dict(obj, dark_rc_subst_dict)
546 obj = bld(features = 'subst')
547 obj.source = [ 'ardour3_fonts.rc.in' ]
548 obj.target = 'ardour3_light_fonts.rc'
549 obj.install_path = None
550 set_subst_dict(obj, light_rc_subst_dict)
552 obj = bld(rule = 'cp ${SRC} ${TGT}')
553 obj.source = [ 'ardour3_widget_list.rc' ]
554 obj.target = 'ardour3_widgets.rc'
555 obj.install_path = None
558 rule = include_processor,
559 source = 'ardour3_ui_dark.rc.pre',
560 target = 'ardour3_ui_dark.rc'
564 rule = include_processor,
565 source = 'ardour3_ui_light.rc.pre',
566 target = 'ardour3_ui_light.rc'
571 if bld.env['GTKOSX']:
572 menus_argv = [ '-E', '-P', '-DGTKOSX' ]
574 menus_argv = [ '-E', '-P' ]
575 obj = bld(features = 'command-output')
577 obj.command_is_external = True
579 obj.argv = menus_argv
580 obj.stdin = 'ardour.menus.in'
581 obj.stdout = 'ardour.menus'
582 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
587 # 'SAE-de-keypad', 'SAE-de-nokeypad', 'SAE-us-keypad',
588 # 'SAE-us-nokeypad', 'ergonomic-us'
590 for b in [ 'mnemonic-us' ] :
592 target = b + '.bindings',
593 source = b + '.bindings.in',
594 rule = '../tools/fmt-bindings --winkey="%s" --accelmap <${SRC} >${TGT}' % bld.env['WINDOWS_KEY']
596 obj.install_path = os.path.join(bld.env['SYSCONFDIR'], 'ardour3')
598 # not modified at present
599 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
600 'step_editing.bindings')
603 bld.install_files('${DATADIR}/ardour3/icons', 'icons/*.png')
604 bld.install_files('${DATADIR}/ardour3/pixmaps', 'pixmaps/*.xpm')
605 bld.install_files('${DATADIR}/ardour3', 'splash.png')
607 # Default UI configuration
608 bld.install_files('${SYSCONFDIR}/ardour3', 'ardour3_ui_default.conf')
609 # Generic widget style mappings
610 bld.install_files('${SYSCONFDIR}/ardour3', 'ardour3_widgets.rc')
612 # Default export stuff
613 bld.install_files('${SYSCONFDIR}/ardour3/export', 'export/*.format')
616 if bld.env['ENABLE_NLS']:
617 mo_files = bld.path.ant_glob ('po/*.mo')
619 lang = os.path.basename (mo).replace ('.mo', '')
620 bld.install_as (os.path.join(bld.env['PREFIX'], 'share', 'locale',
621 lang, 'LC_MESSAGES', APPNAME + '.mo'),
625 autowaf.build_i18n(bld, srcdir, 'gtk2_ardour', APPNAME, gtk2_ardour_sources)