From 02f7ca01c62c34b775643ca1872338af06b5a9ba Mon Sep 17 00:00:00 2001 From: Louie S Date: Thu, 2 Mar 2023 21:36:07 -0800 Subject: configure flag to enable/disable desktop entry installation --- configure | 33 +++++++++++++-- configure.ac | 16 +++++-- data/Makefile.am | 9 ++++ data/Makefile.in | 124 +++++++++++++++++++++++++++++++++++++++++++++---------- debian/install | 2 - debian/rules | 4 +- docs/README.md | 8 ++-- 7 files changed, 158 insertions(+), 38 deletions(-) delete mode 100644 debian/install diff --git a/configure b/configure index ba1dd45..192ff3a 100755 --- a/configure +++ b/configure @@ -623,6 +623,8 @@ ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS +DESKTOP_ENTRY_FALSE +DESKTOP_ENTRY_TRUE WINDOWS_FALSE WINDOWS_TRUE UNIX_FALSE @@ -733,6 +735,7 @@ enable_silent_rules enable_dependency_tracking with_ncurses with_ncursesw +enable_desktop_entry ' ac_precious_vars='build_alias host_alias @@ -1384,6 +1387,7 @@ Optional Features: do not reject slow dependency extractors --disable-dependency-tracking speeds up one-time build + --enable-desktop-entry install a desktop entry (default is no) Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -5722,6 +5726,24 @@ else fi +# enable/disable options +# Check whether --enable-desktop-entry was given. +if test "${enable_desktop_entry+set}" = set; then : + enableval=$enable_desktop_entry; desktop_entry=$enableval +else + desktop_entry=no +fi + + + if test "$desktop_entry" = "yes"; then + DESKTOP_ENTRY_TRUE= + DESKTOP_ENTRY_FALSE='#' +else + DESKTOP_ENTRY_TRUE='#' + DESKTOP_ENTRY_FALSE= +fi + + ac_config_files="$ac_config_files Makefile src/Makefile docs/Makefile data/Makefile" cat >confcache <<\_ACEOF @@ -5901,6 +5923,10 @@ if test -z "${WINDOWS_TRUE}" && test -z "${WINDOWS_FALSE}"; then as_fn_error $? "conditional \"WINDOWS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${DESKTOP_ENTRY_TRUE}" && test -z "${DESKTOP_ENTRY_FALSE}"; then + as_fn_error $? "conditional \"DESKTOP_ENTRY\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 @@ -7047,7 +7073,8 @@ cat << EOF ** Configuration summary for ${PACKAGE_NAME} ${PACKAGE_VERSION} - Prefix: ${prefix} - Compiler: ${CC} ${CFLAGS} ${CPPFLAGS} - Libraries: ${LIBS} + Prefix: ${prefix} + Compiler: ${CC} ${CFLAGS} ${CPPFLAGS} + Libraries: ${LIBS} + Desktop Entry: ${desktop_entry} EOF diff --git a/configure.ac b/configure.ac index 22fe560..fab92d6 100644 --- a/configure.ac +++ b/configure.ac @@ -45,6 +45,15 @@ esac AM_CONDITIONAL([UNIX], [test "$build_unix" = "yes"]) AM_CONDITIONAL([WINDOWS], [test "$build_windows" = "yes"]) +# enable/disable options +AC_ARG_ENABLE([desktop-entry], + [AS_HELP_STRING([--enable-desktop-entry], + [install a desktop entry (default is no)])], + [desktop_entry=$enableval], + [desktop_entry=no]) + +AM_CONDITIONAL([DESKTOP_ENTRY], [test "$desktop_entry" = "yes"]) + AC_CONFIG_FILES([Makefile src/Makefile docs/Makefile @@ -56,7 +65,8 @@ cat << EOF ** Configuration summary for ${PACKAGE_NAME} ${PACKAGE_VERSION} - Prefix: ${prefix} - Compiler: ${CC} ${CFLAGS} ${CPPFLAGS} - Libraries: ${LIBS} + Prefix: ${prefix} + Compiler: ${CC} ${CFLAGS} ${CPPFLAGS} + Libraries: ${LIBS} + Desktop Entry: ${desktop_entry} EOF diff --git a/data/Makefile.am b/data/Makefile.am index 20c7465..dafdf2a 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -1,6 +1,8 @@ EXTRA_DIST = terminal-media-launcher.ico terminal-media-launcher.svg # Build a .desktop entry +if DESKTOP_ENTRY + BUILT_SOURCES = $(PACKAGE_NAME).desktop CLEANFILES = $(PACKAGE_NAME).desktop $(PACKAGE_NAME).desktop: Makefile @@ -13,3 +15,10 @@ $(PACKAGE_NAME).desktop: Makefile echo "Icon=$(PACKAGE_NAME)" >> $@ echo "Terminal=true" >> $@ echo "Categories=Utility" >> $@ + +desktopdir = $(datadir)/applications +icondir = $(datadir)/pixmaps +desktop_DATA = $(PACKAGE_NAME).desktop +icon_DATA = $(PACKAGE_NAME).svg + +endif diff --git a/data/Makefile.in b/data/Makefile.in index f56e399..d441747 100644 --- a/data/Makefile.in +++ b/data/Makefile.in @@ -13,6 +13,7 @@ # PARTICULAR PURPOSE. @SET_MAKE@ + VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ @@ -115,6 +116,35 @@ am__can_run_installinfo = \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(desktopdir)" "$(DESTDIR)$(icondir)" +DATA = $(desktop_DATA) $(icon_DATA) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -222,8 +252,12 @@ top_srcdir = @top_srcdir@ EXTRA_DIST = terminal-media-launcher.ico terminal-media-launcher.svg # Build a .desktop entry -BUILT_SOURCES = $(PACKAGE_NAME).desktop -CLEANFILES = $(PACKAGE_NAME).desktop +@DESKTOP_ENTRY_TRUE@BUILT_SOURCES = $(PACKAGE_NAME).desktop +@DESKTOP_ENTRY_TRUE@CLEANFILES = $(PACKAGE_NAME).desktop +@DESKTOP_ENTRY_TRUE@desktopdir = $(datadir)/applications +@DESKTOP_ENTRY_TRUE@icondir = $(datadir)/pixmaps +@DESKTOP_ENTRY_TRUE@desktop_DATA = $(PACKAGE_NAME).desktop +@DESKTOP_ENTRY_TRUE@icon_DATA = $(PACKAGE_NAME).svg all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-am @@ -257,6 +291,48 @@ $(top_srcdir)/configure: $(am__configure_deps) $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): +install-desktopDATA: $(desktop_DATA) + @$(NORMAL_INSTALL) + @list='$(desktop_DATA)'; test -n "$(desktopdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(desktopdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(desktopdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(desktopdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(desktopdir)" || exit $$?; \ + done + +uninstall-desktopDATA: + @$(NORMAL_UNINSTALL) + @list='$(desktop_DATA)'; test -n "$(desktopdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(desktopdir)'; $(am__uninstall_files_from_dir) +install-iconDATA: $(icon_DATA) + @$(NORMAL_INSTALL) + @list='$(icon_DATA)'; test -n "$(icondir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(icondir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(icondir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(icondir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(icondir)" || exit $$?; \ + done + +uninstall-iconDATA: + @$(NORMAL_UNINSTALL) + @list='$(icon_DATA)'; test -n "$(icondir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(icondir)'; $(am__uninstall_files_from_dir) tags TAGS: ctags CTAGS: @@ -300,8 +376,11 @@ distdir-am: $(DISTFILES) check-am: all-am check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-am -all-am: Makefile +all-am: Makefile $(DATA) installdirs: + for dir in "$(DESTDIR)$(desktopdir)" "$(DESTDIR)$(icondir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done install: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-am install-exec: $(BUILT_SOURCES) @@ -356,7 +435,7 @@ info: info-am info-am: -install-data-am: +install-data-am: install-desktopDATA install-iconDATA install-dvi: install-dvi-am @@ -400,33 +479,34 @@ ps: ps-am ps-am: -uninstall-am: +uninstall-am: uninstall-desktopDATA uninstall-iconDATA .MAKE: all check install install-am install-exec install-strip .PHONY: all all-am check check-am clean clean-generic cscopelist-am \ ctags-am distclean distclean-generic distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ - pdf-am ps ps-am tags-am uninstall uninstall-am + install-data-am install-desktopDATA install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-iconDATA install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic pdf pdf-am ps ps-am tags-am uninstall \ + uninstall-am uninstall-desktopDATA uninstall-iconDATA .PRECIOUS: Makefile -$(PACKAGE_NAME).desktop: Makefile - echo "[Desktop Entry]" > $@ - echo "Type=Application" >> $@ - echo "Name=$(PACKAGE_NAME)" >> $@ - echo "Comment=Terminal Media Launcher" >> $@ - echo "Path=$(bindir)/$(PACKAGE_NAME)$(EXEEXT)" >> $@ - echo "Exec=$(PACKAGE_NAME)$(EXEEXT)" >> $@ - echo "Icon=$(PACKAGE_NAME)" >> $@ - echo "Terminal=true" >> $@ - echo "Categories=Utility" >> $@ +@DESKTOP_ENTRY_TRUE@$(PACKAGE_NAME).desktop: Makefile +@DESKTOP_ENTRY_TRUE@ echo "[Desktop Entry]" > $@ +@DESKTOP_ENTRY_TRUE@ echo "Type=Application" >> $@ +@DESKTOP_ENTRY_TRUE@ echo "Name=$(PACKAGE_NAME)" >> $@ +@DESKTOP_ENTRY_TRUE@ echo "Comment=Terminal Media Launcher" >> $@ +@DESKTOP_ENTRY_TRUE@ echo "Path=$(bindir)/$(PACKAGE_NAME)$(EXEEXT)" >> $@ +@DESKTOP_ENTRY_TRUE@ echo "Exec=$(PACKAGE_NAME)$(EXEEXT)" >> $@ +@DESKTOP_ENTRY_TRUE@ echo "Icon=$(PACKAGE_NAME)" >> $@ +@DESKTOP_ENTRY_TRUE@ echo "Terminal=true" >> $@ +@DESKTOP_ENTRY_TRUE@ echo "Categories=Utility" >> $@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/debian/install b/debian/install deleted file mode 100644 index a83f3b7..0000000 --- a/debian/install +++ /dev/null @@ -1,2 +0,0 @@ -data/terminal-media-launcher.desktop /usr/share/applications -data/terminal-media-launcher.svg /usr/share/pixmaps diff --git a/debian/rules b/debian/rules index f0465d2..fc32edf 100755 --- a/debian/rules +++ b/debian/rules @@ -6,7 +6,5 @@ #export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed %: + dh_auto_configure -- --enable-desktop-entry dh $@ --with autoreconf - -#override_dh_install: -# dh_install --list-missing -X.la -X.pyc -X.pyo diff --git a/docs/README.md b/docs/README.md index 804e977..8ebcbd3 100644 --- a/docs/README.md +++ b/docs/README.md @@ -55,17 +55,15 @@ make uninstall By default, the program and related files are installed with prefix `/usr/local`, but this prefix can be changed with `./configure --prefix=PREFIX` flag (i.e., `./configure --prefix=$HOME/.local` - +Setting this flag will install a desktop entry alongside the program when following the installation instructions above ## Screenshots -- cgit