13
0
livetrax/gtk2_ardour/SConscript
Carl Hetherington 7a726092d7 Fix scons install build.
git-svn-id: svn://localhost/ardour2/branches/3.0@5164 d708f5d6-7413-0410-9779-e7cbd77b26cf
2009-06-11 11:53:36 +00:00

639 lines
19 KiB
Python

# -*- python -*-
import os
import os.path
import glob
Import('env install_prefix final_prefix config_prefix libraries i18n ardour_version')
gtkardour = env.Clone()
gtkmmtests = env.Clone()
#
# this defines the version number of the GTK interface to ardour
#
domain = 'gtk2_ardour'
gtkardour.Append(DOMAIN=domain, MAJOR=1,MINOR=0,MICRO=2)
gtkardour.Append(CCFLAGS="-DPACKAGE=\\\"" + domain + "\\\"")
gtkardour.Append(CXXFLAGS="-DPACKAGE=\\\"" + domain + "\\\"")
gtkardour.Append(CXXFLAGS=["-DLIBSIGC_DISABLE_DEPRECATED", "-DGLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED", "-DGLIBMM_EXCEPTIONS_ENABLED", "-DGLIBMM_PROPERTIES_ENABLED"])
gtkardour.Append(CPPPATH="#/") # for top level svn_revision.h
#gtkardour.Append(CXXFLAGS="-DFLOWCANVAS_AA")
gtkardour.Append(PACKAGE=domain)
gtkardour.Append(POTFILE=domain + '.pot')
if gtkardour['IS_OSX']:
gtkardour.Append (LINKFLAGS="-Xlinker -headerpad -Xlinker 2048 -framework CoreAudio")
gtkardour.Merge ([
libraries['ardour'],
libraries['ardour_cp'],
libraries['asound'],
libraries['atkmm'],
libraries['cairomm'],
libraries['fftw3'],
libraries['fftw3f'],
libraries['freetype2'],
libraries['gdkmm2'],
libraries['glib2'],
libraries['glibmm2'],
libraries['gtk2'],
libraries['gtkmm2'],
libraries['gtkmm2ext'],
libraries['jack'],
libraries['libgnomecanvas2'],
libraries['libgnomecanvasmm'],
libraries['lrdf'],
libraries['midi++2'],
libraries['smf'],
libraries['evoral'],
libraries['pangomm'],
libraries['pbd'],
libraries['samplerate'],
libraries['sigc2'],
libraries['sndfile'],
libraries['taglib'],
libraries['sysmidi'],
libraries['vamphost'],
libraries['vamp'],
libraries['xml'],
libraries['xslt']
])
gtkmmtests.Append(CXXFLAGS="-DLIBSIGC_DISABLE_DEPRECATED")
gtkmmtests.Merge ([
libraries['atkmm'],
libraries['gdkmm2'],
libraries['glib2'],
libraries['glibmm2'],
libraries['gtk2'],
libraries['gtkmm2'],
libraries['pangomm'],
libraries['sigc2']
])
if gtkardour['DMALLOC']:
gtkardour.Merge([libraries['dmalloc']])
gtkardour.Append(CCFLAGS='-DUSE_DMALLOC')
if gtkardour['FREESOUND']:
gtkardour.Merge ([libraries['curl']])
gtkardour.Append(CCFLAGS='-DFREESOUND')
if gtkardour['RUBBERBAND']:
gtkardour.Merge ([ libraries['rubberband'] ])
else:
gtkardour.Merge ([ libraries['soundtouch'] ])
audiounit_files=Split("""
au_pluginui.mm
""")
gtkosx_files=Split("""
cocoacarbon.mm
""")
x11_files=Split("""
x11.cc
""")
gtkardour_files=Split("""
about.cc
actions.cc
add_midi_cc_track_dialog.cc
add_route_dialog.cc
analysis_window.cc
ardour_dialog.cc
ardour_ui.cc
ardour_ui2.cc
ardour_ui_dependents.cc
ardour_ui_dialogs.cc
ardour_ui_ed.cc
ardour_ui_mixer.cc
ardour_ui_options.cc
audio_clock.cc
audio_region_editor.cc
audio_region_view.cc
audio_streamview.cc
audio_time_axis.cc
automation_controller.cc
automation_line.cc
automation_region_view.cc
automation_streamview.cc
automation_time_axis.cc
axis_view.cc
bundle_manager.cc
canvas-flag.cc
canvas-note-event.cc
canvas-note.cc
canvas-program-change.cc
canvas-simpleline.c
canvas-simplerect.c
canvas-sysex.cc
canvas-waveview.c
control_point.cc
control_point_dialog.cc
crossfade_edit.cc
crossfade_view.cc
curvetest.cc
diamond.cc
editing.cc
editor.cc
editor_actions.cc
editor_audio_import.cc
editor_audiotrack.cc
editor_canvas.cc
editor_canvas_events.cc
editor_cursors.cc
editor_drag.cc
editor_edit_groups.cc
editor_export_audio.cc
editor_hscroller.cc
editor_keyboard.cc
editor_keys.cc
editor_markers.cc
editor_mixer.cc
editor_mouse.cc
editor_nudge.cc
editor_ops.cc
editor_region_list.cc
editor_route_list.cc
editor_rulers.cc
editor_scrub.cc
editor_selection.cc
editor_selection_list.cc
editor_summary.cc
editor_tempodisplay.cc
editor_timefx.cc
engine_dialog.cc
enums.cc
export_channel_selector.cc
export_dialog.cc
export_file_notebook.cc
export_filename_selector.cc
export_format_dialog.cc
export_format_selector.cc
export_preset_selector.cc
export_timespan_selector.cc
fft.cc
fft_graph.cc
fft_result.cc
gain_meter.cc
generic_pluginui.cc
ghostregion.cc
global_port_matrix.cc
gtk-custom-hruler.c
gtk-custom-ruler.c
io_selector.cc
keyboard.cc
keyeditor.cc
latency_gui.cc
level_meter.cc
lineset.cc
location_ui.cc
main.cc
marker.cc
midi_channel_selector.cc
midi_port_dialog.cc
midi_region_view.cc
midi_scroomer.cc
midi_streamview.cc
midi_time_axis.cc
mixer_strip.cc
mixer_ui.cc
nag.cc
option_editor.cc
opts.cc
panner.cc
panner2d.cc
panner_ui.cc
piano_roll_header.cc
playlist_selector.cc
plugin_eq_gui.cc
plugin_selector.cc
plugin_ui.cc
port_group.cc
port_matrix.cc
port_matrix_body.cc
port_matrix_column_labels.cc
port_matrix_component.cc
port_matrix_grid.cc
port_matrix_labels.cc
port_matrix_row_labels.cc
processor_box.cc
prompter.cc
public_editor.cc
rc_option_editor.cc
region_gain_line.cc
region_selection.cc
region_view.cc
return_ui.cc
rhythm_ferret.cc
route_params_ui.cc
route_processor_selection.cc
route_time_axis.cc
route_ui.cc
selection.cc
send_ui.cc
session_import_dialog.cc
session_metadata_dialog.cc
session_option_editor.cc
sfdb_ui.cc
simpleline.cc
simplerect.cc
splash.cc
startup.cc
streamview.cc
strip_silence_dialog.cc
tape_region_view.cc
tempo_dialog.cc
tempo_lines.cc
theme_manager.cc
time_axis_view.cc
time_axis_view_item.cc
time_fx_dialog.cc
time_selection.cc
ui_config.cc
utils.cc
version.cc
waveview.cc
""")
freesound_files=Split("""
sfdb_freesound_mootcher.cc
""")
pixmap_files = glob.glob('pixmaps/*.xpm')
icon_files = glob.glob ('icons/*.png')
intl_files = gtkardour_files + glob.glob('*.h')
evtest_files=Split("""
evtest.cc
""")
mtest_files=Split("""
mtest.cc
""")
rcu_files=Split("""
rcu.cc
""")
itest_files=Split("""
itest.cc
""")
stest_files=Split("""
stest.cc
""")
tt_files=Split ("""
tt.cc
""")
extra_sources = []
vst_files = [ 'vst_pluginui.cc' ]
if env['VST']:
extra_sources += vst_files
gtkardour.Append (CCFLAGS="-DVST_SUPPORT", CPPPATH="#libs/fst")
lv2_files = [ 'lv2_plugin_ui.cc' ]
if env['LV2']:
extra_sources += lv2_files
gtkardour.Append (CCFLAGS="-DHAVE_SLV2")
gtkardour.Merge ([libraries['slv2']])
if gtkardour['GTKOSX']:
extra_sources += gtkosx_files
gtkardour.Append (CCFLAGS="-DTOP_MENUBAR -DGTKOSX")
gtkardour.Append (LINKFLAGS=" -framework AppKit -framework CoreAudioKit")
if gtkardour['AUDIOUNITS']:
extra_sources += audiounit_files
gtkardour.Append(CCFLAGS='-DHAVE_AUDIOUNITS')
gtkardour.Merge([libraries['appleutility']])
else:
extra_sources += x11_files
if env['FREESOUND']:
extra_sources += freesound_files
intl_files += extra_sources
gtkardour.Append(CCFLAGS="-D_REENTRANT -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE")
gtkardour.Append(CXXFLAGS="-DLOCALEDIR=\\\""+final_prefix+"/share/locale\\\"")
versionflag = '-DVERSIONSTRING=\\\"' + env['VERSION'] + '\\\"'
gtkardour.Append(CXXFLAGS=versionflag)
executable = 'ardour-' + ardour_version
ardour = gtkardour.Program(target = executable, source = gtkardour_files + extra_sources)
ardourlib = gtkardour.SharedLibrary(target = 'ardourgtk', source = gtkardour_files + extra_sources)
evest = gtkmmtests.Program(target = 'evtest', source = evtest_files)
mtest = gtkardour.Program(target = 'mtest', source = mtest_files)
itest = gtkardour.Program(target = 'itest', source = itest_files)
rcu = gtkardour.Program(target = 'rcu', source = rcu_files)
tt = gtkmmtests.Program(target = 'tt', source = tt_files)
my_font_dict = { }
if gtkardour['IS_OSX']:
#
# OS X font rendering is different even with X11
#
font_sizes = {
'TINY' : '7',
'SMALLER' : '9',
'SMALL' : '10',
'NORMAL' : '11',
'BIG' : '12',
'BIGGER' : '14',
'LARGE' : '18',
'LARGER' : '28',
'HUGER' : '36',
'MASSIVE' : '60'
}
basefont = "Lucida Grande"
else:
#
# Linux/X11 font rendering
#
if gtkardour['OLDFONTS']:
font_sizes = {
'TINY' : '4',
'SMALLER' : '6',
'SMALL' : '7',
'NORMAL' : '8',
'BIG' : '12',
'BIGGER' : '14',
'LARGE' : '18',
'LARGER' : '24',
'HUGER' : '34',
'MASSIVE' : '60'
}
else:
font_sizes = {
'TINY' : '6',
'SMALLER' : '8',
'SMALL' : '9',
'NORMAL' : '10',
'BIG' : '14',
'BIGGER' : '16',
'LARGE' : '18',
'LARGER' : '24',
'HUGER' : '34',
'MASSIVE' : '60'
}
basefont = "sans"
for style in ['', 'BOLD', 'ITALIC']:
for sizename,points in font_sizes.iteritems():
if (len (style)):
key = "_".join (['FONT',style,sizename])
fontstyle = " ".join ([basefont,style.lower(),points])
else:
key = "_".join (['FONT',sizename])
fontstyle = " ".join ([basefont,points])
key = '%' + key + '%'
my_font_dict[key] = fontstyle
#
# create menus based on build platform
#
if env['GTKOSX']:
ardour_menus = env.Command ('ardour.menus', 'ardour.menus.in', "cpp -E -P -DGTKOSX -DTOP_MENUBAR ardour.menus.in ardour.menus", chdir=1)
else:
ardour_menus = env.Command ('ardour.menus', 'ardour.menus.in', "cpp -E -P ardour.menus.in ardour.menus", chdir=1)
ardour_dark_theme = env.SubstInFile ('ardour3_ui_dark.rc',
'ardour3_ui_dark.rc.in',
SUBST_DICT = my_font_dict)
ardour_light_theme = env.SubstInFile ('ardour3_ui_light.rc',
'ardour3_ui_light.rc.in',
SUBST_DICT = my_font_dict)
ardour_dark_sae_theme = env.SubstInFile ('ardour3_ui_dark_sae.rc',
'ardour3_ui_dark_sae.rc.in',
SUBST_DICT = my_font_dict)
ardour_light_sae_theme = env.SubstInFile ('ardour3_ui_light_sae.rc',
'ardour3_ui_light_sae.rc.in',
SUBST_DICT = my_font_dict)
my_subst_dict = { }
#
# null substitution just to avoid ardour.bindings being in svn
#
keybindings_dict = { }
if gtkardour['GTKOSX']:
#
# Command(Meta), Alt(Mod1), Ctrl, Shift
# **** as of february 4th 2008, OUR VERSION OF *****
# Gtk/Quartz maps:
# NSCommand (aka "Command" aka "Apple" aka "Cauliflower") -> Meta
# NSAlternate (aka "Option") -> Mod1
#
keybindings_dict['@PRIMARY@'] = 'Meta'
keybindings_dict['@SECONDARY@'] = 'Mod1'
keybindings_dict['@TERTIARY@'] = 'Shift'
keybindings_dict['@LEVEL4@'] = 'Ctrl'
keybindings_dict['@WINDOW@'] = 'Mod1'
else:
#
# Ctrl, Alt, Shift, Mod4(Super/Windows/Hyper)
#
keybindings_dict['@PRIMARY@'] = 'Ctrl'
keybindings_dict['@SECONDARY@'] = 'Alt'
keybindings_dict['@TERTIARY@'] = 'Shift'
keybindings_dict['@LEVEL4@'] = env['WINDOWS_KEY']
keybindings_dict['@WINDOW@'] = 'Alt'
for b in [ 'SAE-de-keypad', 'SAE-de-nokeypad', 'SAE-us-keypad', 'SAE-us-nokeypad', 'mnemonic-us', 'ergonomic-us' ]:
target_file = b + '.bindings'
src_file = target_file + '.in'
Default (env.SubstInFile (target_file, src_file, SUBST_DICT = keybindings_dict))
my_subst_dict['@INSTALL_PREFIX@'] = final_prefix
my_subst_dict['@LIBDIR@'] = env['LIBDIR']
my_subst_dict['@LIBS@'] = 'libs'
my_subst_dict['@VERSION@'] = ardour_version
my_subst_dict['@EXECUTABLE@'] = 'gtk2_ardour/ardour-' + ardour_version
ardoursh = env.SubstInFile ('ardour.sh','ardour.sh.in', SUBST_DICT = my_subst_dict);
env.AddPostAction (ardoursh, Chmod ('$TARGET', 0755))
ardourdev = env.SubstInFile ('ardev_common.sh','ardev_common.sh.in', SUBST_DICT = my_subst_dict);
env.AddPostAction (ardourdev, Chmod ('$TARGET', 0755))
Default(ardourdev)
Default(ardoursh)
Default(ardour_dark_theme)
Default(ardour_light_theme)
Default(ardour_dark_sae_theme)
Default(ardour_light_sae_theme)
Default(ardour_menus)
if env['VST']:
Default(ardourlib)
# the library - into the library dir
env.Alias('install', env.Install(os.path.join(install_prefix, env['LIBDIR'], 'ardour3'), ardourlib))
else:
if env['VERSIONED']:
Default (env.VersionedExecutable ('tagged_executable', ardour))
else:
Default(ardour)
#install
# the executable - into the library dir
env.Alias('install', env.Install(os.path.join(install_prefix, env['LIBDIR'], 'ardour3'), ardour))
# the script - into the bin dir
env.Alias('install', env.InstallAs(os.path.join(install_prefix, 'bin')+'/ardour3', ardoursh))
if env['NLS']:
i18n (gtkardour, gtkardour_files, env)
# configuration files
env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour3'), ardour_dark_theme))
env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour3'), ardour_light_theme))
env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour3'), ardour_dark_sae_theme))
env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour3'), ardour_light_sae_theme))
env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour3'), 'ardour3_ui_default.conf'))
env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour3'), 'ardour.menus'))
env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour3'), 'ardour-sae.menus'))
env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour3'), 'ergonomic-us.bindings'))
env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour3'), 'mnemonic-us.bindings'))
env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour3'), 'SAE-de-keypad.bindings'))
env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour3'), 'SAE-us-keypad.bindings'))
env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour3'), 'SAE-de-nokeypad.bindings'))
env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour3'), 'SAE-us-nokeypad.bindings'))
# data files
env.Alias('install', env.Install(os.path.join(install_prefix, 'share', 'ardour3'), 'splash.png'))
env.Alias('install', env.Install(os.path.join(install_prefix, 'share', 'ardour3', 'pixmaps'), pixmap_files))
env.Alias('install', env.Install(os.path.join(install_prefix, 'share', 'ardour3', 'icons'), icon_files))
env.Alias ('version', gtkardour.VersionBuild(['version.cc','version.h'], []))
env.Alias ('version', gtkardour.VersionBuild(['version.cc','version.h'], []))
# This will install icons and MIME type as per freedesktop.org specs. #
if env['FREEDESKTOP']:
desktop_icon_install_prefix = install_prefix + '/share/icons/hicolor'
# Install the desktop icons to the default locations #
env.Alias('install', env.InstallAs(os.path.join(desktop_icon_install_prefix, '16x16', 'apps', 'ardour3.png'), 'icons/ardour_icon_16px.png'))
env.Alias('install', env.InstallAs(os.path.join(desktop_icon_install_prefix, '22x22', 'apps', 'ardour3.png'), 'icons/ardour_icon_22px.png'))
env.Alias('install', env.InstallAs(os.path.join(desktop_icon_install_prefix, '32x32', 'apps', 'ardour3.png'), 'icons/ardour_icon_32px.png'))
env.Alias('install', env.InstallAs(os.path.join(desktop_icon_install_prefix, '48x48', 'apps', 'ardour3.png'), 'icons/ardour_icon_48px.png'))
# Install the mime type xml file and its icon #
env.Alias('install', env.Install(os.path.join(install_prefix, 'share', 'mime', 'packages'), 'ardour3.xml'))
env.Alias('install', env.InstallAs(os.path.join(desktop_icon_install_prefix, '16x16', 'mimetypes', 'application-x-ardour3.png'), 'icons/application-x-ardour_16px.png'))
env.Alias('install', env.InstallAs(os.path.join(desktop_icon_install_prefix, '22x22', 'mimetypes', 'application-x-ardour3.png'), 'icons/application-x-ardour_22px.png'))
env.Alias('install', env.InstallAs(os.path.join(desktop_icon_install_prefix, '32x32', 'mimetypes', 'application-x-ardour3.png'), 'icons/application-x-ardour_32px.png'))
env.Alias('install', env.InstallAs(os.path.join(desktop_icon_install_prefix, '48x48', 'mimetypes', 'application-x-ardour3.png'), 'icons/application-x-ardour_48px.png'))
env.Alias('install', env.Command (os.path.join(install_prefix, 'share', 'mime'), [], 'update-mime-database $TARGET'))
# Update the icon cache #
env.Alias('install', env.Command (desktop_icon_install_prefix, [], 'touch --no-create $TARGET'))
env.Alias('install', env.Command (desktop_icon_install_prefix, [], 'gtk-update-icon-cache $TARGET'))
# Make the ardour3.desktop file and install it #
env.Alias('install', env.Command ('ardour3.desktop', 'ardour3.desktop.in', 'cat $SOURCES > $TARGET'))
env.Alias('install', env.Install(os.path.join(install_prefix, 'share', 'applications'), 'ardour3.desktop'))
env.Alias('install', env.Command (os.path.join(install_prefix, 'share', 'applications'), [], 'update-desktop-database $TARGET'))
# uninstall target.. needed to run update-mime-database and update-desktop-database after removal. #`
remove_desktop_files = env.Command ('another_frobnicatory_decoy', [],
[ Delete (install_prefix + '/share/mime/packages/ardour3.xml'),
Delete (install_prefix + '/share/applications/ardour3.desktop'),
Delete (desktop_icon_install_prefix + '/16x16/apps/ardour3.png'),
Delete (desktop_icon_install_prefix + '/22x22/apps/ardour3.png'),
Delete (desktop_icon_install_prefix + '/32x32/apps/ardour3.png'),
Delete (desktop_icon_install_prefix + '/48x48/apps/ardour3.png'),
Delete (desktop_icon_install_prefix + '/16x16/mimetypes/application-x-ardour3.png'),
Delete (desktop_icon_install_prefix + '/22x22/mimetypes/application-x-ardour3.png'),
Delete (desktop_icon_install_prefix + '/32x32/mimetypes/application-x-ardour3.png'),
Delete (desktop_icon_install_prefix + '/48x48/mimetypes/application-x-ardour3.png'),
Action ('update-mime-database ' + install_prefix + '/share/mime'),
Action ('gtk-update-icon-cache ' + desktop_icon_install_prefix),
Action ('update-desktop-database ' + install_prefix + '/share/applications')])
env.Alias('uninstall', remove_desktop_files)
#dist
env.Alias ('tarball', env.Distribute (env['DISTTREE'],
[ 'SConscript',
'i18n.h', 'gettext.h',
'ardour.sh.in',
'ardev_common.sh.in',
'ardev', 'ardbg',
'ardour3_ui_dark.rc.in',
'ardour3_ui_light.rc.in',
'ardour3_ui_dark_sae.rc.in',
'ardour3_ui_light_sae.rc.in',
'splash.png',
'ardour.menus.in',
'ardour-sae.menus',
'mnemonic-us.bindings.in',
'ergonomic-us.bindings.in',
'SAE-us-keypad.bindings.in',
'SAE-us-nokeypad.bindings.in',
'SAE-de-keypad.bindings.in',
'SAE-de-nokeypad.bindings.in',
'ardour3_ui_default.conf',
'editor_xpms',
'ardour3.xml',
'ardour3.desktop.in'
] +
gtkardour_files +
vst_files +
pixmap_files +
icon_files +
audiounit_files +
lv2_files +
gtkosx_files +
x11_files +
freesound_files +
glob.glob('po/*.po') + glob.glob('*.h')))
# generate a prototype full-featured ardour_ui.rc file
env.Alias ('protorc', env.Command ('proto.rc', gtkardour_files, """
grep set_name $SOURCES | \
sed 's/.*("\([a-zA-Z_][a-zA-Z_]*\)").*/\\1/' | \
grep -v '\\.' | sort | uniq | \
awk '/\\./ {} { printf ("style \\"%s\\"\\n{\\n\
fg[NORMAL] = { 0, 0, 0 }\\n\
fg[ACTIVE] = { 0, 0, 0 }\\n\
fg[SELECTED] = { 0, 0, 0 }\\n\
bg[NORMAL] = { 0, 0, 0 }\\n\
bg[ACTIVE] = { 0, 0, 0 }\\n\
bg[SELECTED] = { 0, 0, 0 }\\n\
}\\nwidget \\"*%s\\" style \\"%s\\"\\nwidget \\"*%s*\\" style \\"%s\\"\\n\\n", \
$$0, $$0, $$0, $$0, $$0) }' > $TARGET && \
grep 'color_map\[[a-zA-Z_][a-zA-Z]*\]' $SOURCES | \
sed 's/.*\[\([a-zA-Z_][a-zA-Z_]*\)].*/\\1/'| \
sort | uniq | \
awk '{ printf ("style \\"%s\\"\\n{\\n\
fg[NORMAL] = { 0, 0, 0 }\\n\
fg[ACTIVE] = { 0, 0, 0 }\\n\
}\\nwidget \\"*%s\\" style \\"%s\\"\\n \\n\\n", $$0, $$0, $$0) }' >> $TARGET ;
"""
))