fix up meter thread management when JACK client starts/stops/is halted ; put focus...
[ardour.git] / gtk2_ardour / SConscript
1 # -*- python -*-
2
3 import os
4 import os.path
5 import glob
6
7 Import('env install_prefix final_prefix config_prefix libraries i18n ardour_version')
8
9 gtkardour = env.Copy()
10 gtkmmtests = env.Copy()
11
12 #
13 # this defines the version number of the GTK interface to ardour
14 #
15
16 domain = 'gtk2_ardour'
17
18 gtkardour.Append(DOMAIN=domain, MAJOR=1,MINOR=0,MICRO=2)
19 gtkardour.Append(CCFLAGS="-DPACKAGE=\\\"" + domain + "\\\"")
20 gtkardour.Append(CXXFLAGS="-DPACKAGE=\\\"" + domain + "\\\"")
21 gtkardour.Append(CXXFLAGS="-DLIBSIGC_DISABLE_DEPRECATED")
22 gtkardour.Append(CPPPATH="#/")  # for top level svn_revision.h
23 #gtkardour.Append(CXXFLAGS="-DFLOWCANVAS_AA")
24 gtkardour.Append(PACKAGE=domain)
25 gtkardour.Append(POTFILE=domain + '.pot')
26
27 if gtkardour['IS_OSX']:
28         gtkardour.Append (LINKFLAGS="-Xlinker -headerpad -Xlinker 2048")
29
30 gtkardour.Merge ([
31     libraries['ardour'],
32     libraries['ardour_cp'],
33     libraries['atkmm'],
34     libraries['fftw3'],
35     libraries['fftw3f'],
36     libraries['flac'],
37     libraries['gdkmm2'],
38     libraries['glib2'],
39     libraries['glibmm2'],
40     libraries['gtk2'],
41     libraries['gtkmm2'],
42     libraries['gtkmm2ext'],
43     libraries['jack'],
44     libraries['libgnomecanvas2'],
45     libraries['libgnomecanvasmm'],
46     libraries['lrdf'],
47     libraries['midi++2'],
48     libraries['pangomm'],
49     libraries['pbd'],
50     libraries['samplerate'],
51     libraries['sigc2'],
52     libraries['sndfile-ardour'],
53     libraries['sysmidi'],
54     libraries['vamp'],
55     libraries['vamphost'],
56     libraries['xml'],
57     libraries['xslt']
58 ])
59
60 gtkmmtests.Append(CXXFLAGS="-DLIBSIGC_DISABLE_DEPRECATED")
61
62 gtkmmtests.Merge ([
63     libraries['atkmm'],
64     libraries['gdkmm2'],
65     libraries['glib2'],
66     libraries['glibmm2'],
67     libraries['gtk2'],
68     libraries['gtkmm2'],
69     libraries['pangomm'],
70     libraries['sigc2']
71 ])
72
73 if gtkardour['DMALLOC']:
74         gtkardour.Merge([libraries['dmalloc']])
75         gtkardour.Append(CCFLAGS='-DUSE_DMALLOC')
76
77 if gtkardour['FFT_ANALYSIS']:
78         gtkardour.Merge ([libraries['fftw3f']])
79         gtkardour.Append(CCFLAGS='-DFFT_ANALYSIS')
80
81 if gtkardour['RUBBERBAND']:
82         gtkardour.Merge ([ libraries['rubberband'] ])
83 else:
84         gtkardour.Merge ([ libraries['soundtouch'] ])
85
86 skipped_files=Split("""
87 connection_editor.cc
88 """)
89
90 audiounit_files=Split("""
91 au_pluginui.mm
92 """)
93
94 gtkosx_files=Split("""
95 cocoacarbon.mm
96 """)
97
98 x11_files=Split("""
99 x11.cc
100 """)
101
102 gtkardour_files=Split("""
103 about.cc
104 actions.cc
105 add_route_dialog.cc
106 ardour_dialog.cc
107 ardour_ui2.cc
108 ardour_ui.cc
109 ardour_ui_dependents.cc
110 ardour_ui_dialogs.cc
111 ardour_ui_ed.cc
112 ardour_ui_mixer.cc
113 ardour_ui_options.cc
114 audio_clock.cc
115 audio_region_editor.cc
116 audio_region_view.cc
117 audio_streamview.cc
118 audio_time_axis.cc
119 automation_gain_line.cc
120 automation_line.cc
121 automation_pan_line.cc
122 automation_time_axis.cc
123 axis_view.cc
124 boolean_automation_line.cc
125 canvas-imageframe.c
126 canvas-simpleline.c
127 canvas-simplerect.c
128 canvas-waveview.c
129 crossfade_edit.cc
130 crossfade_view.cc
131 curvetest.cc
132 editing.cc
133 editor_actions.cc
134 editor_audio_import.cc
135 editor_audiotrack.cc
136 editor_canvas.cc
137 editor_canvas_events.cc
138 editor.cc
139 editor_cursors.cc
140 editor_edit_groups.cc
141 editor_export_audio.cc
142 editor_hscroller.cc
143 editor_imageframe.cc
144 editor_keyboard.cc
145 editor_keys.cc
146 editor_markers.cc
147 editor_mixer.cc
148 editor_mouse.cc
149 editor_nudge.cc
150 editor_ops.cc
151 editor_region_list.cc
152 editor_route_list.cc
153 editor_rulers.cc
154 editor_scrub.cc
155 editor_selection.cc
156 editor_selection_list.cc
157 editor_tempodisplay.cc
158 editor_timefx.cc
159 engine_dialog.cc
160 enums.cc
161 export_dialog.cc
162 export_range_markers_dialog.cc
163 export_region_dialog.cc
164 export_session_dialog.cc
165 gain_automation_time_axis.cc
166 gain_meter.cc
167 generic_pluginui.cc
168 ghostregion.cc
169 gtk-custom-hruler.c
170 gtk-custom-ruler.c
171 imageframe.cc
172 imageframe_socket_handler.cc
173 imageframe_time_axis.cc
174 imageframe_time_axis_group.cc
175 imageframe_time_axis_view.cc
176 imageframe_view.cc
177 io_selector.cc
178 keyboard.cc
179 keyeditor.cc
180 level_meter.cc
181 location_ui.cc
182 main.cc
183 marker.cc
184 marker_time_axis.cc
185 marker_time_axis_view.cc
186 marker_view.cc
187 midi_port_dialog.cc
188 mixer_strip.cc
189 mixer_ui.cc
190 new_session_dialog.cc
191 option_editor.cc
192 opts.cc
193 pan_automation_time_axis.cc
194 panner2d.cc
195 panner.cc
196 panner_ui.cc
197 playlist_selector.cc
198 plugin_selector.cc
199 plugin_ui.cc
200 prompter.cc
201 public_editor.cc
202 redirect_automation_line.cc
203 redirect_automation_time_axis.cc
204 redirect_box.cc
205 region_gain_line.cc
206 region_selection.cc
207 region_view.cc
208 rhythm_ferret.cc
209 route_params_ui.cc
210 route_redirect_selection.cc
211 route_time_axis.cc
212 route_ui.cc
213 selection.cc
214 send_ui.cc
215 sfdb_ui.cc
216 simpleline.cc
217 simplerect.cc
218 splash.cc
219 streamview.cc
220 tape_region_view.cc
221 tempo_dialog.cc
222 theme_manager.cc
223 time_axis_view.cc
224 time_axis_view_item.cc
225 time_selection.cc
226 ui_config.cc
227 utils.cc
228 version.cc
229 visual_time_axis.cc
230 waveview.cc
231 """)
232
233 fft_analysis_files=Split("""
234 analysis_window.cc
235 fft_graph.cc
236 fft_result.cc
237 """)
238
239 pixmap_files = glob.glob('pixmaps/*.xpm')
240 icon_files = glob.glob ('icons/*.png')
241
242 intl_files = gtkardour_files + glob.glob('*.h')
243
244 evtest_files=Split("""
245 evtest.cc
246 """)
247
248 mtest_files=Split("""
249 mtest.cc
250 """)
251
252
253 rcu_files=Split("""
254 rcu.cc
255 """)
256
257 itest_files=Split("""
258 itest.cc
259 """)
260
261 stest_files=Split("""
262 stest.cc
263 """)
264
265 tt_files=Split ("""
266 tt.cc
267 """)
268
269 extra_sources = []
270
271 vst_files = [ 'vst_pluginui.cc' ]
272
273 if env['VST']:
274         extra_sources += vst_files
275         gtkardour.Append (CCFLAGS="-DVST_SUPPORT", CPPPATH="#libs/fst")
276
277 if env['LV2']:
278         gtkardour.Append (CCFLAGS="-DHAVE_SLV2")
279         gtkardour.Merge ([libraries['slv2']])
280
281
282 if gtkardour['GTKOSX']:
283         extra_sources += gtkosx_files
284         gtkardour.Append (CCFLAGS="-DTOP_MENUBAR -DGTKOSX")
285         gtkardour.Append (LINKFLAGS=" -framework AppKit -framework CoreAudioKit")
286
287         if gtkardour['AUDIOUNITS']:
288                 extra_sources += audiounit_files
289                 gtkardour.Append(CCFLAGS='-DHAVE_AUDIOUNITS')
290                 gtkardour.Merge([libraries['appleutility']])
291
292 else:
293    extra_sources += x11_files
294         
295  
296 if env['FFT_ANALYSIS']:
297         extra_sources += fft_analysis_files
298
299 intl_files += extra_sources
300
301 gtkardour.Append(CCFLAGS="-D_REENTRANT -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE")
302 gtkardour.Append(CXXFLAGS="-DLOCALEDIR=\\\""+final_prefix+"/share/locale\\\"")
303
304 versionflag = '-DVERSIONSTRING=\\\"' + env['VERSION'] + '\\\"'
305
306 gtkardour.Append(CXXFLAGS=versionflag)
307
308 executable = 'ardour-' + ardour_version
309
310 ardour = gtkardour.Program(target = executable, source = gtkardour_files + extra_sources)
311 ardourlib = gtkardour.SharedLibrary(target = 'ardourgtk', source = gtkardour_files + extra_sources)
312
313 evest = gtkmmtests.Program(target = 'evtest', source = evtest_files)
314 mtest = gtkardour.Program(target = 'mtest', source = mtest_files)
315 itest = gtkardour.Program(target = 'itest', source = itest_files)
316 rcu = gtkardour.Program(target = 'rcu', source = rcu_files)
317 tt = gtkmmtests.Program(target = 'tt', source = tt_files)
318
319 my_font_dict = { }
320
321 if gtkardour['IS_OSX']:
322         #
323         # OS X font rendering is different even with X11
324         #
325
326         font_sizes = {
327                 'TINY' : '7',
328                 'SMALLER' : '9',
329                 'SMALL' : '10',
330                 'NORMAL' : '11',
331                 'BIG' : '12',
332                 'BIGGER' : '14',
333                 'LARGE' : '18',
334                 'LARGER' : '28',
335                 'HUGER' : '36',
336                 'MASSIVE' : '60'
337                 }
338         basefont = "Lucida Grande"
339
340 else:
341         #
342         # Linux/X11 font rendering
343         #
344         
345         if gtkardour['OLDFONTS']:
346                 font_sizes = {
347                         'TINY' : '4',
348                         'SMALLER' : '6',
349                         'SMALL' : '7',
350                         'NORMAL' : '8',
351                         'BIG' : '12',
352                         'BIGGER' : '14',
353                         'LARGE' : '18',
354                         'LARGER' : '24',
355                         'HUGER' : '34',
356                         'MASSIVE' : '60'
357                         }
358         else:
359                 font_sizes = {
360                         'TINY' : '6',
361                         'SMALLER' : '8',
362                         'SMALL' : '9',
363                         'NORMAL' : '10',
364                         'BIG' : '14',
365                         'BIGGER' : '16',
366                         'LARGE' : '18',
367                         'LARGER' : '24',
368                         'HUGER' : '34',
369                         'MASSIVE' : '60'
370                         }
371
372         basefont = "sans"
373
374 for style in ['', 'BOLD', 'ITALIC']:
375         for sizename,points in font_sizes.iteritems():
376                 if (len (style)):
377                         key = "_".join (['FONT',style,sizename])
378                         fontstyle = " ".join ([basefont,style.lower(),points])
379                 else:
380                         key = "_".join (['FONT',sizename])
381                         fontstyle = " ".join ([basefont,points])
382
383                 key = '%' + key + '%'
384                 my_font_dict[key] = fontstyle
385
386 ardour_dark_theme = env.SubstInFile ('ardour2_ui_dark.rc', 'ardour2_ui_dark.rc.in', SUBST_DICT = my_font_dict)
387 ardour_light_theme = env.SubstInFile ('ardour2_ui_light.rc', 'ardour2_ui_light.rc.in', SUBST_DICT = my_font_dict)
388
389 my_subst_dict = { }
390
391 #
392 # null substitution just to avoid ardour.bindings being in svn
393 #
394
395 keybindings_dict = { }
396
397 if gtkardour['GTKOSX'] and gtkardour['NATIVE_OSX_KEYS']:
398         #
399         # Command(Meta), Alt(Mod1), Ctrl, Shift
400         # **** as of february 4th 2008, OUR VERSION OF *****
401         # Gtk/Quartz maps:
402         #  NSCommand (aka "Command" aka "Apple" aka "Cauliflower") -> Meta
403         #  NSAlternate (aka "Option")  -> Mod1
404         #
405         keybindings_dict['%PRIMARY%'] = 'Meta'
406         keybindings_dict['%SECONDARY%'] = 'Mod1'
407         keybindings_dict['%TERTIARY%'] = 'Shift'
408         keybindings_dict['%LEVEL4%'] = 'Ctrl'
409         keybindings_dict['%WINDOW%'] = 'Mod1'
410 else:
411         #
412         # Ctrl, Alt, Shift, Mod4(Super/Windows/Hyper)
413         #
414         keybindings_dict['%PRIMARY%'] = 'Ctrl'
415         keybindings_dict['%SECONDARY%'] = 'Alt'
416         keybindings_dict['%TERTIARY%'] = 'Shift'
417         keybindings_dict['%LEVEL4%'] = env['WINDOWS_KEY']
418         keybindings_dict['%WINDOW%'] = 'Alt'
419
420 for b in [ 'SAE-de', 'mnemonic-us', 'ergonomic-us' ]:
421         target_file = b + '.bindings'
422         src_file = target_file + '.in'
423         Default (env.SubstInFile (target_file, src_file, SUBST_DICT = keybindings_dict))
424
425 my_subst_dict['%INSTALL_PREFIX%'] = final_prefix
426 my_subst_dict['%LIBDIR%'] = env['LIBDIR']
427 my_subst_dict['%VERSION%'] = ardour_version
428
429 ardoursh = env.SubstInFile ('ardour.sh','ardour.sh.in', SUBST_DICT = my_subst_dict);
430 env.AddPostAction (ardoursh, Chmod ('$TARGET', 0755))
431
432 ardourdev = env.SubstInFile ('ardev_common.sh','ardev_common.sh.in', SUBST_DICT = my_subst_dict);
433 env.AddPostAction (ardourdev, Chmod ('$TARGET', 0755))
434
435 Default(ardourdev)
436 Default(ardoursh)
437 Default(ardour_dark_theme)
438 Default(ardour_light_theme)
439
440 if env['VST']:
441         Default(ardourlib)
442         # the library - into the library dir
443         env.Alias('install', env.Install(os.path.join(install_prefix, env['LIBDIR'], 'ardour2'), ardourlib))
444 else:
445
446         if env['VERSIONED']:
447                 Default (env.VersionedExecutable ('tagged_executable', ardour))
448         else:
449                 Default(ardour)
450
451         #install
452
453         # the executable - into the library dir
454         env.Alias('install', env.Install(os.path.join(install_prefix, env['LIBDIR'], 'ardour2'), ardour))
455         # the script - into the bin dir
456         env.Alias('install', env.InstallAs(os.path.join(install_prefix, 'bin')+'/ardour2', ardoursh))
457
458 if env['NLS']:
459         i18n (gtkardour, gtkardour_files+skipped_files+fft_analysis_files, env)
460     
461 # configuration files
462 env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), ardour_dark_theme))
463 env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), ardour_light_theme))
464 env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), 'ardour2_ui_default.conf'))
465 env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), 'ardour.menus'))
466 env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), 'ardour-sae.menus'))
467 env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), 'ergonomic-us.bindings'))
468 env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), 'mnemonic-us.bindings'))
469 env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), 'SAE-de.bindings'))
470 # data files
471 env.Alias('install', env.Install(os.path.join(install_prefix, 'share', 'ardour2'), 'splash.png'))
472 env.Alias('install', env.Install(os.path.join(install_prefix, 'share', 'ardour2', 'pixmaps'), pixmap_files))
473 env.Alias('install', env.Install(os.path.join(install_prefix, 'share', 'ardour2', 'icons'), icon_files))
474
475 env.Alias ('version', gtkardour.VersionBuild(['version.cc','version.h'], []))
476                 
477 #dist
478 env.Alias ('tarball', env.Distribute (env['DISTTREE'],
479                                       [ 'SConscript',
480                                         'i18n.h', 'gettext.h',
481                                         'ardour.sh.in',
482                                         'ardev_common.sh.in',
483                                         'ardev', 'ardbg',
484                                         'ardour2_ui_dark.rc.in', 'ardour2_ui_light.rc.in', 'splash.png',
485                                         'ardour.menus', 'ardour-sae.menus', 
486                                         'ardour.bindings.in', 
487                                         'ardour-sae-ansi.bindings.in', 
488                                         'ardour-sae-de.bindings.in', 
489                                         'ardour2_ui_default.conf',
490                                         'editor_xpms'
491                                         ] +
492                                       gtkardour_files +
493                                       vst_files +
494                                       pixmap_files +
495                                       icon_files +
496                                       skipped_files +
497                                       audiounit_files + 
498                                       gtkosx_files +
499                                       x11_files +
500                                       fft_analysis_files +
501                                       glob.glob('po/*.po') + glob.glob('*.h')))
502
503 # generate a prototype full-featured ardour_ui.rc file
504
505 env.Alias ('protorc', env.Command ('proto.rc', gtkardour_files, """
506      grep set_name $SOURCES | \
507 sed 's/.*("\([a-zA-Z_][a-zA-Z_]*\)").*/\\1/' | \
508 grep -v '\\.' | sort | uniq | \
509 awk '/\\./ {} { printf ("style \\"%s\\"\\n{\\n\
510   fg[NORMAL] =   { 0, 0, 0 }\\n\
511   fg[ACTIVE] =   { 0, 0, 0 }\\n\
512   fg[SELECTED] = { 0, 0, 0 }\\n\
513   bg[NORMAL] =   { 0, 0, 0 }\\n\
514   bg[ACTIVE] =   { 0, 0, 0 }\\n\
515   bg[SELECTED] = { 0, 0, 0 }\\n\
516 }\\nwidget \\"*%s\\" style \\"%s\\"\\nwidget \\"*%s*\\" style \\"%s\\"\\n\\n", \
517   $$0, $$0, $$0, $$0, $$0) }' > $TARGET && \
518      grep 'color_map\[[a-zA-Z_][a-zA-Z]*\]' $SOURCES | \
519  sed 's/.*\[\([a-zA-Z_][a-zA-Z_]*\)].*/\\1/'| \
520  sort | uniq | \
521  awk '{ printf ("style \\"%s\\"\\n{\\n\
522   fg[NORMAL] =   { 0, 0, 0 }\\n\
523   fg[ACTIVE] =   { 0, 0, 0 }\\n\
524 }\\nwidget \\"*%s\\" style \\"%s\\"\\n \\n\\n", $$0, $$0, $$0) }' >> $TARGET ;
525 """
526 ))