first, incomplete pass at step entry dialog, along with various SVG and PNG files...
[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 = '3'
12 MINOR = '0'
13 MICRO = '0'
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         'gtk_pianokeyboard.c',
120         'interthread_progress_window.cc',
121         'io_selector.cc',
122         'keyboard.cc',
123         'keyeditor.cc',
124         'latency_gui.cc',
125         'led.cc',
126         'level_meter.cc',
127         'lineset.cc',
128         'location_ui.cc',
129         'main.cc',
130         'marker.cc',
131         'midi_automation_line.cc',
132         'midi_channel_selector.cc',
133         'midi_cut_buffer.cc',
134         'midi_list_editor.cc',
135         'midi_port_dialog.cc',
136         'midi_region_view.cc',
137         'midi_scroomer.cc',
138         'midi_streamview.cc',
139         'midi_time_axis.cc',
140         'midi_tracer.cc',
141         'mixer_group_tabs.cc',
142         'mixer_strip.cc',
143         'mixer_ui.cc',
144         'monitor_section.cc',
145         'nag.cc',
146         'option_editor.cc',
147         'opts.cc',
148         'panner.cc',
149         'panner2d.cc',
150         'panner_ui.cc',
151         'piano_roll_header.cc',
152         'playlist_selector.cc',
153         'plugin_eq_gui.cc',
154         'plugin_selector.cc',
155         'plugin_ui.cc',
156         'port_group.cc',
157         'port_matrix.cc',
158         'port_matrix_body.cc',
159         'port_matrix_column_labels.cc',
160         'port_matrix_component.cc',
161         'port_matrix_grid.cc',
162         'port_matrix_labels.cc',
163         'port_matrix_row_labels.cc',
164         'processor_box.cc',
165         'prompter.cc',
166         'public_editor.cc',
167         'quantize_dialog.cc',
168         'rc_option_editor.cc',
169         'region_editor.cc',
170         'region_gain_line.cc',
171         'region_selection.cc',
172         'region_view.cc',
173         'return_ui.cc',
174         'rhythm_ferret.cc',
175         'route_group_dialog.cc',
176         'route_group_menu.cc',
177         'route_params_ui.cc',
178         'route_processor_selection.cc',
179         'route_time_axis.cc',
180         'route_ui.cc',
181         'selection.cc',
182         'send_ui.cc',
183         'session_import_dialog.cc',
184         'session_metadata_dialog.cc',
185         'session_option_editor.cc',
186         'sfdb_ui.cc',
187         'simpleline.cc',
188         'simplerect.cc',
189         'splash.cc',
190         'startup.cc',
191         'step_entry.cc',
192         'streamview.cc',
193         'strip_silence_dialog.cc',
194         'tape_region_view.cc',
195         'tempo_dialog.cc',
196         'tempo_lines.cc',
197         'theme_manager.cc',
198         'time_axis_view.cc',
199         'time_axis_view_item.cc',
200         'time_fx_dialog.cc',
201         'time_selection.cc',
202         'track_selection.cc',
203         'track_view_list.cc',
204         'ui_config.cc',
205         'utils.cc',
206         'version.cc',
207         'volume_controller.cc',
208         'waveview.cc',
209 ]
210
211 def set_options(opt):
212         autowaf.set_options(opt)
213
214 def configure(conf):
215         autowaf.build_version_files(path_prefix+'version.h', path_prefix+'version.cc',
216                         'gtk2_ardour', MAJOR, MINOR, MICRO)
217         autowaf.configure(conf)
218         conf.check_tool('compiler_cxx')
219
220         if re.search ("linux", sys.platform) != None:
221                 autowaf.check_pkg(conf, 'alsa', uselib_store='ALSA')
222                 #
223                 #       TODO: Insert a sanity check for on OS X
224                 #       to ensure that CoreAudio is present....
225                 #       Really shouldn't these checks be in AutoWaf?
226                 #
227         autowaf.check_pkg(conf, 'flac', uselib_store='FLAC', atleast_version='1.2.1')
228         autowaf.check_pkg(conf, 'gthread', uselib_store='GTHREAD', atleast_version='2.10.1')
229         autowaf.check_pkg(conf, 'gtk+-2.0', uselib_store='GTK', atleast_version='2.12.1')
230         autowaf.check_pkg(conf, 'gtkmm-2.4', uselib_store='GTKMM', atleast_version='2.8')
231         autowaf.check_pkg(conf, 'libgnomecanvas-2.0', uselib_store='GNOMECANVAS', atleast_version='2.0')
232         autowaf.check_pkg(conf, 'libgnomecanvasmm-2.6', uselib_store='GNOMECANVASMM', atleast_version='2.12.0')
233         autowaf.check_pkg(conf, 'ogg', uselib_store='OGG', atleast_version='1.1.2')
234
235         conf.check_tool('misc') # subst tool
236
237         conf.write_config_header('gtk2ardour-config.h')
238         
239         # Boost headers
240         autowaf.check_header(conf, 'boost/shared_ptr.hpp')
241         autowaf.check_header(conf, 'boost/weak_ptr.hpp')
242
243 # Add a waf `feature' to allow compilation of things using winegcc
244 from TaskGen import feature
245 @feature("wine")
246 def set_winegcc(self):
247         self.env.LINK_CXX = self.env.LINK_CC = 'wineg++'
248         self.env.CC = 'winegcc'
249
250 def build(bld):
251         # GTK front-end; if we're using VST we build this as a shared library, otherwise
252         # it's a normal executabale
253         if bld.env['VST_SUPPORT']:
254                 obj = bld.new_task_gen(features = 'cxx cc cshlib')
255         else:
256                 obj = bld.new_task_gen(features = 'cxx cc cprogram')
257
258         obj.includes     = ['.']
259         obj.source       = gtk2_ardour_sources
260         obj.name         = 'gtk2_ardour'
261         if bld.env['VST_SUPPORT']:
262                 obj.target = 'gtk2_ardour'
263                 obj.includes += ['../libs/fst']
264         else:
265                 obj.target = 'ardour-3.0'
266         obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
267         obj.uselib       = 'UUID FLAC GLIBMM GTHREAD GTK GNOMECANVAS OGG ALSA'
268         obj.uselib       += ' GTKMM GNOMECANVASMM OSX GTKOSX COREAUDIO'
269         obj.uselib_local = '''libpbd libmidipp libtaglib libardour libardour_cp
270                               libgtkmm2ext libtaglib'''
271         obj.cflags       = ['-DPACKAGE="gtk2_ardour"']
272         obj.cxxflags     = ['-DPACKAGE="gtk2_ardour"']
273         obj.cxxflags     += ['-DVERSIONSTRING="' + bld.env['VERSION'] + '"']
274         obj.cxxflags     += ['-DDATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"']
275         obj.cxxflags     += ['-DCONFIG_DIR="' + os.path.normpath(bld.env['CONFIGDIR']) + '"']
276         obj.cxxflags     += ['-DMODULE_DIR="' + os.path.normpath(bld.env['LIBDIR']) + '"']
277         obj.cxxflags     += ['-DLOCALEDIR="' + os.path.join(
278                         os.path.normpath(bld.env['DATADIR']), 'locale') + '"']
279         obj.cxxflags     += ['-DPROGRAM_NAME="' + bld.env['PROGRAM_NAME'] + '"']
280
281         if bld.env['HAVE_SLV2']:
282                 obj.source += [ 'lv2_plugin_ui.cc' ]
283                 obj.uselib += ' SLV2 '
284
285         if bld.env['FREESOUND']:
286                 obj.source +=  [ 'sfdb_freesound_mootcher.cc' ]
287
288         if bld.env['VST_SUPPORT']:
289                 obj.source += [ 'vst_pluginui.cc' ]
290                 obj.cxxflags += [ '-DVST_SUPPORT' ]
291
292         if bld.env['GTKOSX']:
293                 TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cc']
294                 obj.source += [ 'cocoacarbon.mm' ]
295
296                 if bld.env['AUDIOUNITS']:
297                         obj.source += [ 'au_pluginui.mm' ]
298                         obj.uselib_local += ' libappleutility '
299
300         else:
301                 obj.source += [ 'x11.cc' ]
302
303         if bld.env['VST_SUPPORT']:
304                 # If we require VST support we build a stub main() and the FST library here using
305                 # winegcc, and link it to the GTK front-end library
306                 obj = bld.new_task_gen (features = 'cxx cc cprogram wine')
307                 obj.source = '''
308                         ../libs/fst/fst.c
309                         ../libs/fst/fstinfofile.c
310                         ../libs/fst/vsti.c
311                         ../libs/fst/vstwin.c
312                         ../vst/winmain.c
313                 '''
314                 obj.includes = '../libs/fst'
315                 obj.target = 'ardour-3.0-vst'
316                 obj.linkflags = ['-mwindows', '-Wl,--export-dynamic', '-lpthread']
317                 obj.defines = ['_POSIX_SOURCE', 'USE_WS_PREFIX']
318                 obj.uselib = 'ALSA'
319                 obj.uselib_local = '''libpbd libmidipp libtaglib libardour libardour_cp libgtkmm2ext libtaglib gtk2_ardour'''
320
321         # Wrappers
322
323         wrapper_subst_dict = {
324                 'INSTALL_PREFIX' : bld.env['PREFIX'],
325                 'LIBDIR'         : os.path.normpath(bld.env['LIBDIRNAME']),
326                 'LIBS'           : 'build/default/libs',
327                 'VERSION'        : '3.0',
328                 'EXECUTABLE'     : 'build/default/gtk2_ardour/ardour-3.0'
329         }
330
331         obj              = bld.new_task_gen('subst')
332         obj.source       = 'ardev_common.sh.in'
333         obj.target       = 'ardev_common_waf.sh'
334         obj.chmod        = 0755
335         obj.dict         = wrapper_subst_dict
336
337         obj              = bld.new_task_gen('subst')
338         obj.source       = 'ardour.sh.in'
339         obj.target       = 'ardour3'
340         obj.chmod        = 0755
341         obj.dict         = wrapper_subst_dict
342         obj.install_path = bld.env['BINDIR']
343
344         # Font configuration
345
346         font_subst_dict = {}
347         font_sizes      = {}
348         base_font       = ""
349
350         # Set up font sizes
351         if bld.env['IS_OSX']: # OS X fonts
352                 basefont = "Lucida Grande"
353                 font_sizes = {
354                         'TINY' : '7',
355                         'SMALLER' : '9',
356                         'SMALL' : '10',
357                         'NORMAL' : '11',
358                         'BIG' : '12',
359                         'BIGGER' : '14',
360                         'LARGE' : '18',
361                         'LARGER' : '28',
362                         'HUGER' : '36',
363                         'MASSIVE' : '60'
364                 }
365         else: # Linux/X11 fonts
366                 basefont = "sans"
367                 font_sizes = {
368                         'TINY' : '6',
369                         'SMALLER' : '8',
370                         'SMALL' : '9',
371                         'NORMAL' : '10',
372                         'BIG' : '14',
373                         'BIGGER' : '16',
374                         'LARGE' : '18',
375                         'LARGER' : '24',
376                         'HUGER' : '34',
377                         'MASSIVE' : '60'
378                 }
379
380         # Set up font substitution dictionary
381         for style in ['', 'BOLD', 'ITALIC']:
382                 for sizename,points in font_sizes.iteritems():
383                         if (len (style)):
384                                 key = "_".join (['FONT',style,sizename])
385                                 fontstyle = " ".join ([basefont,style.lower(),points])
386                         else:
387                                 key = "_".join (['FONT',sizename])
388                                 fontstyle = " ".join ([basefont,points])
389                                 
390                         font_subst_dict[key] = fontstyle
391
392         # add normal monospace to font dict
393         font_subst_dict['FONT_MONOSPACE_NORMAL'] = 'monospace 10'
394
395         # RC files
396         obj              = bld.new_task_gen('subst')
397         obj.source       = 'ardour3_ui_dark.rc.in'
398         obj.target       = 'ardour3_ui_dark.rc'
399         obj.dict         = font_subst_dict
400         obj.install_path = os.path.join(bld.env['CONFIGDIR'], 'ardour3')
401
402         obj              = bld.new_task_gen('subst')
403         obj.source       = 'ardour3_ui_light.rc.in'
404         obj.target       = 'ardour3_ui_light.rc'
405         obj.dict         = font_subst_dict
406         obj.install_path = os.path.join(bld.env['CONFIGDIR'], 'ardour3')
407
408         obj              = bld.new_task_gen('subst')
409         obj.source       = 'ardour3_ui_dark_sae.rc.in'
410         obj.target       = 'ardour3_ui_dark_sae.rc'
411         obj.dict         = font_subst_dict
412         obj.install_path = os.path.join(bld.env['CONFIGDIR'], 'ardour3')
413
414         obj              = bld.new_task_gen('subst')
415         obj.source       = 'ardour3_ui_light_sae.rc.in'
416         obj.target       = 'ardour3_ui_light_sae.rc'
417         obj.dict         = font_subst_dict
418         obj.install_path = os.path.join(bld.env['CONFIGDIR'], 'ardour3')
419
420         # Menus
421         menus_argv = []
422         if bld.env['GTKOSX']:
423                 menus_argv = [ '-E', '-P', '-DGTKOSX' ]
424         else:
425                 menus_argv = [ '-E', '-P' ]
426         obj = bld.new_task_gen('command-output')
427         obj.command = 'cpp'
428         obj.command_is_external = True
429         obj.no_inputs = True
430         obj.argv = menus_argv
431         obj.stdin = 'ardour.menus.in'
432         obj.stdout = 'ardour.menus'
433         bld.install_files(os.path.join(bld.env['CONFIGDIR'], 'ardour3'), 'ardour.menus')
434
435         # Keybindings
436
437         # 'SAE-de-keypad', 'SAE-de-nokeypad', 'SAE-us-keypad', 'SAE-us-nokeypad', 'ergonomic-us'
438
439         for b in [ 'mnemonic-us' ] :
440                 obj = bld.new_task_gen (
441                         target = b + '.bindings',
442                         source = b + '.bindings.in',
443                         rule = '../tools/fmt-bindings --winkey=%s --accelmap <${SRC} >${TGT}' % bld.env['windows_key']
444                         )
445                 obj.install_path = os.path.join(bld.env['CONFIGDIR'], 'ardour3')
446
447         # Icons/Images
448         bld.install_files('${DATADIR}/ardour3/icons', 'icons/*.png')
449         bld.install_files('${DATADIR}/ardour3/pixmaps', 'pixmaps/*.xpm')
450         bld.install_files('${DATADIR}/ardour3', 'splash.png')
451
452         # Default UI configuration
453         bld.install_files('${CONFIGDIR}/ardour3', 'ardour3_ui_default.conf')
454
455         # i18n
456         if bld.env['ENABLE_NLS']:
457                 mo_files = glob.glob (os.path.join (bld.get_curdir(), 'po/*.mo'))
458                 for mo in mo_files:
459                         lang = os.path.basename (mo).replace ('.mo', '')
460                         bld.install_as (os.path.join (bld.env['PREFIX'], 'share', 'locale', lang, 'LC_MESSAGES', APPNAME + '.mo'), mo)
461
462 def i18n(bld):
463         autowaf.build_i18n (bld, 'gtk2_ardour', APPNAME, gtk2_ardour_sources)
464