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 'volume_controller.cc',
239 autowaf.set_options(opt)
243 conf.load('compiler_cxx')
244 autowaf.build_version_files(
245 path_prefix + 'version.h',
246 path_prefix + 'version.cc',
247 'gtk2_ardour', MAJOR, MINOR, MICRO)
248 autowaf.configure(conf)
250 if re.search ("linux", sys.platform) != None:
251 autowaf.check_pkg(conf, 'alsa', uselib_store='ALSA')
253 # TODO: Insert a sanity check for on OS X to ensure CoreAudio is present
255 autowaf.check_pkg(conf, 'flac', uselib_store='FLAC',
256 atleast_version='1.2.1')
257 autowaf.check_pkg(conf, 'gthread-2.0', uselib_store='GTHREAD',
258 atleast_version='2.10.1')
259 autowaf.check_pkg(conf, 'gtk+-2.0', uselib_store='GTK',
260 atleast_version='2.18')
261 autowaf.check_pkg(conf, 'gtkmm-2.4', uselib_store='GTKMM',
262 atleast_version='2.18')
263 autowaf.check_pkg(conf, 'libgnomecanvas-2.0',
264 uselib_store='GNOMECANVAS', atleast_version='2.30')
265 autowaf.check_pkg(conf, 'libgnomecanvasmm-2.6',
266 uselib_store='GNOMECANVASMM', atleast_version='2.16')
267 autowaf.check_pkg(conf, 'ogg', uselib_store='OGG', atleast_version='1.1.2')
269 conf.write_config_header('gtk2ardour-config.h', remove=False)
272 autowaf.check_header(conf, 'cxx', 'boost/shared_ptr.hpp')
273 autowaf.check_header(conf, 'cxx', 'boost/weak_ptr.hpp')
275 # Add a waf `feature' to allow compilation of things using winegcc
276 from waflib.TaskGen import feature
278 def set_winegcc(self):
279 self.env.LINK_CXX = self.env.LINK_CC = 'wineg++'
280 self.env.CC = 'winegcc'
282 def _doPyp(infileName, deps = False):
285 re_spaces = re.compile("\s+")
287 if infileName == '-':
290 fd = open(infileName)
291 inLines = fd.readlines()
297 bits = re_spaces.split(line)
298 if bits[0] == '##include':
303 # assume included file comes from same place as source file
304 incName = os.path.join (os.path.dirname (infileName), incName);
305 outStr += _doPyp(incName)
316 def include_processor(task):
317 infileName = task.inputs[0].srcpath()
318 outfileName = os.path.join(out, task.outputs[0].bldpath())
319 fdOut = open (outfileName, "w")
320 fdOut.write (_doPyp(infileName))
324 def build_color_scheme(path, prefix):
328 if re.search ('^#@color', line):
329 line.strip() # remove newline
331 if len(color_scheme):
333 color_scheme += prefix
335 color_scheme += words[1]
337 color_scheme += words[2]
342 # GTK front-end; if we're using VST we build this as a shared library,
343 # otherwise it's a normal executabale
344 if bld.is_defined('VST_SUPPORT'):
345 obj = bld(features = 'cxx c cxxshlib')
347 obj = bld(features = 'cxx c cxxprogram')
350 obj.source = gtk2_ardour_sources
351 obj.name = 'gtk2_ardour'
353 if bld.is_defined('VST_SUPPORT'):
354 obj.target = 'gtk2_ardour'
355 obj.includes += ['../libs/fst']
357 obj.target = 'ardour-3.0'
358 obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
359 obj.uselib = 'UUID FLAC GLIBMM GTHREAD GTK OGG ALSA CURL DL'
360 obj.uselib += ' GTKMM GNOMECANVASMM GNOMECANVAS '
361 obj.uselib += ' AUDIOUNITS OSX GTKOSX '
362 obj.use = [ 'libpbd',
369 if sys.platform == 'darwin':
370 obj.use += ' libappleutility'
372 'PACKAGE="gtk2_ardour"',
373 'VERSIONSTRING="' + bld.env['VERSION'] + '"',
374 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
375 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
376 'MODULE_DIR="' + os.path.normpath(bld.env['LIBDIR']) + '"',
377 'LOCALEDIR="' + os.path.join(os.path.normpath(bld.env['DATADIR']),
379 'PROGRAM_NAME="' + bld.env['PROGRAM_NAME'] + '"'
381 obj.includes += ['../libs']
383 if bld.is_defined('HAVE_SUIL'):
384 obj.source += [ 'lv2_plugin_ui.cc' ]
385 obj.uselib += ' SUIL '
387 if bld.is_defined('FREESOUND'):
388 obj.source += [ 'sfdb_freesound_mootcher.cc' ]
390 if bld.is_defined('VST_SUPPORT'):
391 obj.source += [ 'vst_pluginui.cc' ]
392 obj.defines += [ 'VST_SUPPORT' ]
393 bld.env.append ('LINKFLAGS', '-lX11')
395 if bld.is_defined('LXVST_SUPPORT'):
396 obj.source += [ 'lxvst_pluginui.cc' ]
397 obj.defines += [ 'LXVST_SUPPORT' ]
398 obj.linkflags += [ '-lX11' ]
400 if bld.is_defined('PHONE_HOME'):
401 obj.defines += [ 'PHONE_HOME' ]
403 if bld.is_defined('HAVE_COREAUDIO'):
404 TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cc']
405 obj.source += [ 'cocoacarbon.mm', 'au_pluginui.mm' ]
406 obj.use += ' libappleutility '
408 if bld.is_defined('VST_SUPPORT'):
409 # If we require VST support we build a stub main() and the FST library
410 # here using winegcc, and link it to the GTK front-end library
411 obj = bld(features = 'cxx c cxxprogram wine')
414 ../libs/fst/fstinfofile.c
419 obj.includes = '../libs/fst'
420 obj.target = 'ardour-3.0-vst'
421 obj.linkflags += ['-mwindows', '-Wl,--export-dynamic', '-lpthread']
422 obj.defines = ['_POSIX_SOURCE', 'USE_WS_PREFIX']
424 obj.use = ['libpbd','libmidipp','libtaglib','libardour',
425 'libardour_cp','libgtkmm2ext','libtaglib',
430 wrapper_subst_dict = {
431 'INSTALL_PREFIX' : bld.env['PREFIX'],
432 'LIBDIR' : os.path.normpath(bld.env['LIBDIR']),
433 'LIBS' : 'build/libs',
435 'EXECUTABLE' : 'build/gtk2_ardour/ardour-3.0'
438 def set_subst_dict(obj, dict):
440 setattr(obj, i, dict[i])
442 obj = bld(features = 'subst', rule= 'chmod 0755 ${TGT}')
443 obj.source = 'ardev_common.sh.in'
444 obj.target = 'ardev_common_waf.sh'
445 obj.chmod = Utils.O755
446 obj.dict = wrapper_subst_dict
447 set_subst_dict(obj, wrapper_subst_dict)
449 obj = bld(features = 'subst')
450 obj.source = 'ardour.sh.in'
451 obj.target = 'ardour3'
452 obj.chmod = Utils.O755
453 obj.dict = wrapper_subst_dict
454 obj.install_path = bld.env['BINDIR']
455 set_subst_dict(obj, wrapper_subst_dict)
459 dark_rc_subst_dict = {}
460 light_rc_subst_dict = {}
465 if bld.is_defined('GTKOSX'): # OS X fonts
466 basefont = "Lucida Grande"
479 else: # Linux/X11 fonts
480 basefont = '' # unspecified - use system defaults
494 # Set up font substitution dictionary
496 for style in ['', 'BOLD', 'ITALIC']:
497 for sizename,points in iter(font_sizes.items()):
499 key = "_".join (['FONT',style,sizename])
500 fontstyle = " ".join ([basefont,style.lower(),points])
502 key = "_".join (['FONT',sizename])
503 fontstyle = " ".join ([basefont,points])
505 dark_rc_subst_dict[key] = fontstyle
506 light_rc_subst_dict[key] = fontstyle
509 for sizename,points in iter(font_sizes.items()):
510 key = "_".join (['FONT_SIZE',sizename])
511 dark_rc_subst_dict[key] = points
512 light_rc_subst_dict[key] = points
515 dark_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
516 'gtk2_ardour/ardour3_ui_dark.rc.in', 'ARDOUR_DARK')
517 dark_rc_subst_dict['COLPREFIX'] = 'ARDOUR_DARK'
518 light_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
519 'gtk2_ardour/ardour3_ui_light.rc.in', 'ARDOUR_LIGHT')
520 light_rc_subst_dict['COLPREFIX'] = 'ARDOUR_LIGHT'
522 obj = bld(features = 'subst')
523 obj.source = [ 'ardour3_ui_dark.rc.in' ]
524 obj.target = 'ardour3_ui_dark.rc.pre'
525 obj.install_path = None
526 set_subst_dict(obj, dark_rc_subst_dict)
528 obj = bld(features = 'subst')
529 obj.source = [ 'ardour3_ui_light.rc.in' ]
530 obj.target = 'ardour3_ui_light.rc.pre'
531 obj.install_path = None
532 set_subst_dict(obj, light_rc_subst_dict)
534 obj = bld(features = 'subst')
535 obj.source = [ 'ardour3_styles.rc.in' ]
536 obj.target = 'ardour3_dark_styles.rc'
537 obj.install_path = None
538 set_subst_dict(obj, dark_rc_subst_dict)
540 obj = bld(features = 'subst')
541 obj.source = [ 'ardour3_styles.rc.in' ]
542 obj.target = 'ardour3_light_styles.rc'
543 obj.install_path = None
544 set_subst_dict(obj, light_rc_subst_dict)
546 obj = bld(features = 'subst')
547 obj.source = [ 'ardour3_fonts.rc.in' ]
548 obj.target = 'ardour3_dark_fonts.rc'
549 obj.install_path = None
550 set_subst_dict(obj, dark_rc_subst_dict)
552 obj = bld(features = 'subst')
553 obj.source = [ 'ardour3_fonts.rc.in' ]
554 obj.target = 'ardour3_light_fonts.rc'
555 obj.install_path = None
556 set_subst_dict(obj, light_rc_subst_dict)
558 obj = bld(rule = 'cp ${SRC} ${TGT}')
559 obj.source = [ 'ardour3_widget_list.rc' ]
560 obj.target = 'ardour3_widgets.rc'
561 obj.install_path = None
563 obj = bld (rule = include_processor)
564 obj.source = [ 'ardour3_ui_dark.rc.pre' ]
565 # find and add all ##include dependencies as sources
566 obj.source += _doPyp (bld.path.find_resource ('ardour3_ui_dark.rc.in').srcpath(), True)
567 obj.target = 'ardour3_ui_dark.rc'
568 obj.install_path = '${SYSCONFDIR}/ardour3'
570 obj = bld (rule = include_processor)
571 obj.source = [ 'ardour3_ui_light.rc.pre' ]
572 # find and add all ##include dependencies as sources
573 obj.source += _doPyp (bld.path.find_resource ('ardour3_ui_light.rc.in').srcpath(), True)
574 obj.target = 'ardour3_ui_light.rc'
575 obj.install_path = '${SYSCONFDIR}/ardour3'
579 if bld.is_defined('GTKOSX'):
580 menus_argv = [ '-E', '-P', '-DGTKOSX' ]
582 menus_argv = [ '-E', '-P' ]
583 obj = bld(features = 'command-output')
585 obj.command_is_external = True
587 obj.argv = menus_argv
588 obj.stdin = 'ardour.menus.in'
589 obj.stdout = 'ardour.menus'
590 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
595 # 'SAE-de-keypad', 'SAE-de-nokeypad', 'SAE-us-keypad',
596 # 'SAE-us-nokeypad', 'ergonomic-us'
598 for b in [ 'mnemonic-us' ] :
600 target = b + '.bindings',
601 source = b + '.bindings.in',
602 rule = '../tools/fmt-bindings --platform="%s" --winkey="%s" --accelmap <${SRC} >${TGT}' % (sys.platform, bld.env['WINDOWS_KEY'] )
604 obj.install_path = os.path.join(bld.env['SYSCONFDIR'], 'ardour3')
606 # not modified at present
607 bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
608 'step_editing.bindings')
611 bld.install_files('${DATADIR}/ardour3/icons', bld.path.ant_glob('icons/*.png'))
612 bld.install_files('${DATADIR}/ardour3/pixmaps', bld.path.ant_glob('pixmaps/*.xpm'))
613 bld.install_files('${DATADIR}/ardour3', 'splash.png')
615 # Default UI configuration
616 bld.install_files('${SYSCONFDIR}/ardour3', 'ardour3_ui_default.conf')
617 # Generic widget style mappings
618 bld.install_files('${SYSCONFDIR}/ardour3', 'ardour3_widgets.rc')
620 # Default export stuff
621 bld.install_files('${SYSCONFDIR}/ardour3/export', bld.path.ant_glob('export/*.format'))
624 if bld.is_defined('ENABLE_NLS'):
625 mo_files = bld.path.ant_glob ('po/*.mo')
627 lang = os.path.basename (mo).replace ('.mo', '')
628 bld.install_as (os.path.join(bld.env['PREFIX'], 'share', 'locale',
629 lang, 'LC_MESSAGES', APPNAME + '.mo'),
633 autowaf.build_i18n(bld, srcdir, 'gtk2_ardour', APPNAME, gtk2_ardour_sources)