summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlejandro Colomar <alx@kernel.org>2023-04-09 13:04:48 +0200
committerAlejandro Colomar <alx@kernel.org>2023-04-09 13:07:17 +0200
commit6a828d5b6879ef19c3f59034fe1d0850d25d0056 (patch)
tree97e9164c65c6a14fcf9435c125dacc433e2e62cd
parentc4d8bc8fb9a9cf4693cd8f15caa3861850ddaab3 (diff)
*.mk: $Z: Support installing bzip2 compressed pages
Gentoo currently installs pages compressed with this format. Signed-off-by: Alejandro Colomar <alx@kernel.org>
-rw-r--r--Makefile3
-rw-r--r--lib/cmd.mk1
-rw-r--r--lib/install-man.mk10
3 files changed, 11 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index d31d8b710..96b2be92e 100644
--- a/Makefile
+++ b/Makefile
@@ -133,7 +133,7 @@ help-variables:
$(info V Define to non-empty string for verbose output)
$(info )
$(info LINK_PAGES How to install link pages. ["so", "symlink"])
- $(info Z Install pages compressed. ["", ".gz"])
+ $(info Z Install pages compressed. ["", ".bz2", ".gz"])
$(info )
$(info DISTNAME $$(git describe))
$(info DISTVERSION /$$DISTNAME/s/man-pages-//)
@@ -175,6 +175,7 @@ help-variables:
$(info MANDOC {EXTRA_,}MANDOCFLAGS)
$(info MAN2HTML {EXTRA_,}MAN2HTMLFLAGS)
$(info )
+ $(info BZIP2)
$(info ECHO)
$(info EXPR)
$(info FIND)
diff --git a/lib/cmd.mk b/lib/cmd.mk
index f24a51924..7af9d112b 100644
--- a/lib/cmd.mk
+++ b/lib/cmd.mk
@@ -8,6 +8,7 @@ ifndef MAKEFILE_CMD_INCLUDED
MAKEFILE_CMD_INCLUDED := 1
+BZIP2 := bzip2
CP := cp
ECHO := echo
EXPR := expr
diff --git a/lib/install-man.mk b/lib/install-man.mk
index 76f57b142..d25062176 100644
--- a/lib/install-man.mk
+++ b/lib/install-man.mk
@@ -23,10 +23,11 @@ endif
Z :=
ifeq ($(Z),)
+else ifeq ($(Z),.bz2)
else ifeq ($(Z),.gz)
else
$(warning "Z": "$(Z)")
-$(error Valid values for "Z": ["", ".gz"])
+$(error Valid values for "Z": ["", ".bz2", ".gz"])
endif
@@ -172,7 +173,12 @@ ifeq ($(LINK_PAGES),symlink)
| $(XARGS) -I tgt $(LN) -fsT tgt $@; \
fi
endif
-ifeq ($(Z),.gz)
+ifeq ($(Z),.bz2)
+ if ! $(TEST) -L $@; then \
+ $(BZIP2) <$@ \
+ | $(SPONGE) $@; \
+ fi
+else ifeq ($(Z),.gz)
if ! $(TEST) -L $@; then \
$(GZIP) - <$@ \
| $(SPONGE) $@; \