xref: /freebsd/contrib/mandoc/INSTALL (revision 61d06d6bd19dafe8ea971dd43e8328fa1b473456)
1*61d06d6bSBaptiste Daroussin$Id: INSTALL,v 1.22 2018/07/31 15:34:00 schwarze Exp $
2*61d06d6bSBaptiste Daroussin
3*61d06d6bSBaptiste DaroussinAbout the portable mandoc distribution
4*61d06d6bSBaptiste Daroussin--------------------------------------
5*61d06d6bSBaptiste DaroussinThe mandoc manpage compiler toolset (formerly called "mdocml")
6*61d06d6bSBaptiste Daroussinis a suite of tools compiling mdoc(7), the roff(7) macro language
7*61d06d6bSBaptiste Daroussinof choice for BSD manual pages, and man(7), the predominant
8*61d06d6bSBaptiste Daroussinhistorical language for UNIX manuals.
9*61d06d6bSBaptiste Daroussin
10*61d06d6bSBaptiste DaroussinIt includes a man(1) manual viewer and additional tools.
11*61d06d6bSBaptiste DaroussinFor general information, see <http://mandoc.bsd.lv/>.
12*61d06d6bSBaptiste Daroussin
13*61d06d6bSBaptiste DaroussinIn case you have questions or want to provide feedback, read
14*61d06d6bSBaptiste Daroussin<http://mandoc.bsd.lv/contact.html>.  Consider subscribing to the
15*61d06d6bSBaptiste Daroussindiscuss@ mailing list mentioned on that page.  If you intend to
16*61d06d6bSBaptiste Daroussinhelp with the development of mandoc, consider subscribing to the
17*61d06d6bSBaptiste Daroussintech@ mailing list, too.
18*61d06d6bSBaptiste Daroussin
19*61d06d6bSBaptiste DaroussinEnjoy using the mandoc toolset!
20*61d06d6bSBaptiste Daroussin
21*61d06d6bSBaptiste DaroussinIngo Schwarze, Karlsruhe, August 2018
22*61d06d6bSBaptiste Daroussin
23*61d06d6bSBaptiste Daroussin
24*61d06d6bSBaptiste DaroussinInstallation
25*61d06d6bSBaptiste Daroussin------------
26*61d06d6bSBaptiste DaroussinBefore manually installing mandoc on your system, please check
27*61d06d6bSBaptiste Daroussinwhether the newest version of mandoc is already installed by default
28*61d06d6bSBaptiste Daroussinor available via a binary package or a ports system.  A list of the
29*61d06d6bSBaptiste Daroussinlatest bundled and ported versions of mandoc for various operating
30*61d06d6bSBaptiste Daroussinsystems is maintained at <http://mandoc.bsd.lv/ports.html>.
31*61d06d6bSBaptiste Daroussin
32*61d06d6bSBaptiste DaroussinRegarding how packages and ports are maintained for your operating
33*61d06d6bSBaptiste Daroussinsystem, please consult your operating system documentation.
34*61d06d6bSBaptiste DaroussinTo install mandoc manually, the following steps are needed:
35*61d06d6bSBaptiste Daroussin
36*61d06d6bSBaptiste Daroussin1. If you want to build the CGI program, man.cgi(8), too,
37*61d06d6bSBaptiste Daroussinrun the command "echo BUILD_CGI=1 >> configure.local".
38*61d06d6bSBaptiste DaroussinThen run "cp cgi.h.example cgi.h" and edit cgi.h as desired.
39*61d06d6bSBaptiste Daroussin
40*61d06d6bSBaptiste Daroussin2. If you also want to build the catman(8) utility, run the
41*61d06d6bSBaptiste Daroussincommand "echo BUILD_CATMAN=1 >> configure.local".  Note that it
42*61d06d6bSBaptiste Daroussinis unlikely to be a drop-in replacement providing the same
43*61d06d6bSBaptiste Daroussinfunctionality as your system's "catman", if your operating
44*61d06d6bSBaptiste Daroussinsystem contains one.
45*61d06d6bSBaptiste Daroussin
46*61d06d6bSBaptiste Daroussin3. Define MANPATH_DEFAULT in configure.local
47*61d06d6bSBaptiste Daroussinif /usr/share/man:/usr/X11R6/man:/usr/local/man is not appropriate
48*61d06d6bSBaptiste Daroussinfor your operating system.
49*61d06d6bSBaptiste Daroussin
50*61d06d6bSBaptiste Daroussin4. Run "./configure".
51*61d06d6bSBaptiste DaroussinThis script attempts autoconfiguration of mandoc for your system.
52*61d06d6bSBaptiste DaroussinRead both its standard output and the file "Makefile.local" it
53*61d06d6bSBaptiste Daroussingenerates.  If anything looks wrong or different from what you
54*61d06d6bSBaptiste Daroussinwish, read the file "configure.local.example", create and edit
55*61d06d6bSBaptiste Daroussina file "configure.local", and re-run "./configure" until the
56*61d06d6bSBaptiste Daroussinresult seems right to you.
57*61d06d6bSBaptiste Daroussin
58*61d06d6bSBaptiste Daroussin5. Run "make".
59*61d06d6bSBaptiste DaroussinAny POSIX-compatible make, in particular both BSD make and GNU make,
60*61d06d6bSBaptiste Daroussinshould work.  If the build fails, look at "configure.local.example"
61*61d06d6bSBaptiste Daroussinand go back to step 2.
62*61d06d6bSBaptiste Daroussin
63*61d06d6bSBaptiste Daroussin6. Run "make -n install" and check whether everything will be
64*61d06d6bSBaptiste Daroussininstalled to the intended places.  Otherwise, put some *DIR or *NM*
65*61d06d6bSBaptiste Daroussinvariables into "configure.local" and go back to step 4.
66*61d06d6bSBaptiste Daroussin
67*61d06d6bSBaptiste Daroussin7. Optionally run the regression suite.
68*61d06d6bSBaptiste DaroussinBasically, that amounts to "cd regress && ./regress.pl".
69*61d06d6bSBaptiste DaroussinBut you should probably look at "./mandoc -l regress/regress.pl.1"
70*61d06d6bSBaptiste Daroussinfirst.
71*61d06d6bSBaptiste Daroussin
72*61d06d6bSBaptiste Daroussin8. Run "sudo make install".  If you intend to build a binary
73*61d06d6bSBaptiste Daroussinpackage using some kind of fake root mechanism, you may need a
74*61d06d6bSBaptiste Daroussincommand like "make DESTDIR=... install".  Read the *-install targets
75*61d06d6bSBaptiste Daroussinin the "Makefile" to understand how DESTDIR is used.
76*61d06d6bSBaptiste Daroussin
77*61d06d6bSBaptiste Daroussin9. Run the command "sudo makewhatis" to build mandoc.db(5) databases
78*61d06d6bSBaptiste Daroussinin all the directory trees configured in step 3.  Whenever installing
79*61d06d6bSBaptiste Daroussinnew manual pages, re-run makewhatis(8) to update the databases, or
80*61d06d6bSBaptiste Daroussinapropos(1) will not find the new pages.
81*61d06d6bSBaptiste Daroussin
82*61d06d6bSBaptiste Daroussin10. To set up a man.cgi(8) server, read its manual page.
83*61d06d6bSBaptiste Daroussin
84*61d06d6bSBaptiste DaroussinNote that a very small number of man(7) pages contain low-level
85*61d06d6bSBaptiste Daroussinroff(7) markup that mandoc does not yet understand.  On some BSD
86*61d06d6bSBaptiste Daroussinsystems using mandoc, third-party software is vetted on whether it
87*61d06d6bSBaptiste Daroussinmay be formatted with mandoc.  If not, groff(1) is pulled in as a
88*61d06d6bSBaptiste Daroussindependency and used to install pre-formatted "catpages" instead of
89*61d06d6bSBaptiste Daroussinmanual page sources.  This mechanism is used much less frequently
90*61d06d6bSBaptiste Daroussinthan in the past.  On OpenBSD, only 25 out of about 10000 ports
91*61d06d6bSBaptiste Daroussinstill require formatting with groff(1).
92*61d06d6bSBaptiste Daroussin
93*61d06d6bSBaptiste Daroussin
94*61d06d6bSBaptiste DaroussinUnderstanding mandoc dependencies
95*61d06d6bSBaptiste Daroussin---------------------------------
96*61d06d6bSBaptiste DaroussinThe following libraries are required:
97*61d06d6bSBaptiste Daroussin
98*61d06d6bSBaptiste Daroussin1. zlib for decompressing gzipped manual pages.
99*61d06d6bSBaptiste Daroussin
100*61d06d6bSBaptiste Daroussin2. The fts(3) directory traversion functions.
101*61d06d6bSBaptiste DaroussinIf your system does not have them, the bundled compatibility version
102*61d06d6bSBaptiste Daroussinwill be used, so you need not worry in that case.  But be careful: old
103*61d06d6bSBaptiste Daroussinglibc versions of fts(3) were known to be broken on 32bit platforms,
104*61d06d6bSBaptiste Daroussinsee <https://sourceware.org/bugzilla/show_bug.cgi?id=11460>.
105*61d06d6bSBaptiste DaroussinThat was presumably fixed in glibc-2.23.
106*61d06d6bSBaptiste DaroussinIf you run into that problem, set "HAVE_FTS=0" in configure.local.
107*61d06d6bSBaptiste Daroussin
108*61d06d6bSBaptiste Daroussin3. Marc Espie's ohash(3) library.
109*61d06d6bSBaptiste DaroussinIf your system does not have it, the bundled compatibility version
110*61d06d6bSBaptiste Daroussinwill be used, so you probably need not worry about it.
111*61d06d6bSBaptiste Daroussin
112*61d06d6bSBaptiste DaroussinOne of the chief design goals of the mandoc toolbox is to make
113*61d06d6bSBaptiste Daroussinsure that nothing related to documentation requires C++.
114*61d06d6bSBaptiste DaroussinConsequently, linking mandoc against any kind of C++ program
115*61d06d6bSBaptiste Daroussinwould defeat the purpose and is not supported.
116*61d06d6bSBaptiste Daroussin
117*61d06d6bSBaptiste Daroussin
118*61d06d6bSBaptiste DaroussinChecking autoconfiguration quality
119*61d06d6bSBaptiste Daroussin----------------------------------
120*61d06d6bSBaptiste DaroussinIf you want to check whether automatic configuration works well
121*61d06d6bSBaptiste Daroussinon your platform, consider the following:
122*61d06d6bSBaptiste Daroussin
123*61d06d6bSBaptiste DaroussinThe mandoc package intentionally does not use GNU autoconf because
124*61d06d6bSBaptiste Daroussinwe consider that toolset a blatant example of overengineering that
125*61d06d6bSBaptiste Daroussinis obsolete nowadays, since all modern operating systems are now
126*61d06d6bSBaptiste Daroussinreasonably close to POSIX and do not need arcane shell magic any
127*61d06d6bSBaptiste Daroussinlonger.  If your system does need such magic, consider upgrading
128*61d06d6bSBaptiste Daroussinto reasonably modern POSIX-compliant tools rather than asking for
129*61d06d6bSBaptiste Daroussinautoconf-style workarounds.
130*61d06d6bSBaptiste Daroussin
131*61d06d6bSBaptiste DaroussinAs far as mandoc is using any features not mandated by ANSI X3.159-1989
132*61d06d6bSBaptiste Daroussin("ANSI C") or IEEE Std 1003.1-2008 ("POSIX") that some modern systems
133*61d06d6bSBaptiste Daroussindo not have, we intend to provide autoconfiguration tests and
134*61d06d6bSBaptiste Daroussincompat_*.c implementations.  Please report any that turn out to be
135*61d06d6bSBaptiste Daroussinmissing.  Note that while we do strive to produce portable code,
136*61d06d6bSBaptiste Daroussinwe do not slavishly restrict ourselves to POSIX-only interfaces.
137*61d06d6bSBaptiste DaroussinFor improved security and readability, we do use well-designed,
138*61d06d6bSBaptiste Daroussinmodern interfaces like reallocarray(3) even if they are still rather
139*61d06d6bSBaptiste Daroussinuncommon, of course bundling compat_*.c implementations as needed.
140*61d06d6bSBaptiste Daroussin
141*61d06d6bSBaptiste DaroussinWhere mandoc is using ANSI C or POSIX features that some systems
142*61d06d6bSBaptiste Daroussinstill lack and that compat_*.c implementations can be provided for
143*61d06d6bSBaptiste Daroussinwithout too much hassle, we will consider adding them, too, so
144*61d06d6bSBaptiste Daroussinplease report whatever is missing on your platform.
145*61d06d6bSBaptiste Daroussin
146*61d06d6bSBaptiste DaroussinThe following steps can be used to manually check the automatic
147*61d06d6bSBaptiste Daroussinconfiguration on your platform:
148*61d06d6bSBaptiste Daroussin
149*61d06d6bSBaptiste Daroussin1. Run "make distclean".
150*61d06d6bSBaptiste Daroussin
151*61d06d6bSBaptiste Daroussin2. Run "./configure"
152*61d06d6bSBaptiste Daroussin
153*61d06d6bSBaptiste Daroussin3. Read the file "config.log".  It shows the compiler commands used
154*61d06d6bSBaptiste Daroussinto test the libraries installed on your system and the standard
155*61d06d6bSBaptiste Daroussinoutput and standard error output these commands produce.  Watch out
156*61d06d6bSBaptiste Daroussinfor unexpected failures.  Those are most likely to happen if headers
157*61d06d6bSBaptiste Daroussinor libraries are installed in unusual places or interfaces defined
158*61d06d6bSBaptiste Daroussinin unusual headers.  You can also look at the file "config.h" and
159*61d06d6bSBaptiste Daroussincheck that no "#define HAVE_*" differ from your expectations.
160