From 1e5410e2d62b61d49089cfd7de5714babc894c72 Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Tue, 9 Dec 2014 09:14:33 +0000 Subject: Support choosing alternative binary and manual names from configure.local, to help downstream distributions avoid naming conflicts. --- Makefile | 29 ++++++++++++++++++----------- configure | 24 ++++++++++++++++++++++++ configure.local.example | 32 ++++++++++++++++++++++++++++++-- main.c | 11 +++++------ 4 files changed, 77 insertions(+), 19 deletions(-) diff --git a/Makefile b/Makefile index 9fc6c033..dac57421 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.452 2014/12/09 07:29:42 schwarze Exp $ +# $Id: Makefile,v 1.453 2014/12/09 09:14:33 schwarze Exp $ # # Copyright (c) 2010, 2011, 2012 Kristaps Dzonsons # Copyright (c) 2011, 2013, 2014 Ingo Schwarze @@ -314,8 +314,12 @@ base-install: base-build $(INSTALL_MAN) mandoc.1 demandoc.1 $(DESTDIR)$(MANDIR)/man1 $(INSTALL_MAN) mandoc.3 mandoc_escape.3 mandoc_malloc.3 \ mchars_alloc.3 tbl.3 $(DESTDIR)$(MANDIR)/man3 - $(INSTALL_MAN) man.7 mdoc.7 roff.7 eqn.7 tbl.7 mandoc_char.7 \ - $(DESTDIR)$(MANDIR)/man7 + $(INSTALL_MAN) man.7 $(DESTDIR)$(MANDIR)/man7/${MANM_MAN}.7 + $(INSTALL_MAN) mdoc.7 $(DESTDIR)$(MANDIR)/man7/${MANM_MDOC}.7 + $(INSTALL_MAN) roff.7 $(DESTDIR)$(MANDIR)/man7/${MANM_ROFF}.7 + $(INSTALL_MAN) eqn.7 $(DESTDIR)$(MANDIR)/man7/${MANM_EQN}.7 + $(INSTALL_MAN) tbl.7 $(DESTDIR)$(MANDIR)/man7/${MANM_TBL}.7 + $(INSTALL_MAN) mandoc_char.7 $(DESTDIR)$(MANDIR)/man7 $(INSTALL_DATA) example.style.css $(DESTDIR)$(EXAMPLEDIR) db-install: base-build @@ -325,16 +329,19 @@ db-install: base-build mkdir -p $(DESTDIR)$(MANDIR)/man3 mkdir -p $(DESTDIR)$(MANDIR)/man5 mkdir -p $(DESTDIR)$(MANDIR)/man8 - ln -f $(DESTDIR)$(BINDIR)/mandoc $(DESTDIR)$(BINDIR)/apropos - ln -f $(DESTDIR)$(BINDIR)/mandoc $(DESTDIR)$(BINDIR)/man - ln -f $(DESTDIR)$(BINDIR)/mandoc $(DESTDIR)$(BINDIR)/whatis - ln -f $(DESTDIR)$(BINDIR)/mandoc $(DESTDIR)$(SBINDIR)/makewhatis - $(INSTALL_MAN) apropos.1 man.1 $(DESTDIR)$(MANDIR)/man1 - ln -f $(DESTDIR)$(MANDIR)/man1/apropos.1 \ - $(DESTDIR)$(MANDIR)/man1/whatis.1 + ln -f $(DESTDIR)$(BINDIR)/mandoc $(DESTDIR)$(BINDIR)/$(BINM_APROPOS) + ln -f $(DESTDIR)$(BINDIR)/mandoc $(DESTDIR)$(BINDIR)/$(BINM_MAN) + ln -f $(DESTDIR)$(BINDIR)/mandoc $(DESTDIR)$(BINDIR)/$(BINM_WHATIS) + ln -f $(DESTDIR)$(BINDIR)/mandoc \ + $(DESTDIR)$(SBINDIR)/$(BINM_MAKEWHATIS) + $(INSTALL_MAN) apropos.1 $(DESTDIR)$(MANDIR)/man1/$(BINM_APROPOS).1 + $(INSTALL_MAN) man.1 $(DESTDIR)$(MANDIR)/man1/$(BINM_MAN).1 + ln -f $(DESTDIR)$(MANDIR)/man1/$(BINM_APROPOS).1 \ + $(DESTDIR)$(MANDIR)/man1/$(BINM_WHATIS).1 $(INSTALL_MAN) mansearch.3 $(DESTDIR)$(MANDIR)/man3 $(INSTALL_MAN) mandoc.db.5 $(DESTDIR)$(MANDIR)/man5 - $(INSTALL_MAN) makewhatis.8 $(DESTDIR)$(MANDIR)/man8 + $(INSTALL_MAN) makewhatis.8 \ + $(DESTDIR)$(MANDIR)/man8/$(BINM_MAKEWHATIS).8 cgi-install: cgi-build mkdir -p $(DESTDIR)$(CGIBINDIR) diff --git a/configure b/configure index 7e83d724..99d7228c 100755 --- a/configure +++ b/configure @@ -75,6 +75,16 @@ WWWPREFIX="/var/www" HTDOCDIR= CGIBINDIR= +BINM_APROPOS="apropos" +BINM_MAN="man" +BINM_WHATIS="whatis" +BINM_MAKEWHATIS="makewhatis" +MANM_MAN="man" +MANM_MDOC="mdoc" +MANM_ROFF="roff" +MANM_EQN="eqn" +MANM_TBL="tbl" + INSTALL="install" INSTALL_PROGRAM= INSTALL_LIB= @@ -285,6 +295,11 @@ cat << __HEREDOC__ #define HAVE_OHASH ${HAVE_OHASH} #define HAVE_MANPATH ${HAVE_MANPATH} +#define BINM_APROPOS "${BINM_APROPOS}" +#define BINM_MAN "${BINM_MAN}" +#define BINM_WHATIS "${BINM_WHATIS}" +#define BINM_MAKEWHATIS "${BINM_MAKEWHATIS}" + #if !defined(__BEGIN_DECLS) # ifdef __cplusplus # define __BEGIN_DECLS extern "C" { @@ -380,6 +395,15 @@ EXAMPLEDIR = ${EXAMPLEDIR} WWWPREFIX = ${WWWPREFIX} HTDOCDIR = ${HTDOCDIR} CGIBINDIR = ${CGIBINDIR} +BINM_APROPOS = ${BINM_APROPOS} +BINM_MAN = ${BINM_MAN} +BINM_WHATIS = ${BINM_WHATIS} +BINM_MAKEWHATIS = ${BINM_MAKEWHATIS} +MANM_MAN = ${MANM_MAN} +MANM_MDOC = ${MANM_MDOC} +MANM_ROFF = ${MANM_ROFF} +MANM_EQN = ${MANM_EQN} +MANM_TBL = ${MANM_TBL} INSTALL = ${INSTALL} INSTALL_PROGRAM = ${INSTALL_PROGRAM} INSTALL_LIB = ${INSTALL_LIB} diff --git a/configure.local.example b/configure.local.example index 76dcc629..037d48a4 100644 --- a/configure.local.example +++ b/configure.local.example @@ -1,4 +1,4 @@ -# $Id: configure.local.example,v 1.1 2014/08/16 19:00:01 schwarze Exp $ +# $Id: configure.local.example,v 1.2 2014/12/09 09:14:33 schwarze Exp $ # # Copyright (c) 2014 Ingo Schwarze # @@ -58,7 +58,7 @@ HAVE_WCHAR=0 # If you do not want uname(3) to be called but instead want a fixed # string to be used, use the following line: -OSNAME="OpenBSD 5.5" +OSNAME="OpenBSD 5.6" # The following installation directories are used. # It is possible to set only one or a few of these variables, @@ -74,6 +74,19 @@ LIBDIR="${PREFIX}/lib/mandoc" MANDIR="${PREFIX}/man" EXAMPLEDIR="${PREFIX}/share/examples/mandoc" +# Some distributions may want to avoid naming conflicts among manuals. +# If you want to change the names of installed section 7 manual pages, +# the following alternative names are suggested. +# The suffix ".7" will automatically be appended. +# It is possible to set only one or a few of these variables, +# there is no need to copy the whole block. + +MANM_MAN="mandoc_man" # default is "man" +MANM_MDOC="mandoc_mdoc" # default is "mdoc" +MANM_ROFF="mandoc_roff" # default is "roff" +MANM_EQN="mandoc_eqn" # default is "eqn" +MANM_TBL="mandoc_tbl" # default is "tbl" + # It is possible to change the utility program used for installation # and the modes files are installed with. The defaults are: @@ -125,6 +138,21 @@ HAVE_MANPATH=1 HAVE_MANPATH=0 +# Some distributions may want to avoid naming conflicts +# with groff, man-db, or other tools. +# If you want to change the names of binary programs, +# the following alternative names are suggested. +# Using other names is possible as well. +# This changes the names of the installed section 1 and section 8 +# manual pages as well. +# It is possible to set only one or a few of these variables, +# there is no need to copy the whole block. + +BINM_APROPOS=mapropos # default is "apropos" +BINM_MAN=mman # default is "man" +BINM_WHATIS=mwhatis # default is "whatis" +BINM_MAKEWHATIS=mandocdb # default is "makewhatis" + # --- user settings related man.cgi ------------------------------------ # By default, building man.cgi(8) is disabled. To enable it, copy diff --git a/main.c b/main.c index 7416321f..17655139 100644 --- a/main.c +++ b/main.c @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.203 2014/12/09 07:29:42 schwarze Exp $ */ +/* $Id: main.c,v 1.204 2014/12/09 09:14:33 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons * Copyright (c) 2010, 2011, 2012, 2014 Ingo Schwarze @@ -134,8 +134,7 @@ main(int argc, char *argv[]) ++progname; #if HAVE_SQLITE3 - if (0 == strncmp(progname, "mandocdb", 8) || - 0 == strncmp(progname, "makewhatis", 10)) + if (strcmp(progname, BINM_MAKEWHATIS) == 0) return(mandocdb(argc, argv)); #endif @@ -147,11 +146,11 @@ main(int argc, char *argv[]) memset(&search, 0, sizeof(struct mansearch)); search.outkey = "Nd"; - if (strcmp(progname, "man") == 0) + if (strcmp(progname, BINM_MAN) == 0) search.argmode = ARG_NAME; - else if (strncmp(progname, "apropos", 7) == 0) + else if (strcmp(progname, BINM_APROPOS) == 0) search.argmode = ARG_EXPR; - else if (strncmp(progname, "whatis", 6) == 0) + else if (strcmp(progname, BINM_WHATIS) == 0) search.argmode = ARG_WORD; else if (strncmp(progname, "help", 4) == 0) search.argmode = ARG_NAME; -- cgit v1.2.3-56-ge451