move midi scroomer to right of meter and fix alignment
[ardour.git] / gtk2_ardour / wscript
1 #!/usr/bin/env python
2 from waflib.extras import autowaf as autowaf
3 from waflib import Options, TaskGen
4 import waflib.Logs as Logs, waflib.Utils as Utils
5 import os
6 import shutil
7 import sys
8 import re
9 import time
10 from waflib.Task import Task
11
12 I18N_PACKAGE = 'gtk2_ardour3'
13
14 # Mandatory variables
15 top = '.'
16 out = 'build'
17
18 path_prefix = 'gtk2_ardour/'
19
20 gtk2_ardour_sources = [
21         'about.cc',
22         'actions.cc',
23         'add_route_dialog.cc',
24         'ambiguous_file_dialog.cc',
25         'analysis_window.cc',
26         'ardour_button.cc',
27         'ardour_dialog.cc',
28         'ardour_display.cc',
29         'ardour_dropdown.cc',
30         'ardour_knob.cc',
31         'ardour_ui.cc',
32         'ardour_ui2.cc',
33         'ardour_ui_dependents.cc',
34         'ardour_ui_dialogs.cc',
35         'ardour_ui_ed.cc',
36         'ardour_ui_mixer.cc',
37         'ardour_ui_options.cc',
38         'ardour_window.cc',
39         'audio_clock.cc',
40         'audio_region_editor.cc',
41         'audio_region_view.cc',
42         'audio_streamview.cc',
43         'audio_time_axis.cc',
44         'automation_controller.cc',
45         'automation_line.cc',
46         'automation_region_view.cc',
47         'automation_streamview.cc',
48         'automation_time_axis.cc',
49         'axis_view.cc',
50         'big_clock_window.cc',
51         'bundle_manager.cc',
52         'button_joiner.cc',
53         'clock_group.cc',
54         'configinfo.cc',
55         'control_point.cc',
56         'control_point_dialog.cc',
57         'curvetest.cc',
58         'debug.cc',
59         'edit_note_dialog.cc',
60         'editing.cc',
61         'editor.cc',
62         'editor_actions.cc',
63         'editor_audio_import.cc',
64         'editor_audiotrack.cc',
65         'editor_canvas.cc',
66         'editor_canvas_events.cc',
67         'editor_component.cc',
68         'editor_cursors.cc',
69         'editor_drag.cc',
70         'editor_route_groups.cc',
71         'editor_export_audio.cc',
72         'editor_group_tabs.cc',
73         'editor_keys.cc',
74         'editor_locations.cc',
75         'editor_markers.cc',
76         'editor_mixer.cc',
77         'editor_mouse.cc',
78         'editor_ops.cc',
79         'editor_regions.cc',
80         'editor_routes.cc',
81         'editor_rulers.cc',
82         'editor_selection.cc',
83         'editor_snapshots.cc',
84         'editor_summary.cc',
85         'editor_tempodisplay.cc',
86         'editor_timefx.cc',
87         'engine_dialog.cc',
88         'enums.cc',
89         'export_channel_selector.cc',
90         'export_dialog.cc',
91         'export_file_notebook.cc',
92         'export_filename_selector.cc',
93         'export_format_dialog.cc',
94         'export_format_selector.cc',
95         'export_preset_selector.cc',
96         'export_timespan_selector.cc',
97         'fft.cc',
98         'fft_graph.cc',
99         'fft_result.cc',
100         'sfdb_freesound_mootcher.cc',
101         'gain_meter.cc',
102         'generic_pluginui.cc',
103         'ghostregion.cc',
104         'global_port_matrix.cc',
105         'group_tabs.cc',
106         'gtk_pianokeyboard.c',
107         'gui_object.cc',
108         'insert_time_dialog.cc',
109         'interthread_progress_window.cc',
110         'io_selector.cc',
111         'hit.cc',
112         'keyboard.cc',
113         'keyeditor.cc',
114         'latency_gui.cc',
115         'led.cc',
116         'level_meter.cc',
117         'location_ui.cc',
118         'main.cc',
119         'main_clock.cc',
120         'marker.cc',
121         'midi_automation_line.cc',
122         'midi_channel_dialog.cc',
123         'midi_channel_selector.cc',
124         'midi_cut_buffer.cc',
125         'midi_export_dialog.cc',
126         'midi_list_editor.cc',
127         'midi_port_dialog.cc',
128         'midi_region_view.cc',
129         'midi_scroomer.cc',
130         'midi_selection.cc',
131         'midi_streamview.cc',
132         'midi_time_axis.cc',
133         'midi_tracer.cc',
134         'midi_velocity_dialog.cc',
135         'missing_file_dialog.cc',
136         'missing_plugin_dialog.cc',
137         'mixer_actor.cc',
138         'mixer_group_tabs.cc',
139         'mixer_strip.cc',
140         'mixer_ui.cc',
141         'meterbridge.cc',
142         'meter_strip.cc',
143         'meter_patterns.cc',
144         'monitor_section.cc',
145         'mono_panner.cc',
146         'mono_panner_editor.cc',
147         'mouse_cursors.cc',
148         'nag.cc',
149         'new_plugin_preset_dialog.cc',
150         'normalize_dialog.cc',
151         'note.cc',
152         'note_base.cc',
153         'note_player.cc',
154         'nsm.cc',
155         'nsmclient.cc',
156         'option_editor.cc',
157         'opts.cc',
158         'panner2d.cc',
159         'panner_editor.cc',
160         'panner_interface.cc',
161         'panner_ui.cc',
162         'patch_change.cc',
163         'piano_roll_header.cc',
164         'pingback.cc',
165         'playlist_selector.cc',
166         'plugin_eq_gui.cc',
167         'plugin_selector.cc',
168         'plugin_ui.cc',
169         'port_group.cc',
170         'port_insert_ui.cc',
171         'port_matrix.cc',
172         'port_matrix_body.cc',
173         'port_matrix_column_labels.cc',
174         'port_matrix_component.cc',
175         'port_matrix_grid.cc',
176         'port_matrix_labels.cc',
177         'port_matrix_row_labels.cc',
178         'processor_box.cc',
179         'patch_change_dialog.cc',
180         'progress_reporter.cc',
181         'prompter.cc',
182         'public_editor.cc',
183         'quantize_dialog.cc',
184         'rc_option_editor.cc',
185         'region_editor.cc',
186         'region_gain_line.cc',
187         'region_layering_order_editor.cc',
188         'region_selection.cc',
189         'region_view.cc',
190         'return_ui.cc',
191         'rhythm_ferret.cc',
192         'route_group_dialog.cc',
193         'route_group_menu.cc',
194         'route_params_ui.cc',
195         'route_processor_selection.cc',
196         'route_time_axis.cc',
197         'route_ui.cc',
198         'ruler_dialog.cc',
199         'search_path_option.cc',
200         'selection.cc',
201         'send_ui.cc',
202         'session_dialog.cc',
203         'session_import_dialog.cc',
204         'session_metadata_dialog.cc',
205         'session_option_editor.cc',
206         'sfdb_ui.cc',
207         'shuttle_control.cc',
208         'soundcloud_export_selector.cc',
209         'splash.cc',
210         'speaker_dialog.cc',
211         'startup.cc',
212         'step_editor.cc',
213         'step_entry.cc',
214         'stereo_panner.cc',
215         'stereo_panner_editor.cc',
216         'streamview.cc',
217         'strip_silence_dialog.cc',
218         'sys_ex.cc',
219         'tape_region_view.cc',
220         'tempo_dialog.cc',
221         'tempo_lines.cc',
222         'theme_manager.cc',
223         'time_axis_view.cc',
224         'time_axis_view_item.cc',
225         'time_fx_dialog.cc',
226         'time_info_box.cc',
227         'time_selection.cc',
228         'track_selection.cc',
229         'track_view_list.cc',
230         'transpose_dialog.cc',
231         'ui_config.cc',
232         'utils.cc',
233         'verbose_cursor.cc',
234         'version.cc',
235         'visibility_group.cc',
236         'volume_controller.cc',
237         'window_manager.cc',
238 # video-timeline related sources:
239         'video_image_frame.cc',
240         'add_video_dialog.cc',
241         'editor_videotimeline.cc',
242         'video_timeline.cc',
243         'video_monitor.cc',
244         'transcode_ffmpeg.cc',
245         'transcode_video_dialog.cc',
246         'video_server_dialog.cc',
247         'utils_videotl.cc',
248         'export_video_dialog.cc',
249         'export_video_infobox.cc'
250 ]
251
252 def options(opt):
253     autowaf.set_options(opt)
254
255 def configure(conf):
256     conf.load('misc')
257     conf.load('compiler_cxx')
258     # we don't use hard-coded micro versions with ardour, so hard code it to zero
259     autowaf.build_version_files(
260         path_prefix + 'version.h',
261         path_prefix + 'version.cc',
262         'gtk2_ardour', conf.env['MAJOR'], conf.env['MINOR'], 0,
263         '', '')
264     autowaf.configure(conf)
265
266     # TODO: Insert a sanity check for on OS X to ensure CoreAudio is present
267
268     autowaf.check_pkg(conf, 'fftw3f', uselib_store='FFTW3F',
269                       mandatory=True)
270     autowaf.check_pkg(conf, 'flac', uselib_store='FLAC',
271                       atleast_version='1.2.1')
272     autowaf.check_pkg(conf, 'gthread-2.0', uselib_store='GTHREAD',
273                       atleast_version='2.10.1')
274     autowaf.check_pkg(conf, 'gtk+-2.0', uselib_store='GTK',
275                       atleast_version='2.18')
276     autowaf.check_pkg(conf, 'gtkmm-2.4', uselib_store='GTKMM',
277                       atleast_version='2.18')
278     autowaf.check_pkg(conf, 'ogg', uselib_store='OGG', atleast_version='1.1.2')
279     autowaf.check_pkg(conf, 'x11', uselib_store='X11', atleast_version='1.1', mandatory=False)
280     autowaf.check_pkg(conf, 'fontconfig', uselib_store='FONTCONFIG')
281
282     conf.write_config_header('gtk2ardour-config.h', remove=False)
283
284     # Boost headers
285     autowaf.check_header(conf, 'cxx', 'boost/shared_ptr.hpp')
286     autowaf.check_header(conf, 'cxx', 'boost/weak_ptr.hpp')
287
288 # Add a waf `feature' to allow compilation of things using winegcc
289 from waflib.TaskGen import feature
290 @feature("wine")
291 def set_winegcc(self):
292     self.env.LINK_CXX = self.env.LINK_CC = 'wineg++'
293     self.env.CC = 'winegcc'
294
295 def _doPyp(infileName, deps = False):
296     outStr = ''
297     out = []
298     re_spaces = re.compile("\s+")
299
300     if infileName == '-':
301         fd = sys.stdin
302     else:
303         fd = open(infileName)
304     inLines = fd.readlines()
305     if fd != sys.stdin:
306         fd.close()
307         
308
309     for line in inLines:
310         bits = re_spaces.split(line)
311         if bits[0] == '##include':
312             incName = bits[1]
313             if (deps):
314                 out += [ incName ]
315             else:
316                 # assume included file comes from same place as source file
317                 incName = os.path.join (os.path.dirname (infileName), incName);
318                 outStr += _doPyp(incName)
319         else:
320             if not deps:
321                 outStr += line
322
323     # done
324     if deps:
325         return out
326     else:
327         return outStr
328
329 def include_processor(task):
330     infileName = task.inputs[0].srcpath()
331     outfileName = os.path.join(out, task.outputs[0].bldpath())
332     fdOut = open (outfileName, "w")
333     fdOut.write (_doPyp(infileName))
334     fdOut.close ()
335
336
337 def build_color_scheme(path, prefix):
338     f = open (path, 'r')
339     color_scheme = ''
340     for line in f:
341         if re.search ('^#@color', line):
342             line.strip() # remove newline
343             words = line.split()
344             if len(color_scheme):
345                 color_scheme += ';'
346             color_scheme += prefix
347             color_scheme += '_'
348             color_scheme += words[1]
349             color_scheme += ':'
350             color_scheme += words[2]
351     f.close()
352     return color_scheme
353
354 def build(bld):
355
356     VERSION = "%s.%s" % (bld.env['MAJOR'], bld.env['MINOR'])
357
358     if bld.is_defined('WINDOWS_VST_SUPPORT') and bld.env['build_target'] != 'mingw':
359         # Windows VST support w/wine
360         # If we require VST support we build a stub main() and the FST library
361         # here using winegcc, and link it to the GTK front-end library
362         obj = bld (features = 'cxx c cxxprogram wine')
363         obj.source = (
364             '../libs/fst/vstwin.c',
365             '../vst/winmain.c',
366             )
367         #
368         # XXX do we really need to explicitly link to all of these for the wine executable?
369         #
370         obj.use          = [ 'libpbd',
371                              'libmidipp',
372                              'libardour',
373                              'libardour_cp',
374                              'libtimecode',
375                              'libmidipp',
376                              'libgtk2_ardour',
377                              'libgtkmm2ext',
378                              'libcanvas'
379                              ]
380         obj.target = 'ardour-' + str (bld.env['VERSION']) + '-vst.exe.so'
381         obj.includes  = [ '../libs/fst', '.' ]
382         obj.linkflags = ['-mwindows', '-Wl,--export-dynamic']
383         obj.defines = ['_POSIX_SOURCE', 'USE_WS_PREFIX']
384         obj.install_path = bld.env['DLLDIR']
385         # end of the wine executable
386
387         # now the shared library containing the GTK GUI for ardour
388         obj = bld (features = 'cxx c cxxshlib')
389         obj.source    = gtk2_ardour_sources
390         obj.includes  = [ '../libs/fst', '.' ]
391         obj.name      = 'libgtk2_ardour'
392         obj.target    = 'gtk2_ardour'
393     else:
394         # just the normal executable version of the GTK GUI
395         obj = bld (features = 'cxx c cxxprogram')
396         obj.source    = gtk2_ardour_sources
397         obj.target = 'ardour-' + str (bld.env['VERSION'])
398         obj.includes = ['.']
399         obj.ldflags = ['-no-undefined']
400
401         if bld.is_defined('WINDOWS_VST_SUPPORT'):
402         # Windows VST support mingw
403             obj.source += [ '../vst/winmain.c' ]
404             obj.includes += [ '../libs/fst' ]
405
406     # at this point, "obj" refers to either the normal native executable
407     # OR the shared library built for use with wine on linux.
408
409     obj.use      = [ 'libpbd',
410                      'libardour',
411                      'libardour_cp',
412                      'libtimecode',
413                      'libmidipp',
414                      'libgtkmm2ext',
415                      'libcanvas',
416                      ]
417
418     obj.defines = [
419         'PACKAGE="' + I18N_PACKAGE + '"',
420         'VERSIONSTRING="' + str (bld.env['VERSION']) + '"',
421         'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
422         'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
423         'LOCALEDIR="' + os.path.join(os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
424         ]
425     obj.install_path = bld.env['DLLDIR']
426     obj.uselib       = 'UUID FLAC FONTCONFIG GLIBMM GTHREAD GTK OGG CURL DL'
427     obj.uselib       += ' GTKMM CANVAS FFTW3F'
428     obj.uselib       += ' AUDIOUNITS OSX GTKOSX LO '
429     obj.uselib       += ' TAGLIB '
430
431     if sys.platform == 'darwin':
432         obj.uselib += ' AUDIOUNITS OSX GTKOSX'
433         obj.use    += ' libappleutility'
434         obj.source += [ 'cocoacarbon.mm', 'bundle_env_cocoa.cc' ]
435     elif bld.env['build_target'] == 'mingw':
436         obj.source += [ 'bundle_env_mingw.cc' ]
437     else:
438         obj.source += [ 'bundle_env_linux.cc' ]
439
440     obj.includes += ['../libs']
441
442     if bld.env['build_target'] == 'mingw':
443         if bld.env['DEBUG'] == False:
444             obj.linkflags = ['-mwindows']
445
446     if bld.is_defined('HAVE_SUIL'):
447         obj.source += [ 'lv2_plugin_ui.cc' ]
448         obj.use += [ 'SUIL' ]
449
450     if bld.is_defined('NEED_INTL'):
451         obj.linkflags = ' -lintl'
452
453     if bld.is_defined('WINDOWS_VST_SUPPORT'):
454         obj.source += [ 'windows_vst_plugin_ui.cc' ]
455         obj.defines += [ 'WINDOWS_VST_SUPPORT' ]
456         if bld.env['build_target'] != 'mingw':
457             obj.use += [ 'X11' ]
458         
459     if bld.is_defined('LXVST_SUPPORT'):
460         obj.source += [ 'linux_vst_gui_support.cc', 'lxvst_plugin_ui.cc' ]
461         obj.defines += [ 'LXVST_SUPPORT' ]
462         obj.use += [ 'X11' ]
463
464     if bld.is_defined('WINDOWS_VST_SUPPORT') or bld.is_defined('LXVST_SUPPORT'):
465         obj.source += [ 'vst_plugin_ui.cc' ]
466         
467     if bld.is_defined('PHONE_HOME'):
468         obj.defines += [ 'PHONE_HOME' ]
469
470     if bld.is_defined('HAVE_COREAUDIO'):
471         TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cc']
472         obj.use += ' libappleutility '
473
474     if bld.is_defined('AUDIOUNIT_SUPPORT'):
475         obj.source += [ 'au_pluginui.mm' ]
476
477     # Wrappers
478
479     wrapper_subst_dict = {
480             'INSTALL_PREFIX' : bld.env['PREFIX'],
481             'LIBDIR'         : os.path.normpath(bld.env['DLLDIR']),
482             'DATADIR'        : os.path.normpath(bld.env['DATADIR']),
483             'CONFDIR'        : os.path.normpath(bld.env['CONFDIR']),
484             'LIBS'           : 'build/libs',
485             'VERSION'        : bld.env['VERSION'],
486             'EXECUTABLE'     : 'build/gtk2_ardour/ardour-' + str (bld.env['VERSION'])
487     }
488
489     def set_subst_dict(obj, dict):
490         for i in dict:
491             setattr(obj, i, dict[i])
492
493     obj              = bld(features = 'subst', rule= 'chmod 0755 ${TGT}')
494     obj.source       = 'ardev_common.sh.in'
495     obj.target       = 'ardev_common_waf.sh'
496     obj.chmod        = Utils.O755
497     obj.dict         = wrapper_subst_dict
498     set_subst_dict(obj, wrapper_subst_dict)
499
500     obj              = bld(features = 'subst')
501     obj.source       = 'ardour.sh.in'
502     obj.target       = 'ardour3'
503     obj.chmod        = Utils.O755
504     obj.dict         = wrapper_subst_dict
505     obj.install_path = bld.env['BINDIR']
506     set_subst_dict(obj, wrapper_subst_dict)
507
508     if bld.is_defined('WINDOWS_VST_SUPPORT'):
509         obj              = bld(features = 'subst')
510         obj.source       = '../vst/ardourvst.in'
511         obj.target       = 'ardourvst3'
512         obj.chmod        = Utils.O755
513         obj.dict         = wrapper_subst_dict
514         obj.install_path = bld.env['BINDIR']
515         set_subst_dict(obj, wrapper_subst_dict)
516
517     # Font configuration
518
519     dark_rc_subst_dict = {}
520     light_rc_subst_dict = {}
521     ui_conf_dict = {}
522     font_sizes      = {}
523     base_font       = ""
524
525     # Set up font sizes
526     if bld.is_defined('GTKOSX'): # OS X fonts
527         basefont = ""
528         font_sizes = {
529                 'SMALLER' : '9',
530                 'SMALL' : '10',
531                 'NORMAL' : '11',
532                 'BIG' : '13',
533                 'BIGGER' : '17',
534                 'LARGE' : '18',
535                 'LARGER' : '28',
536                 'HUGER' : '36',
537                 'MASSIVE' : '60',
538         }
539         
540         # There is no acceptable monospace font available on older versions of OS X
541         # and no API on those versions to load TTF files that will work with 
542         # GTK/fontconfig/pango.
543         #
544         # In addition, the ArdourMono font gets clipped for some reason on OS X
545         #
546         # Moreover, Lucida Grande just seems to work even though it is not monospace
547         # so just use it.
548         #
549         font_names = {
550             'MONOSPACE' : 'Lucida Grande',
551         }
552     else: # Linux/X11 fonts
553         basefont = '' # unspecified - use system defaults
554         font_sizes = {
555                 'SMALLER' : '8',
556                 'SMALL' : '9',
557                 'NORMAL' : '10',
558                 'BIG' : '14',
559                 'BIGGER' : '17',
560                 'LARGE' : '18',
561                 'LARGER' : '24',
562                 'HUGER' : '34',
563                 'MASSIVE' : '60',
564         }
565         font_names = {
566                 'MONOSPACE' : 'ArdourMono',
567         }
568
569     # Set up font substitution dictionary
570     # @FONT_XXXX@
571     for style in ['', 'BOLD', 'ITALIC']:
572         for sizename,points in iter(font_sizes.items()):
573             if (len (style)):
574                 key = "_".join (['FONT',style,sizename])
575                 fontstyle = " ".join ([basefont,style.lower(),points])
576             else:
577                 key = "_".join (['FONT',sizename])
578                 fontstyle = " ".join ([basefont,points])
579
580             dark_rc_subst_dict[key] = fontstyle
581             light_rc_subst_dict[key] = fontstyle
582             ui_conf_dict[key] = points
583             
584     # @FONT_SIZE_XXXX@
585     for sizename,points in iter(font_sizes.items()):
586             key = "_".join (['FONT_SIZE',sizename])
587             dark_rc_subst_dict[key] = points
588             light_rc_subst_dict[key] = points
589             ui_conf_dict[key] = points
590
591     # various font names, eg @BOLD_MONOSPACE@
592     for font_sym,text in iter(font_names.items()):
593         key = font_sym
594         dark_rc_subst_dict[key] = text
595         light_rc_subst_dict[key] = text
596         ui_conf_dict[key] = text
597
598     # RC files
599     dark_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
600         'gtk2_ardour/ardour3_ui_dark.rc.in', 'ARDOUR_DARK')
601     dark_rc_subst_dict['COLPREFIX'] = 'ARDOUR_DARK'
602     light_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
603         'gtk2_ardour/ardour3_ui_light.rc.in', 'ARDOUR_LIGHT')
604     light_rc_subst_dict['COLPREFIX'] = 'ARDOUR_LIGHT'
605
606     obj              = bld(features = 'subst')
607     obj.source       = [ 'ardour3_ui_dark.rc.in' ]
608     obj.target       = 'ardour3_ui_dark.rc.pre'
609     obj.install_path = None
610     set_subst_dict(obj, dark_rc_subst_dict)
611
612     obj              = bld(features = 'subst')
613     obj.source       = [ 'ardour3_ui_light.rc.in' ]
614     obj.target       = 'ardour3_ui_light.rc.pre'
615     obj.install_path = None
616     set_subst_dict(obj, light_rc_subst_dict)
617
618     obj              = bld(features = 'subst')
619     obj.source       = [ 'ardour3_styles.rc.in' ]
620     obj.target       = 'ardour3_dark_styles.rc'
621     obj.install_path = None
622     set_subst_dict(obj, dark_rc_subst_dict)
623
624     obj              = bld(features = 'subst')
625     obj.source       = [ 'ardour3_styles.rc.in' ]
626     obj.target       = 'ardour3_light_styles.rc'
627     obj.install_path = None
628     set_subst_dict(obj, light_rc_subst_dict)
629
630     obj              = bld(features = 'subst')
631     obj.source       = [ 'ardour3_fonts.rc.in' ]
632     obj.target       = 'ardour3_dark_fonts.rc'
633     obj.install_path = None
634     set_subst_dict(obj, dark_rc_subst_dict)
635
636     obj              = bld(features = 'subst')
637     obj.source       = [ 'ardour3_fonts.rc.in' ]
638     obj.target       = 'ardour3_light_fonts.rc'
639     obj.install_path = None
640     set_subst_dict(obj, light_rc_subst_dict)
641
642     obj              = bld(rule = autowaf.copyfile) 
643     obj.source       = [ 'ardour3_widget_list.rc' ]
644     obj.target       = 'ardour3_widgets.rc'
645     obj.install_path = None
646
647     obj = bld (rule = include_processor)
648     obj.source = [ 'ardour3_ui_dark.rc.pre' ]
649     # find and add all ##include dependencies as sources
650     obj.source += _doPyp (bld.path.find_resource ('ardour3_ui_dark.rc.in').srcpath(), True)
651     obj.target = 'ardour3_ui_dark.rc'
652     obj.install_path = bld.env['CONFDIR']
653
654     obj = bld (rule = include_processor)
655     obj.source = [ 'ardour3_ui_light.rc.pre' ]
656     # find and add all ##include dependencies as sources
657     obj.source += _doPyp (bld.path.find_resource ('ardour3_ui_light.rc.in').srcpath(), True)
658     obj.target = 'ardour3_ui_light.rc'
659     obj.install_path = bld.env['CONFDIR']
660
661     obj              = bld(features = 'subst')
662     obj.source       = [ 'ardour3_ui_default.conf.in' ]
663     obj.target       = 'ardour3_ui_default.conf'
664     obj.install_path = None
665     set_subst_dict(obj, ui_conf_dict)
666
667     # Menus
668     menus_argv = []
669     if bld.is_defined('GTKOSX'):
670         menus_argv = [ '-E', '-P', '-DGTKOSX' ]
671     else:
672         menus_argv = [ '-E', '-P' ]
673
674     # always build all versions of the menu definitions
675     # so that we can try them out with different program builds.
676     for program in [ 'ardour', 'trx' ]:
677         obj = bld(features = 'command-output')
678         obj.command = 'cpp'
679         obj.command_is_external = True
680         obj.no_inputs = True
681         obj.argv = menus_argv
682         obj.dep_vars = ['GTKOSX']
683         obj.stdin = program + '.menus.in'
684         obj.stdout = program + '.menus'
685         bld.install_files (bld.env['CONFDIR'], program + '.menus')
686
687     # Keybindings
688
689     # 'SAE-de-keypad', 'SAE-de-nokeypad', 'SAE-us-keypad',
690     # 'SAE-us-nokeypad', 'ergonomic-us'
691
692     #
693     # explicitly state the use of perl here so that it works on windows too
694     # 
695     a_rule = 'perl ../tools/fmt-bindings --platform="%s" --winkey="%s" --accelmap <${SRC} >${TGT}' % (sys.platform, bld.env['WINDOWS_KEY'] )
696     for b in [ 'mnemonic-us' ] :
697         obj = bld(
698             target = b + '.bindings',
699             source = b + '.bindings.in',
700             rule = a_rule
701             )
702         obj.install_path = bld.env['CONFDIR']
703
704     # not modified at present
705     bld.install_files(bld.env['CONFDIR'], 'step_editing.bindings')
706     bld.install_files(bld.env['CONFDIR'], 'mixer.bindings')
707
708     # Icons/Images
709     bld.install_files(os.path.join (bld.env['DATADIR'], 'icons'), bld.path.ant_glob('icons/*.png'))
710     bld.install_files(os.path.join (bld.env['DATADIR'], 'pixmaps'), bld.path.ant_glob('pixmaps/*.xpm'))
711     bld.install_files(bld.env['DATADIR'], 'splash.png')
712     bld.install_files(bld.env['DATADIR'], 'small-splash.png')
713     bld.install_files(bld.env['DATADIR'], 'ArdourMono.ttf')
714
715     # Default UI configuration
716     bld.install_files(bld.env['CONFDIR'], 'ardour3_ui_default.conf')
717
718     # Default export stuff
719     bld.install_files(os.path.join(bld.env['CONFDIR'],' export'), bld.path.ant_glob('export/*.format'))
720
721     # i18n
722     if bld.is_defined('ENABLE_NLS'):
723         mo_files = bld.path.ant_glob('po/*.mo')
724         for mo in mo_files:
725             lang = os.path.basename(mo.srcpath()).replace('.mo', '')
726             bld.install_as(os.path.join(bld.env['PREFIX'], 'share', 'locale',
727                                         lang, 'LC_MESSAGES', I18N_PACKAGE + '.mo'),
728                            mo)
729
730 def i18n(bld):
731     autowaf.build_i18n(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
732                        'Paul Davis')
733
734 def i18n_pot(bld):
735     autowaf.build_i18n_pot(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
736                        'Paul Davis')
737
738 def i18n_po(bld):
739     autowaf.build_i18n_po(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
740                        'Paul Davis')
741
742 def i18n_mo(bld):
743     autowaf.build_i18n_mo(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
744                        'Paul Davis')