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