Merged with trunk R1141
[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(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 editing.cc
116 editor.cc
117 editor_actions.cc
118 editor_audio_import.cc
119 editor_audiotrack.cc
120 editor_canvas.cc
121 editor_canvas_events.cc
122 editor_cursors.cc
123 editor_edit_groups.cc
124 editor_export_audio.cc
125 editor_hscroller.cc
126 editor_imageframe.cc
127 editor_keyboard.cc
128 editor_keys.cc
129 editor_markers.cc
130 editor_mixer.cc
131 editor_mouse.cc
132 editor_nudge.cc
133 editor_ops.cc
134 editor_region_list.cc
135 editor_route_list.cc
136 editor_rulers.cc
137 editor_scrub.cc
138 editor_selection_list.cc
139 editor_tempodisplay.cc
140 editor_timefx.cc
141 export_dialog.cc
142 export_session_dialog.cc
143 export_region_dialog.cc
144 export_range_markers_dialog.cc
145 gain_automation_time_axis.cc
146 gain_meter.cc
147 ghostregion.cc
148 grouped_buttons.cc
149 gtk-custom-hruler.c
150 gtk-custom-ruler.c
151 imageframe.cc
152 imageframe_socket_handler.cc
153 imageframe_time_axis.cc
154 imageframe_time_axis_group.cc
155 imageframe_time_axis_view.cc
156 imageframe_view.cc
157 io_selector.cc
158 keyboard.cc
159 ladspa_pluginui.cc
160 location_ui.cc
161 main.cc
162 marker.cc
163 marker_time_axis.cc
164 marker_time_axis_view.cc
165 marker_view.cc
166 mixer_strip.cc
167 mixer_ui.cc
168 new_session_dialog.cc
169 option_editor.cc
170 opts.cc
171 pan_automation_time_axis.cc
172 panner2d.cc
173 panner_ui.cc
174 playlist_selector.cc
175 plugin_selector.cc
176 plugin_ui.cc
177 prompter.cc
178 public_editor.cc
179 redirect_automation_line.cc
180 redirect_automation_time_axis.cc
181 redirect_box.cc
182 region_gain_line.cc
183 region_selection.cc
184 region_view.cc
185 audio_region_view.cc
186 midi_region_view.cc
187 tape_region_view.cc
188 route_params_ui.cc
189 route_redirect_selection.cc
190 route_ui.cc
191 selection.cc
192 sfdb_ui.cc
193 send_ui.cc
194 streamview.cc
195 audio_streamview.cc
196 tempo_dialog.cc
197 time_axis_view.cc
198 time_axis_view_item.cc
199 route_time_axis.cc
200 time_selection.cc
201 utils.cc
202 version.cc
203 visual_time_axis.cc
204 waveview.cc
205 """)
206
207 fft_analysis_files=Split("""
208 analysis_window.cc
209 fft_graph.cc
210 fft_result.cc
211 """)
212
213 pixmap_files = glob.glob('pixmaps/*.xpm')
214 icon_files = glob.glob ('icons/*.png')
215
216 intl_files = gtkardour_files + glob.glob('*.h')
217
218 mtest_files=Split("""
219 mtest.cc
220 """)
221
222
223 rcu_files=Split("""
224 rcu.cc
225 """)
226
227 itest_files=Split("""
228 itest.cc
229 """)
230
231 stest_files=Split("""
232 stest.cc
233 """)
234
235 tt_files=Split ("""
236 tt.cc
237 """)
238
239 extra_sources = []
240
241 vst_files = [ 'vst_pluginui.cc' ]
242
243 if env['VST']:
244         extra_sources += vst_files
245         gtkardour.Append (CCFLAGS="-DVST_SUPPORT", CPPPATH="#libs/fst")
246
247 if gtkardour['AUDIOUNITS']:
248     extra_sources += audiounit_files
249     gtkardour.Append(CCFLAGS='-DHAVE_AUDIOUNITS')
250     gtkardour.Append(LINKFLAGS='-framework Carbon')
251     gtkardour.Merge([libraries['appleutility']])
252  
253 if env['FFT_ANALYSIS']:
254         extra_sources += fft_analysis_files
255
256 intl_files += extra_sources
257
258 gtkardour.Append(CCFLAGS="-D_REENTRANT -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE")
259 gtkardour.Append(CXXFLAGS="-DLOCALEDIR=\\\""+final_prefix+"/share/locale\\\"")
260
261 versionflag = '-DVERSIONSTRING=\\\"' + env['VERSION'] + '\\\"'
262
263 gtkardour.Append(CXXFLAGS=versionflag)
264
265 executable = 'ardour.bin'
266
267 ardour = gtkardour.Program(target = executable, source = gtkardour_files + extra_sources)
268 ardourlib = gtkardour.SharedLibrary(target = 'ardourgtk', source = gtkardour_files + extra_sources)
269
270 mtest = gtkardour.Program(target = 'mtest', source = mtest_files)
271 itest = gtkardour.Program(target = 'itest', source = itest_files)
272 rcu = gtkardour.Program(target = 'rcu', source = rcu_files)
273 tt = gtkmmtests.Program(target = 'tt', source = tt_files)
274
275 my_subst_dict = { }
276 my_subst_dict['%INSTALL_PREFIX%'] = final_prefix
277
278 ardoursh = env.SubstInFile ('ardour.sh','ardour.sh.in', SUBST_DICT = my_subst_dict);
279 env.AddPostAction (ardoursh, Chmod ('$TARGET', 0755))
280
281 if env['VST']:
282         Default(ardourlib)
283         # the library - into the library dir
284         env.Alias('install', env.Install(os.path.join(install_prefix, 'lib/ardour2'), ardourlib))
285 else:
286
287         if env['VERSIONED']:
288                 Default (env.VersionedExecutable ('tagged_executable', ardour))
289         else:
290                 Default(ardour)
291
292         #install
293
294         # the executable - into the library dir
295         env.Alias('install', env.Install(os.path.join(install_prefix, 'lib/ardour2'), ardour))
296         # the script - into the bin dir
297         env.Alias('install', env.InstallAs(os.path.join(install_prefix, 'bin')+'/ardour2', ardoursh))
298
299 if env['NLS']:
300         i18n (gtkardour, gtkardour_files+skipped_files+fft_analysis_files, env)
301     
302 # configuration files
303 env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), 'ardour2_ui.rc'))
304 env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), 'ardour.menus'))
305 env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), 'ardour.bindings'))
306 env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), 'ardour.colors'))
307 # data files
308 env.Alias('install', env.Install(os.path.join(install_prefix, 'share/ardour2'), 'splash.png'))
309 env.Alias('install', env.Install(os.path.join(install_prefix, 'share/ardour2/pixmaps'), pixmap_files))
310 env.Alias('install', env.Install(os.path.join(install_prefix, 'share/ardour2/icons'), icon_files))
311
312 env.Alias ('version', gtkardour.VersionBuild(['version.cc','version.h'], []))
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 ))