60e7bca331cc9808b171f5be687a4d975fe4e763
[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 audio_time_axis.cc
97 audio_region_editor.cc
98 automation_gain_line.cc
99 automation_line.cc
100 automation_pan_line.cc
101 automation_time_axis.cc
102 midi_time_axis.cc
103 midi_streamview.cc
104 axis_view.cc
105 canvas-imageframe.c
106 canvas-simpleline.c
107 simpleline.cc
108 canvas-simplerect.c
109 simplerect.cc
110 canvas-waveview.c
111 color_manager.cc
112 crossfade_edit.cc
113 crossfade_view.cc
114 curvetest.cc
115 enums.cc
116 editing.cc
117 editor.cc
118 editor_actions.cc
119 editor_audio_import.cc
120 editor_audiotrack.cc
121 editor_canvas.cc
122 editor_canvas_events.cc
123 editor_cursors.cc
124 editor_edit_groups.cc
125 editor_export_audio.cc
126 editor_hscroller.cc
127 editor_imageframe.cc
128 editor_keyboard.cc
129 editor_keys.cc
130 editor_markers.cc
131 editor_mixer.cc
132 editor_mouse.cc
133 editor_nudge.cc
134 editor_ops.cc
135 editor_region_list.cc
136 editor_route_list.cc
137 editor_rulers.cc
138 editor_scrub.cc
139 editor_selection.cc
140 editor_selection_list.cc
141 editor_tempodisplay.cc
142 editor_timefx.cc
143 export_dialog.cc
144 export_session_dialog.cc
145 export_region_dialog.cc
146 export_range_markers_dialog.cc
147 gain_automation_time_axis.cc
148 gain_meter.cc
149 ghostregion.cc
150 gtk-custom-hruler.c
151 gtk-custom-ruler.c
152 imageframe.cc
153 imageframe_socket_handler.cc
154 imageframe_time_axis.cc
155 imageframe_time_axis_group.cc
156 imageframe_time_axis_view.cc
157 imageframe_view.cc
158 io_selector.cc
159 keyboard.cc
160 ladspa_pluginui.cc
161 location_ui.cc
162 main.cc
163 marker.cc
164 marker_time_axis.cc
165 marker_time_axis_view.cc
166 marker_view.cc
167 mixer_strip.cc
168 mixer_ui.cc
169 new_session_dialog.cc
170 option_editor.cc
171 opts.cc
172 pan_automation_time_axis.cc
173 panner.cc
174 panner2d.cc
175 panner_ui.cc
176 playlist_selector.cc
177 plugin_selector.cc
178 plugin_ui.cc
179 prompter.cc
180 public_editor.cc
181 redirect_automation_line.cc
182 redirect_automation_time_axis.cc
183 redirect_box.cc
184 region_gain_line.cc
185 region_selection.cc
186 region_view.cc
187 audio_region_view.cc
188 midi_region_view.cc
189 tape_region_view.cc
190 route_params_ui.cc
191 route_redirect_selection.cc
192 route_ui.cc
193 selection.cc
194 sfdb_ui.cc
195 send_ui.cc
196 streamview.cc
197 audio_streamview.cc
198 tempo_dialog.cc
199 time_axis_view.cc
200 time_axis_view_item.cc
201 route_time_axis.cc
202 time_selection.cc
203 utils.cc
204 version.cc
205 visual_time_axis.cc
206 waveview.cc
207 """)
208
209 fft_analysis_files=Split("""
210 analysis_window.cc
211 fft_graph.cc
212 fft_result.cc
213 """)
214
215 pixmap_files = glob.glob('pixmaps/*.xpm')
216 icon_files = glob.glob ('icons/*.png')
217
218 intl_files = gtkardour_files + glob.glob('*.h')
219
220 mtest_files=Split("""
221 mtest.cc
222 """)
223
224
225 rcu_files=Split("""
226 rcu.cc
227 """)
228
229 itest_files=Split("""
230 itest.cc
231 """)
232
233 stest_files=Split("""
234 stest.cc
235 """)
236
237 tt_files=Split ("""
238 tt.cc
239 """)
240
241 extra_sources = []
242
243 vst_files = [ 'vst_pluginui.cc' ]
244
245 if env['VST']:
246         extra_sources += vst_files
247         gtkardour.Append (CCFLAGS="-DVST_SUPPORT", CPPPATH="#libs/fst")
248
249 if gtkardour['AUDIOUNITS']:
250     extra_sources += audiounit_files
251     gtkardour.Append(CCFLAGS='-DHAVE_AUDIOUNITS')
252     gtkardour.Append(LINKFLAGS='-framework Carbon')
253     gtkardour.Merge([libraries['appleutility']])
254  
255 if env['FFT_ANALYSIS']:
256         extra_sources += fft_analysis_files
257
258 intl_files += extra_sources
259
260 gtkardour.Append(CCFLAGS="-D_REENTRANT -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE")
261 gtkardour.Append(CXXFLAGS="-DLOCALEDIR=\\\""+final_prefix+"/share/locale\\\"")
262
263 versionflag = '-DVERSIONSTRING=\\\"' + env['VERSION'] + '\\\"'
264
265 gtkardour.Append(CXXFLAGS=versionflag)
266
267 executable = 'ardour-' + ardour_version
268
269 ardour = gtkardour.Program(target = executable, source = gtkardour_files + extra_sources)
270 ardourlib = gtkardour.SharedLibrary(target = 'ardourgtk', source = gtkardour_files + extra_sources)
271
272 mtest = gtkardour.Program(target = 'mtest', source = mtest_files)
273 itest = gtkardour.Program(target = 'itest', source = itest_files)
274 rcu = gtkardour.Program(target = 'rcu', source = rcu_files)
275 tt = gtkmmtests.Program(target = 'tt', source = tt_files)
276
277 my_subst_dict = { }
278
279 #
280 # null substitution just to avoid ardour.bindings being in svn
281 #
282
283 ardourbindings = env.SubstInFile ('ardour.bindings', 'ardour.bindings.in', SUBST_DICT = my_subst_dict);
284
285 my_subst_dict['%INSTALL_PREFIX%'] = final_prefix
286 my_subst_dict['%LIBDIR%'] = env['LIBDIR']
287 my_subst_dict['%VERSION%'] = ardour_version
288
289 ardoursh = env.SubstInFile ('ardour.sh','ardour.sh.in', SUBST_DICT = my_subst_dict);
290 env.AddPostAction (ardoursh, Chmod ('$TARGET', 0755))
291
292 ardourdev = env.SubstInFile ('ardev_common.sh','ardev_common.sh.in', SUBST_DICT = my_subst_dict);
293 env.AddPostAction (ardourdev, Chmod ('$TARGET', 0755))
294
295 Default(ardourbindings)
296 Default(ardourdev)
297 Default(ardoursh)
298
299 if env['VST']:
300         Default(ardourlib)
301         # the library - into the library dir
302         env.Alias('install', env.Install(os.path.join(install_prefix, env['LIBDIR'], 'ardour2'), ardourlib))
303 else:
304
305         if env['VERSIONED']:
306                 Default (env.VersionedExecutable ('tagged_executable', ardour))
307         else:
308                 Default(ardour)
309
310         #install
311
312         # the executable - into the library dir
313         env.Alias('install', env.Install(os.path.join(install_prefix, env['LIBDIR'], 'ardour2'), ardour))
314         # the script - into the bin dir
315         env.Alias('install', env.InstallAs(os.path.join(install_prefix, 'bin')+'/ardour2', ardoursh))
316
317 if env['NLS']:
318         i18n (gtkardour, gtkardour_files+skipped_files+fft_analysis_files, env)
319     
320 # configuration files
321 env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), 'ardour2_ui.rc'))
322 env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), 'ardour.menus'))
323 env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), 'ardour.bindings'))
324 env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), 'ardour.colors'))
325 # data files
326 env.Alias('install', env.Install(os.path.join(install_prefix, 'share', 'ardour2'), 'splash.png'))
327 env.Alias('install', env.Install(os.path.join(install_prefix, 'share', 'ardour2', 'pixmaps'), pixmap_files))
328 env.Alias('install', env.Install(os.path.join(install_prefix, 'share', 'ardour2', 'icons'), icon_files))
329
330 env.Alias ('version', gtkardour.VersionBuild(['version.cc','version.h'], []))
331                 
332 #dist
333 env.Alias ('tarball', env.Distribute (env['DISTTREE'],
334                                       [ 'SConscript',
335                                         'i18n.h', 'gettext.h',
336                                         'ardour.sh.in',
337                                         'ardev_common.sh.in',
338                                         'ardour2_ui.rc', 'splash.png',
339                                         'ardour.menus', 'ardour.bindings.in', 'ardour.colors',
340                                         'editor_xpms'
341                                         ] +
342                                       gtkardour_files +
343                                       vst_files +
344                                       pixmap_files +
345                                       icon_files +
346                                       skipped_files +
347                                       audiounit_files + 
348                                       fft_analysis_files +
349                                       glob.glob('po/*.po') + glob.glob('*.h')))
350
351 # generate a prototype full-featured ardour_ui.rc file
352
353 env.Alias ('protorc', env.Command ('proto.rc', gtkardour_files, """
354      grep set_name $SOURCES | \
355 sed 's/.*("\([a-zA-Z_][a-zA-Z_]*\)").*/\\1/' | \
356 grep -v '\\.' | sort | uniq | \
357 awk '/\\./ {} { printf ("style \\"%s\\"\\n{\\n\
358   fg[NORMAL] =   { 0, 0, 0 }\\n\
359   fg[ACTIVE] =   { 0, 0, 0 }\\n\
360   fg[SELECTED] = { 0, 0, 0 }\\n\
361   bg[NORMAL] =   { 0, 0, 0 }\\n\
362   bg[ACTIVE] =   { 0, 0, 0 }\\n\
363   bg[SELECTED] = { 0, 0, 0 }\\n\
364 }\\nwidget \\"*%s\\" style \\"%s\\"\\nwidget \\"*%s*\\" style \\"%s\\"\\n\\n", \
365   $$0, $$0, $$0, $$0, $$0) }' > $TARGET && \
366      grep 'color_map\[[a-zA-Z_][a-zA-Z]*\]' $SOURCES | \
367  sed 's/.*\[\([a-zA-Z_][a-zA-Z_]*\)].*/\\1/'| \
368  sort | uniq | \
369  awk '{ printf ("style \\"%s\\"\\n{\\n\
370   fg[NORMAL] =   { 0, 0, 0 }\\n\
371   fg[ACTIVE] =   { 0, 0, 0 }\\n\
372 }\\nwidget \\"*%s\\" style \\"%s\\"\\n \\n\\n", $$0, $$0, $$0) }' >> $TARGET ;
373 """
374 ))