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