pack zoom controls into upper right of editor table/packer
[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_drag.cc
107                 editor_edit_groups.cc
108                 editor_export_audio.cc
109                 editor_hscroller.cc
110                 editor_keyboard.cc
111                 editor_keys.cc
112                 editor_markers.cc
113                 editor_mixer.cc
114                 editor_mouse.cc
115                 editor_nudge.cc
116                 editor_ops.cc
117                 editor_region_list.cc
118                 editor_route_list.cc
119                 editor_rulers.cc
120                 editor_scrub.cc
121                 editor_selection.cc
122                 editor_selection_list.cc
123                 editor_summary.cc
124                 editor_tempodisplay.cc
125                 editor_timefx.cc
126                 engine_dialog.cc
127                 enums.cc
128                 export_channel_selector.cc
129                 export_dialog.cc
130                 export_file_notebook.cc
131                 export_filename_selector.cc
132                 export_format_dialog.cc
133                 export_format_selector.cc
134                 export_preset_selector.cc
135                 export_timespan_selector.cc
136                 fft.cc
137                 fft_graph.cc
138                 fft_result.cc
139                 gain_meter.cc
140                 generic_pluginui.cc
141                 ghostregion.cc
142                 global_port_matrix.cc
143                 gtk-custom-hruler.c
144                 gtk-custom-ruler.c
145                 io_selector.cc
146                 keyboard.cc
147                 keyeditor.cc
148                 latency_gui.cc
149                 level_meter.cc
150                 lineset.cc
151                 location_ui.cc
152                 main.cc
153                 marker.cc
154                 midi_channel_selector.cc
155                 midi_port_dialog.cc
156                 midi_region_view.cc
157                 midi_scroomer.cc
158                 midi_streamview.cc
159                 midi_time_axis.cc
160                 mixer_strip.cc
161                 mixer_ui.cc
162                 nag.cc
163                 option_editor.cc
164                 opts.cc
165                 panner.cc
166                 panner2d.cc
167                 panner_ui.cc
168                 piano_roll_header.cc
169                 playlist_selector.cc
170                 plugin_eq_gui.cc
171                 plugin_selector.cc
172                 plugin_ui.cc
173                 port_group.cc
174                 port_matrix.cc
175                 port_matrix_body.cc
176                 port_matrix_column_labels.cc
177                 port_matrix_component.cc
178                 port_matrix_grid.cc
179                 port_matrix_labels.cc
180                 port_matrix_row_labels.cc
181                 processor_box.cc
182                 prompter.cc
183                 public_editor.cc
184                 rc_option_editor.cc
185                 region_gain_line.cc
186                 region_selection.cc
187                 region_view.cc
188                 return_ui.cc
189                 rhythm_ferret.cc
190                 route_params_ui.cc
191                 route_processor_selection.cc
192                 route_time_axis.cc
193                 route_ui.cc
194                 selection.cc
195                 send_ui.cc
196                 session_import_dialog.cc
197                 session_metadata_dialog.cc
198                 session_option_editor.cc
199                 sfdb_ui.cc
200                 simpleline.cc
201                 simplerect.cc
202                 splash.cc
203                 startup.cc
204                 streamview.cc
205                 strip_silence_dialog.cc
206                 tape_region_view.cc
207                 tempo_dialog.cc
208                 tempo_lines.cc
209                 theme_manager.cc
210                 time_axis_view.cc
211                 time_axis_view_item.cc
212                 time_fx_dialog.cc
213                 time_selection.cc
214                 ui_config.cc
215                 utils.cc
216                 version.cc
217                 waveview.cc
218         '''
219         obj.source += ' x11.cc'
220         obj.includes     = ['.']
221         obj.name         = 'gtk2_ardour'
222         obj.target       = 'ardour-3.0'
223         obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
224         obj.uselib       = 'UUID FLAC GLIBMM GTHREAD GTK GNOMECANVAS OGG ALSA'
225         obj.uselib       += ' GTKMM GNOMECANVASMM'
226         obj.uselib_local = '''libpbd libmidipp libtaglib libardour libsurfaces
227                               libgtkmm2ext libtaglib'''
228         obj.cxxflags     = ['-DVERSIONSTRING="' + GTK2_ARDOUR_VERSION + '"']
229         obj.cxxflags     += ['-DPACKAGE="gtk2_ardour"']
230         obj.cxxflags     += ['-DDATA_DIR="' + os.path.normpath(bld.env['DATADIRNAME']) + '"']
231         obj.cxxflags     += ['-DCONFIG_DIR="' + os.path.normpath(bld.env['CONFIGDIRNAME']) + '"']
232         obj.cxxflags     += ['-DMODULE_DIR="' + os.path.normpath(bld.env['LIBDIRNAME']) + '"']
233         obj.cxxflags     += ['-DLOCALEDIR="' + os.path.join(
234                         os.path.normpath(bld.env['DATADIRNAME']), 'locale') + '"']
235         if bld.env['HAVE_SLV2']:
236                 obj.source += ' lv2_plugin_ui.cc '
237                 obj.uselib += ' SLV2 '
238                 obj.cxxflags += ['-DHAVE_SLV2']
239
240         # Wrappers
241
242         wrapper_subst_dict = {
243                 'INSTALL_PREFIX' : bld.env['PREFIX'],
244                 'LIBDIR'         : os.path.normpath(bld.env['LIBDIRNAME']),
245                 'LIBS'           : 'build/default/libs',
246                 'VERSION'        : '3.0',
247                 'EXECUTABLE'     : 'build/default/gtk2_ardour/ardour-3.0'
248         }
249
250         obj              = bld.new_task_gen('subst')
251         obj.source       = 'ardev_common.sh.in'
252         obj.target       = 'ardev_common_waf.sh'
253         obj.chmod        = 0755
254         obj.dict         = wrapper_subst_dict
255
256         obj              = bld.new_task_gen('subst')
257         obj.source       = 'ardour.sh.in'
258         obj.target       = 'ardour3'
259         obj.chmod        = 0755
260         obj.dict         = wrapper_subst_dict
261         obj.install_path = bld.env['BINDIR']
262
263         # Font configuration
264
265         font_subst_dict = {}
266         font_sizes      = {}
267         base_font       = ""
268
269         # Set up font substitution dictionary
270         for style in ['', 'BOLD', 'ITALIC']:
271                 for sizename,points in font_sizes.iteritems():
272                         if (len (style)):
273                                 key = "_".join (['FONT',style,sizename])
274                                 fontstyle = " ".join ([basefont,style.lower(),points])
275                         else:
276                                 key = "_".join (['FONT',sizename])
277                                 fontstyle = " ".join ([basefont,points])
278                         key = '%' + key + '%'
279                         font_subst_dict[key] = fontstyle
280
281         # Set up font sizes
282         if bld.env['IS_OSX']: # OS X fonts
283                 basefont = "Lucida Grande"
284                 font_sizes = {
285                         'TINY' : '7',
286                         'SMALLER' : '9',
287                         'SMALL' : '10',
288                         'NORMAL' : '11',
289                         'BIG' : '12',
290                         'BIGGER' : '14',
291                         'LARGE' : '18',
292                         'LARGER' : '28',
293                         'HUGER' : '36',
294                         'MASSIVE' : '60'
295                 }
296         else: # Linux/X11 fonts
297                 basefont = "sans"
298                 font_sizes = {
299                         'TINY' : '6',
300                         'SMALLER' : '8',
301                         'SMALL' : '9',
302                         'NORMAL' : '10',
303                         'BIG' : '14',
304                         'BIGGER' : '16',
305                         'LARGE' : '18',
306                         'LARGER' : '24',
307                         'HUGER' : '34',
308                         'MASSIVE' : '60'
309                 }
310
311         # RC files
312
313         obj              = bld.new_task_gen('subst')
314         obj.source       = 'ardour3_ui_dark.rc.in'
315         obj.target       = 'ardour3_ui_dark.rc'
316         obj.dict         = font_subst_dict
317         obj.install_path = os.path.join(bld.env['CONFIGDIR'], 'ardour3')
318
319         obj              = bld.new_task_gen('subst')
320         obj.source       = 'ardour3_ui_light.rc.in'
321         obj.target       = 'ardour3_ui_light.rc'
322         obj.dict         = font_subst_dict
323         obj.install_path = os.path.join(bld.env['CONFIGDIR'], 'ardour3')
324
325         obj              = bld.new_task_gen('subst')
326         obj.source       = 'ardour3_ui_dark_sae.rc.in'
327         obj.target       = 'ardour3_ui_dark_sae.rc'
328         obj.dict         = font_subst_dict
329         obj.install_path = os.path.join(bld.env['CONFIGDIR'], 'ardour3')
330
331         obj              = bld.new_task_gen('subst')
332         obj.source       = 'ardour3_ui_light_sae.rc.in'
333         obj.target       = 'ardour3_ui_light_sae.rc'
334         obj.dict         = font_subst_dict
335         obj.install_path = os.path.join(bld.env['CONFIGDIR'], 'ardour3')
336
337         # Menus
338         menus_argv = []
339         if bld.env['GTKOSX']:
340                 menus_argv = [ '-E', '-P', '-DGTKOSX', '-DTOP_MENUBAR' ]
341         else:
342                 menus_argv = [ '-E', '-P' ]
343         obj = bld.new_task_gen('command-output')
344         obj.command = 'cpp'
345         obj.command_is_external = True
346         obj.no_inputs = True
347         obj.argv = menus_argv
348         obj.stdin = 'ardour.menus.in'
349         obj.stdout = 'ardour.menus'
350         obj.install_path = os.path.join(bld.env['CONFIGDIR'], 'ardour3')
351
352         # Keybindings
353         keybindings_dict = {}
354         if bld.env['GTKOSX']:
355                 keybindings_dict['PRIMARY']   = 'Meta'
356                 keybindings_dict['SECONDARY'] = 'Mod1'
357                 keybindings_dict['TERTIARY']  = 'Shift'
358                 keybindings_dict['LEVEL4']    = 'Ctrl'
359                 keybindings_dict['WINDOW']    = 'Mod1'
360         else:
361                 keybindings_dict['PRIMARY']   = 'Ctrl'
362                 keybindings_dict['SECONDARY'] = 'Alt'
363                 keybindings_dict['TERTIARY']  = 'Shift'
364                 keybindings_dict['LEVEL4']    = bld.env['WINDOWS_KEY']
365                 keybindings_dict['WINDOW']    = 'Alt'
366
367         for b in [ 'SAE-de-keypad', 'SAE-de-nokeypad', 'SAE-us-keypad', 'SAE-us-nokeypad',
368                    'mnemonic-us', 'ergonomic-us' ]:
369                 obj = bld.new_task_gen('subst')
370                 obj.target = b + '.bindings'
371                 obj.source = obj.target + '.in'
372                 obj.dict   = keybindings_dict
373
374         # Icons/Images
375         bld.install_files('${DATADIR}/ardour3/icons', 'icons/*.png')
376         bld.install_files('${DATADIR}/ardour3/pixmaps', 'pixmaps/*.xpm')
377         bld.install_files('${DATADIR}/ardour3', 'splash.png')
378
379 def shutdown():
380         autowaf.shutdown()
381