Various work on bundles. We now have a Bundle Manager dialogue, and hopefully things...
[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['DIST_TARGET'] == 'panther' or gtkardour['DIST_TARGET'] == 'tiger':
28        gtkardour.Append (LINKFLAGS="-Xlinker -headerpad -Xlinker 2048")
29
30 gtkardour.Merge ([
31     libraries['ardour'],
32     libraries['ardour_cp'],
33     libraries['gtkmm2ext'],
34     libraries['midi++2'],
35     libraries['pbd'],
36     libraries['gtkmm2'],
37     libraries['glib2'],
38     libraries['libgnomecanvas2'],
39     libraries['libgnomecanvasmm'],
40     libraries['sysmidi'],
41     libraries['sndfile-ardour'],
42     libraries['flac'],
43     libraries['lrdf'],
44     libraries['glibmm2'],
45     libraries['pangomm'],
46     libraries['atkmm'],
47     libraries['gdkmm2'],
48     libraries['sigc2'],
49     libraries['gtk2'],
50     libraries['xml'],
51     libraries['xslt'],
52     libraries['soundtouch'],
53     libraries['samplerate'],
54     libraries['jack'],
55     libraries['sysaudio']
56 ])
57
58 gtkmmtests.Append(CXXFLAGS="-DLIBSIGC_DISABLE_DEPRECATED")
59
60 gtkmmtests.Merge ([
61     libraries['gtkmm2'],
62     libraries['glib2'],
63     libraries['glibmm2'],
64     libraries['pangomm'],
65     libraries['atkmm'],
66     libraries['gdkmm2'],
67     libraries['sigc2'],
68     libraries['gtk2']
69 ])
70
71 if gtkardour['DMALLOC']:
72         gtkardour.Merge([libraries['dmalloc']])
73         gtkardour.Append(CCFLAGS='-DUSE_DMALLOC')
74
75 if gtkardour['FFT_ANALYSIS']:
76         gtkardour.Merge ([libraries['fftw3f']])
77         gtkardour.Append(CCFLAGS='-DFFT_ANALYSIS')
78
79 skipped_files=Split("""
80 connection_editor.cc
81 """)
82
83 audiounit_files=Split("""
84 au_pluginui.cc
85 """)
86
87 gtkosx_files=Split("""
88 sync-menu.c
89 cocoacarbon.c
90 """)
91
92 x11_files=Split("""
93 x11.cc
94 """)
95
96 gtkardour_files=Split("""
97 about.cc
98 actions.cc
99 add_route_dialog.cc
100 add_midi_cc_track_dialog.cc
101 ardour_dialog.cc
102 ardour_ui.cc
103 ardour_ui2.cc
104 ardour_ui_dependents.cc
105 ardour_ui_dialogs.cc
106 ardour_ui_ed.cc
107 ardour_ui_mixer.cc
108 ardour_ui_options.cc
109 audio_clock.cc
110 audio_time_axis.cc
111 audio_region_editor.cc
112 control_point.cc
113 automation_line.cc
114 automation_time_axis.cc
115 automation_streamview.cc
116 automation_controller.cc
117 automation_region_view.cc
118 bundle_manager.cc
119 midi_port_dialog.cc
120 midi_time_axis.cc
121 midi_streamview.cc
122 axis_view.cc
123 canvas-simpleline.c
124 simpleline.cc
125 canvas-simplerect.c
126 simplerect.cc
127 canvas-waveview.c
128 diamond.cc
129 canvas-midi-event.cc
130 crossfade_edit.cc
131 crossfade_view.cc
132 curvetest.cc
133 enums.cc
134 editing.cc
135 editor.cc
136 editor_actions.cc
137 editor_audio_import.cc
138 editor_audiotrack.cc
139 editor_canvas.cc
140 editor_canvas_events.cc
141 editor_cursors.cc
142 editor_edit_groups.cc
143 editor_export_audio.cc
144 editor_hscroller.cc
145 editor_keyboard.cc
146 editor_keys.cc
147 editor_markers.cc
148 editor_mixer.cc
149 editor_mouse.cc
150 editor_nudge.cc
151 editor_ops.cc
152 editor_region_list.cc
153 editor_route_list.cc
154 editor_rulers.cc
155 editor_scrub.cc
156 editor_selection.cc
157 editor_selection_list.cc
158 editor_tempodisplay.cc
159 editor_timefx.cc
160 engine_dialog.cc
161 export_dialog.cc
162 export_session_dialog.cc
163 export_region_dialog.cc
164 export_range_markers_dialog.cc
165 gain_meter.cc
166 ghostregion.cc
167 gtk-custom-hruler.c
168 gtk-custom-ruler.c
169 io_selector.cc
170 port_matrix.cc
171 keyboard.cc
172 keyeditor.cc
173 ladspa_pluginui.cc
174 latency_gui.cc
175 location_ui.cc
176 main.cc
177 marker.cc
178 mixer_strip.cc
179 mixer_ui.cc
180 new_session_dialog.cc
181 option_editor.cc
182 opts.cc
183 panner.cc
184 panner2d.cc
185 panner_ui.cc
186 playlist_selector.cc
187 plugin_selector.cc
188 plugin_ui.cc
189 prompter.cc
190 public_editor.cc
191 processor_box.cc
192 region_gain_line.cc
193 region_selection.cc
194 region_view.cc
195 audio_region_view.cc
196 midi_region_view.cc
197 tape_region_view.cc
198 route_params_ui.cc
199 route_processor_selection.cc
200 route_ui.cc
201 selection.cc
202 sfdb_ui.cc
203 send_ui.cc
204 streamview.cc
205 audio_streamview.cc
206 tempo_dialog.cc
207 theme_manager.cc
208 time_axis_view.cc
209 time_axis_view_item.cc
210 route_time_axis.cc
211 time_selection.cc
212 ui_config.cc
213 utils.cc
214 version.cc
215 waveview.cc
216 tempo_lines.cc
217 """)
218
219 fft_analysis_files=Split("""
220 analysis_window.cc
221 fft_graph.cc
222 fft_result.cc
223 """)
224
225 pixmap_files = glob.glob('pixmaps/*.xpm')
226 icon_files = glob.glob ('icons/*.png')
227
228 intl_files = gtkardour_files + glob.glob('*.h')
229
230 mtest_files=Split("""
231 mtest.cc
232 """)
233
234
235 rcu_files=Split("""
236 rcu.cc
237 """)
238
239 itest_files=Split("""
240 itest.cc
241 """)
242
243 stest_files=Split("""
244 stest.cc
245 """)
246
247 tt_files=Split ("""
248 tt.cc
249 """)
250
251 extra_sources = []
252
253 vst_files = [ 'vst_pluginui.cc' ]
254
255 if env['VST']:
256         extra_sources += vst_files
257         gtkardour.Append (CCFLAGS="-DVST_SUPPORT", CPPPATH="#libs/fst")
258
259 cmt_files=Split("""
260 canvas-imageframe.c
261 editor_imageframe.cc
262 imageframe.cc
263 imageframe_socket_handler.cc
264 imageframe_time_axis.cc
265 imageframe_time_axis_group.cc
266 imageframe_time_axis_view.cc
267 imageframe_view.cc
268 marker_time_axis.cc
269 marker_time_axis_view.cc
270 marker_view.cc
271 visual_time_axis.cc
272 """)
273
274 if env['CMT']:
275     extra_sources += cmt_files
276     gtkardour.Append (CCFLAGS="-DWITH_CMT")
277
278 if gtkardour['GTKOSX']:
279    extra_sources += gtkosx_files
280    gtkardour.Append (CCFLAGS="-DTOP_MENUBAR -DGTKOSX")
281 else:
282    extra_sources += x11_files
283         
284 if gtkardour['AUDIOUNITS']:
285     extra_sources += audiounit_files
286     gtkardour.Append(CCFLAGS='-DHAVE_AUDIOUNITS')
287     gtkardour.Append(LINKFLAGS='-framework Carbon')
288     gtkardour.Merge([libraries['appleutility']])
289  
290 if env['FFT_ANALYSIS']:
291         extra_sources += fft_analysis_files
292
293 intl_files += extra_sources
294
295 gtkardour.Append(CCFLAGS="-D_REENTRANT -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE")
296 gtkardour.Append(CXXFLAGS="-DLOCALEDIR=\\\""+final_prefix+"/share/locale\\\"")
297
298 versionflag = '-DVERSIONSTRING=\\\"' + env['VERSION'] + '\\\"'
299
300 gtkardour.Append(CXXFLAGS=versionflag)
301
302 executable = 'ardour-' + ardour_version
303
304 ardour = gtkardour.Program(target = executable, source = gtkardour_files + extra_sources)
305 ardourlib = gtkardour.SharedLibrary(target = 'ardourgtk', source = gtkardour_files + extra_sources)
306
307 mtest = gtkardour.Program(target = 'mtest', source = mtest_files)
308 itest = gtkardour.Program(target = 'itest', source = itest_files)
309 rcu = gtkardour.Program(target = 'rcu', source = rcu_files)
310 tt = gtkmmtests.Program(target = 'tt', source = tt_files)
311
312 my_font_dict = { }
313
314 if gtkardour['DIST_TARGET'] == 'panther' or gtkardour['DIST_TARGET'] == 'tiger':
315         #
316         # OS X font rendering is different even with X11
317         #
318         my_font_dict['%FONT_TINY%'] = 'Lucida Grande 7'
319         my_font_dict['%FONT_SMALLERER%'] = 'Lucida Grande 8'
320         my_font_dict['%FONT_SMALLER%'] = 'Lucida Grande 9'
321         my_font_dict['%FONT_SMALL%'] = 'Lucida Grande 10'
322         my_font_dict['%FONT_NORMAL%'] = 'Lucida Grande 11'
323         my_font_dict['%FONT_BIG%'] = 'Lucida Grande 12'
324         my_font_dict['%FONT_BIGGER%'] = 'Lucida Grande 14'
325         my_font_dict['%FONT_LARGE%'] = 'Lucida Grande 18'
326         my_font_dict['%FONT_LARGER%'] = 'Lucida Grande 28'
327         my_font_dict['%FONT_HUGER%'] = 'Lucida Grande 36'
328         my_font_dict['%FONT_MASSIVE%'] = 'Lucida Grande 60'
329         my_font_dict['%FONT_BOLD_TINY%'] = 'Lucida Grande bold 7'
330         my_font_dict['%FONT_BOLD_SMALLER%'] = 'Lucida Grande bold 9'
331         my_font_dict['%FONT_BOLD_SMALL%'] = 'Lucida Grande bold 10'
332         my_font_dict['%FONT_BOLD_NORMAL%'] = 'Lucida Grande bold 11'
333         my_font_dict['%FONT_BOLD_BIG%'] = 'Lucida Grande bold 13'
334         my_font_dict['%FONT_BOLD_BIGGER%'] = 'Lucida Grande bold 14'
335         my_font_dict['%FONT_BOLD_LARGE%'] = 'Lucida Grande bold 20'
336         my_font_dict['%FONT_BOLD_LARGER%'] = 'Lucida Grande bold 25'
337         my_font_dict['%FONT_BOLD_HUGER%'] = 'Lucida Grande bold 36'
338         my_font_dict['%FONT_BOLD_MASSIVE%'] = 'Lucida Grande bold 60'
339         my_font_dict['%FONT_ITALIC_TINY%'] = 'Lucida Grande italic 7'
340         my_font_dict['%FONT_ITALIC_SMALLER%'] = 'Lucida Grande italic 9'
341         my_font_dict['%FONT_ITALIC_SMALL%'] = 'Lucida Grande italic 10'
342         my_font_dict['%FONT_ITALIC_NORMAL%'] = 'Lucida Grande italic 11'
343         my_font_dict['%FONT_ITALIC_BIG%'] = 'Lucida Grande italic 15'
344         my_font_dict['%FONT_ITALIC_BIGGER%'] = 'Lucida Grande italic 16'
345         my_font_dict['%FONT_ITALIC_LARGE%'] = 'Lucida Grande italic 20'
346         my_font_dict['%FONT_ITALIC_LARGER%'] = 'Lucida Grande italic 28'
347         my_font_dict['%FONT_ITALIC_HUGER%'] = 'Lucida Grande italic 36'
348         my_font_dict['%FONT_ITALIC_MASSIVE%'] = 'Lucida Grande italic 60'
349 else:
350         #
351         # Linux/X11 font rendering
352         #
353         my_font_dict['%FONT_TINY%'] = 'sans 4'
354         my_font_dict['%FONT_SMALLERER%'] = 'sans 6'
355         my_font_dict['%FONT_SMALLER%'] = 'sans 6'
356         my_font_dict['%FONT_SMALL%'] = 'sans 7'
357         my_font_dict['%FONT_NORMAL%'] = 'sans 8'
358         my_font_dict['%FONT_BIG%'] = 'sans 12'
359         my_font_dict['%FONT_BIGGER%'] = 'sans 14'
360         my_font_dict['%FONT_LARGE%'] = 'sans 18'
361         my_font_dict['%FONT_LARGER%'] = 'sans 24'
362         my_font_dict['%FONT_HUGER%'] = 'sans 34'
363         my_font_dict['%FONT_MASSIVE%'] = 'sans 60'
364         my_font_dict['%FONT_BOLD_TINY%'] = 'sans bold 4'
365         my_font_dict['%FONT_BOLD_SMALLER%'] = 'sans bold 6'
366         my_font_dict['%FONT_BOLD_SMALL%'] = 'sans bold 7'
367         my_font_dict['%FONT_BOLD_NORMAL%'] = 'sans bold 8'
368         my_font_dict['%FONT_BOLD_BIG%'] = 'sans bold 12'
369         my_font_dict['%FONT_BOLD_BIGGER%'] = 'sans bold 14'
370         my_font_dict['%FONT_BOLD_LARGE%'] = 'sans bold 18'
371         my_font_dict['%FONT_BOLD_LARGER%'] = 'sans bold 24'
372         my_font_dict['%FONT_BOLD_HUGE%'] = 'sans bold 25'
373         my_font_dict['%FONT_BOLD_HUGER%'] = 'sans bold 34'
374         my_font_dict['%FONT_BOLD_MASSIVE%'] = 'sans bold 60'
375         my_font_dict['%FONT_ITALIC_TINY%'] = 'sans italic 4'
376         my_font_dict['%FONT_ITALIC_SMALLER%'] = 'sans italic 6'
377         my_font_dict['%FONT_ITALIC_SMALL%'] = 'sans italic 7'
378         my_font_dict['%FONT_ITALIC_NORMAL%'] = 'sans italic 8'
379         my_font_dict['%FONT_ITALIC_BIG%'] = 'sans italic 12'
380         my_font_dict['%FONT_ITALIC_BIGGER%'] = 'sans italic 14'
381         my_font_dict['%FONT_ITALIC_LARGE%'] = 'sans italic 18'
382         my_font_dict['%FONT_ITALIC_LARGER%'] = 'sans italic 24'
383         my_font_dict['%FONT_ITALIC_HUGE%'] = 'sans italic 25'
384         my_font_dict['%FONT_ITALIC_HUGER%'] = 'sans italic 34'
385         my_font_dict['%FONT_ITALIC_MASSIVE%'] = 'sans italic 60'
386
387 ardour_dark_theme = env.SubstInFile ('ardour2_ui_dark.rc', 'ardour2_ui_dark.rc.in', SUBST_DICT = my_font_dict)
388 ardour_light_theme = env.SubstInFile ('ardour2_ui_light.rc', 'ardour2_ui_light.rc.in', SUBST_DICT = my_font_dict)
389
390 my_subst_dict = { }
391
392 #
393 # null substitution just to avoid ardour.bindings being in svn
394 #
395
396 ardourbindings = env.SubstInFile ('ardour.bindings', 'ardour.bindings.in', SUBST_DICT = my_subst_dict);
397
398 my_subst_dict['%INSTALL_PREFIX%'] = final_prefix
399 my_subst_dict['%LIBDIR%'] = env['LIBDIR']
400 my_subst_dict['%VERSION%'] = ardour_version
401
402 ardoursh = env.SubstInFile ('ardour.sh','ardour.sh.in', SUBST_DICT = my_subst_dict);
403 env.AddPostAction (ardoursh, Chmod ('$TARGET', 0755))
404
405 ardourdev = env.SubstInFile ('ardev_common.sh','ardev_common.sh.in', SUBST_DICT = my_subst_dict);
406 env.AddPostAction (ardourdev, Chmod ('$TARGET', 0755))
407
408 Default(ardourbindings)
409 Default(ardourdev)
410 Default(ardoursh)
411 Default(ardour_dark_theme)
412 Default(ardour_light_theme)
413
414 if env['VST']:
415         Default(ardourlib)
416         # the library - into the library dir
417         env.Alias('install', env.Install(os.path.join(install_prefix, env['LIBDIR'], 'ardour2'), ardourlib))
418 else:
419
420         if env['VERSIONED']:
421                 Default (env.VersionedExecutable ('tagged_executable', ardour))
422         else:
423                 Default(ardour)
424
425         #install
426
427         # the executable - into the library dir
428         env.Alias('install', env.Install(os.path.join(install_prefix, env['LIBDIR'], 'ardour2'), ardour))
429         # the script - into the bin dir
430         env.Alias('install', env.InstallAs(os.path.join(install_prefix, 'bin')+'/ardour2', ardoursh))
431
432 if env['NLS']:
433         i18n (gtkardour, gtkardour_files+skipped_files+fft_analysis_files, env)
434     
435 # configuration files
436 env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), ardour_dark_theme))
437 env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), ardour_light_theme))
438 env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), 'ardour.menus'))
439 env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), 'ardour-sae.menus'))
440 env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), 'ardour.bindings'))
441 env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), 'ardour2_ui_default.conf'))
442 # data files
443 env.Alias('install', env.Install(os.path.join(install_prefix, 'share', 'ardour2'), 'splash.png'))
444 env.Alias('install', env.Install(os.path.join(install_prefix, 'share', 'ardour2', 'pixmaps'), pixmap_files))
445 env.Alias('install', env.Install(os.path.join(install_prefix, 'share', 'ardour2', 'icons'), icon_files))
446
447 env.Alias ('version', gtkardour.VersionBuild(['version.cc','version.h'], []))
448                 
449 #dist
450 env.Alias ('tarball', env.Distribute (env['DISTTREE'],
451                                       [ 'SConscript',
452                                         'i18n.h', 'gettext.h',
453                                         'ardour.sh.in',
454                                         'ardev_common.sh.in',
455                                         'ardev', 'ardbg',
456                                         'ardour2_ui_dark.rc', 'ardour2_ui_light.rc', 'splash.png',
457                                         'ardour.menus',
458                                         'ardour-sae.menus',
459                                         'ardour.bindings.in', 'ardour2_ui_default.conf',
460                                         'editor_xpms'
461                                         ] +
462                                       gtkardour_files +
463                                       vst_files +
464                                       pixmap_files +
465                                       icon_files +
466                                       skipped_files +
467                                       audiounit_files + 
468                                       gtkosx_files +
469                                       x11_files +
470                                       fft_analysis_files +
471                                       glob.glob('po/*.po') + glob.glob('*.h')))
472
473 # generate a prototype full-featured ardour_ui.rc file
474
475 env.Alias ('protorc', env.Command ('proto.rc', gtkardour_files, """
476      grep set_name $SOURCES | \
477 sed 's/.*("\([a-zA-Z_][a-zA-Z_]*\)").*/\\1/' | \
478 grep -v '\\.' | sort | uniq | \
479 awk '/\\./ {} { printf ("style \\"%s\\"\\n{\\n\
480   fg[NORMAL] =   { 0, 0, 0 }\\n\
481   fg[ACTIVE] =   { 0, 0, 0 }\\n\
482   fg[SELECTED] = { 0, 0, 0 }\\n\
483   bg[NORMAL] =   { 0, 0, 0 }\\n\
484   bg[ACTIVE] =   { 0, 0, 0 }\\n\
485   bg[SELECTED] = { 0, 0, 0 }\\n\
486 }\\nwidget \\"*%s\\" style \\"%s\\"\\nwidget \\"*%s*\\" style \\"%s\\"\\n\\n", \
487   $$0, $$0, $$0, $$0, $$0) }' > $TARGET && \
488      grep 'color_map\[[a-zA-Z_][a-zA-Z]*\]' $SOURCES | \
489  sed 's/.*\[\([a-zA-Z_][a-zA-Z_]*\)].*/\\1/'| \
490  sort | uniq | \
491  awk '{ printf ("style \\"%s\\"\\n{\\n\
492   fg[NORMAL] =   { 0, 0, 0 }\\n\
493   fg[ACTIVE] =   { 0, 0, 0 }\\n\
494 }\\nwidget \\"*%s\\" style \\"%s\\"\\n \\n\\n", $$0, $$0, $$0) }' >> $TARGET ;
495 """
496 ))