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