fix [git] version header file creation for old python
[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     bak = conf.env['define_key']
285     conf.define('VERSIONSTRING', str (conf.env['VERSION']))
286     conf.env['define_key'] = ['VERSIONSTRING']
287     conf.write_config_header('gtk2ardour-version.h')
288     conf.env['define_key'] = bak;
289
290     # Boost headers
291     autowaf.check_header(conf, 'cxx', 'boost/shared_ptr.hpp')
292     autowaf.check_header(conf, 'cxx', 'boost/weak_ptr.hpp')
293
294 # Add a waf `feature' to allow compilation of things using winegcc
295 from waflib.TaskGen import feature
296 @feature("wine")
297 def set_winegcc(self):
298     self.env.LINK_CXX = self.env.LINK_CC = 'wineg++'
299     self.env.CC = 'winegcc'
300
301 def _doPyp(infileName, deps = False):
302     outStr = ''
303     out = []
304     re_spaces = re.compile("\s+")
305
306     if infileName == '-':
307         fd = sys.stdin
308     else:
309         fd = open(infileName)
310     inLines = fd.readlines()
311     if fd != sys.stdin:
312         fd.close()
313         
314
315     for line in inLines:
316         bits = re_spaces.split(line)
317         if bits[0] == '##include':
318             incName = bits[1]
319             if (deps):
320                 out += [ incName ]
321             else:
322                 # assume included file comes from same place as source file
323                 incName = os.path.join (os.path.dirname (infileName), incName);
324                 outStr += _doPyp(incName)
325         else:
326             if not deps:
327                 outStr += line
328
329     # done
330     if deps:
331         return out
332     else:
333         return outStr
334
335 def include_processor(task):
336     infileName = task.inputs[0].srcpath()
337     outfileName = os.path.join(out, task.outputs[0].bldpath())
338     fdOut = open (outfileName, "w")
339     fdOut.write (_doPyp(infileName))
340     fdOut.close ()
341
342
343 def build_color_scheme(path, prefix):
344     f = open (path, 'r')
345     color_scheme = ''
346     for line in f:
347         if re.search ('^#@color', line):
348             line.strip() # remove newline
349             words = line.split()
350             if len(color_scheme):
351                 color_scheme += ';'
352             color_scheme += prefix
353             color_scheme += '_'
354             color_scheme += words[1]
355             color_scheme += ':'
356             color_scheme += words[2]
357     f.close()
358     return color_scheme
359
360 def build(bld):
361
362     VERSION = "%s.%s" % (bld.env['MAJOR'], bld.env['MINOR'])
363
364     if bld.is_defined('WINDOWS_VST_SUPPORT') and bld.env['build_target'] != 'mingw':
365         # Windows VST support w/wine
366         # If we require VST support we build a stub main() and the FST library
367         # here using winegcc, and link it to the GTK front-end library
368         obj = bld (features = 'cxx c cxxprogram wine')
369         obj.source = (
370             '../libs/fst/vstwin.c',
371             '../vst/winmain.c',
372             )
373         #
374         # XXX do we really need to explicitly link to all of these for the wine executable?
375         #
376         obj.use          = [ 'libpbd',
377                              'libmidipp',
378                              'libardour',
379                              'libardour_cp',
380                              'libtimecode',
381                              'libmidipp',
382                              'libgtk2_ardour',
383                              'libgtkmm2ext',
384                              'libcanvas'
385                              ]
386         obj.target = 'ardour-' + str (bld.env['VERSION']) + '-vst.exe.so'
387         obj.includes  = [ '../libs/fst', '.' ]
388         obj.linkflags = ['-mwindows', '-Wl,--export-dynamic']
389         obj.defines = ['_POSIX_SOURCE', 'USE_WS_PREFIX']
390         obj.install_path = bld.env['DLLDIR']
391         # end of the wine executable
392
393         # now the shared library containing the GTK GUI for ardour
394         obj = bld (features = 'cxx c cxxshlib')
395         obj.source    = gtk2_ardour_sources
396         obj.includes  = [ '../libs/fst', '.' ]
397         obj.name      = 'libgtk2_ardour'
398         obj.target    = 'gtk2_ardour'
399     else:
400         # just the normal executable version of the GTK GUI
401         obj = bld (features = 'cxx c cxxprogram')
402         obj.source    = gtk2_ardour_sources
403         obj.target = 'ardour-' + str (bld.env['VERSION'])
404         obj.includes = ['.']
405         obj.ldflags = ['-no-undefined']
406
407         if bld.is_defined('WINDOWS_VST_SUPPORT'):
408         # Windows VST support mingw
409             obj.source += [ '../vst/winmain.c' ]
410             obj.includes += [ '../libs/fst' ]
411
412     # at this point, "obj" refers to either the normal native executable
413     # OR the shared library built for use with wine on linux.
414
415     obj.use      = [ 'libpbd',
416                      'libardour',
417                      'libardour_cp',
418                      'libtimecode',
419                      'libmidipp',
420                      'libgtkmm2ext',
421                      'libcanvas',
422                      ]
423
424     obj.defines = [
425         'PACKAGE="' + I18N_PACKAGE + '"',
426         'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
427         'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
428         'LOCALEDIR="' + os.path.join(os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
429         ]
430     obj.install_path = bld.env['DLLDIR']
431     obj.uselib       = 'UUID FLAC FONTCONFIG GLIBMM GTHREAD GTK OGG CURL DL'
432     obj.uselib       += ' GTKMM CANVAS FFTW3F'
433     obj.uselib       += ' AUDIOUNITS OSX GTKOSX LO '
434     obj.uselib       += ' TAGLIB '
435
436     if sys.platform == 'darwin':
437         obj.uselib += ' AUDIOUNITS OSX GTKOSX'
438         obj.use    += ' libappleutility'
439         obj.source += [ 'cocoacarbon.mm', 'bundle_env_cocoa.cc' ]
440     elif bld.env['build_target'] == 'mingw':
441         obj.source += [ 'bundle_env_mingw.cc' ]
442     else:
443         obj.source += [ 'bundle_env_linux.cc' ]
444
445     obj.includes += ['../libs']
446
447     if bld.env['build_target'] == 'mingw':
448         if bld.env['DEBUG'] == False:
449             obj.linkflags = ['-mwindows']
450
451     if bld.is_defined('HAVE_SUIL'):
452         obj.source += [ 'lv2_plugin_ui.cc' ]
453         obj.use += [ 'SUIL' ]
454
455     if bld.is_defined('NEED_INTL'):
456         obj.linkflags = ' -lintl'
457
458     if bld.is_defined('WINDOWS_VST_SUPPORT'):
459         obj.source += [ 'windows_vst_plugin_ui.cc' ]
460         obj.defines += [ 'WINDOWS_VST_SUPPORT' ]
461         if bld.env['build_target'] != 'mingw':
462             obj.use += [ 'X11' ]
463         
464     if bld.is_defined('LXVST_SUPPORT'):
465         obj.source += [ 'linux_vst_gui_support.cc', 'lxvst_plugin_ui.cc' ]
466         obj.defines += [ 'LXVST_SUPPORT' ]
467         obj.use += [ 'X11' ]
468
469     if bld.is_defined('WINDOWS_VST_SUPPORT') or bld.is_defined('LXVST_SUPPORT'):
470         obj.source += [ 'vst_plugin_ui.cc' ]
471         
472     if bld.is_defined('PHONE_HOME'):
473         obj.defines += [ 'PHONE_HOME' ]
474
475     if bld.is_defined('HAVE_COREAUDIO'):
476         TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cc']
477         obj.use += ' libappleutility '
478
479     if bld.is_defined('AUDIOUNIT_SUPPORT'):
480         obj.source += [ 'au_pluginui.mm' ]
481
482     # Wrappers
483
484     wrapper_subst_dict = {
485             'INSTALL_PREFIX' : bld.env['PREFIX'],
486             'LIBDIR'         : os.path.normpath(bld.env['DLLDIR']),
487             'DATADIR'        : os.path.normpath(bld.env['DATADIR']),
488             'CONFDIR'        : os.path.normpath(bld.env['CONFDIR']),
489             'LIBS'           : 'build/libs',
490             'VERSION'        : bld.env['VERSION'],
491             'EXECUTABLE'     : 'build/gtk2_ardour/ardour-' + str (bld.env['VERSION'])
492     }
493
494     def set_subst_dict(obj, dict):
495         for i in dict:
496             setattr(obj, i, dict[i])
497
498     obj              = bld(features = 'subst', rule= 'chmod 0755 ${TGT}')
499     obj.source       = 'ardev_common.sh.in'
500     obj.target       = 'ardev_common_waf.sh'
501     obj.chmod        = Utils.O755
502     obj.dict         = wrapper_subst_dict
503     set_subst_dict(obj, wrapper_subst_dict)
504
505     obj              = bld(features = 'subst')
506     obj.source       = 'ardour.sh.in'
507     obj.target       = 'ardour3'
508     obj.chmod        = Utils.O755
509     obj.dict         = wrapper_subst_dict
510     obj.install_path = bld.env['BINDIR']
511     set_subst_dict(obj, wrapper_subst_dict)
512
513     if bld.is_defined('WINDOWS_VST_SUPPORT'):
514         obj              = bld(features = 'subst')
515         obj.source       = '../vst/ardourvst.in'
516         obj.target       = 'ardourvst3'
517         obj.chmod        = Utils.O755
518         obj.dict         = wrapper_subst_dict
519         obj.install_path = bld.env['BINDIR']
520         set_subst_dict(obj, wrapper_subst_dict)
521
522     # Font configuration
523
524     dark_rc_subst_dict = {}
525     light_rc_subst_dict = {}
526     ui_conf_dict = {}
527     font_sizes      = {}
528     base_font       = ""
529
530     # Set up font sizes
531     if bld.is_defined('GTKOSX'): # OS X fonts
532         basefont = ""
533         font_sizes = {
534                 'SMALLER' : '9',
535                 'SMALL' : '10',
536                 'NORMAL' : '11',
537                 'BIG' : '13',
538                 'BIGGER' : '17',
539                 'LARGE' : '18',
540                 'LARGER' : '28',
541                 'HUGER' : '36',
542                 'MASSIVE' : '60',
543         }
544         
545         # There is no acceptable monospace font available on older versions of OS X
546         # and no API on those versions to load TTF files that will work with 
547         # GTK/fontconfig/pango.
548         #
549         # In addition, the ArdourMono font gets clipped for some reason on OS X
550         #
551         # Moreover, Lucida Grande just seems to work even though it is not monospace
552         # so just use it.
553         #
554         font_names = {
555             'MONOSPACE' : 'Lucida Grande',
556         }
557     else: # Linux/X11 fonts
558         basefont = '' # unspecified - use system defaults
559         font_sizes = {
560                 'SMALLER' : '8',
561                 'SMALL' : '9',
562                 'NORMAL' : '10',
563                 'BIG' : '14',
564                 'BIGGER' : '17',
565                 'LARGE' : '18',
566                 'LARGER' : '24',
567                 'HUGER' : '34',
568                 'MASSIVE' : '60',
569         }
570         font_names = {
571                 'MONOSPACE' : 'ArdourMono',
572         }
573
574     # Set up font substitution dictionary
575     # @FONT_XXXX@
576     for style in ['', 'BOLD', 'ITALIC']:
577         for sizename,points in iter(font_sizes.items()):
578             if (len (style)):
579                 key = "_".join (['FONT',style,sizename])
580                 fontstyle = " ".join ([basefont,style.lower(),points])
581             else:
582                 key = "_".join (['FONT',sizename])
583                 fontstyle = " ".join ([basefont,points])
584
585             dark_rc_subst_dict[key] = fontstyle
586             light_rc_subst_dict[key] = fontstyle
587             ui_conf_dict[key] = points
588             
589     # @FONT_SIZE_XXXX@
590     for sizename,points in iter(font_sizes.items()):
591             key = "_".join (['FONT_SIZE',sizename])
592             dark_rc_subst_dict[key] = points
593             light_rc_subst_dict[key] = points
594             ui_conf_dict[key] = points
595
596     # various font names, eg @BOLD_MONOSPACE@
597     for font_sym,text in iter(font_names.items()):
598         key = font_sym
599         dark_rc_subst_dict[key] = text
600         light_rc_subst_dict[key] = text
601         ui_conf_dict[key] = text
602
603     # RC files
604     dark_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
605         'gtk2_ardour/ardour3_ui_dark.rc.in', 'ARDOUR_DARK')
606     dark_rc_subst_dict['COLPREFIX'] = 'ARDOUR_DARK'
607     light_rc_subst_dict['COLOR_SCHEME'] = build_color_scheme(
608         'gtk2_ardour/ardour3_ui_light.rc.in', 'ARDOUR_LIGHT')
609     light_rc_subst_dict['COLPREFIX'] = 'ARDOUR_LIGHT'
610
611     obj              = bld(features = 'subst')
612     obj.source       = [ 'ardour3_ui_dark.rc.in' ]
613     obj.target       = 'ardour3_ui_dark.rc.pre'
614     obj.install_path = None
615     set_subst_dict(obj, dark_rc_subst_dict)
616
617     obj              = bld(features = 'subst')
618     obj.source       = [ 'ardour3_ui_light.rc.in' ]
619     obj.target       = 'ardour3_ui_light.rc.pre'
620     obj.install_path = None
621     set_subst_dict(obj, light_rc_subst_dict)
622
623     obj              = bld(features = 'subst')
624     obj.source       = [ 'ardour3_styles.rc.in' ]
625     obj.target       = 'ardour3_dark_styles.rc'
626     obj.install_path = None
627     set_subst_dict(obj, dark_rc_subst_dict)
628
629     obj              = bld(features = 'subst')
630     obj.source       = [ 'ardour3_styles.rc.in' ]
631     obj.target       = 'ardour3_light_styles.rc'
632     obj.install_path = None
633     set_subst_dict(obj, light_rc_subst_dict)
634
635     obj              = bld(features = 'subst')
636     obj.source       = [ 'ardour3_fonts.rc.in' ]
637     obj.target       = 'ardour3_dark_fonts.rc'
638     obj.install_path = None
639     set_subst_dict(obj, dark_rc_subst_dict)
640
641     obj              = bld(features = 'subst')
642     obj.source       = [ 'ardour3_fonts.rc.in' ]
643     obj.target       = 'ardour3_light_fonts.rc'
644     obj.install_path = None
645     set_subst_dict(obj, light_rc_subst_dict)
646
647     obj              = bld(rule = autowaf.copyfile) 
648     obj.source       = [ 'ardour3_widget_list.rc' ]
649     obj.target       = 'ardour3_widgets.rc'
650     obj.install_path = None
651
652     obj = bld (rule = include_processor)
653     obj.source = [ 'ardour3_ui_dark.rc.pre' ]
654     # find and add all ##include dependencies as sources
655     obj.source += _doPyp (bld.path.find_resource ('ardour3_ui_dark.rc.in').srcpath(), True)
656     obj.target = 'ardour3_ui_dark.rc'
657     obj.install_path = bld.env['CONFDIR']
658
659     obj = bld (rule = include_processor)
660     obj.source = [ 'ardour3_ui_light.rc.pre' ]
661     # find and add all ##include dependencies as sources
662     obj.source += _doPyp (bld.path.find_resource ('ardour3_ui_light.rc.in').srcpath(), True)
663     obj.target = 'ardour3_ui_light.rc'
664     obj.install_path = bld.env['CONFDIR']
665
666     obj              = bld(features = 'subst')
667     obj.source       = [ 'ardour3_ui_default.conf.in' ]
668     obj.target       = 'ardour3_ui_default.conf'
669     obj.install_path = None
670     set_subst_dict(obj, ui_conf_dict)
671
672     # Menus
673     menus_argv = []
674     if bld.is_defined('GTKOSX'):
675         menus_argv = [ '-E', '-P', '-DGTKOSX' ]
676     else:
677         menus_argv = [ '-E', '-P' ]
678
679     # always build all versions of the menu definitions
680     # so that we can try them out with different program builds.
681     for program in [ 'ardour', 'trx' ]:
682         obj = bld(features = 'command-output')
683         obj.command = 'cpp'
684         obj.command_is_external = True
685         obj.no_inputs = True
686         obj.argv = menus_argv
687         obj.dep_vars = ['GTKOSX']
688         obj.stdin = program + '.menus.in'
689         obj.stdout = program + '.menus'
690         bld.install_files (bld.env['CONFDIR'], program + '.menus')
691
692     # Keybindings
693
694     # 'SAE-de-keypad', 'SAE-de-nokeypad', 'SAE-us-keypad',
695     # 'SAE-us-nokeypad', 'ergonomic-us'
696
697     #
698     # explicitly state the use of perl here so that it works on windows too
699     # 
700     a_rule = 'perl ../tools/fmt-bindings --platform="%s" --winkey="%s" --accelmap <${SRC} >${TGT}' % (sys.platform, bld.env['WINDOWS_KEY'] )
701     for b in [ 'mnemonic-us' ] :
702         obj = bld(
703             target = b + '.bindings',
704             source = b + '.bindings.in',
705             rule = a_rule
706             )
707         obj.install_path = bld.env['CONFDIR']
708
709     # not modified at present
710     bld.install_files(bld.env['CONFDIR'], 'step_editing.bindings')
711     bld.install_files(bld.env['CONFDIR'], 'mixer.bindings')
712
713     # Icons/Images
714     bld.install_files(os.path.join (bld.env['DATADIR'], 'icons'), bld.path.ant_glob('icons/*.png'))
715     bld.install_files(os.path.join (bld.env['DATADIR'], 'pixmaps'), bld.path.ant_glob('pixmaps/*.xpm'))
716     bld.install_files(bld.env['DATADIR'], 'splash.png')
717     bld.install_files(bld.env['DATADIR'], 'small-splash.png')
718     bld.install_files(bld.env['DATADIR'], 'ArdourMono.ttf')
719
720     # Default UI configuration
721     bld.install_files(bld.env['CONFDIR'], 'ardour3_ui_default.conf')
722
723     # Default export stuff
724     bld.install_files(os.path.join(bld.env['CONFDIR'],' export'), bld.path.ant_glob('export/*.format'))
725
726     # i18n
727     if bld.is_defined('ENABLE_NLS'):
728         mo_files = bld.path.ant_glob('po/*.mo')
729         for mo in mo_files:
730             lang = os.path.basename(mo.srcpath()).replace('.mo', '')
731             bld.install_as(os.path.join(bld.env['PREFIX'], 'share', 'locale',
732                                         lang, 'LC_MESSAGES', I18N_PACKAGE + '.mo'),
733                            mo)
734
735 def i18n(bld):
736     autowaf.build_i18n(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
737                        'Paul Davis')
738
739 def i18n_pot(bld):
740     autowaf.build_i18n_pot(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
741                        'Paul Davis')
742
743 def i18n_po(bld):
744     autowaf.build_i18n_po(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
745                        'Paul Davis')
746
747 def i18n_mo(bld):
748     autowaf.build_i18n_mo(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
749                        'Paul Davis')