aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2015-01-21 22:41:49 +0000
committerIngo Schwarze <schwarze@openbsd.org>2015-01-21 22:41:49 +0000
commit481fa37c9d12175d129ac739a8959a5da5a6d478 (patch)
tree2ece135b24bf7a8fd8d07caf5d424ff5b8498a67
parent2c8780108e37e85285813e3f999444c3e861a456 (diff)
downloadmandoc-481fa37c9d12175d129ac739a8959a5da5a6d478.tar.gz
mandoc-481fa37c9d12175d129ac739a8959a5da5a6d478.tar.zst
mandoc-481fa37c9d12175d129ac739a8959a5da5a6d478.zip
Support homebrew-style linking on Mac OS X.
Idea found together with Alexis Hildebrandt <surryhill at gmail dot com>.
-rwxr-xr-xconfigure4
-rw-r--r--configure.local.example12
-rw-r--r--mandocdb.c12
3 files changed, 23 insertions, 5 deletions
diff --git a/configure b/configure
index 57ac898f..e7cb2e0b 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# Copyright (c) 2014 Ingo Schwarze <schwarze@openbsd.org>
+# Copyright (c) 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
@@ -70,6 +70,7 @@ INCLUDEDIR=
LIBDIR=
MANDIR=
EXAMPLEDIR=
+HOMEBREWDIR=
WWWPREFIX="/var/www"
HTDOCDIR=
@@ -276,6 +277,7 @@ __HEREDOC__
echo
echo "#define VERSION \"${VERSION}\""
[ -n "${OSNAME}" ] && echo "#define OSNAME \"${OSNAME}\""
+[ -n "${HOMEBREWDIR}" ] && echo "#define HOMEBREWDIR \"${HOMEBREWDIR}\""
cat << __HEREDOC__
#define HAVE_DIRENT_NAMLEN ${HAVE_DIRENT_NAMLEN}
diff --git a/configure.local.example b/configure.local.example
index 037d48a4..0ab3e37e 100644
--- a/configure.local.example
+++ b/configure.local.example
@@ -1,6 +1,6 @@
-# $Id: configure.local.example,v 1.2 2014/12/09 09:14:33 schwarze Exp $
+# $Id: configure.local.example,v 1.3 2015/01/21 22:41:49 schwarze Exp $
#
-# Copyright (c) 2014 Ingo Schwarze <schwarze@openbsd.org>
+# Copyright (c) 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
@@ -153,6 +153,14 @@ BINM_MAN=mman # default is "man"
BINM_WHATIS=mwhatis # default is "whatis"
BINM_MAKEWHATIS=mandocdb # default is "makewhatis"
+# When using the "homebrew" package manager on Mac OS X, the actual
+# manuals are located in a so-called "cellar" and only symlinked
+# into the manual trees. To allow mandoc to follow such symlinks,
+# you have to specify the physical location of the cellar as returned
+# by realpath(3), for example:
+
+HOMEBREWDIR=/Cellar
+
# --- user settings related man.cgi ------------------------------------
# By default, building man.cgi(8) is disabled. To enable it, copy
diff --git a/mandocdb.c b/mandocdb.c
index b403ceb9..6ae390be 100644
--- a/mandocdb.c
+++ b/mandocdb.c
@@ -1,4 +1,4 @@
-/* $Id: mandocdb.c,v 1.183 2015/01/15 04:26:40 schwarze Exp $ */
+/* $Id: mandocdb.c,v 1.184 2015/01/21 22:41:49 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -613,7 +613,11 @@ treescan(void)
say(path, "&realpath");
continue;
}
- if (strstr(buf, basedir) != buf) {
+ if (strstr(buf, basedir) != buf
+#ifdef HOMEBREWDIR
+ && strstr(buf, HOMEBREWDIR) != buf
+#endif
+ ) {
if (warnings) say("",
"%s: outside base directory", buf);
continue;
@@ -818,6 +822,10 @@ filescan(const char *file)
start = buf;
else if (strstr(buf, basedir) == buf)
start = buf + strlen(basedir);
+#ifdef HOMEBREWDIR
+ else if (strstr(buf, HOMEBREWDIR) == buf)
+ start = buf;
+#endif
else {
exitcode = (int)MANDOCLEVEL_BADARG;
say("", "%s: outside base directory", buf);