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