fix up those horribly thick separators between ruler lines
[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 = 'gtk2_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 if gtkardour['IS_OSX']:
28         gtkardour.Append (LINKFLAGS="-Xlinker -headerpad -Xlinker 2048")
29
30 gtkardour.Merge ([
31     libraries['ardour'],
32     libraries['ardour_cp'],
33     libraries['atkmm'],
34     libraries['fftw3'],
35     libraries['fftw3f'],
36     libraries['flac'],
37     libraries['freetype2'],
38     libraries['gdkmm2'],
39     libraries['glib2'],
40     libraries['glibmm2'],
41     libraries['gtk2'],
42     libraries['gtkmm2'],
43     libraries['gtkmm2ext'],
44     libraries['jack'],
45     libraries['libgnomecanvas2'],
46     libraries['libgnomecanvasmm'],
47     libraries['lrdf'],
48     libraries['midi++2'],
49     libraries['pangomm'],
50     libraries['pbd'],
51     libraries['samplerate'],
52     libraries['sigc2'],
53     libraries['sndfile-ardour'],
54     libraries['sysmidi'],
55     libraries['vamp'],
56     libraries['vamphost'],
57     libraries['xml'],
58     libraries['xslt']
59 ])
60
61 gtkmmtests.Append(CXXFLAGS="-DLIBSIGC_DISABLE_DEPRECATED")
62
63 gtkmmtests.Merge ([
64     libraries['atkmm'],
65     libraries['gdkmm2'],
66     libraries['glib2'],
67     libraries['glibmm2'],
68     libraries['gtk2'],
69     libraries['gtkmm2'],
70     libraries['pangomm'],
71     libraries['sigc2']
72 ])
73
74 if gtkardour['DMALLOC']:
75         gtkardour.Merge([libraries['dmalloc']])
76         gtkardour.Append(CCFLAGS='-DUSE_DMALLOC')
77
78 if gtkardour['FFT_ANALYSIS']:
79         gtkardour.Merge ([libraries['fftw3f']])
80         gtkardour.Append(CCFLAGS='-DFFT_ANALYSIS')
81
82 if gtkardour['FREESOUND']:
83         gtkardour.Merge ([libraries['curl']])
84         gtkardour.Append(CCFLAGS='-DFREESOUND')
85
86 if gtkardour['RUBBERBAND']:
87         gtkardour.Merge ([ libraries['rubberband'] ])
88 else:
89         gtkardour.Merge ([ libraries['soundtouch'] ])
90
91 skipped_files=Split("""
92 connection_editor.cc
93 """)
94
95 audiounit_files=Split("""
96 au_pluginui.mm
97 """)
98
99 gtkosx_files=Split("""
100 cocoacarbon.mm
101 """)
102
103 x11_files=Split("""
104 x11.cc
105 """)
106
107 gtkardour_files=Split("""
108 about.cc
109 actions.cc
110 add_route_dialog.cc
111 ardour_dialog.cc
112 ardour_ui2.cc
113 ardour_ui.cc
114 ardour_ui_dependents.cc
115 ardour_ui_dialogs.cc
116 ardour_ui_ed.cc
117 ardour_ui_mixer.cc
118 ardour_ui_options.cc
119 audio_clock.cc
120 audio_region_editor.cc
121 audio_region_view.cc
122 audio_streamview.cc
123 audio_time_axis.cc
124 automation_gain_line.cc
125 automation_line.cc
126 automation_pan_line.cc
127 automation_time_axis.cc
128 axis_view.cc
129 boolean_automation_line.cc
130 canvas-imageframe.c
131 canvas-simpleline.c
132 canvas-simplerect.c
133 canvas-waveview.c
134 crossfade_edit.cc
135 crossfade_view.cc
136 curvetest.cc
137 editing.cc
138 editor_actions.cc
139 editor_audio_import.cc
140 editor_audiotrack.cc
141 editor_canvas.cc
142 editor_canvas_events.cc
143 editor.cc
144 editor_cursors.cc
145 editor_edit_groups.cc
146 editor_export_audio.cc
147 editor_hscroller.cc
148 editor_imageframe.cc
149 editor_keyboard.cc
150 editor_keys.cc
151 editor_markers.cc
152 editor_mixer.cc
153 editor_mouse.cc
154 editor_nudge.cc
155 editor_ops.cc
156 editor_region_list.cc
157 editor_route_list.cc
158 editor_rulers.cc
159 editor_scrub.cc
160 editor_selection.cc
161 editor_selection_list.cc
162 editor_tempodisplay.cc
163 editor_timefx.cc
164 engine_dialog.cc
165 enums.cc
166 export_dialog.cc
167 export_range_markers_dialog.cc
168 export_region_dialog.cc
169 export_session_dialog.cc
170 gain_automation_time_axis.cc
171 gain_meter.cc
172 generic_pluginui.cc
173 ghostregion.cc
174 gtk-custom-hruler.c
175 gtk-custom-ruler.c
176 imageframe.cc
177 imageframe_socket_handler.cc
178 imageframe_time_axis.cc
179 imageframe_time_axis_group.cc
180 imageframe_time_axis_view.cc
181 imageframe_view.cc
182 io_selector.cc
183 keyboard.cc
184 keyeditor.cc
185 level_meter.cc
186 location_ui.cc
187 main.cc
188 marker.cc
189 marker_time_axis.cc
190 marker_time_axis_view.cc
191 marker_view.cc
192 midi_port_dialog.cc
193 mixer_strip.cc
194 mixer_ui.cc
195 new_session_dialog.cc
196 option_editor.cc
197 opts.cc
198 pan_automation_time_axis.cc
199 panner2d.cc
200 panner.cc
201 panner_ui.cc
202 playlist_selector.cc
203 plugin_selector.cc
204 plugin_ui.cc
205 prompter.cc
206 public_editor.cc
207 redirect_automation_line.cc
208 redirect_automation_time_axis.cc
209 redirect_box.cc
210 region_gain_line.cc
211 region_selection.cc
212 region_view.cc
213 rhythm_ferret.cc
214 route_params_ui.cc
215 route_redirect_selection.cc
216 route_time_axis.cc
217 route_ui.cc
218 selection.cc
219 send_ui.cc
220 sfdb_ui.cc
221 simpleline.cc
222 simplerect.cc
223 splash.cc
224 streamview.cc
225 tape_region_view.cc
226 tempo_dialog.cc
227 theme_manager.cc
228 time_axis_view.cc
229 time_axis_view_item.cc
230 time_selection.cc
231 ui_config.cc
232 utils.cc
233 version.cc
234 visual_time_axis.cc
235 waveview.cc
236 """)
237
238 fft_analysis_files=Split("""
239 analysis_window.cc
240 fft_graph.cc
241 fft_result.cc
242 """)
243
244 freesound_files=Split("""
245 sfdb_freesound_mootcher.cc
246 """)
247
248 pixmap_files = glob.glob('pixmaps/*.xpm')
249 icon_files = glob.glob ('icons/*.png')
250
251 intl_files = gtkardour_files + glob.glob('*.h')
252
253 evtest_files=Split("""
254 evtest.cc
255 """)
256
257 mtest_files=Split("""
258 mtest.cc
259 """)
260
261
262 rcu_files=Split("""
263 rcu.cc
264 """)
265
266 itest_files=Split("""
267 itest.cc
268 """)
269
270 stest_files=Split("""
271 stest.cc
272 """)
273
274 tt_files=Split ("""
275 tt.cc
276 """)
277
278 extra_sources = []
279
280 vst_files = [ 'vst_pluginui.cc' ]
281
282 if env['VST']:
283         extra_sources += vst_files
284         gtkardour.Append (CCFLAGS="-DVST_SUPPORT", CPPPATH="#libs/fst")
285
286 if env['LV2']:
287         gtkardour.Append (CCFLAGS="-DHAVE_SLV2")
288         gtkardour.Merge ([libraries['slv2']])
289
290
291 if gtkardour['GTKOSX']:
292         extra_sources += gtkosx_files
293         gtkardour.Append (CCFLAGS="-DTOP_MENUBAR -DGTKOSX")
294         gtkardour.Append (LINKFLAGS=" -framework AppKit -framework CoreAudioKit")
295
296         if gtkardour['AUDIOUNITS']:
297                 extra_sources += audiounit_files
298                 gtkardour.Append(CCFLAGS='-DHAVE_AUDIOUNITS')
299                 gtkardour.Merge([libraries['appleutility']])
300
301 else:
302    extra_sources += x11_files
303         
304  
305 if env['FFT_ANALYSIS']:
306         extra_sources += fft_analysis_files
307
308 if env['FREESOUND']:
309         extra_sources += freesound_files
310
311 intl_files += extra_sources
312
313 gtkardour.Append(CCFLAGS="-D_REENTRANT -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE")
314 gtkardour.Append(CXXFLAGS="-DLOCALEDIR=\\\""+final_prefix+"/share/locale\\\"")
315
316 versionflag = '-DVERSIONSTRING=\\\"' + env['VERSION'] + '\\\"'
317
318 gtkardour.Append(CXXFLAGS=versionflag)
319
320 executable = 'ardour-' + ardour_version
321
322 ardour = gtkardour.Program(target = executable, source = gtkardour_files + extra_sources)
323 ardourlib = gtkardour.SharedLibrary(target = 'ardourgtk', source = gtkardour_files + extra_sources)
324
325 evest = gtkmmtests.Program(target = 'evtest', source = evtest_files)
326 mtest = gtkardour.Program(target = 'mtest', source = mtest_files)
327 itest = gtkardour.Program(target = 'itest', source = itest_files)
328 rcu = gtkardour.Program(target = 'rcu', source = rcu_files)
329 tt = gtkmmtests.Program(target = 'tt', source = tt_files)
330
331 my_font_dict = { }
332
333 if gtkardour['IS_OSX']:
334         #
335         # OS X font rendering is different even with X11
336         #
337
338         font_sizes = {
339                 'TINY' : '7',
340                 'SMALLER' : '9',
341                 'SMALL' : '10',
342                 'NORMAL' : '11',
343                 'BIG' : '12',
344                 'BIGGER' : '14',
345                 'LARGE' : '18',
346                 'LARGER' : '28',
347                 'HUGER' : '36',
348                 'MASSIVE' : '60'
349                 }
350         basefont = "Lucida Grande"
351
352 else:
353         #
354         # Linux/X11 font rendering
355         #
356         
357         if gtkardour['OLDFONTS']:
358                 font_sizes = {
359                         'TINY' : '4',
360                         'SMALLER' : '6',
361                         'SMALL' : '7',
362                         'NORMAL' : '8',
363                         'BIG' : '12',
364                         'BIGGER' : '14',
365                         'LARGE' : '18',
366                         'LARGER' : '24',
367                         'HUGER' : '34',
368                         'MASSIVE' : '60'
369                         }
370         else:
371                 font_sizes = {
372                         'TINY' : '6',
373                         'SMALLER' : '8',
374                         'SMALL' : '9',
375                         'NORMAL' : '10',
376                         'BIG' : '14',
377                         'BIGGER' : '16',
378                         'LARGE' : '18',
379                         'LARGER' : '24',
380                         'HUGER' : '34',
381                         'MASSIVE' : '60'
382                         }
383
384         basefont = "sans"
385
386 for style in ['', 'BOLD', 'ITALIC']:
387         for sizename,points in font_sizes.iteritems():
388                 if (len (style)):
389                         key = "_".join (['FONT',style,sizename])
390                         fontstyle = " ".join ([basefont,style.lower(),points])
391                 else:
392                         key = "_".join (['FONT',sizename])
393                         fontstyle = " ".join ([basefont,points])
394
395                 key = '%' + key + '%'
396                 my_font_dict[key] = fontstyle
397
398 ardour_dark_theme = env.SubstInFile ('ardour2_ui_dark.rc', 'ardour2_ui_dark.rc.in', SUBST_DICT = my_font_dict)
399 ardour_light_theme = env.SubstInFile ('ardour2_ui_light.rc', 'ardour2_ui_light.rc.in', SUBST_DICT = my_font_dict)
400
401 my_subst_dict = { }
402
403 #
404 # null substitution just to avoid ardour.bindings being in svn
405 #
406
407 keybindings_dict = { }
408
409 if gtkardour['GTKOSX'] and gtkardour['NATIVE_OSX_KEYS']:
410         #
411         # Command(Meta), Alt(Mod1), Ctrl, Shift
412         # **** as of february 4th 2008, OUR VERSION OF *****
413         # Gtk/Quartz maps:
414         #  NSCommand (aka "Command" aka "Apple" aka "Cauliflower") -> Meta
415         #  NSAlternate (aka "Option")  -> Mod1
416         #
417         keybindings_dict['%PRIMARY%'] = 'Meta'
418         keybindings_dict['%SECONDARY%'] = 'Mod1'
419         keybindings_dict['%TERTIARY%'] = 'Shift'
420         keybindings_dict['%LEVEL4%'] = 'Ctrl'
421         keybindings_dict['%WINDOW%'] = 'Mod1'
422 else:
423         #
424         # Ctrl, Alt, Shift, Mod4(Super/Windows/Hyper)
425         #
426         keybindings_dict['%PRIMARY%'] = 'Ctrl'
427         keybindings_dict['%SECONDARY%'] = 'Alt'
428         keybindings_dict['%TERTIARY%'] = 'Shift'
429         keybindings_dict['%LEVEL4%'] = env['WINDOWS_KEY']
430         keybindings_dict['%WINDOW%'] = 'Alt'
431
432 for b in [ 'SAE-de', 'mnemonic-us', 'ergonomic-us' ]:
433         target_file = b + '.bindings'
434         src_file = target_file + '.in'
435         Default (env.SubstInFile (target_file, src_file, SUBST_DICT = keybindings_dict))
436
437 my_subst_dict['%INSTALL_PREFIX%'] = final_prefix
438 my_subst_dict['%LIBDIR%'] = env['LIBDIR']
439 my_subst_dict['%VERSION%'] = ardour_version
440
441 ardoursh = env.SubstInFile ('ardour.sh','ardour.sh.in', SUBST_DICT = my_subst_dict);
442 env.AddPostAction (ardoursh, Chmod ('$TARGET', 0755))
443
444 ardourdev = env.SubstInFile ('ardev_common.sh','ardev_common.sh.in', SUBST_DICT = my_subst_dict);
445 env.AddPostAction (ardourdev, Chmod ('$TARGET', 0755))
446
447 Default(ardourdev)
448 Default(ardoursh)
449 Default(ardour_dark_theme)
450 Default(ardour_light_theme)
451
452 if env['VST']:
453         Default(ardourlib)
454         # the library - into the library dir
455         env.Alias('install', env.Install(os.path.join(install_prefix, env['LIBDIR'], 'ardour2'), ardourlib))
456 else:
457
458         if env['VERSIONED']:
459                 Default (env.VersionedExecutable ('tagged_executable', ardour))
460         else:
461                 Default(ardour)
462
463         #install
464
465         # the executable - into the library dir
466         env.Alias('install', env.Install(os.path.join(install_prefix, env['LIBDIR'], 'ardour2'), ardour))
467         # the script - into the bin dir
468         env.Alias('install', env.InstallAs(os.path.join(install_prefix, 'bin')+'/ardour2', ardoursh))
469
470 if env['NLS']:
471         i18n (gtkardour, gtkardour_files+skipped_files+fft_analysis_files, env)
472     
473 # configuration files
474 env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), ardour_dark_theme))
475 env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), ardour_light_theme))
476 env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), 'ardour2_ui_default.conf'))
477 env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), 'ardour.menus'))
478 env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), 'ardour-sae.menus'))
479 env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), 'ergonomic-us.bindings'))
480 env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), 'mnemonic-us.bindings'))
481 env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), 'SAE-de.bindings'))
482 # data files
483 env.Alias('install', env.Install(os.path.join(install_prefix, 'share', 'ardour2'), 'splash.png'))
484 env.Alias('install', env.Install(os.path.join(install_prefix, 'share', 'ardour2', 'pixmaps'), pixmap_files))
485 env.Alias('install', env.Install(os.path.join(install_prefix, 'share', 'ardour2', 'icons'), icon_files))
486 env.Alias ('version', gtkardour.VersionBuild(['version.cc','version.h'], []))
487
488 # This will install icons and MIME type as per freedesktop.org specs. #
489 if env['FREEDESKTOP']:
490         desktop_icon_install_prefix = install_prefix + '/share/icons/hicolor'
491         # Install the desktop icons to the default locations #
492         env.Alias('install', env.InstallAs(os.path.join(desktop_icon_install_prefix, '16x16', 'apps', 'ardour2.png'), 'icons/ardour_icon_16px.png'))
493         env.Alias('install', env.InstallAs(os.path.join(desktop_icon_install_prefix, '22x22', 'apps', 'ardour2.png'), 'icons/ardour_icon_22px.png'))
494         env.Alias('install', env.InstallAs(os.path.join(desktop_icon_install_prefix, '32x32', 'apps', 'ardour2.png'), 'icons/ardour_icon_32px.png'))
495         env.Alias('install', env.InstallAs(os.path.join(desktop_icon_install_prefix, '48x48', 'apps', 'ardour2.png'), 'icons/ardour_icon_48px.png'))
496         # Install the mime type xml file and its icon #
497         env.Alias('install', env.Install(os.path.join(install_prefix, 'share', 'mime', 'packages'), 'ardour2.xml'))
498         env.Alias('install', env.Install(os.path.join(desktop_icon_install_prefix, '48x48', 'mimetypes'), 'icons/application-x-ardour2.png'))
499         env.Alias('install', env.Command (os.path.join(install_prefix, 'share', 'mime'), [], 'update-mime-database $TARGET'))
500         # Update the icon cache #
501         env.Alias('install', env.Command (desktop_icon_install_prefix, [], 'touch --no-create $TARGET'))
502         env.Alias('install', env.Command (desktop_icon_install_prefix, [], 'gtk-update-icon-cache $TARGET'))
503         # Make the ardour2.desktop file and install it #
504         env.Alias('install', env.Command ('ardour2.desktop', 'ardour2.desktop.in', 'cat $SOURCES  > $TARGET'))
505         env.Alias('install', env.Install(os.path.join(install_prefix, 'share', 'applications'), 'ardour2.desktop'))
506         env.Alias('install', env.Command (os.path.join(install_prefix, 'share', 'applications'), [], 'update-desktop-database $TARGET'))
507         # uninstall target.. needed to run  update-mime-database and update-desktop-database after removal. #`
508         remove_desktop_files = env.Command ('another_frobnicatory_decoy', [],
509                              [ Delete (install_prefix + '/share/mime/packages/ardour2.xml'),
510                                Delete (install_prefix + '/share/applications/ardour2.desktop'),
511                                Delete (desktop_icon_install_prefix + '/16x16/apps/ardour2.png'),
512                                Delete (desktop_icon_install_prefix + '/22x22/apps/ardour2.png'),
513                                Delete (desktop_icon_install_prefix + '/32x32/apps/ardour2.png'),
514                                Delete (desktop_icon_install_prefix + '/48x48/apps/ardour2.png'),
515                                Delete (desktop_icon_install_prefix + '/48x48/mimetypes/application-x-ardour2.png'),
516                                Action ('update-mime-database ' + install_prefix + '/share/mime'),
517                                Action ('gtk-update-icon-cache ' + desktop_icon_install_prefix),
518                                Action ('update-desktop-database ' + install_prefix + '/share/applications')])
519         env.Alias('uninstall', remove_desktop_files)
520
521 #dist
522 env.Alias ('tarball', env.Distribute (env['DISTTREE'],
523                                       [ 'SConscript',
524                                         'i18n.h', 'gettext.h',
525                                         'ardour.sh.in',
526                                         'ardev_common.sh.in',
527                                         'ardev', 'ardbg',
528                                         'ardour2_ui_dark.rc.in', 'ardour2_ui_light.rc.in', 'splash.png',
529                                         'ardour.menus', 'ardour-sae.menus', 
530                                         'ardour.bindings.in', 
531                                         'ardour-sae-ansi.bindings.in', 
532                                         'ardour-sae-de.bindings.in', 
533                                         'ardour2_ui_default.conf',
534                                         'editor_xpms',
535                                         'ardour2.xml',
536                                         'ardour2.desktop.in'
537                                         ] +
538                                       gtkardour_files +
539                                       vst_files +
540                                       pixmap_files +
541                                       icon_files +
542                                       skipped_files +
543                                       audiounit_files + 
544                                       gtkosx_files +
545                                       x11_files +
546                                       fft_analysis_files +
547                                       freesound_files +
548                                       glob.glob('po/*.po') + glob.glob('*.h')))
549
550 # generate a prototype full-featured ardour_ui.rc file
551
552 env.Alias ('protorc', env.Command ('proto.rc', gtkardour_files, """
553      grep set_name $SOURCES | \
554 sed 's/.*("\([a-zA-Z_][a-zA-Z_]*\)").*/\\1/' | \
555 grep -v '\\.' | sort | uniq | \
556 awk '/\\./ {} { printf ("style \\"%s\\"\\n{\\n\
557   fg[NORMAL] =   { 0, 0, 0 }\\n\
558   fg[ACTIVE] =   { 0, 0, 0 }\\n\
559   fg[SELECTED] = { 0, 0, 0 }\\n\
560   bg[NORMAL] =   { 0, 0, 0 }\\n\
561   bg[ACTIVE] =   { 0, 0, 0 }\\n\
562   bg[SELECTED] = { 0, 0, 0 }\\n\
563 }\\nwidget \\"*%s\\" style \\"%s\\"\\nwidget \\"*%s*\\" style \\"%s\\"\\n\\n", \
564   $$0, $$0, $$0, $$0, $$0) }' > $TARGET && \
565      grep 'color_map\[[a-zA-Z_][a-zA-Z]*\]' $SOURCES | \
566  sed 's/.*\[\([a-zA-Z_][a-zA-Z_]*\)].*/\\1/'| \
567  sort | uniq | \
568  awk '{ printf ("style \\"%s\\"\\n{\\n\
569   fg[NORMAL] =   { 0, 0, 0 }\\n\
570   fg[ACTIVE] =   { 0, 0, 0 }\\n\
571 }\\nwidget \\"*%s\\" style \\"%s\\"\\n \\n\\n", $$0, $$0, $$0) }' >> $TARGET ;
572 """
573 ))