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