summaryrefslogtreecommitdiff
path: root/gnu/packages/patches/mandoc-support-zstd-compression.patch
diff options
context:
space:
mode:
authorSören Tempel <[email protected]>2025-01-28 16:55:48 +0100
committerMaxim Cournoyer <[email protected]>2025-01-29 22:13:39 +0900
commit4176f6c52f485549f829af048ef9a6726b52e112 (patch)
treec0573d2f2866c1013ac0fef53ee3fb18d4ef2edf /gnu/packages/patches/mandoc-support-zstd-compression.patch
parent9a17331bc3c47fd3fb3b497864603c5fdb84c3fa (diff)
gnu: mandoc: Support zstd-compressed man pages.
Since #68242 Guix uses zstd compression for man pages. Unfortunately, upstream mandoc only supports gzip compressed man pages. Luckily, zstd provides a wrapper library which easily allows adapting software using zlib to zstd compression. This patch uses this wrapper library in conjunction with mandoc to add support for zstd compression to it, thereby allowing Guix man pages to be viewed with mandoc again. Without this patch, mandoc is essentially defunct on Guix. * gnu/packages/man.scm (mandoc): Support zstd compression. * gnu/local.mk: Add new patch. * gnu/packages/patches/mandoc-support-zstd-compression.patch: New file. Signed-off-by: Maxim Cournoyer <[email protected]> Change-Id: I49a6b9f81309aa1b9f0e5d19b1813dbac13cf968
Diffstat (limited to 'gnu/packages/patches/mandoc-support-zstd-compression.patch')
-rw-r--r--gnu/packages/patches/mandoc-support-zstd-compression.patch60
1 files changed, 60 insertions, 0 deletions
diff --git a/gnu/packages/patches/mandoc-support-zstd-compression.patch b/gnu/packages/patches/mandoc-support-zstd-compression.patch
new file mode 100644
index 0000000000..a73c762f3f
--- /dev/null
+++ b/gnu/packages/patches/mandoc-support-zstd-compression.patch
@@ -0,0 +1,60 @@
+mandoc upstream does not support zstd compression. However, Guix uses zstd
+compression for its man pages, therefore — without support for this
+compression method — mandoc would be quite useless. Hence, this patchset uses
+zlibWrapper from the zstd project to add zstd compression support to mandoc.
+
+Upstream-status: https://inbox.vuxu.org/mandoc-discuss/[email protected]/T/#t
+
+diff -upr mandoc-1.14.6.orig/Makefile mandoc-1.14.6/Makefile
+--- mandoc-1.14.6.orig/Makefile 2025-01-11 16:20:31.511129163 +0100
++++ mandoc-1.14.6/Makefile 2025-01-11 19:16:35.924788821 +0100
+@@ -251,7 +251,12 @@ LIBMANDOC_OBJS = $(LIBMAN_OBJS) \
+ msec.o \
+ preconv.o \
+ read.o \
+- tag.o
++ tag.o \
++ zstd_zlibwrapper.o \
++ gzclose.o \
++ gzlib.o \
++ gzread.o \
++ gzwrite.o
+
+ ALL_COBJS = compat_err.o \
+ compat_fts.o \
+Only in mandoc-1.14.6: Makefile.orig
+diff -upr mandoc-1.14.6.orig/configure mandoc-1.14.6/configure
+--- mandoc-1.14.6.orig/configure 2025-01-11 16:20:31.511129163 +0100
++++ mandoc-1.14.6/configure 2025-01-11 19:16:35.924788821 +0100
+@@ -430,7 +430,7 @@ fi
+ [ "${FATAL}" -eq 0 ] || exit 1
+
+ # --- LDADD ---
+-LDADD="${LDADD} ${LD_NANOSLEEP} ${LD_RECVMSG} ${LD_OHASH} -lz"
++LDADD="${LDADD} ${LD_NANOSLEEP} ${LD_RECVMSG} ${LD_OHASH} -lz -lzstd"
+ echo "selected LDADD=\"${LDADD}\"" 1>&2
+ echo "selected LDADD=\"${LDADD}\"" 1>&3
+ echo 1>&3
+Only in mandoc-1.14.6: configure.orig
+diff -upr mandoc-1.14.6.orig/read.c mandoc-1.14.6/read.c
+--- mandoc-1.14.6.orig/read.c 2025-01-11 16:35:03.825441715 +0100
++++ mandoc-1.14.6/read.c 2025-01-11 19:16:35.924788821 +0100
+@@ -37,7 +37,7 @@
+ #include <stdlib.h>
+ #include <string.h>
+ #include <unistd.h>
+-#include <zlib.h>
++#include <zstd_zlibwrapper.h>
+
+ #include "mandoc_aux.h"
+ #include "mandoc.h"
+@@ -627,7 +627,7 @@ mparse_open(struct mparse *curp, const char *file)
+ int fd, save_errno;
+
+ cp = strrchr(file, '.');
+- curp->gzip = (cp != NULL && ! strcmp(cp + 1, "gz"));
++ curp->gzip = (cp != NULL && (! strcmp(cp + 1, "gz") || ! strcmp(cp + 1, "zst")));
+
+ /* First try to use the filename as it is. */
+
+Only in mandoc-1.14.6: read.c.orig