Merged with trunk R992.
[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 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(CXXFLAGS="-DFLOWCANVAS_AA")
23 gtkardour.Append(PACKAGE=domain)
24 gtkardour.Append(POTFILE=domain + '.pot')
25
26 gtkardour.Merge ([
27     libraries['ardour'],
28     libraries['ardour_cp'],
29     libraries['gtkmm2ext'],
30     libraries['midi++2'],
31     libraries['pbd'],
32     libraries['gtkmm2'],
33     libraries['glib2'],
34     libraries['libgnomecanvas2'],
35     libraries['libgnomecanvasmm'],
36     libraries['sysmidi'],
37     libraries['sndfile'],
38     libraries['flac'],
39     libraries['lrdf'],
40     libraries['glibmm2'],
41     libraries['pangomm'],
42     libraries['atkmm'],
43     libraries['gdkmm2'],
44     libraries['sigc2'],
45     libraries['gtk2'],
46     libraries['xml'],
47     libraries['xslt'],
48     libraries['soundtouch'],
49     libraries['samplerate'],
50     libraries['jack']
51 ])
52
53 gtkmmtests.Append(CXXFLAGS="-DLIBSIGC_DISABLE_DEPRECATED")
54
55 gtkmmtests.Merge ([
56     libraries['gtkmm2'],
57     libraries['glib2'],
58     libraries['glibmm2'],
59     libraries['pangomm'],
60     libraries['atkmm'],
61     libraries['gdkmm2'],
62     libraries['sigc2'],
63     libraries['gtk2']
64 ])
65
66 if gtkardour['DMALLOC']:
67         gtkardour.Merge([libraries['dmalloc']])
68         gtkardour.Append(CCFLAGS='-DUSE_DMALLOC')
69
70 if gtkardour['FFT_ANALYSIS']:
71         gtkardour.Merge ([libraries['fftw3f']])
72         gtkardour.Append(CCFLAGS='-DFFT_ANALYSIS')
73
74 skipped_files=Split("""
75 connection_editor.cc
76 """)
77
78 audiounit_files=Split("""
79 au_pluginui.cc
80 """)
81
82 gtkardour_files=Split("""
83 about.cc
84 actions.cc
85 add_route_dialog.cc
86 ardour_dialog.cc
87 ardour_ui.cc
88 ardour_ui2.cc
89 ardour_ui_dependents.cc
90 ardour_ui_dialogs.cc
91 ardour_ui_ed.cc
92 ardour_ui_mixer.cc
93 ardour_ui_options.cc
94 audio_clock.cc
95 audio_time_axis.cc
96 audio_region_editor.cc
97 automation_gain_line.cc
98 automation_line.cc
99 automation_pan_line.cc
100 automation_time_axis.cc
101 midi_time_axis.cc
102 midi_streamview.cc
103 axis_view.cc
104 canvas-imageframe.c
105 canvas-simpleline.c
106 simpleline.cc
107 canvas-simplerect.c
108 simplerect.cc
109 canvas-waveview.c
110 color_manager.cc
111 crossfade_edit.cc
112 crossfade_view.cc
113 curvetest.cc
114 editing.cc
115 editor.cc
116 editor_actions.cc
117 editor_audio_import.cc
118 editor_audiotrack.cc
119 editor_canvas.cc
120 editor_canvas_events.cc
121 editor_cursors.cc
122 editor_edit_groups.cc
123 editor_export_audio.cc
124 editor_hscroller.cc
125 editor_imageframe.cc
126 editor_keyboard.cc
127 editor_keys.cc
128 editor_markers.cc
129 editor_mixer.cc
130 editor_mouse.cc
131 editor_nudge.cc
132 editor_ops.cc
133 editor_region_list.cc
134 editor_route_list.cc
135 editor_rulers.cc
136 editor_scrub.cc
137 editor_selection_list.cc
138 editor_tempodisplay.cc
139 editor_timefx.cc
140 export_dialog.cc
141 export_session_dialog.cc
142 export_region_dialog.cc
143 export_range_markers_dialog.cc
144 gain_automation_time_axis.cc
145 gain_meter.cc
146 ghostregion.cc
147 grouped_buttons.cc
148 gtk-custom-hruler.c
149 gtk-custom-ruler.c
150 imageframe.cc
151 imageframe_socket_handler.cc
152 imageframe_time_axis.cc
153 imageframe_time_axis_group.cc
154 imageframe_time_axis_view.cc
155 imageframe_view.cc
156 io_selector.cc
157 keyboard.cc
158 ladspa_pluginui.cc
159 location_ui.cc
160 main.cc
161 marker.cc
162 marker_time_axis.cc
163 marker_time_axis_view.cc
164 marker_view.cc
165 mixer_strip.cc
166 mixer_ui.cc
167 new_session_dialog.cc
168 option_editor.cc
169 opts.cc
170 pan_automation_time_axis.cc
171 panner2d.cc
172 panner_ui.cc
173 playlist_selector.cc
174 plugin_selector.cc
175 plugin_ui.cc
176 prompter.cc
177 public_editor.cc
178 redirect_automation_line.cc
179 redirect_automation_time_axis.cc
180 redirect_box.cc
181 region_gain_line.cc
182 region_selection.cc
183 region_view.cc
184 audio_region_view.cc
185 midi_region_view.cc
186 tape_region_view.cc
187 route_params_ui.cc
188 route_redirect_selection.cc
189 route_ui.cc
190 selection.cc
191 sfdb_ui.cc
192 send_ui.cc
193 streamview.cc
194 audio_streamview.cc
195 tempo_dialog.cc
196 time_axis_view.cc
197 time_axis_view_item.cc
198 route_time_axis.cc
199 time_selection.cc
200 utils.cc
201 version.cc
202 visual_time_axis.cc
203 waveview.cc
204 """)
205
206 fft_analysis_files=Split("""
207 analysis_window.cc
208 fft_graph.cc
209 fft_result.cc
210 """)
211
212 pixmap_files = glob.glob('pixmaps/*.xpm')
213 icon_files = glob.glob ('icons/*.png')
214
215 intl_files = gtkardour_files + glob.glob('*.h')
216
217 mtest_files=Split("""
218 mtest.cc
219 """)
220
221
222 rcu_files=Split("""
223 rcu.cc
224 """)
225
226 itest_files=Split("""
227 itest.cc
228 """)
229
230 stest_files=Split("""
231 stest.cc
232 """)
233
234 tt_files=Split ("""
235 tt.cc
236 """)
237
238 extra_sources = []
239
240 vst_files = [ 'vst_pluginui.cc' ]
241
242 if env['VST']:
243         extra_sources += vst_files
244         gtkardour.Append (CCFLAGS="-DVST_SUPPORT", CPPPATH="#libs/fst")
245
246 if gtkardour['AUDIOUNITS']:
247     extra_sources += audiounit_files
248     gtkardour.Append(CCFLAGS='-DHAVE_AUDIOUNITS')
249     gtkardour.Append(LINKFLAGS='-framework Carbon')
250     gtkardour.Merge([libraries['appleutility']])
251  
252 if env['FFT_ANALYSIS']:
253         extra_sources += fft_analysis_files
254
255 intl_files += extra_sources
256
257 gtkardour.Append(CCFLAGS="-D_REENTRANT -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE")
258 gtkardour.Append(CXXFLAGS="-DLOCALEDIR=\\\""+final_prefix+"/share/locale\\\"")
259
260 versionflag = '-DVERSIONSTRING=\\\"' + env['VERSION'] + '\\\"'
261
262 gtkardour.Append(CXXFLAGS=versionflag)
263
264 gtkardour.VersionBuild(['version.cc','version.h'], 'SConscript')
265
266 executable = 'ardour.bin'
267
268 ardour = gtkardour.Program(target = executable, source = gtkardour_files + extra_sources)
269 ardourlib = gtkardour.SharedLibrary(target = 'ardourgtk', source = gtkardour_files + extra_sources)
270
271 mtest = gtkardour.Program(target = 'mtest', source = mtest_files)
272 itest = gtkardour.Program(target = 'itest', source = itest_files)
273 rcu = gtkardour.Program(target = 'rcu', source = rcu_files)
274 tt = gtkmmtests.Program(target = 'tt', source = tt_files)
275
276 my_subst_dict = { }
277 my_subst_dict['%INSTALL_PREFIX%'] = final_prefix
278
279 ardoursh = env.SubstInFile ('ardour.sh','ardour.sh.in', SUBST_DICT = my_subst_dict);
280 env.AddPostAction (ardoursh, Chmod ('$TARGET', 0755))
281
282 if env['VST']:
283         Default(ardourlib)
284         # the library - into the library dir
285         env.Alias('install', env.Install(os.path.join(install_prefix, 'lib/ardour2'), ardourlib))
286 else:
287
288         if env['VERSIONED']:
289                 Default (env.VersionedExecutable ('tagged_executable', ardour))
290         else:
291                 Default(ardour)
292
293         #install
294
295         # the executable - into the library dir
296         env.Alias('install', env.Install(os.path.join(install_prefix, 'lib/ardour2'), ardour))
297         # the script - into the bin dir
298         env.Alias('install', env.InstallAs(os.path.join(install_prefix, 'bin')+'/ardour2', ardoursh))
299
300 if env['NLS']:
301         i18n (gtkardour, gtkardour_files+skipped_files+fft_analysis_files, env)
302     
303 # configuration files
304 env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), 'ardour2_ui.rc'))
305 env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), 'ardour.menus'))
306 env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), 'ardour.bindings'))
307 env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), 'ardour.colors'))
308 # data files
309 env.Alias('install', env.Install(os.path.join(install_prefix, 'share/ardour2'), 'splash.png'))
310 env.Alias('install', env.Install(os.path.join(install_prefix, 'share/ardour2/pixmaps'), pixmap_files))
311 env.Alias('install', env.Install(os.path.join(install_prefix, 'share/ardour2/icons'), icon_files))
312
313                 
314 #dist
315 env.Alias ('tarball', env.Distribute (env['DISTTREE'],
316                                       [ 'SConscript',
317                                         'i18n.h', 'gettext.h',
318                                         'ardour.sh.in',
319                                         'ardour2_ui.rc', 'splash.png',
320                                         'ardour.menus', 'ardour.bindings', 'ardour.colors',
321                                         'editor_xpms'
322                                         ] +
323                                       gtkardour_files +
324                                       vst_files +
325                                       pixmap_files +
326                                       icon_files +
327                                       skipped_files +
328                                       audiounit_files + 
329                                       fft_analysis_files +
330                                       glob.glob('po/*.po') + glob.glob('*.h')))
331
332 # generate a prototype full-featured ardour_ui.rc file
333
334 env.Alias ('protorc', env.Command ('proto.rc', gtkardour_files, """
335      grep set_name $SOURCES | \
336 sed 's/.*("\([a-zA-Z_][a-zA-Z_]*\)").*/\\1/' | \
337 grep -v '\\.' | sort | uniq | \
338 awk '/\\./ {} { printf ("style \\"%s\\"\\n{\\n\
339   fg[NORMAL] =   { 0, 0, 0 }\\n\
340   fg[ACTIVE] =   { 0, 0, 0 }\\n\
341   fg[SELECTED] = { 0, 0, 0 }\\n\
342   bg[NORMAL] =   { 0, 0, 0 }\\n\
343   bg[ACTIVE] =   { 0, 0, 0 }\\n\
344   bg[SELECTED] = { 0, 0, 0 }\\n\
345 }\\nwidget \\"*%s\\" style \\"%s\\"\\nwidget \\"*%s*\\" style \\"%s\\"\\n\\n", \
346   $$0, $$0, $$0, $$0, $$0) }' > $TARGET && \
347      grep 'color_map\[[a-zA-Z_][a-zA-Z]*\]' $SOURCES | \
348  sed 's/.*\[\([a-zA-Z_][a-zA-Z_]*\)].*/\\1/'| \
349  sort | uniq | \
350  awk '{ printf ("style \\"%s\\"\\n{\\n\
351   fg[NORMAL] =   { 0, 0, 0 }\\n\
352   fg[ACTIVE] =   { 0, 0, 0 }\\n\
353 }\\nwidget \\"*%s\\" style \\"%s\\"\\n \\n\\n", $$0, $$0, $$0) }' >> $TARGET ;
354 """
355 ))