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