]> diplodocus.org Git - nmh/blob - docs/README.developers
If -[no]concat is given to show(1), have it use showmimeproc instead
[nmh] / docs / README.developers
1 #
2 # README.developers
3 #
4
5 This file is intended to provide a few tips for anyone doing development on nmh.
6 Developers who learn things "the hard way" about the nmh codebase (as opposed to
7 local info best encoded in a comment) are encouraged to share their wisdom here.
8
9 Following a commit checklist, the topics are organized alphabetically.
10
11 ----------------
12 commit checklist
13 ----------------
14
15 1. code updated?
16 2. test added?
17 3. make distcheck passed?
18 4. man page and other documentation updated?
19 5. docs/pending-release-notes updated?
20 6. should commit message reference bug report?
21 7. update/close bug report (with commit id)?
22 8. notify nmh-users?
23
24
25 ---------------------------------
26 C library/system call usage notes
27 ---------------------------------
28 * Use m_mktemp2() or m_mktemp() instead of mkstemp(3) (see section on
29 nmh temporary files below).
30 * Use m_unlink() instead of unlink(3).
31 * Use done() instead of _exit(3) except after a fork(3).
32
33
34 -------------------------
35 autoconf & automake files
36 -------------------------
37
38 If you wish to change the `configure' script, the generated Makefile
39 or other related files, you'll need to first install GNU m4, available
40 from <ftp://ftp.gnu.org/pub/gnu/m4/>, then GNU autoconf
41 (<ftp://ftp.gnu.org/pub/gnu/autoconf/>) and GNU automake
42 (<ftp://ftp.gnu.org/pub/gnu/automake/>). Nmh is currently using a
43 minimum of autoconf 2.68 and automake 1.12.
44
45 Most of the configure-related files are automatically generated.
46 The only files you should need to manually edit are configure.ac
47 and any autoconf macros in the m4 directory. Don't, for instance,
48 edit config.h.in. Though it is an input file from the point of
49 view of the users (and the configure script) it is an output file
50 from the point of view of the developers (and the autoconf script).
51
52 If you wish to add a new autoconf macro, it should be placed in it's
53 own file and put in the m4 directory; aclocal will automatically pick
54 it up and automake will add it to the distribution target automatically.
55
56 If you wish to make changes to the Makefile, you will need to edit
57 Makefile.am. See the automake documentation if you need further help.
58 You should always check changes to Makefile.am by using "make distcheck".
59
60 Note that the automatically generated autotools files (such as config.h.in,
61 Makefile.in, and configure), are NOT kept in git. Thus, when you check out
62 a git tree, you need to run the autogen.sh script before you can build
63 anything:
64
65 % ./autogen.sh
66
67
68 -------------------
69 directory structure
70 -------------------
71
72 Following is a list of nmh's directories along with a brief description of the
73 purpose of each one. Meanings are given for the abbreviations, but note that
74 these meanings are just informed guesses as to what the MH developers were
75 thinking.
76
77 ./
78 The top-level directory. Contains files like README and INSTALL.
79
80 config/
81 Contains utility files for the `configure' process. Ordinarily nothing in
82 here needs to be messed with.
83
84 docs/
85 Contains more specialized documentation, such as this file and
86 the FAQ.
87
88 etc/
89 Contains files, file templates, and scripts to generate files that will be
90 installed in the ${prefix}/etc directory. Stuff like replcomps.
91
92 h/
93 Most of nmh's header (.h) files are kept not in the individual source
94 directories, but in this central location.
95
96 man/
97 Contains all the input files that are processed to generate nmh's manual
98 pages.
99
100 mts/
101 "mts" stands for "Message Transfer Service". Source files specific to the
102 different MTSs go in the subdirectories.
103
104 mts/smtp/
105 When nmh is configured to just talk to an SMTP server over TCP/IP, the
106 source in this directory is compiled.
107
108 sbr/
109 "sbr" stands for "subroutine(s)". For the most part, each source file in
110 this directory contains a single function with the same name as the source
111 file. These functions are of general use and are called from throughout
112 nmh.
113
114 test/
115 The num unit test suite.
116
117 uip/
118 "uip" stands for "User Interface Programs". Most nmh commands have a file
119 in this directory named <command>.c containing the code for that command
120 (e.g. repl.c). In some cases there is also an auxiliary file called
121 <command>sbr.c which contains additional subroutines called from <command>.c
122 (which would contain not much else besides main()).
123
124
125 ---
126 git
127 ---
128
129 As of December 2010, nmh has switched to using git for revision control
130 instead of CVS. While the topic of git is beyond the scope of this FAQ,
131 to get started with git & nmh, you can run the following command to checkout
132 the nmh repository (with read-only access to it):
133
134 % git clone git://git.savannah.nongnu.org/nmh.git
135
136 That will create a workspace called nmh. To update that workspace
137 with changes to the master, cd to it and run:
138
139 % git pull
140
141 If you are a project member and want write access to the repository,
142 you'll have to checkout with the following command instead of the one
143 above:
144
145 % git clone <username>@git.sv.nongnu.org:/srv/git/nmh.git
146
147 We suggest using git pull --rebase instead of the default merge for
148 git pull. If you don't want to add the --rebase option every time,
149 you can tell git pull to always rebase in your nmh workspace by
150 cd'ing to it and running the following command:
151
152 % git config --bool branch.master.rebase true
153
154 And you'll probably want the following, also, so that --rebase applies
155 to any new branches that you create:
156
157 % git config branch.autosetuprebase always
158
159 -------------------------------------------------------
160 nmh-local functions to use in preference to OS versions
161 -------------------------------------------------------
162
163 For some system functions whose availability or behavior varies from OS to OS,
164 nmh conditionally uses a local definition with the same name as the OS function
165 (e.g. snprintf()). For other functions, developers need to avoid the OS
166 versions and always use the nmh-supplied function. Here is a list of such
167 functions:
168
169 OS function nmh-local version to use instead
170 =========== ================================
171 getpass() nmh_getpass()
172
173
174 -------------------
175 nmh temporary files
176 -------------------
177
178 To create a temporary file, use m_mktemp2() or m_mktemp(). They use
179 mkstemp(3), but they also register the temporary file for removal on
180 program termination. So, do not use mkstemp() directly.
181
182 To further support this, nmh_init() must be called at the beginning of
183 main(). And, if a child process is not going to immediately call one
184 of the exec(3) functions or _exit(3) after a fork(3), it should call
185 unregister_for_removal(0). Finally, nmh_init() sets up signal handlers
186 for several signals: these signal handlers should not be disabled.
187
188
189 --------------
190 nmh test suite
191 --------------
192
193 The nmh test suite is run through the Makefile, with "make check"
194 or "make distcheck".
195
196 To enable the use of valgrind, where available, set the environment
197 variable NMH_VALGRIND to a non-null value. However, a separate
198 environment variable, VALGRIND_ME, triggers the use of valgrind in
199 test/inc/test-eom-align because it greatly extends the duration of
200 that test.
201
202 In the nmh test suite, nmh programs to be tested should be invoked
203 through the run_test or run_prog shell functions defined in
204 test/common.sh.
205
206 -------------
207 releasing nmh
208 -------------
209
210 To make a public release of nmh (we'll use version 1.5 as the example
211 here; the convention for release candidates is to use something like
212 "1.5-RC1"):
213
214 1. % echo 1.5 > VERSION
215 % date +"%e %B %Y" > DATE
216 (DATE should contain something like "30 December 2000")
217
218 2. % git commit VERSION DATE; git push
219
220 3. % git tag -a 1.5 -m 'Releasing nmh-1.5.'
221
222 Note that the new convention for tagging is to simply tag with the
223 version number (tag formats in the past have varied).
224
225 4. % make distcheck
226
227 If you want to check the distribution build with some particular
228 configure options, set the DISTCHECK_CONFIGURE_FLAGS variable.
229 E.g.:
230
231 % make distcheck DISTCHECK_CONFIGURE_FLAGS=--with-cyrus-sasl
232
233 5. If all is well and your tarball is final, go back to your workspace and do:
234
235 % echo 1.5+dev > VERSION
236
237 6. % git commit VERSION; git push
238
239 7. Upload the distribution file to savannah. You can automate this process
240 by doing:
241
242 % make upload SAVANNAH_USERNAME=username
243
244 This will automatically call gpg to sign the release. You can bypass
245 this step by setting the SKIP_GPG_SIG variable.
246
247 8. Update the http://www.nongnu.org/nmh/ homepage. (It lives in the CVS
248 'webpages repository'; see https://savannah.nongnu.org/cvs/?group=nmh)
249
250 9. Add a news item to the savannah nmh page. You'll have to submit it first
251 and then separately approve it (under News->Manage).
252
253 10. Send the release announcement email to the following places:
254 nmh-workers@nongnu.org
255 nmh-announce@nongnu.org
256 exmh-users@redhat.com
257 exmh-workers@redhat.com
258 mh-e-users@lists.sourceforge.net
259
260 If the release fixes significant security holes, also send an announcement
261 to bugtraq@securityfocus.com. The exmh lists require you to be subscribed
262 in order to post. Note that you don't need to post separately to
263 comp.mail.mh, as the mh-users mailing list is apparently bidirectionally
264 gatewayed to it.
265
266 Preferably, the announcement should contain the MD5 hash generated above,
267 and should be PGP-signed. It should include the URL for the tarball as
268 well as the URL of the website. It should contain a brief summary of
269 visible changes, as well as the URL of the git diff page that would show
270 a detailed list of changes. The changes between 1.5 and 1.4 would be
271 shown by [this is just a guess, I don't know anything about cgit, and
272 it assumes that we tag with nmh-x_x-release from now on]:
273
274 http://git.savannah.gnu.org/cgit/nmh.git/diff/?h=nmh-1_5-release?h=nmh-1_4-release