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