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 --- Makefile.in | 7 +++-- configure | 3 +- configure.ac | 3 +- data/Makefile.am | 25 ++++++++++------- data/Makefile.in | 40 +++++++++++++-------------- data/terminal-media-launcher.desktop.in | 9 ++++++ spec/terminal-media-launcher.spec | 49 --------------------------------- spec/terminal-media-launcher.spec.in | 49 +++++++++++++++++++++++++++++++++ 8 files changed, 102 insertions(+), 83 deletions(-) create mode 100644 data/terminal-media-launcher.desktop.in delete mode 100644 spec/terminal-media-launcher.spec create mode 100644 spec/terminal-media-launcher.spec.in diff --git a/Makefile.in b/Makefile.in index dd24389..5539957 100644 --- a/Makefile.in +++ b/Makefile.in @@ -97,7 +97,7 @@ DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d -CONFIG_CLEAN_FILES = +CONFIG_CLEAN_FILES = spec/terminal-media-launcher.spec CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) @@ -187,7 +187,8 @@ ETAGS = etags CTAGS = ctags CSCOPE = cscope DIST_SUBDIRS = $(SUBDIRS) -am__DIST_COMMON = $(dist_man_MANS) $(srcdir)/Makefile.in COPYING \ +am__DIST_COMMON = $(dist_man_MANS) $(srcdir)/Makefile.in \ + $(top_srcdir)/spec/terminal-media-launcher.spec.in COPYING \ compile config.guess config.sub depcomp install-sh missing DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) @@ -375,6 +376,8 @@ $(top_srcdir)/configure: $(am__configure_deps) $(ACLOCAL_M4): $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): +spec/terminal-media-launcher.spec: $(top_builddir)/config.status $(top_srcdir)/spec/terminal-media-launcher.spec.in + cd $(top_builddir) && $(SHELL) ./config.status $@ install-man1: $(dist_man_MANS) $(man1_MANS) @$(NORMAL_INSTALL) @list1='$(man1_MANS)'; \ diff --git a/configure b/configure index 192ff3a..12c0cdc 100755 --- a/configure +++ b/configure @@ -5744,7 +5744,7 @@ else fi -ac_config_files="$ac_config_files Makefile src/Makefile docs/Makefile data/Makefile" +ac_config_files="$ac_config_files Makefile src/Makefile docs/Makefile data/Makefile spec/terminal-media-launcher.spec" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -6504,6 +6504,7 @@ do "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "docs/Makefile") CONFIG_FILES="$CONFIG_FILES docs/Makefile" ;; "data/Makefile") CONFIG_FILES="$CONFIG_FILES data/Makefile" ;; + "spec/terminal-media-launcher.spec") CONFIG_FILES="$CONFIG_FILES spec/terminal-media-launcher.spec" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac diff --git a/configure.ac b/configure.ac index fab92d6..5ffbe5f 100644 --- a/configure.ac +++ b/configure.ac @@ -57,7 +57,8 @@ AM_CONDITIONAL([DESKTOP_ENTRY], [test "$desktop_entry" = "yes"]) AC_CONFIG_FILES([Makefile src/Makefile docs/Makefile - data/Makefile]) + data/Makefile + spec/terminal-media-launcher.spec]) AC_OUTPUT # Print helpful message 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 diff --git a/spec/terminal-media-launcher.spec b/spec/terminal-media-launcher.spec deleted file mode 100644 index 2adcc1c..0000000 --- a/spec/terminal-media-launcher.spec +++ /dev/null @@ -1,49 +0,0 @@ -Name: terminal-media-launcher -Version: 0.1 -Release: 1%{?dist} -Summary: Lightweight Terminal Media Launcher written in C - -License: GPLv3+ -URL: https://github.com/lshprung/terminal-media-launcher -Source0: %{name}-%{version}.tar.gz - -Requires: glibc >= 2.7, ncurses >= 6 - -%description -Terminal Media Launcher is a command line utility to help streamline -launching applications and other media - -%prep -%autosetup - - -%build -%configure --enable-desktop-entry -%make_build - - -%install -rm -rf $RPM_BUILD_ROOT -%make_install - - -%files -%license -%doc -%{_bindir}/terminal-media-launcher -%{_docdir}/terminal-media-launcher/README.md -%{_docdir}/terminal-media-launcher/screenshot1.png -%{_docdir}/terminal-media-launcher/screenshot2.png -%{_docdir}/terminal-media-launcher/terminal-media-launcher-config.md -%{_docdir}/terminal-media-launcher/windows_compile_instructions.md -%{_mandir}/man1/terminal-media-launcher.1.gz -%{_mandir}/man5/terminal-media-launcher-config.5.gz -%{_mandir}/man5/terminal-media-launcher-config.5.gz -%{_datadir}/applications/terminal-media-launcher.desktop -%{_datadir}/pixmaps/terminal-media-launcher.svg - - - -%changelog -* Thu Mar 02 2023 louie -- First version being packaged diff --git a/spec/terminal-media-launcher.spec.in b/spec/terminal-media-launcher.spec.in new file mode 100644 index 0000000..238282e --- /dev/null +++ b/spec/terminal-media-launcher.spec.in @@ -0,0 +1,49 @@ +Name: @PACKAGE_NAME@ +Version: @PACKAGE_VERSION@ +Release: 1%{?dist} +Summary: Lightweight Terminal Media Launcher written in C + +License: GPLv3+ +URL: https://github.com/lshprung/terminal-media-launcher +Source0: %{name}-%{version}.tar.gz + +Requires: glibc >= 2.7, ncurses >= 6 + +%description +Terminal Media Launcher is a command line utility to help streamline +launching applications and other media + +%prep +%autosetup + + +%build +%configure --enable-desktop-entry +%make_build + + +%install +rm -rf $RPM_BUILD_ROOT +%make_install + + +%files +%license +%doc +%{_bindir}/terminal-media-launcher +%{_docdir}/terminal-media-launcher/README.md +%{_docdir}/terminal-media-launcher/screenshot1.png +%{_docdir}/terminal-media-launcher/screenshot2.png +%{_docdir}/terminal-media-launcher/terminal-media-launcher-config.md +%{_docdir}/terminal-media-launcher/windows_compile_instructions.md +%{_mandir}/man1/terminal-media-launcher.1.gz +%{_mandir}/man5/terminal-media-launcher-config.5.gz +%{_mandir}/man5/terminal-media-launcher-config.5.gz +%{_datadir}/applications/terminal-media-launcher.desktop +%{_datadir}/pixmaps/terminal-media-launcher.svg + + + +%changelog +* Thu Mar 02 2023 louie +- First version being packaged -- cgit