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 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'data/Makefile.am') 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 -- cgit