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