Modify Stateful to allow undo to be done using differences in state.
[ardour.git] / gtk2_ardour / wscript
1 #!/usr/bin/env python
2 import autowaf
3 import os
4 import glob
5 import Options
6 import sys
7 import TaskGen
8 import re
9
10 # Version of this package (even if built as a child)
11 MAJOR = '1'
12 MINOR = '0'
13 MICRO = '2'
14 GTK2_ARDOUR_VERSION = "%s.%s.%s" % (MAJOR, MINOR, MICRO)
15
16 # Variables for 'waf dist'
17 APPNAME = 'gtk2_ardour'
18 VERSION = GTK2_ARDOUR_VERSION
19
20 # Mandatory variables
21 srcdir = '.'
22 blddir = 'build'
23
24 path_prefix = 'gtk2_ardour/'
25
26 gtk2_ardour_sources = [
27         'about.cc',
28         'actions.cc',
29         'add_midi_cc_track_dialog.cc',
30         'add_route_dialog.cc',
31         'analysis_window.cc',
32         'ardour_dialog.cc',
33         'ardour_ui.cc',
34         'ardour_ui2.cc',
35         'ardour_ui_dependents.cc',
36         'ardour_ui_dialogs.cc',
37         'ardour_ui_ed.cc',
38         'ardour_ui_mixer.cc',
39         'ardour_ui_options.cc',
40         'audio_clock.cc',
41         'audio_region_editor.cc',
42         'audio_region_view.cc',
43         'audio_streamview.cc',
44         'audio_time_axis.cc',
45         'automation_controller.cc',
46         'automation_line.cc',
47         'automation_region_view.cc',
48         'automation_streamview.cc',
49         'automation_time_axis.cc',
50         'axis_view.cc',
51         'bundle_manager.cc',
52         'cairo_widget.cc',
53         'canvas-flag.cc',
54         'canvas-hit.cc',
55         'canvas-note-event.cc',
56         'canvas-note.cc',
57         'canvas-program-change.cc',
58         'canvas-simpleline.c',
59         'canvas-simplerect.c',
60         'canvas-sysex.cc',
61         'canvas-waveview.c',
62         'configinfo.cc',
63         'control_point.cc',
64         'control_point_dialog.cc',
65         'crossfade_edit.cc',
66         'crossfade_view.cc',
67         'curvetest.cc',
68         'diamond.cc',
69         'editing.cc',
70         'editor.cc',
71         'editor_actions.cc',
72         'editor_audio_import.cc',
73         'editor_audiotrack.cc',
74         'editor_canvas.cc',
75         'editor_canvas_events.cc',
76         'editor_component.cc',
77         'editor_cursors.cc',
78         'editor_drag.cc',
79         'editor_route_groups.cc',
80         'editor_export_audio.cc',
81         'editor_group_tabs.cc',
82         'editor_keyboard.cc',
83         'editor_keys.cc',
84         'editor_locations.cc',
85         'editor_markers.cc',
86         'editor_mixer.cc',
87         'editor_mouse.cc',
88         'editor_nudge.cc',
89         'editor_ops.cc',
90         'editor_regions.cc',
91         'editor_routes.cc',
92         'editor_rulers.cc',
93         'editor_scrub.cc',
94         'editor_selection.cc',
95         'editor_snapshots.cc',
96         'editor_summary.cc',
97         'editor_tempodisplay.cc',
98         'editor_timefx.cc',
99         'engine_dialog.cc',
100         'enums.cc',
101         'export_channel_selector.cc',
102         'export_dialog.cc',
103         'export_file_notebook.cc',
104         'export_filename_selector.cc',
105         'export_format_dialog.cc',
106         'export_format_selector.cc',
107         'export_preset_selector.cc',
108         'export_timespan_selector.cc',
109         'fft.cc',
110         'fft_graph.cc',
111         'fft_result.cc',
112         'gain_meter.cc',
113         'generic_pluginui.cc',
114         'ghostregion.cc',
115         'global_port_matrix.cc',
116         'group_tabs.cc',
117         'gtk-custom-hruler.c',
118         'gtk-custom-ruler.c',
119         'io_selector.cc',
120         'keyboard.cc',
121         'keyeditor.cc',
122         'latency_gui.cc',
123         'level_meter.cc',
124         'lineset.cc',
125         'location_ui.cc',
126         'main.cc',
127         'marker.cc',
128         'midi_channel_selector.cc',
129         'midi_cut_buffer.cc',
130         'midi_list_editor.cc',
131         'midi_port_dialog.cc',
132         'midi_region_view.cc',
133         'midi_scroomer.cc',
134         'midi_streamview.cc',
135         'midi_time_axis.cc',
136         'midi_tracer.cc',
137         'mixer_group_tabs.cc',
138         'mixer_strip.cc',
139         'mixer_ui.cc',
140         'nag.cc',
141         'option_editor.cc',
142         'opts.cc',
143         'panner.cc',
144         'panner2d.cc',
145         'panner_ui.cc',
146         'piano_roll_header.cc',
147         'playlist_selector.cc',
148         'plugin_eq_gui.cc',
149         'plugin_selector.cc',
150         'plugin_ui.cc',
151         'port_group.cc',
152         'port_matrix.cc',
153         'port_matrix_body.cc',
154         'port_matrix_column_labels.cc',
155         'port_matrix_component.cc',
156         'port_matrix_grid.cc',
157         'port_matrix_labels.cc',
158         'port_matrix_row_labels.cc',
159         'processor_box.cc',
160         'prompter.cc',
161         'public_editor.cc',
162         'quantize_dialog.cc',
163         'rc_option_editor.cc',
164         'region_gain_line.cc',
165         'region_selection.cc',
166         'region_view.cc',
167         'return_ui.cc',
168         'rhythm_ferret.cc',
169         'route_group_dialog.cc',
170         'route_group_menu.cc',
171         'route_params_ui.cc',
172         'route_processor_selection.cc',
173         'route_time_axis.cc',
174         'route_ui.cc',
175         'selection.cc',
176         'send_ui.cc',
177         'session_import_dialog.cc',
178         'session_metadata_dialog.cc',
179         'session_option_editor.cc',
180         'sfdb_ui.cc',
181         'simpleline.cc',
182         'simplerect.cc',
183         'splash.cc',
184         'startup.cc',
185         'streamview.cc',
186         'strip_silence_dialog.cc',
187         'tape_region_view.cc',
188         'tempo_dialog.cc',
189         'tempo_lines.cc',
190         'theme_manager.cc',
191         'time_axis_view.cc',
192         'time_axis_view_item.cc',
193         'time_fx_dialog.cc',
194         'time_selection.cc',
195         'track_selection.cc',
196         'track_view_list.cc',
197         'ui_config.cc',
198         'utils.cc',
199         'version.cc',
200         'waveview.cc',
201 ]
202
203 def set_options(opt):
204         autowaf.set_options(opt)
205
206 def configure(conf):
207         autowaf.build_version_files(path_prefix+'version.h', path_prefix+'version.cc',
208                         'gtk2_ardour', MAJOR, MINOR, MICRO)
209         autowaf.configure(conf)
210         conf.check_tool('compiler_cxx')
211
212         if re.search ("linux", sys.platform) != None:
213                 autowaf.check_pkg(conf, 'alsa', uselib_store='ALSA')
214                 #
215                 #       TODO: Insert a sanity check for on OS X
216                 #       to ensure that CoreAudio is present....
217                 #       Really shouldn't these checks be in AutoWaf?
218                 #
219         autowaf.check_pkg(conf, 'flac', uselib_store='FLAC', atleast_version='1.2.1')
220         autowaf.check_pkg(conf, 'gthread', uselib_store='GTHREAD', atleast_version='2.10.1')
221         autowaf.check_pkg(conf, 'gtk+-2.0', uselib_store='GTK', atleast_version='2.12.1')
222         autowaf.check_pkg(conf, 'gtkmm-2.4', uselib_store='GTKMM', atleast_version='2.8')
223         autowaf.check_pkg(conf, 'libgnomecanvas-2.0', uselib_store='GNOMECANVAS', atleast_version='2.0')
224         autowaf.check_pkg(conf, 'libgnomecanvasmm-2.6', uselib_store='GNOMECANVASMM', atleast_version='2.12.0')
225         autowaf.check_pkg(conf, 'ogg', uselib_store='OGG', atleast_version='1.1.2')
226
227         conf.check_tool('misc') # subst tool
228
229         conf.write_config_header('gtk2ardour-config.h')
230         
231         # Boost headers
232         autowaf.check_header(conf, 'boost/shared_ptr.hpp')
233         autowaf.check_header(conf, 'boost/weak_ptr.hpp')
234
235 def build(bld):
236         # Program
237         obj = bld.new_task_gen(features = 'cxx cc cprogram')
238         obj.includes     = ['.']
239         obj.source       = gtk2_ardour_sources
240         obj.name         = 'gtk2_ardour'
241         obj.target       = 'ardour-3.0'
242         obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
243         obj.uselib       = 'UUID FLAC GLIBMM GTHREAD GTK GNOMECANVAS OGG ALSA'
244         obj.uselib       += ' GTKMM GNOMECANVASMM OSX GTKOSX COREAUDIO'
245         obj.uselib_local = '''libpbd libmidipp libtaglib libardour libardour_cp
246                               libgtkmm2ext libtaglib'''
247         obj.cflags       = ['-DPACKAGE="gtk2_ardour"']
248         obj.cxxflags     = ['-DPACKAGE="gtk2_ardour"']
249         obj.cxxflags     += ['-DVERSIONSTRING="' + GTK2_ARDOUR_VERSION + '"']
250         obj.cxxflags     += ['-DDATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"']
251         obj.cxxflags     += ['-DCONFIG_DIR="' + os.path.normpath(bld.env['CONFIGDIR']) + '"']
252         obj.cxxflags     += ['-DMODULE_DIR="' + os.path.normpath(bld.env['LIBDIR']) + '"']
253         obj.cxxflags     += ['-DLOCALEDIR="' + os.path.join(
254                         os.path.normpath(bld.env['DATADIR']), 'locale') + '"']
255
256         if bld.env['HAVE_SLV2']:
257                 obj.source += [ 'lv2_plugin_ui.cc' ]
258                 obj.uselib += ' SLV2 '
259
260         if bld.env['FREESOUND']:
261                 obj.source +=  [ 'sfdb_freesound_mootcher.cc' ]
262
263         if bld.env['VST']:
264                 obj.source += [ 'vst_pluginui.cc' ]
265                 obj.cxxflags += [ '-DVST_SUPPORT' ]
266
267         if bld.env['GTKOSX']:
268                 TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cc']
269                 obj.source += [ 'cocoacarbon.mm' ]
270
271                 if bld.env['AUDIOUNITS']:
272                         obj.source += [ 'au_pluginui.mm' ]
273                         obj.uselib_local += ' libappleutility '
274
275         else:
276                 obj.source += [ 'x11.cc' ]
277
278         # Wrappers
279
280         wrapper_subst_dict = {
281                 'INSTALL_PREFIX' : bld.env['PREFIX'],
282                 'LIBDIR'         : os.path.normpath(bld.env['LIBDIRNAME']),
283                 'LIBS'           : 'build/default/libs',
284                 'VERSION'        : '3.0',
285                 'EXECUTABLE'     : 'build/default/gtk2_ardour/ardour-3.0'
286         }
287
288         obj              = bld.new_task_gen('subst')
289         obj.source       = 'ardev_common.sh.in'
290         obj.target       = 'ardev_common_waf.sh'
291         obj.chmod        = 0755
292         obj.dict         = wrapper_subst_dict
293
294         obj              = bld.new_task_gen('subst')
295         obj.source       = 'ardour.sh.in'
296         obj.target       = 'ardour3'
297         obj.chmod        = 0755
298         obj.dict         = wrapper_subst_dict
299         obj.install_path = bld.env['BINDIR']
300
301         # Font configuration
302
303         font_subst_dict = {}
304         font_sizes      = {}
305         base_font       = ""
306
307         # Set up font sizes
308         if bld.env['IS_OSX']: # OS X fonts
309                 basefont = "Lucida Grande"
310                 font_sizes = {
311                         'TINY' : '7',
312                         'SMALLER' : '9',
313                         'SMALL' : '10',
314                         'NORMAL' : '11',
315                         'BIG' : '12',
316                         'BIGGER' : '14',
317                         'LARGE' : '18',
318                         'LARGER' : '28',
319                         'HUGER' : '36',
320                         'MASSIVE' : '60'
321                 }
322         else: # Linux/X11 fonts
323                 basefont = "sans"
324                 font_sizes = {
325                         'TINY' : '6',
326                         'SMALLER' : '8',
327                         'SMALL' : '9',
328                         'NORMAL' : '10',
329                         'BIG' : '14',
330                         'BIGGER' : '16',
331                         'LARGE' : '18',
332                         'LARGER' : '24',
333                         'HUGER' : '34',
334                         'MASSIVE' : '60'
335                 }
336
337         # Set up font substitution dictionary
338         for style in ['', 'BOLD', 'ITALIC']:
339                 for sizename,points in font_sizes.iteritems():
340                         if (len (style)):
341                                 key = "_".join (['FONT',style,sizename])
342                                 fontstyle = " ".join ([basefont,style.lower(),points])
343                         else:
344                                 key = "_".join (['FONT',sizename])
345                                 fontstyle = " ".join ([basefont,points])
346                                 
347                         font_subst_dict[key] = fontstyle
348
349         # add normal monospace to font dict
350         font_subst_dict['FONT_MONOSPACE_NORMAL'] = 'monospace 10'
351
352         # RC files
353         obj              = bld.new_task_gen('subst')
354         obj.source       = 'ardour3_ui_dark.rc.in'
355         obj.target       = 'ardour3_ui_dark.rc'
356         obj.dict         = font_subst_dict
357         obj.install_path = os.path.join(bld.env['CONFIGDIR'], 'ardour3')
358
359         obj              = bld.new_task_gen('subst')
360         obj.source       = 'ardour3_ui_light.rc.in'
361         obj.target       = 'ardour3_ui_light.rc'
362         obj.dict         = font_subst_dict
363         obj.install_path = os.path.join(bld.env['CONFIGDIR'], 'ardour3')
364
365         obj              = bld.new_task_gen('subst')
366         obj.source       = 'ardour3_ui_dark_sae.rc.in'
367         obj.target       = 'ardour3_ui_dark_sae.rc'
368         obj.dict         = font_subst_dict
369         obj.install_path = os.path.join(bld.env['CONFIGDIR'], 'ardour3')
370
371         obj              = bld.new_task_gen('subst')
372         obj.source       = 'ardour3_ui_light_sae.rc.in'
373         obj.target       = 'ardour3_ui_light_sae.rc'
374         obj.dict         = font_subst_dict
375         obj.install_path = os.path.join(bld.env['CONFIGDIR'], 'ardour3')
376
377         # Menus
378         menus_argv = []
379         if bld.env['GTKOSX']:
380                 menus_argv = [ '-E', '-P', '-DGTKOSX' ]
381         else:
382                 menus_argv = [ '-E', '-P' ]
383         obj = bld.new_task_gen('command-output')
384         obj.command = 'cpp'
385         obj.command_is_external = True
386         obj.no_inputs = True
387         obj.argv = menus_argv
388         obj.stdin = 'ardour.menus.in'
389         obj.stdout = 'ardour.menus'
390         bld.install_files(os.path.join(bld.env['CONFIGDIR'], 'ardour3'), 'ardour.menus')
391
392         # Keybindings
393
394         # 'SAE-de-keypad', 'SAE-de-nokeypad', 'SAE-us-keypad', 'SAE-us-nokeypad', 'ergonomic-us'
395
396         for b in [ 'mnemonic-us' ] :
397                 obj = bld.new_task_gen (
398                         target = b + '.bindings',
399                         source = b + '.bindings.in',
400                         rule = '../tools/fmt-bindings --winkey=%s --accelmap <${SRC} >${TGT}' % bld.env['windows_key']
401                         )
402                 obj.install_path = os.path.join(bld.env['CONFIGDIR'], 'ardour3')
403
404         # Icons/Images
405         bld.install_files('${DATADIR}/ardour3/icons', 'icons/*.png')
406         bld.install_files('${DATADIR}/ardour3/pixmaps', 'pixmaps/*.xpm')
407         bld.install_files('${DATADIR}/ardour3', 'splash.png')
408
409         # Default UI configuration
410         bld.install_files('${CONFIGDIR}/ardour3', 'ardour3_ui_default.conf')
411
412         # i18n
413         if bld.env['ENABLE_NLS']:
414                 mo_files = glob.glob (os.path.join (bld.get_curdir(), 'po/*.mo'))
415                 for mo in mo_files:
416                         lang = os.path.basename (mo).replace ('.mo', '')
417                         bld.install_as (os.path.join (bld.env['PREFIX'], 'share', 'locale', lang, 'LC_MESSAGES', APPNAME + '.mo'), mo)
418
419 def i18n(bld):
420         autowaf.build_i18n (bld, 'gtk2_ardour', APPNAME, gtk2_ardour_sources)
421