From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED autolearn=no autolearn_force=no version=3.4.4 Received: (qmail 24286 invoked from network); 30 Mar 2021 19:49:58 -0000 Received: from bsd.lv (HELO mandoc.bsd.lv) (66.111.2.12) by inbox.vuxu.org with ESMTPUTF8; 30 Mar 2021 19:49:58 -0000 Received: from fantadrom.bsd.lv (localhost [127.0.0.1]) by mandoc.bsd.lv (OpenSMTPD) with ESMTP id e2a0e434 for ; Tue, 30 Mar 2021 14:49:56 -0500 (EST) Received: from mail1.systemli.org (mail1.systemli.org [212.103.72.247]) by mandoc.bsd.lv (OpenSMTPD) with ESMTP id 442596b9 for ; Tue, 30 Mar 2021 14:49:54 -0500 (EST) From: sternenseemann DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=systemli.org; s=default; t=1617133791; bh=Ee4smRY2d2FAV/rPuIcNcd+rKYQsME659BDHfjrUw+U=; h=From:Subject:To:Date:From; b=Bm1uMcwl0Qjd8pMgxyo35TSC2sVZxnbneq0xmkt9yteaq6vSKTqZbl7eL/rG34Bqh 9Icl0DpCY+IP+qaSZB27AsSzVkmvrY+I+q838p6RBwmt+1xiGB1NANQvs0OO8z4vih 26swW/7m5ymYLbC/l8qLnN7SRgSPwEraac6dn1uHEqEMiSwIoluuFb10gEM4l9cZVE Vsh8ypKkomIjqzpZqaxjX7b8kTYVRXVvrULK4tVSs77NBkWeXL4p+VEzghaFnAsXCc nFnhg13HxU248ShZ/6Srxsin5HfG8aGR0Ye9sha4AQj0sdiVDZVaNO7MWtzKwI9gKn h4DT5LiTktXXA== Subject: [PATCH makewhatis] add NIXSTOREDIR configuration variable to support NixOS To: tech@mandoc.bsd.lv Message-ID: <8bce7cc9-954e-1c28-ee25-13969f66eb20@systemli.org> Date: Tue, 30 Mar 2021 21:49:49 +0200 X-Mailinglist: mandoc-tech Reply-To: tech@mandoc.bsd.lv MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On NixOS there is a similar situation as with Hombrew: The actual man pages are installed into custom prefixes for each package under /nix/store and then symlinked to in the global share/man directory (which is /run/current-system/sw/share/man for NixOS). This of course makes makewhatis skip every installed man page when indexing because /nix/store is considered outside of the man directory. To fix this issue I've followed the implementation of HOMEBREWDIR. The drawback of this being that more or less the same code is duplicated for this purpose. However there may be a (arguably very small) group of users who would possibly want to use both configuration variables at the same time as the nix package manager can also be installed on macOS, but it would probably also not do any harm merging the two variables into one. This patch is necessary to provide a mandoc-based alternative to the current documentation.man module in NixOS which uses GNU's man-db package. I have a working implementation of this (using a cvs version of mandoc with this patch applied) here: https://github.com/openlab-aux/vuizvui/blob/master/modules/user/sternenseemann/documentation/mandoc.nix A side note: During testing I haven't been able to trigger the code path of the ifdef in filescan. I've added it anyways because HOMEBREWDIR also has been added there, but didn't seem to be a situation where basedir is set and filescan is called, but maybe I missed something. cheers, lukas 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=o 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 { -- To unsubscribe send an email to tech+unsubscribe@mandoc.bsd.lv