Factor load functionality into include builtin.
[m4/ericb.git] / HACKING
blobe19cde5897f94c9781d53eb4a85472efacebaa48
1 GNU M4
2 ******
4 1. Introduction
5 ===============
7 This file attempts to describe the processes we use to maintain M4,
8 and is not part of a release distribution.
11 2. Maintenance Notes
12 ====================
14 * If you incorporate a change from somebody on the net:
15   If it is a large change, you must make sure they have signed the
16   appropriate paperwork, and be sure to add their name and email
17   address to THANKS.  AUTHORS is built from the FSF list of copyright
18   assignments, on fencepost.gnu.org.
20 * If somebody reports a new bug, write a test case, then mention his
21   name in the ChangeLog entry.
23 * The correct response to most actual bugs is to write a new test case
24   which demonstrates the bug.  Then fix the bug, re-run the test suite,
25   and check everything in.
27 * Changes with user-visible effects must be mentioned in NEWS.
29 * New macros must be blind, or else prefixed with `m4' or `__', in
30   order to minimize backward compatibility issues with previous
31   releases of M4 when processing English text.
33 * GNU Coding Standards should be followed:
34     http://www.gnu.org/prep/standards/
35   Additionally, while GNU M4 is not yet POSIX compliant, we are trying
36   to get closer to it (although some design decisions state that POSIX
37   compliance should only happen when POSIXLY_CORRECT is in the
38   environment or the -G option was passed on the command line):
39     http://www.opengroup.org/onlinepubs/009695399/utilities/m4.html
41 * Except for third-party files (libtool, gnulib, ...), all .c files
42   should #include <config.h> before anything else (since there are some
43   #defines in config.h that potentially impact system headers, such as
44   when the user does ./configure --disable-assert).  This means that no
45   .h files need to #include <config.h>.  However, users compiling
46   external modules should be able to compile without <config.h>, since
47   <config.h> is specific to the M4 build and is not installable.
50 3. Bootstrapping
51 ================
53 * The master M4 repository is stored in git.  You can obtain a read-only
54   copy with:
55     git clone git://git.sv.gnu.org/m4.git
56   or
57     cvs -d:pserver:anonymous@pserver.git.sv.gnu.org:/srv/git/m4.git \
58       co -d m4 HEAD
60   If you are a member of the savannah group for M4, a read-write
61   copy can be obtained by:
62     git clone <savannah-user>@git.sv.gnu.org:/srv/git/m4.git
64 * Before you can build from git, you need to bootstrap.  This requires:
65   - A pre-installed version of GNU M4 1.4.5 or later, built from a
66     package (recommend 1.4.13 or later)
67   - A git checkout of Autoconf (2.63b-41 or later)
68   - Automake 1.10b or later
69   - Libtool 2.2 or later
70   - Gettext 0.16 or later
71   - Gperf 3.0 or later
72   - Help2man 1.29 or later
73   - Xz 4.999.8beta or later (from <http://tukaani.org/xz/>)
74   - Texinfo 4.8 or later
75   - Any prerequisites of the above (such as perl, tex)
77   Note that none of these bootstrapping dependencies should be required
78   by a distributed release.
80 * M4 includes gnulib as a git submodule.  By default, the bootstrap
81   script will attempt to run
82     git submodule update --init
83   to grab a gnulib clone from the official read-only location of
84     git://git.sv.gnu.org/gnulib.git
86   However, this can be network and disk intensive.  If you already have
87   another gnulib clone on your disk, you can use the environment
88   variable GNULIB_SRCDIR to point to the previous checkout to speed up
89   the process.  Additionally, both the bootstrap script and gnulib-tool
90   require a shell that supports functions, so you can set the
91   environment variable CONFIG_SHELL to choose a better shell on systems
92   (like Solaris) where /bin/sh is lacking.  Thus, you may find it
93   convenient to run:
94     GNULIB_SRCDIR=path/to/gnulib CONFIG_SHELL=path/to/sh \
95       path/to/sh ./bootstrap
97   A read-only copy of gnulib can be obtained by:
98       git clone git://git.sv.gnu.org/gnulib.git
99     or
100       cvs -d:pserver:anonymous@pserver.git.sv.gnu.org:/srv/git/gnulib.git \
101         co -d gnulib HEAD
103   Using a CVS checkout might work, but it is relatively untested,
104   particularly now that we use a git submodule for gnulib.
106   If you are a member of the savannah group for gnulib, a read-write
107   copy can be obtained by:
108     git clone <savannah-user>@git.sv.gnu.org:/srv/git/gnulib.git
110   If you are behind a firewall that blocks the git protocol, you may
111   find it useful to do:
112     git config --global url.http://git.sv.gnu.org/r/.insteadof \
113       git://git.sv.gnu.org/
114   to force git to transparently rewrite all savannah git references to
115   instead use http.
117 * Either add the gnulib directory to your PATH, or run
118     GNULIB_TOOL=path/to/gnulib/gnulib-tool ./bootstrap
120 * When it is time for a release, it is a good idea to bootstrap with
121   official releases of the autotools, rather than git builds, to reduce
122   the pain of a user re-running bootstrap on the packaged M4.  However,
123   files installed by Automake should be updated to the latest version
124   from their respective upstream source, rather than the version that
125   shipped with the automake release.
127 * Normally, after running bootstrap, 'git status' should not show any
128   differences; if things changed, please provide a patch or at least
129   report it as a bug.  One case where things are changed is if the
130   gnulib submodule comes from an older date than the current installed
131   libtool, such that libtoolize will replace the symlinks to an older
132   version of build-aux files with their newer counterpart; the fix to
133   this is updating the submodule to a newer gnulib version.
136 4. Test Suite
137 =============
139 * Use
140     make check
141   liberally, on as many platforms as you can.  Use as many compilers and
142   linkers you can.
144 * Some of the testsuite is generated from the documentation.
145   All instances of @example in doc/m4.texinfo that are not preceeded by
146   "@comment ignore" are turned into tests in the tests directory.
149 5. Editing 'ChangeLog'
150 ======================
152 * When in doubt, check that emacs can syntax-color properly in
153   change-log-mode.  And preferably use emacs 'C-x 4 a'
154   (add-change-log-entry-other-window) to open ChangeLog with an
155   appropriate new template.
157 * If this change is by a different author, or on a different date to the
158   last entry start a new entry at the top of the file with the format
159   (note two spaces between each field):
161 yyyy-mm-dd  Name of Author  <email@address>
163 *  If more than one person collaborated on the change, additional
164    authors can be listed on subsequent lines, thus:
166 yyyy-mm-dd  Name of Main Author  <email@address>,
167             Name of Contributor  <another@email.address>
169 * Where a change author did not supply a copyright assignment, but the
170   changes they submitted were sufficiently trivial to commit in any case
171   (see the GCS for guidelines on this), then flag this against their
172   name in the header, thus:
174 yyyy-mm-dd  Name of Author  <email@address>  (tiny change)
176 * Preferably the next part should be a description of the overall
177   purpose of the change, separated from the header by a blank line,
178   indented by 1 tab, and filled at column 72.  The last character of the
179   description should be a colon, :.
181 * Changes to each file come next.  Each new file starts on a new line,
182   indented by 1 tab and starting with an asterisk and a space.  Multiple
183   files can be listed here relative to $top_srcdir, and comma separated.
184   Names of functions (or sections as appropriate) to which the change
185   applies should be named inside parentheses and comma separated.  If
186   this goes beyond column 72, then parens should be closed and re-opened
187   on the next line:
189         * file, another/file, test/testcases/foo.test (func_foo)
190         (func_bar, func_baz): Description of changes.
192 * If the change does not apply to particular functions (or sections),
193   the section list can be omitted:
195         * file, another/file, test/testcases/foo.test: General changes.
197 * If the changes are particular to certain architectures, they should be
198   listed after the functions in square brackets:
200         * file, another/file (func_foo) [linux, solaris]: Description of
201         changes.
203 * Subsequent changes in other files that are related to the same overall
204   enhancement or bugfix should be listed concurrently, without blank
205   lines.  Always start a fresh line for a new file:
207         * file, another/file (func_foo) [linux, solaris]: Description of
208         changes.
209         * doc/foo.texi (Invoking Foo): Document.
210         * NEWS: Updated.
212 * If the change is in response to a problem reported by someone other
213   than the author, then credit them at the end of the description with:
215         Reported by Reporter Name <email@address>.
217 * See the GNU Coding Standards document for more details on ChangeLog
218   formatting.
220 6. Formatting
221 =============
223 * Use space-only indentation in nearly all files (Makefile and
224   ChangeLogs being the exception).
226   If you use Emacs and your m4 working directory name matches,
227   this code in your ~/.emacs enables the right mode:
229   ;; In m4, indent with spaces everywhere (not TABs).
230   ;; Exceptions: Makefile and ChangeLog modes.
231   (add-hook 'find-file-hook '(lambda ()
232     (if (and buffer-file-name
233              (string-match "/m4\\>" (buffer-file-name))
234              (not (string-equal mode-name "Change Log"))
235              (not (string-equal mode-name "Makefile")))
236         (setq indent-tabs-mode nil))))
238 * Since the source code was massively converted from tabs in December
239   2009, you may find it helpful to use 'git diff -w' and 'git blame -w'
240   helpful for overlooking the whitespace changes.
242 * Avoid #ifdefs inside function bodies, whenever possible.  If you
243   encounter a portability issue, it is better to propose a gnulib module
244   that works around it, and have m4 use that module.
247 7. Release Procedure
248 ====================
250 * If you are an m4 maintainer, but have not yet registered your
251   gpg public key and (preferred) email address with the FSF, send an
252   email, preferably GPG-signed, to <ftp-upload@gnu.org> that includes
253   the following:
255     (a) name of package(s) that you are the maintainer for, and your
256         preferred email address.
258     (b) an ASCII armored copy of your GnuPG key, as an attachment.
259         ("gpg --export -a YOUR_KEY_ID > mykey.asc" should give you
260         this.)
262   When you have received acknowledgement of your message, the proper GPG
263   keys will be registered on ftp-upload.gnu.org and only then will you be
264   authorized to upload files to the FSF ftp machines.
266 * If you do not have access to the mailing list administrative interface,
267   approach the list owners for the password.  Be sure to check the lists
268   (esp. bug-m4) for outstanding bug reports also in the list of
269   pending moderation requests.  This step is not strictly necessary, but
270   helps, since by default, m4-announce rejects all posts, so you have to
271   get an administrator to allow your announcement through.
273 * Make sure you have rsync installed.
275 * Make sure you have a copy of the previous release tarball in the build
276   directory.
278 * Make sure you have GNU make installed.
280 * Make sure you have an up-to-date version of help2man installed.
282 * Make sure your locale is sane, e.g. by exporting LC_ALL=C.
284 * Make sure you are happy with the particular gnulib version recorded as
285   the gnulib submodule.  If necessary to update to the latest, run:
286     git submodule foreach git pull origin master
287     git commit -m 'Update gnulib submodule to latest.' gnulib
288   In particular, ensure that the gnulib version is at least as new as
289   the latest stable libtool release.
291 * Update the version number in NEWS and ChangeLog, and mention in README
292   whether the release is stable.  See
293   http://www.gnu.org/software/libtool/contribute.html for details of the
294   numbering scheme (M4 uses a similar scheme to libtool, although
295   intra-release versions carry more information thanks to
296   git-version-gen).
298 * Run ./bootstrap, perhaps with environment variables set.
300 * Run ./configure (a VPATH build should work, but is less tested).
302 * Run `make'.  The file doc/m4.1 needs to exist for a distribution, and
303   be up-to-date with m4 --help output, but `make dist' intentionally
304   does not depend on running a built binary.
306 * Run `git commit' from the source tree if there are any changes from
307   the previous steps.
309 * Run `git tag -s -m <version> -u <gpg_key> v<version>' with the desired
310   version number.  Do not push anything upstream at this point.
312 * Run `make distcheck'.  If there are any problems, fix them, then run
313   `git tag -d v<version>' and start again from the `git commit' step.
315 * Run `make <target>', with target set to `stable, `alpha', or `beta' as
316   appropriate.  This will run various additional checks and create diff
317   files from the previous version.
319 * Run './build-aux/gnupload --to [dest].gnu.org:m4 [files]' to create
320   detached gpg signature and clear signed directive files, and upload
321   the combination to the correct location.  For an alpha release,
322   gnupload will place files in alpha.gnu.org, in /incoming/alpha; for a
323   full release, gnupload will place files in ftp.gnu.org, in
324   /incoming/ftp.  Verify that the files uploaded successfully before
325   sending an announcement.
327 * Send announcement to m4-discuss@gnu.org, m4-announce@gnu.org, and
328   autotools-announce@gnu.org.  If not an alpha send to info-gnu@gnu.org
329   as well.  Use gnulib/build-aux/announce-gen to form an initial
330   template for the announcement (you may also need to install the perl
331   module Digest::SHA1).  Contact a list administrator for m4-announce in
332   advance to ensure your post will make it through (the list is normally
333   set to silently discard all posts, even from subscribers).
335 * Update version number in configure.ac to next alpha number.
336   See http://www.gnu.org/software/libtool/contribute.html for details of
337   the numbering scheme.
339 * Update NEWS, README, and ChangeLog to start the intra-release changes,
340   and run `git commit'.  Then run `git push origin refs/tags/v<version>'
341   to push the release tag and complete the release.
343 * For stable releases, update the webpages.
344   Run `build-aux/gnu-web-doc-update', which runs `make web-manual' on a
345   temporary git branch corresponding to the release, then copies the
346   contents of doc/manual into a CVS checkout of the M4 manual
347   repository.  Follow up with any needed edits to m4.html, using:
348     export CVS_RSH=ssh
349     cvs -z3 -d:ext:<user>@cvs.savannah.gnu.org:/web/m4 co m4
351 * Update the Free Software Directory.  Browse to:
352     http://directory.fsf.org/project/m4/
353   and send an email to <bug-directory@gnu.org> mentioning any content
354   that needs to be updated.
356 -----------
357 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
358 Foundation, Inc.
360 The canonical source of this file is maintained with the
361 GNU M4 package.  Report bugs to bug-m4@gnu.org.
363 GNU M4 is free software: you can redistribute it and/or modify
364 it under the terms of the GNU General Public License as published by
365 the Free Software Foundation, either version 3 of the License, or
366 (at your option) any later version.
368 GNU M4 is distributed in the hope that it will be useful,
369 but WITHOUT ANY WARRANTY; without even the implied warranty of
370 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
371 GNU General Public License for more details.
373 You should have received a copy of the GNU General Public License
374 along with this program.  If not, see <http://www.gnu.org/licenses/>.
376 Local Variables:
377 mode: text
378 fill-column: 72
379 End:
380 vim:tw=72