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