diff --git a/SConstruct b/SConstruct index 520bcdd058..462fea93e8 100644 --- a/SConstruct +++ b/SConstruct @@ -50,6 +50,7 @@ opts.AddOptions( BoolOption('VST', 'Compile with support for VST', 0), BoolOption('LV2', 'Compile with support for LV2 (if slv2 is available)', 1), BoolOption('GPROFILE', 'Compile with support for gprofile (Developers only)', 0), + BoolOption('FREEDESKTOP', 'Install MIME type, icons and .desktop file as per the freedesktop.org spec (requires xdg-utils and shared-mime-info). "scons uninstall" removes associations in desktop database', 0), BoolOption('TRANZPORT', 'Compile with support for Frontier Designs (if libusb is available)', 1) ) @@ -926,6 +927,26 @@ else: libraries['dmalloc'] = conf.Finish () +# +# ensure FREEDESKTOP target is doable.. +# + +conf = env.Configure () +if env['FREEDESKTOP']: + have_update_mime_database = conf.TryAction (Action ('update-mime-database -v')) + if have_update_mime_database[0] != 1: + print "Warning. You have no update-mime-database command in your PATH. FREEDESKTOP is now disabled." + env['FREEDESKTOP'] = 0 + have_gtk_update_icon_cache = conf.TryAction (Action ('gtk-update-icon-cache -?')) + if have_gtk_update_icon_cache[0] != 1: + print "Warning. You have no gtk-update-icon-cache command in your PATH. FREEDESKTOP is now disabled." + env['FREEDESKTOP'] = 0 + have_update_desktop_database = conf.TryAction (Action ('update-desktop-database -?')) + if have_update_desktop_database[0] != 1: + print "Warning. You have no update-desktop-database command in your PATH. FREEDESKTOP is now disabled." + env['FREEDESKTOP'] = 0 +env = conf.Finish() + # # Audio/MIDI library (needed for MIDI, since audio is all handled via JACK) # diff --git a/gtk2_ardour/SConscript b/gtk2_ardour/SConscript index 56a9633683..0b3da94e06 100644 --- a/gtk2_ardour/SConscript +++ b/gtk2_ardour/SConscript @@ -471,10 +471,43 @@ env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), 'SAE-de # data files env.Alias('install', env.Install(os.path.join(install_prefix, 'share', 'ardour2'), 'splash.png')) env.Alias('install', env.Install(os.path.join(install_prefix, 'share', 'ardour2', 'pixmaps'), pixmap_files)) -env.Alias('install', env.Install(os.path.join(install_prefix, 'share', 'ardour2', 'icons'), icon_files)) - +if not env['FREEDESKTOP']: + env.Alias('install', env.Install(os.path.join(install_prefix, 'share', 'ardour2', 'icons'), icon_files)) 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', 'ardour2.png'), 'icons/ardour_icon_16px.png')) + env.Alias('install', env.InstallAs(os.path.join(desktop_icon_install_prefix, '22x22', 'apps', 'ardour2.png'), 'icons/ardour_icon_22px.png')) + env.Alias('install', env.InstallAs(os.path.join(desktop_icon_install_prefix, '32x32', 'apps', 'ardour2.png'), 'icons/ardour_icon_32px.png')) + env.Alias('install', env.InstallAs(os.path.join(desktop_icon_install_prefix, '48x48', 'apps', 'ardour2.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'), 'ardour2.xml')) + env.Alias('install', env.InstallAs(os.path.join(desktop_icon_install_prefix, '48x48', 'mimetypes','application-x-ardour2.png'), 'icons/ardour_icon_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 ardour2.desktop file and install it # + env.Alias('install', env.Command ('ardour2.desktop', 'ardour2.desktop.in', 'cat $SOURCES > $TARGET')) + env.Alias('install', env.Install(os.path.join(install_prefix, 'share', 'applications'), 'ardour2.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/ardour2.xml'), + Delete (install_prefix + '/share/applications/ardour2.desktop'), + Delete (desktop_icon_install_prefix + '/16x16/apps/ardour2.png'), + Delete (desktop_icon_install_prefix + '/22x22/apps/ardour2.png'), + Delete (desktop_icon_install_prefix + '/32x32/apps/ardour2.png'), + Delete (desktop_icon_install_prefix + '/48x48/apps/ardour2.png'), + Delete (desktop_icon_install_prefix + '/48x48/mimetypes/application-x-ardour2.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', @@ -488,7 +521,9 @@ env.Alias ('tarball', env.Distribute (env['DISTTREE'], 'ardour-sae-ansi.bindings.in', 'ardour-sae-de.bindings.in', 'ardour2_ui_default.conf', - 'editor_xpms' + 'editor_xpms', + 'ardour2.xml', + 'ardour2.desktop.in' ] + gtkardour_files + vst_files + diff --git a/gtk2_ardour/ardour2.desktop.in b/gtk2_ardour/ardour2.desktop.in new file mode 100644 index 0000000000..b5911e89b4 --- /dev/null +++ b/gtk2_ardour/ardour2.desktop.in @@ -0,0 +1,9 @@ +[Desktop Entry] +Name=Ardour +Comment=Ardour Digital Audio Workstation +Exec=ardour2 +Icon=ardour2 +Terminal=false +MimeType=application/x-ardour2; +Type=Application +Categories=AudioVideo;Audio;X-Recorders;X-Multitrack;X-Jack; diff --git a/gtk2_ardour/ardour2.xml b/gtk2_ardour/ardour2.xml new file mode 100644 index 0000000000..dd1c46ecf2 --- /dev/null +++ b/gtk2_ardour/ardour2.xml @@ -0,0 +1,8 @@ + + + + + Ardour session file + + +