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