TODO: Allow multiple simultaneous differing contexts, probably each tied to a
[mmh] / docs / README.developers
1 #
2 # README.developers
3 #
4 # $Id$
5 #
6
7 This file is intended to provide a few tips for anyone doing development on nmh.
8 Developers who learn things "the hard way" about the nmh codebase (as opposed to
9 local info best encoded in a comment) are encouraged to share their wisdom here.
10
11 The topics are organized alphabetically.
12
13
14 --------------
15 autoconf files
16 --------------
17
18 If you wish to change the `configure' script or its related files, you'll need
19 to first install GNU m4, available from <ftp://ftp.gnu.org/pub/gnu/m4/> and then
20 GNU autoconf (<ftp://ftp.gnu.org/pub/gnu/autoconf/>).
21
22 Most of the configure-related files are automatically generated.  The only files
23 you should need to manually edit are acconfig.h and configure.in.  Don't, for
24 instance, edit config.h.in.  Though it is an input file from the point of view
25 of the users (and the configure script) it is an output file from the point of
26 view of the developers (and the autoconf script).
27
28 If you do change acconfig.h or configure.in and want to `cvs commit' them, be
29 sure to regenerate the output files and commit them as well.  The easiest way to
30 regenerate the files is to simply run `make' -- it'll do the necessary calls of
31 autoconf and autoheader and will do a `./config.status --recheck', which will
32 exercise your new configure script.
33
34 When you commit the configure-related files, it's very important to commit them
35 in the right order.  The timestamps on the files in the CVS archive are based on
36 the current time at the moment they were committed -- the timestamps from the
37 local files you commit are not copied over.  If you commit the files in the
38 wrong order, you'll cause unnecessary calls of `autoconf' to occur when people
39 try to `make' their copies of the latest CVS source.  These people may be
40 end-users who don't have any interest in changing the configure-related files
41 and don't have autoconf installed.  They'll be unable to make without playing
42 around with `touch'.
43
44 The correct procedure to commit the configure-related files is:
45
46     % cvs commit acconfig.h aclocal.m4 configure.in
47     % autoheader; autoconf; date > stamp-h.in
48     % cvs commit config.h.in configure stamp-h.in
49
50 The reason for the three-step commit is that configure.in contains the RCS $Id
51 keyword, so when you commit it, a new version is written locally.  Therefore,
52 the autoconf regeneration should be held off until after the commit, or your
53 local stamp-h.in will become out-of-sync with the CVS version (granted, not that
54 big a deal).  For the second step, you're doing the same commands as a 
55 `make reset' would do, but using that command would require extra configure runs
56 to make Makefile be up-to-date.
57
58 If you haven't changed all the files noted above, just commit the ones you have
59 changed, in the stated order (for instance, configure.in, then configure and
60 stamp-h.in).
61
62
63 -------------------
64 directory structure
65 -------------------
66
67 Following is a list of nmh's directories along with a brief description of the
68 purpose of each one.  Meanings are given for the abbreviations, but note that
69 these meanings are just informed guesses as to what the MH developers were
70 thinking. 
71
72 ./
73     The top-level directory.  Contains files like README and INSTALL.
74
75 config/
76     Contains utility files for the `configure' process.  Ordinarily nothing in
77     here needs to be messed with.
78
79 etc/
80     Contains files, file templates, and scripts to generate files that will be
81     installed in the ${prefix}/etc directory.  Stuff like replcomps.
82
83 h/
84     Most of nmh's header (.h) files are kept not in the individual source
85     directories, but in this central location.
86
87 man/
88     Contains all the input files that are processed to generate nmh's manual
89     pages.
90
91 mts/
92     "mts" stands for "Message Transfer Service".  Source files specific to the
93     different MTSs go in the subdirectories.
94
95 mts/mmdf/
96     "mmdf" stands for "Multichannel Memorandum Distribution Facility".  It is an
97     alternative to sendmail used primarily on SCO UNIX.
98
99 mts/sendmail/
100     When nmh is configured --with-mts=sendmail, the files in this directory are
101     used. 
102
103 mts/smtp/
104     When nmh is configured to just talk to an SMTP server over TCP/IP, the
105     source in this directory is compiled.
106
107 sbr/
108     "sbr" stands for "subroutine(s)".  For the most part, each source file in
109     this directory contains a single function with the same name as the source
110     file.  These functions are of general use and are called from throughout
111     nmh.  
112
113 uip/
114     "uip" stands for "User Interface Programs".  Most nmh commands have a file
115     in this directory named <command>.c containing the code for that command
116     (e.g. repl.c).  In some cases there is also an auxiliary file called
117     <command>sbr.c which contains additional subroutines called from <command>.c
118     (which would contain not much else besides main()).
119
120 zotnet/
121     Files in this hierarchy were either written by or moved here by UCI
122     (University of California, Irvine) after they took over MH from the Rand
123     Corporation.  "Zot!" is the sound effect made by the anteater in the "B.C."
124     comic strip when its tongue lashes out at ants.  The anteater is UCI's
125     official mascot.  Not sure whether UCInet was once called ZotNet...
126
127 zotnet/bboards/
128     UCI added Bulletin Board functionality to MH with the `bbc' command.  This
129     functionality has been removed from nmh but apparently files in this
130     directory are still needed for other purposes.
131
132 zotnet/mf/
133     "mf" stands for "Mail Filter".  The filtering in this case apparently refers
134     to translation between different address and mailbox formats.
135
136 zotnet/mts/
137     MTS code not specific to any single MTS apparently goes here.
138
139 zotnet/tws/
140     "tws" apparently stands for "time with structure", a rather odd phrase.
141     This directory used to be the place for date and time manipulation code, but
142     currently nothing in here is compiled.  There are new, more portable
143     versions of the key files in h/ and sbr/, and this directory will soon go
144     away completely.
145
146
147 -------------------------------------------------------
148 nmh-local functions to use in preference to OS versions
149 -------------------------------------------------------
150
151 For some system functions whose availability or behavior varies from OS to OS,
152 nmh conditionally uses a local definition with the same name as the OS function
153 (e.g. snprintf()).  For other functions, developers need to avoid the OS
154 versions and always use the nmh-supplied function.  Here is a list of such
155 functions: 
156
157 OS function  nmh-local version to use instead
158 ===========  ================================
159 getpass()    nmh_getpass()
160
161
162 -------------
163 releasing nmh
164 -------------
165
166 To make a public release of nmh (we'll use version 1.0.4 and my mhost.com
167 account, danh, as examples here):
168
169  1. % echo 1.0.4 > VERSION
170
171  2. Put a comment like "Released nmh-1.0.4." in the ChangeLog.
172
173  3. % cvs commit ChangeLog VERSION
174
175  4. % cvs tag nmh-1_0_4
176     (cvs treats dots specially, so underscores are substituted here.)
177
178  5. % make nmhdist
179
180  6. Untar nmh-1.0.4.tar.gz and `diff -r' it vs. your CVS tree.  Make sure no
181     files got left out of the distribution that should be in it (due to someone
182     forgetting to update the DIST variables in the Makefiles).
183
184  7. If you have root access on your machine, it's good at this point to do:
185
186     % chown -R 0:0 nmh-1.0.4
187     % tar cvf nmh-1.0.4.tar nmh-1.0.4
188     % gzip nmh-1.0.4.tar
189
190     If you leave the files in the archive as being owned by yourself, your UID
191     may coincide with one of a user on a machine where nmh is being installed,
192     making it possible for that user to Trojan the nmh code before the system
193     administrator finishes installing it.
194
195  8. Make sure your new tarball uncompresses and untars with no problem.  Make
196     sure you can configure, make, and install nmh from it.
197
198  9. If all is well and your tarball is final, go back to your CVS tree and do:
199
200     % echo 1.0.4+dev > VERSION
201
202 10. Put a comment like "Upped the version number to 1.0.4+dev until the next nmh
203     release." in the ChangeLog.
204
205 11. % cvs commit ChangeLog VERSION
206
207 12. If possible, make an MD5 hash and/or a PGP signature of nmh-1.0.4.tar.gz.
208
209 13. % scp -p nmh-1.0.4.tar.gz* danh@mhost.com:/var/ftp/pub/nmh
210
211 14. Send an announcement to exmh-users@redhat.com, exmh-workers@redhat.com,
212     mh-users@ics.uci.edu, and nmh-announce@mhost.com.  If the release fixes
213     significant security holes, also send an announcement to
214     bugtraq@securityfocus.com.  The exmh lists require you to be subscribed in
215     order to post.  Note that you don't need to post separately to comp.mail.mh,
216     as the mh-users mailing list is apparently bidirectionally gatewayed to it.
217
218     Preferably, the announcement should contain the MD5 hash generated above,
219     and should be PGP-signed.  It should include the FTP URL for the tarball as
220     well as the URL of the website.  It should contain a brief summary of
221     visible changes, as well as the URL of the cvsweb diff page that would show
222     a detailed list of changes.  The changes between 1.0.3 and 1.0.4 would be
223     shown by:
224
225         http://www.mhost.com/cgi-bin/cvsweb/nmh/ChangeLog?r1=1.40&r2=1.71