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