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