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