Tweak previous, it added a bad memory access
[s-mailx.git] / INSTALL
blob3461e8624a032bfd5e1a0683cbe3e0e3c7e1c64c
1 I n s t a l l i n g  S - n a i l / S - m a i l x
2 ================================================
4 1.  Compilation
5 1.1 What if configuration fails?
6 1.2 What if building fails?
7 1.3 How can i enable debugging?
8 2.  Notes on building the latest release
10 1. Compilation
11 --------------
13 System specific notes can be found in the next section.
14 All (optional) features are documented (and adjustable) in make.rc.
15 Adjustments may also take place, and are usually done, from the command
16 line, overriding those made in make.rc (if any).
17 Without any adjustments all non-experimental features will be enabled,
18 except some which provide redundant functionality (e.g., OPT_SPAMC is
19 disabled because the generic OPT_SPAM_FILTER can do the same).
20 None of the features are "require"d by default, so that configuration
21 won't fail shall any of them not be available or usable.
23   $ make tangerine  # equals "$ make config build test install"
24   $ make distclean  # *Completely* cleanup working directory
26 With adjustments:
28   $ make OPT_POP3=no OPT_SMTP=require tangerine
29   $ make OPT_CROSS_BUILD=y VAL_PREFIX=/some/nasty/prefix tangerine
31 With utility program and feature adjustments:
33   $ make awk=/usr/bin/nawk OPT_SOCKETS=no DESTDIR=./zzz tangerine
35 If OPT_DOTLOCK has been enabled then the minimal privilege-separated
36 SETUID (to VAL_PRIVSEP_USER, default "root") helper program will be build
37 and installed, and therefore the installation process needs to have the
38 appropriate privileges.  In this case it may be useful to separate the
39 configuration / building and the installation tasks and give the last
40 step higher privileges via super(1), sudo(1), su(1) or a similar
41 mechanism, e.g.:
43   $ make VAL_PREFIX=/usr config && make MAKEJOBS='-j 4' &&
44     super make DESTDIR=./xy install
46 would create a "s-nail" binary and install a "s-nail" manual etc.  under
47 the prefix "/usr" but rooted under "[./]xy", i.e., the binary would be
48 installed as "[./]xy/usr/bin/s-nail".
49 The following make(1) targets exists, the default being `build':
51 - tangerine   Shorthand for "$ make config build test install":
52               create or check and update configuration, build, test and
53               install.
54               The variable $DESTDIR will be honoured (see make.rc),
55               but not be tracked in the configuration.
56               In order to parallelize the `build' step pass a $MAKEJOBS
57               variable, as shown below.
58 - all         Shorthand for "$ make config build".
59               In order to parallelize the `build' step pass a $MAKEJOBS
60               variable, as shown below.
62 - config      Only create or check and update the configuration.
63 - build       Only build (using the existing configuration).
64               This can be parallelized, either by a corresponding make(1)
65               invocation when the target is run by itself, or by setting
66               the $MAKEJOBS variable otherwise, e.g., "MAKEJOBS='-j 4'".
67               $MAKEJOBS is not tracked in the configuration.
68 - install     Only install using the built files of the existing
69               configuration.
70               The variable $DESTDIR will be honoured (see make.rc),
71               but not be tracked in the configuration.
73               S-nail will create an uninstall shell script
74               (VAL_UAGENT-uninstall.sh), but which will *not* be installed
75               if $DESTDIR is set non-empty -- within $DESTDIR, that is.
76               Copy or move it manually from the S-nail root directory ./
77               into $DESTDIR as necessary.
79 - clean       Remove anything which can be rebuild.
80 - distclean   Remove anything which can be rebuild or reconfigured.
82 - test        Run cc-test.sh in --check-only mode on the built binary.
84 Setting the make(1) variable $VERBOSE to an arbitrary value during
85 `config' time, as in "$ make VERBOSE=xy tangerine", will change the
86 output of the `all', `install' etc. targets to a more verbose one.
87 If some libraries are missing that you know are installed on your
88 system, or if other errors occur due to missing files but which you know
89 exist, please ensure that the environment variable $C_INCLUDE_PATH
90 includes the necessary "include/" paths and the environment variable
91 $LD_LIBRARY_PATH includes the necessary "lib/"rary paths.
93 The S-nail make system will inspect these two environment variables and
94 *automatically* convert them to cc(1) (c99(1)) -I and -L options (since
95 these environment variables are, different to the command line options,
96 not part of the POSIX standard).
97 To set these environment variables, the following can be done in
98 a Bourne / Korn / POSIX compatible shell:
100   $ C_INCLUDE_PATH="${C_INCLUDE_PATH}:/usr/local/include"
101   $ LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/usr/local/lib"
102   $ export C_INCLUDE_PATH LD_LIBRARY_PATH
103   $ make tangerine
105 The S-nail make system will also automatically integrate pkgsrc(7) paths
106 into this mechanism.  (pkgsrc(7) is a portable package management system
107 that is used as a default on diverse operating systems.)
108 And if all else fails you can also forcefully pass in include directives
109 and library paths by passing prefilled $INCS and $LIBS variables:
111   $ make INCS=-I/mypath/lib LIBS=-l/mypath/iconv tangerine
113 Note there are also some predefined configuration sets available, ment
114 to be used instead of doing manual adjustments (in make.rc or) on the
115 command line (names are case-insensitive):
117 - CONFIG=NULL, CONFIG=NULLI
118   Anything that can be turned off is off.  MIME can't.
119   The latter adds and "require"s iconv(3), though.
121 - CONFIG=MINIMAL
122   This is the most plain mailx(1)-alike mode, but with MIME support and
123   (if available) character set conversion and regular expressions
124   builtin.  Dotlock files and the privileged separated dotlock helper.
126   "Require"s dotlocking and the privileged separated dotlock helper.
128 - CONFIG=MEDIUM
129   Possibly what people want who need nothing but a MIME-capable mailx(1)
130   and don't regret improved usability for the rare interactive use
131   occasions.
133   Like MINIMAL, but with documentation strings, the builtin line editor
134   (MLE) with history support and key bindings, error tracking, basic
135   colour support and IDNA addresses.
137   "Require"s iconv(3), dotlocking and the privileged separated dotlock
138   helper.
140 - CONFIG=NETSEND
141   Sending messages directly to the mail provider via the SMTP protocol,
142   instead of requiring a local mail-transfer-agent (MTA) who does.
144   Adds SSL/TLS, GSSAPI and .netrc file parsing on top of MEDIUM, on the
145   other hand spam filter support is removed.
147   "Require"s iconv(3), SSL/TLS, SMTP (sockets), dotlocking and the
148   privileged separated dotlock helper.
150 - CONFIG=MAXIMAL
151   Anything on, including experimental features.
152   S-nail(1) gains mail fetching capabilities and heads more towards
153   being a full-featured mail-user-agent (MUA) with this configuration.
155   "Require"s iconv(3), regex(3), the MLE as well as dotlocking and the
156   privileged separated dotlock helper.
158 1.1 What if configuration fails?
159 --------------------------------
161 The configuration process creates some files named "config":
163 - config.log  output generated by the configuration compile tests.
164 - config.lst  configuration (chosen option, programs, paths).
165               (Removing this file reenables configuration even after
166               a screwed up configuration, e.g., due to power failure.)
167 - config.h    C program header produced according to config.lst.
168 - config.ev   A set of sh(1) variable for reproducable compile runs.
169 - config.inc  List of C header include paths, as compiler directives.
170 - config.lib  List of used library information, as compiler directives.
172 Of special interest is config.log since the error usually manifests here
173 in textual output.  Maybe that makes it obvious what can be done (header
174 files could not be found because of missing entries in $C_INCLUDE_PATH,
175 libraries could not be linked because of incomplete $LD_LIBRARY_PATH,
176 etc.).
178 Otherwise it is getting complicated, and it would be appreciated if you
179 would contact the mailing-list!
181 If you hit an actual bug in the configuration system, and "make
182 distclean" will not help you out, please "reset" the state by doing
183 a simple "$ rm config.*".
185 1.2 What if building fails?
186 ---------------------------
188 Even worse!  This should not happen if configuration succeeded!  It
189 would be very kind and highly appreciated if you would report this
190 to the mailing-list.
192 1.3 How can i enable debugging?
193 -------------------------------
195 Please ensure OPT_DEBUG=yes is enabled during compilation, as in
197   $ make CONFIG=MAXIMAL OPT_DEBUG=yes
199 If $OPT_AUTOCC is enabled then the build system should automatically
200 adjust the compiler flags accordingly, please see make.rc for more.
201 There is also a `devel'opment target which does most of this by itself:
203   $ make devel
205 $OPT_DEBUG (`devel') will enable memory bound debug canaries and
206 Not-Yet-Dead function graph listings etc.  Whereas the latter will try
207 to write its listing into a file named after your favourite MUA in
208 your $TMPDIR (or "/tmp" or "./", in order), falling back to STDERR shall
209 creation of the file not be possible (we won't overwrite an existing
210 file), the debug facilities in general make their appearance on the
211 standard error channel; because this can be a quite long output, then,
212 it is possibly a good idea to redirect it to a file:
214   $ s-nail -dvv 2> error.log
216 Should you really discover any problems with S-nail it would be very
217 useful for development if you would contact the mailing-list!
218 Thank you!
220 2. Notes on building the latest release
221 ---------------------------------------
223 This software has been in use or is used on a regulary basis on FreeBSD
224 and Linux.  Occasional tests happens on the remains of the following.
225 Unless otherwise noted the following applies to saying
226 "$ make tangerine; make devel && make test".
227 In alphabetical order:
229 - All systems:
230   * I've turned off -Wstrict-overflow warnings unless we're debug
231     enabled (talking about OPT_AUTOCC=yes here).
232   * You will likely see warnings on unused returns from write(2),
233     ftruncate(2) and a few other I/O functions.  These will vanish after
234     the large I/O and MIME rewrite that comes with v15.
235   * I am using the latest gcc(1) and clang(1) compilers, and am doing
236     scan-build(1) and Coverity.com inspection before major releases.
237     Some "XYZ may be used uninitialized" warnings are logically false.
239 - All 32-bit systems:
240   * There _may_ be warnings about format strings, like, e.g.,
241       auxlily.c:1610:10: warning: format '%lu' expects type 'long
242       unsigned int', but argument 3 has type 'size_t'
243     The codebase is ISO C89, so we have no %z printf(3) format.
244     However we try hard to detect the real type size and define the
245     "PRI[du]Z" macros which end up with the correct size, which is
246     also compile-time asserted (see the "MCTA(sizeof(size_t) == XZ)"
247     statements in nail.h).
249     You can completely overcome this situation by forcing ISO C99 mode
250     when compiling, e.g., with gcc(1) and clang(1): if you use
251     $OPT_AUTOCC then also pass "EXTRA_CFLAGS=-std=c99", otherwise
252     ensure -std=c99 is set in your $CFLAGS.
254 . AlpineLinux <https://www.alpinelinux.org/>
255   AlpineLinux 3.4.3, gcc(1).
257 . ArchLinux <https://www.archlinux.org/>
258   Latest as of 2016-09-16, clang(1) and gcc(1).
260 . CRUX Linux <https://www.crux.nu/>
261   CRUX 3.2 RC3, gcc(1).
263 . DragonFly BSD <https://www.dragonflybsd.org/>
264   DragonFly 4.6.0, gcc(1).
265   * I will never get iconv(3) right for Solaris it seems.
267 - FreeBSD <https://www.freebsd.org/>
268   FreeBSD 10.3, clang(1).
270 - NetBSD <https://www.netbsd.org/>
271   Not tested.
273 . OpenBSD <https://www.openbsd.org/>
274   OpenBSD 5.9.
276 - Solaris <http://opencsw.org/>
277   @ First of all: thanks to OpenCSW.org for offering SSH access to
278     their Solaris build cluster!
279   * In order to be able to run the tests you will need a cksum(1) that
280     supports CRC-32 (POSIX).  We look into /opt/csw/gnu/cksum, but if
281     that cannot be found you have to adjust the $cksum variable (see
282     above) to something that works.
283     (v15 will use a different test suite.)
284   * With $OPT_AUTOCC: we try to use Sun cc(1) whenever we find it.
285     If your gcc(1) installation is doing alright you have to turn
286     $OPT_AUTOCC off and use $CC, $CFLAGS and $LDFLAGS.
287   * I will never get iconv(3) right for Solaris it seems.
288   * Some notes collected on earlier trials:
289     + We may forcefully disable stack protectors on SunOS/gcc because of
290       linking errors seen in earlier tests.
291     + If you get the compiler / system header installation error
292         Undefined                       first referenced
293          symbol                             in file
294         __builtin_stdarg_start              auxlily.o
295       then you have to overwrite this symbol with __builtin_va_start,
296       e.g., in conjunction with $OPT_AUTOCC add this:
297        EXTRA_CFLAGS='-D__builtin_stdarg_start=__builtin_va_start'
298     + I couldn't get us going on SunOS 5.9 Sparc: the build system had
299       to be extended to check for UINTPTR_MAX being defined as the empty
300       string and similar very special things.
301   - The OpenCSW build cluster consists of SunOS 5.9 - 5.11 machines
302     under SPARC and i386.
303     It looked good on 2016-09-16.
305 - UnixWare 7.1.4.
306   * Note: it is no longer possible to use the `install' rule, because
307     we use shell functions to ease the task of directory creation etc.
308     (especially useful due to $VERBOSE), and that won't work due to bugs
309     (in the system make(1) program i presume).
310   + Not tested after v14.8.4, just fine before that.
312 . Void Linux <http://www.voidlinux.eu/>
313   Not yet tested for v14.9.0.
314   (My current working environment is restricted since i've lost
315   my main development machine.)
317 # s-ts-mode