fix platform portability issues caused by use of shell cp(1) command and perl script
[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 copyfile (task):
369     src = task.inputs[0].abspath()
370     tgt = task.outputs[0].abspath()
371     shutil.copy2 (src, tgt)
372
373 def build(bld):
374
375     VERSION = "%s.%s" % (bld.env['MAJOR'], bld.env['MINOR'])
376
377     if bld.is_defined('WINDOWS_VST_SUPPORT'):
378         # If we require VST support we build a stub main() and the FST library
379         # here using winegcc, and link it to the GTK front-end library
380         obj = bld(features = 'cxx c cxxprogram wine')
381         obj.source = '''
382                 ../libs/fst/fst.c
383                 ../libs/fst/fstinfofile.c
384                 ../libs/fst/vsti.c
385                 ../libs/fst/vstwin.c
386                 ../vst/winmain.c
387         '''
388         obj.use          = [ 'libpbd',
389                              'libmidipp',
390                              'libtaglib',
391                              'libardour',
392                              'libardour_cp',
393                              'libtimecode',
394                              'libmidipp',
395                              'libgtk2_ardour',
396                              'libgtkmm2ext',
397                              'libtaglib']
398         obj.target = 'ardour-' + bld.env['VERSION'] + '-vst.exe.so'
399         obj.includes  = [ '../libs/fst', '.' ]
400         obj.linkflags = ['-mwindows', '-Wl,--export-dynamic']
401         obj.defines = ['_POSIX_SOURCE', 'USE_WS_PREFIX']
402         obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
403         # end of the wine executable
404
405         # now the shared library containing the GTK GUI for ardour
406         obj = bld (features = 'cxx c cxxshlib')
407         obj.source    = gtk2_ardour_sources
408         obj.includes  = [ '../libs/fst', '.' ]
409         obj.name      = 'libgtk2_ardour'
410         obj.target    = 'gtk2_ardour'
411     else:
412         # just the normal executable version of the GTK GUI
413         obj = bld(features = 'cxx c cxxprogram')
414         obj.source    = gtk2_ardour_sources
415         obj.target = 'ardour-' + bld.env['VERSION']
416         obj.includes = ['.']
417         obj.use      = [ 'libpbd',
418                          'libardour',
419                          'libardour_cp',
420                          'libtimecode',
421                          'libmidipp',
422                          'libgtk2_ardour',
423                          'libgtkmm2ext',
424                        ]
425
426     # continue with setup of obj, which could be a shared library
427     # or an executable.
428
429     obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
430     obj.uselib       = 'UUID FLAC FONTCONFIG GLIBMM GTHREAD GTK OGG CURL DL'
431     obj.uselib       += ' GTKMM GNOMECANVASMM GNOMECANVAS FFTW3F'
432     obj.uselib       += ' AUDIOUNITS OSX GTKOSX LO '
433
434     if bld.env['build_target'] == 'mingw':
435         if bld.env['DEBUG'] == False:
436             obj.linkflags = ['-mwindows']
437
438     if bld.is_defined('USE_EXTERNAL_LIBS'):
439         obj.uselib += ' TAGLIB'
440     else:
441         obj.use.append('libtaglib')
442
443     if sys.platform == 'darwin':
444         obj.use += ' libappleutility'
445     obj.defines     = [
446         'PACKAGE="' + I18N_PACKAGE + '"',
447         'VERSIONSTRING="' + bld.env['VERSION'] + '"',
448         'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
449         'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
450         'LOCALEDIR="' + os.path.join(os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
451         'PROGRAM_NAME="' + bld.env['PROGRAM_NAME'] + '"'
452         ]
453     obj.includes += ['../libs']
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         obj.use += [ 'X11' ]
466         
467     if bld.is_defined('LXVST_SUPPORT'):
468         obj.source += [ 'linux_vst_gui_support.cc', 'lxvst_plugin_ui.cc' ]
469         obj.defines += [ 'LXVST_SUPPORT' ]
470         obj.use += [ 'X11' ]
471
472     if bld.is_defined('WINDOWS_VST_SUPPORT') or bld.is_defined('LXVST_SUPPORT'):
473         obj.source += [ 'vst_plugin_ui.cc' ]
474         
475     if bld.is_defined('PHONE_HOME'):
476         obj.defines += [ 'PHONE_HOME' ]
477
478     if bld.is_defined('HAVE_COREAUDIO'):
479         TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cc']
480         obj.source += [ 'cocoacarbon.mm' ]
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['LIBDIR']),
491             'DATADIR'        : os.path.normpath(bld.env['DATADIR']),
492             'SYSCONFDIR'     : os.path.normpath(bld.env['SYSCONFDIR']),
493             'LIBS'           : 'build/libs',
494             'VERSION'        : bld.env['VERSION'],
495             'EXECUTABLE'     : 'build/gtk2_ardour/ardour-' + 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     font_sizes      = {}
531     base_font       = ""
532
533     # Set up font sizes
534     if bld.is_defined('GTKOSX'): # OS X fonts
535         basefont = ""
536         font_sizes = {
537                 'SMALLER' : '9',
538                 'SMALL' : '10',
539                 'NORMAL' : '11',
540                 'BIG' : '13',
541                 'BIGGER' : '17',
542                 'LARGE' : '18',
543                 'LARGER' : '28',
544                 'HUGER' : '36',
545                 'MASSIVE' : '60',
546         }
547         
548         # There is no acceptable monospace font available on older versions of OS X
549         # and no API on those versions to load TTF files that will work with 
550         # GTK/fontconfig/pango.
551         #
552         # In addition, the ArdourMono font gets clipped for some reason on OS X
553         #
554         # Moreover, Lucida Grande just seems to work even though it is not monospace
555         # so just use it.
556         #
557         font_names = {
558             'MONOSPACE' : 'Lucida Grande',
559         }
560     else: # Linux/X11 fonts
561         basefont = '' # unspecified - use system defaults
562         font_sizes = {
563                 'SMALLER' : '8',
564                 'SMALL' : '9',
565                 'NORMAL' : '10',
566                 'BIG' : '14',
567                 'BIGGER' : '17',
568                 'LARGE' : '18',
569                 'LARGER' : '24',
570                 'HUGER' : '34',
571                 'MASSIVE' : '60',
572         }
573         font_names = {
574                 'MONOSPACE' : 'ArdourMono',
575         }
576
577     # Set up font substitution dictionary
578     # @FONT_XXXX@
579     for style in ['', 'BOLD', 'ITALIC']:
580         for sizename,points in iter(font_sizes.items()):
581             if (len (style)):
582                 key = "_".join (['FONT',style,sizename])
583                 fontstyle = " ".join ([basefont,style.lower(),points])
584             else:
585                 key = "_".join (['FONT',sizename])
586                 fontstyle = " ".join ([basefont,points])
587
588             dark_rc_subst_dict[key] = fontstyle
589             light_rc_subst_dict[key] = fontstyle
590
591     # @FONT_SIZE_XXXX@
592     for sizename,points in iter(font_sizes.items()):
593             key = "_".join (['FONT_SIZE',sizename])
594             dark_rc_subst_dict[key] = points
595             light_rc_subst_dict[key] = points
596
597     # various font names, eg @BOLD_MONOSPACE@
598     for font_sym,text in iter(font_names.items()):
599         key = font_sym
600         dark_rc_subst_dict[key] = text
601         light_rc_subst_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 = 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 = '${SYSCONFDIR}/ardour3'
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 = '${SYSCONFDIR}/ardour3'
665
666     # Menus
667     menus_argv = []
668     if bld.is_defined('GTKOSX'):
669         menus_argv = [ '-E', '-P', '-DGTKOSX' ]
670     else:
671         menus_argv = [ '-E', '-P' ]
672
673     obj = bld(features = 'command-output')
674     obj.command = 'cpp'
675     obj.command_is_external = True
676     obj.no_inputs = True
677     obj.argv = menus_argv
678     obj.stdin = 'ardour.menus.in'
679     obj.stdout = 'ardour.menus'
680     obj.dep_vars = ['GTKOSX']
681     bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
682                       'ardour.menus')
683
684     # Keybindings
685
686     # 'SAE-de-keypad', 'SAE-de-nokeypad', 'SAE-us-keypad',
687     # 'SAE-us-nokeypad', 'ergonomic-us'
688
689     #
690     # explicitly state the use of perl here so that it works on windows too
691     # 
692     a_rule = 'perl ../tools/fmt-bindings --platform="%s" --winkey="%s" --accelmap <${SRC} >${TGT}' % (sys.platform, bld.env['WINDOWS_KEY'] )
693     for b in [ 'mnemonic-us' ] :
694         obj = bld(
695             target = b + '.bindings',
696             source = b + '.bindings.in',
697             rule = a_rule
698             )
699         obj.install_path = os.path.join(bld.env['SYSCONFDIR'], 'ardour3')
700
701     # not modified at present
702     bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
703                       'step_editing.bindings')
704     bld.install_files(os.path.join(bld.env['SYSCONFDIR'], 'ardour3'),
705                       'mixer.bindings')
706
707     # Icons/Images
708     bld.install_files('${DATADIR}/ardour3/icons', bld.path.ant_glob('icons/*.png'))
709     bld.install_files('${DATADIR}/ardour3/pixmaps', bld.path.ant_glob('pixmaps/*.xpm'))
710     bld.install_files('${DATADIR}/ardour3', 'splash.png')
711     bld.install_files('${DATADIR}/ardour3', 'ArdourMono.ttf')
712
713     # Default UI configuration
714     bld.install_files('${SYSCONFDIR}/ardour3', 'ardour3_ui_default.conf')
715
716     # Default export stuff
717     bld.install_files('${SYSCONFDIR}/ardour3/export', bld.path.ant_glob('export/*.format'))
718
719     # i18n
720     if bld.is_defined('ENABLE_NLS'):
721         mo_files = bld.path.ant_glob('po/*.mo')
722         for mo in mo_files:
723             lang = os.path.basename(mo.srcpath()).replace('.mo', '')
724             bld.install_as(os.path.join(bld.env['PREFIX'], 'share', 'locale',
725                                         lang, 'LC_MESSAGES', I18N_PACKAGE + '.mo'),
726                            mo)
727
728 def i18n(bld):
729     autowaf.build_i18n(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
730                        'Paul Davis')
731
732 def i18n_pot(bld):
733     autowaf.build_i18n_pot(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
734                        'Paul Davis')
735
736 def i18n_po(bld):
737     autowaf.build_i18n_po(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
738                        'Paul Davis')
739
740 def i18n_mo(bld):
741     autowaf.build_i18n_mo(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
742                        'Paul Davis')