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