File 0001-Add-install-target.patch of Package emacs-compat

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Bidar?= <bjorn.bidar@thaodan.de>
Date: Wed, 27 Sep 2023 00:25:31 +0300
Subject: [PATCH] Add install target
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Björn Bidar <bjorn.bidar@thaodan.de>
---
 Makefile | 33 +++++++++++++++++++++++++++++++--
 1 file changed, 31 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index d584bc3f78f00d559200c144e8a62bb84c4fd385..5a065652a1be0b1be38607ee11dcef23ed03415b 100644
--- a/Makefile
+++ b/Makefile
@@ -29,7 +29,7 @@
 ### Code:
 
 .POSIX:
-.PHONY: all compile force-compile test clean check
+.PHONY: all compile force-compile test clean check install
 .SUFFIXES: .el .elc
 
 ifeq ($(CI),true)
@@ -37,18 +37,31 @@ ifeq ($(CI),true)
 else
         STRICT =
 endif
+DESTDIR ?=
+PREFIX  ?= /usr
+DATADIR ?= $(PREFIX)/share
+ELDIR   ?= $(DATADIR)/emacs/site-lisp
+INFODIR	?= $(DATADIR)/info
 
 EMACS = emacs
 MAKEINFO = makeinfo
-BYTEC = compat-25.elc \
+GZIP	= gzip
+INSTALL_INFO = install-info
+RUNTIME = compat-25.elc \
 	compat-26.elc \
 	compat-27.elc \
 	compat-28.elc \
 	compat-29.elc \
 	compat-30.elc \
 	compat.elc \
+	compat.elc
+DEVELOPMENT = \
 	compat-macs.elc \
 	compat-tests.elc
+BYTEC = $(RUNTIME) \
+		$(DEVELOPMENT) \
+INFOS = compat.info
+
 
 all: compile
 
@@ -80,6 +93,22 @@ check:
 		sort | uniq > /tmp/compat-links
 	@diff /tmp/compat-defs /tmp/compat-links
 
+install: $(addprefix install-,compat-runtime-el compat-info)
+
+install-compat-runtime-el: $(RUNTIME) $(RUNTIME:.elc=.el) compat-macs.el
+
+install-compat-info: compat.info
+
+install-%-el:
+	$(if $<, install -m755 -d $(DESTDIR)$(ELDIR))
+	$(if $<, install -m644 $^ $(DESTDIR)$(ELDIR))
+
+install-%-info:
+	$(if $<, install -m755 -d $(DESTDIR)$(INFODIR))
+	$(if $<, $(INSTALL_INFO) --info-file=$< --info-dir=$(DESTDIR)$(INFODIR))
+	$(if $<, install -m644 $^ $(DESTDIR)$(INFODIR))
+	$(if $<, $(GZIP) -9nf $(DESTDIR)$(INFODIR)/$<)
+
 $(BYTEC): compat-macs.el
 
 .el.elc:
openSUSE Build Service is sponsored by