From 2bf021ee739fbf3859dc9044a80a0de01ea90bc1 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Tue, 20 Dec 2011 13:11:03 +0000 Subject: [PATCH] Improve support for distributing desktop files and icons * add proper INSTALL_POSIX conditional for makefiles * move all the code to Makefile.am * rename lyx.desktop to lyx.desptop.in and add proper tags to allow handling of program_suffix. * add code to install desktop entry and icons under the proper name. I did not touch scons and cmake, I hope it was not necessary. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40531 a592a061-630c-0410-9148-cb99ea01b6c8 --- Makefile.am | 9 +------ config/lyxinclude.m4 | 6 +++-- configure.ac | 1 + lib/Makefile.am | 42 ++++++++++++++++++----------- lib/{lyx.desktop => lyx.desktop.in} | 6 ++--- 5 files changed, 36 insertions(+), 28 deletions(-) rename lib/{lyx.desktop => lyx.desktop.in} (75%) diff --git a/Makefile.am b/Makefile.am index efcbeca75a..ebdfe0e76a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -22,17 +22,10 @@ SUBDIRS = config development intl po $(BOOST) src sourcedoc lib \ EXTRA_DIST = ANNOUNCE INSTALL.autoconf RELEASE-NOTES UPGRADING \ INSTALL.Win32 INSTALL.MacOSX INSTALL.scons INSTALL.cmake \ README.Win32 README.Cygwin README.localization lyx.1in \ - autogen.sh lib/lyx.desktop lib/images/lyx.svg + autogen.sh man_MANS = lyx.1 -if !INSTALL_WINDOWS -if !INSTALL_MACOSX -desktopdir = $(datadir)/applications -desktop_DATA = lib/lyx.desktop -endif -endif - #Wait some time for bumping automake 1.11, which can use dist-xz #directly without this code, which is to be removed. #xz has low compression by default, but can be affected via diff --git a/config/lyxinclude.m4 b/config/lyxinclude.m4 index 1480fe188a..bb94bfc5b2 100644 --- a/config/lyxinclude.m4 +++ b/config/lyxinclude.m4 @@ -521,12 +521,14 @@ case $lyx_use_packaging in default_prefix=$ac_default_prefix case ${host} in *cygwin*) lyx_install_cygwin=true ;; - esac ;; + esac + lyx_install_posix=true ;; *) LYX_ERROR([Unknown packaging type $lyx_use_packaging]) ;; esac AM_CONDITIONAL(INSTALL_MACOSX, $lyx_install_macosx) -AM_CONDITIONAL(INSTALL_CYGWIN, $lyx_install_cygwin) AM_CONDITIONAL(INSTALL_WINDOWS, $lyx_install_windows) +AM_CONDITIONAL(INSTALL_CYGWIN, $lyx_install_cygwin) +AM_CONDITIONAL(INSTALL_POSIX, $lyx_install_posix) dnl Next two lines are only for autoconf <= 2.59 datadir='${datarootdir}' AC_SUBST(datarootdir) diff --git a/configure.ac b/configure.ac index 700f6ff712..c4f1ebeb31 100644 --- a/configure.ac +++ b/configure.ac @@ -361,6 +361,7 @@ AC_CONFIG_FILES([Makefile \ development/cygwin/lyxrc.dist \ development/lyx.spec \ intl/Makefile \ + lib/lyx.desktop-temp:lib/lyx.desktop.in lib/Makefile \ lib/doc/Makefile \ lib/lyx2lyx/lyx2lyx_version.py \ diff --git a/lib/Makefile.am b/lib/Makefile.am index ade50ffb96..d2211d59dc 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -399,7 +399,6 @@ dist_images_DATA = \ images/layout_Scrap.png \ images/layout_Section.png \ images/lyx-quit.png \ - images/lyx.png \ images/marginalnote-insert.png \ images/master-buffer-update.png \ images/master-buffer-view.png \ @@ -1591,7 +1590,7 @@ dist_springertemplates_DATA = \ templates/springer/svmult_part.lyx \ templates/springer/svmult_preface.lyx \ templates/springer/svmult_referenc.lyx - + thesistemplatesdir = $(pkgdatadir)/templates/thesis dist_thesistemplates_DATA = \ templates/thesis/Acknowledgments.lyx \ @@ -1611,19 +1610,6 @@ dist_tex_DATA = \ tex/lyxskak.sty \ tex/revtex.cls -if !INSTALL_WINDOWS -if !INSTALL_MACOSX -# install application icons. The 'hicolor' theme is the default theme -# where applications themselves should install their icons. -scalableappiconsdir = $(datadir)/icons/hicolor/scalable/apps -scalableappicons_DATA = images/lyx.svg - -fixedappiconsdir = $(datadir)/icons/hicolor/48x48/apps -fixedappicons_DATA = images/lyx.png - -endif -endif - # subscript.sty is not in dist_tex_DATA since we don't want to install it # (it is part of TeXLive). We include it in our source package only so that # packagers may decide to install it (e.g. for MikTeX). @@ -1636,6 +1622,32 @@ dist_ui_DATA = \ ui/stdmenus.inc \ ui/stdtoolbars.inc +if INSTALL_POSIX +# install application icons. The 'hicolor' theme is the default theme +# where applications themselves should install their icons. +lyx@program_suffix@.svg: images/lyx.svg + $(AM_V_GEN)$(INSTALL_DATA) $< $@ +scalableappiconsdir = $(datadir)/icons/hicolor/scalable/apps +scalableappicons_DATA = lyx@program_suffix@.svg + +lyx@program_suffix@.png: images/lyx.png + $(AM_V_GEN)$(INSTALL_DATA) $< $@ +fixedappiconsdir = $(datadir)/icons/hicolor/48x48/apps +fixedappicons_DATA = lyx@program_suffix@.png + +# if configure is asked to generate the name with suffix directly, then +# config.status refuses to rebuild this file (with a variable name), and +# a build error ensues when lyx.desktop.in is changed. +lyx@program_suffix@.desktop: lyx.desktop-temp + $(AM_V_GEN)$(INSTALL_DATA) $< $@ +desktopdir = $(datadir)/applications +desktop_DATA = lyx@program_suffix@.desktop + +CLEANFILES += lyx@program_suffix@.desktop lyx.desktop-temp \ + lyx@program_suffix@.svg lyx@program_suffix@.png +endif +dist_noinst_DATA += lyx.desktop.in images/lyx.svg images/lyx.png + install-data-hook: $(CHMOD) 755 $(DESTDIR)$(pkgdatadir)/configure.py for i in $(dist_scripts_PYTHON); do \ diff --git a/lib/lyx.desktop b/lib/lyx.desktop.in similarity index 75% rename from lib/lyx.desktop rename to lib/lyx.desktop.in index 53f3c301d7..bc6930ad31 100644 --- a/lib/lyx.desktop +++ b/lib/lyx.desktop.in @@ -4,9 +4,9 @@ Type=Application Name=LyX GenericName=Document Processor Comment=High level LaTeX frontend -Exec=lyx %F -TryExec=lyx -Icon=lyx +Exec=lyx@program_suffix@ %F +TryExec=lyx@program_suffix@ +Icon=lyx@program_suffix@ StartupNotify=false StartupWMClass=Lyx Terminal=false