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