From 712af9ea3cb3d0de866221ade19341fd114f7000 Mon Sep 17 00:00:00 2001 From: Louie S Date: Fri, 3 Mar 2023 19:08:50 -0800 Subject: Change a couple of files to templates for less copy/paste --- data/Makefile.am | 25 ++++++++++++--------- data/Makefile.in | 40 ++++++++++++++++----------------- data/terminal-media-launcher.desktop.in | 9 ++++++++ 3 files changed, 44 insertions(+), 30 deletions(-) create mode 100644 data/terminal-media-launcher.desktop.in (limited to 'data') diff --git a/data/Makefile.am b/data/Makefile.am index dafdf2a..b051ebb 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -3,18 +3,23 @@ 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 + +edit = sed \ + -e 's|@PACKAGE_NAME[@]|$(PACKAGE_NAME)|g' \ + -e 's|@bindir[@]|$(bindir)|g' \ + -e 's|@EXEEXT[@]|$(EXEEXT)|g' + $(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" >> $@ + rm -f $@ $@.tmp + srcdir=''; \ + test -f ./$@.in || srcdir=$(srcdir)/; \ + $(edit) $${srcdir}$@.in >$@.tmp + chmod +x $@.tmp + chmod a-w $@.tmp + mv $@.tmp $@ + +$(PACKAGE_NAME).desktop: $(srcdir)/$(PACKAGE_NAME).desktop.in desktopdir = $(datadir)/applications icondir = $(datadir)/pixmaps diff --git a/data/Makefile.in b/data/Makefile.in index d441747..81264d9 100644 --- a/data/Makefile.in +++ b/data/Makefile.in @@ -252,14 +252,17 @@ top_srcdir = @top_srcdir@ EXTRA_DIST = terminal-media-launcher.ico terminal-media-launcher.svg # Build a .desktop entry -@DESKTOP_ENTRY_TRUE@BUILT_SOURCES = $(PACKAGE_NAME).desktop @DESKTOP_ENTRY_TRUE@CLEANFILES = $(PACKAGE_NAME).desktop +@DESKTOP_ENTRY_TRUE@edit = sed \ +@DESKTOP_ENTRY_TRUE@ -e 's|@PACKAGE_NAME[@]|$(PACKAGE_NAME)|g' \ +@DESKTOP_ENTRY_TRUE@ -e 's|@bindir[@]|$(bindir)|g' \ +@DESKTOP_ENTRY_TRUE@ -e 's|@EXEEXT[@]|$(EXEEXT)|g' + @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 +all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @@ -374,17 +377,14 @@ distdir-am: $(DISTFILES) fi; \ done check-am: all-am -check: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) check-am +check: check-am 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) - $(MAKE) $(AM_MAKEFLAGS) install-exec-am +install: install-am +install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am @@ -414,7 +414,6 @@ distclean-generic: maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." - -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) clean: clean-am clean-am: clean-generic mostlyclean-am @@ -481,7 +480,7 @@ ps-am: uninstall-am: uninstall-desktopDATA uninstall-iconDATA -.MAKE: all check install install-am install-exec install-strip +.MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic cscopelist-am \ ctags-am distclean distclean-generic distdir dvi dvi-am html \ @@ -497,16 +496,17 @@ uninstall-am: uninstall-desktopDATA uninstall-iconDATA .PRECIOUS: Makefile + @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" >> $@ +@DESKTOP_ENTRY_TRUE@ rm -f $@ $@.tmp +@DESKTOP_ENTRY_TRUE@ srcdir=''; \ +@DESKTOP_ENTRY_TRUE@ test -f ./$@.in || srcdir=$(srcdir)/; \ +@DESKTOP_ENTRY_TRUE@ $(edit) $${srcdir}$@.in >$@.tmp +@DESKTOP_ENTRY_TRUE@ chmod +x $@.tmp +@DESKTOP_ENTRY_TRUE@ chmod a-w $@.tmp +@DESKTOP_ENTRY_TRUE@ mv $@.tmp $@ + +@DESKTOP_ENTRY_TRUE@$(PACKAGE_NAME).desktop: $(srcdir)/$(PACKAGE_NAME).desktop.in # 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/data/terminal-media-launcher.desktop.in b/data/terminal-media-launcher.desktop.in new file mode 100644 index 0000000..ac2763f --- /dev/null +++ b/data/terminal-media-launcher.desktop.in @@ -0,0 +1,9 @@ +[Desktop Entry] +Type=Application +Name=@PACKAGE_NAME@ +Comment=Terminal Media Launcher +Path=@bindir@/@PACKAGE_NAME@@EXEEXT@ +Exec=@PACKAGE_NAME@@EXEEXT@ +Icon=@PACKAGE_NAME@ +Terminal=true +Categories=Utility -- cgit