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