about summary refs log tree commit diff
path: root/pkgs/sternenseemann/patches/mandoc-nix-store.patch
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/sternenseemann/patches/mandoc-nix-store.patch')
-rw-r--r--pkgs/sternenseemann/patches/mandoc-nix-store.patch75
1 files changed, 75 insertions, 0 deletions
diff --git a/pkgs/sternenseemann/patches/mandoc-nix-store.patch b/pkgs/sternenseemann/patches/mandoc-nix-store.patch
new file mode 100644
index 00000000..22be8fcc
--- /dev/null
+++ b/pkgs/sternenseemann/patches/mandoc-nix-store.patch
@@ -0,0 +1,75 @@
+Index: configure
+===================================================================
+RCS file: /cvs/mandoc/configure,v
+retrieving revision 1.77
+diff -u -r1.77 configure
+--- configure	20 Jul 2020 16:57:30 -0000	1.77
++++ configure	8 Feb 2021 17:51:07 -0000
+@@ -108,6 +108,7 @@
+ LIBDIR=
+ MANDIR=
+ HOMEBREWDIR=
++NIXSTOREDIR=
+ 
+ WWWPREFIX="/var/www"
+ HTDOCDIR=
+@@ -462,6 +463,7 @@
+ [ -n "${OSNAME}" ] && echo "#define OSNAME \"${OSNAME}\""
+ [ -n "${UTF8_LOCALE}" ] && echo "#define UTF8_LOCALE \"${UTF8_LOCALE}\""
+ [ -n "${HOMEBREWDIR}" ] && echo "#define HOMEBREWDIR \"${HOMEBREWDIR}\""
++[ -n "${NIXSTOREDIR}" ] && echo "#define NIXSTOREDIR \"${NIXSTOREDIR}\""
+ [ ${HAVE_ATTRIBUTE} -eq 0 ] && echo "#define __attribute__(x)"
+ [ ${HAVE_EFTYPE} -eq 0 ] && echo "#define EFTYPE EINVAL"
+ [ ${HAVE_O_DIRECTORY} -eq 0 ] && echo "#define O_DIRECTORY 0"
+Index: configure.local.example
+===================================================================
+RCS file: /cvs/mandoc/configure.local.example,v
+retrieving revision 1.39
+diff -u -r1.39 configure.local.example
+--- configure.local.example	20 Jul 2020 16:57:30 -0000	1.39
++++ configure.local.example	8 Feb 2021 17:51:07 -0000
+@@ -218,6 +218,16 @@
+ PREFIX="/usr/local"
+ HOMEBREWDIR="${PREFIX}/Cellar"
+ 
++# Similarly, when using the nix package manager or the NixOS linux
++# distribution, man pages are stored in the packages' output store
++# path in /nix/store.  The globally installed man pages under
++# /run/current-system/sw/share/man are thus symlinks to files under
++# /nix/store.  By setting NIXSTOREDIR, mandoc won't ignore these
++# symlinks.
++# This setting can also be used to support Guix which is derived
++# from NixOS, but uses /gnu/store instead of /nix/store.
++NIXSTOREDIR="/nix/store"
++
+ # --- user settings for the mandoc(3) library --------------------------
+ 
+ # By default, libmandoc.a is not installed.  It is almost never needed
+Index: mandocdb.c
+===================================================================
+RCS file: /cvs/mandoc/mandocdb.c,v
+retrieving revision 1.267
+diff -u -r1.267 mandocdb.c
+--- mandocdb.c	3 Apr 2020 11:35:01 -0000	1.267
++++ mandocdb.c	8 Feb 2021 17:51:08 -0000
+@@ -615,6 +615,9 @@
+ #ifdef HOMEBREWDIR
+ 			    && strncmp(buf, HOMEBREWDIR, strlen(HOMEBREWDIR))
+ #endif
++#ifdef NIXSTOREDIR
++			    && strncmp(buf, NIXSTOREDIR, strlen(NIXSTOREDIR))
++#endif
+ 			) {
+ 				if (warnings) say("",
+ 				    "%s: outside base directory", buf);
+@@ -825,6 +828,10 @@
+ 		start = usefile + basedir_len;
+ #ifdef HOMEBREWDIR
+ 	else if (strncmp(usefile, HOMEBREWDIR, strlen(HOMEBREWDIR)) == 0)
++		start = usefile;
++#endif
++#ifdef NIXSTOREDIR
++	else if (strncmp(usefile, NIXSTOREDIR, strlen(NIXSTOREDIR)) == 0)
+ 		start = usefile;
+ #endif
+ 	else {