summaryrefslogtreecommitdiff
path: root/HACKING
blob: 26b01c5e673e7ac316bedee31fbcd0e42a75c120 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
============================================================================
= This file

* This file attempts to describe the conventions to use when hacking automake.

* After git checkout from Savannah, can do initial build with, e.g.:
  $ ./bootstrap && ./configure --prefix=/tmp/amdev && make

============================================================================
= Administrivia

* The correct response to most actual bugs is to write a new test case
  which demonstrates the bug.  Then fix the bug, re-run the test suite,
  and check everything in.  Run the test suite in parallel or it takes ages.

* If you incorporate a change from somebody on the net:
  - First, if it is not a tiny change, you must make sure they have
    signed the appropriate paperwork.
  - Second, add their name and email address to THANKS.

* If a change fixes or adds a test, mention the test in the commit
  message.  If a change fixes a bug registered in the Automake debbugs
  tracker, mention the bug number in the commit message, using
  the short url form, like https://bugs.gnu.org/1234.  See section below
  about commit messages.

* If a person or people report a new bug, mention their name(s) in the
  commit message that fixes or exposes the bug, and add a line for them
  in THANKS.

* When documenting a non-trivial idiom or example in the manual, be
  sure to add a test case for it, and to reference such test case from
  a proper Texinfo comment.

* Some files in the automake package are not owned by automake (many by
  gnulib, https://gnu.org/s/gnulib); these files are listed in the
  $(FETCHFILES) variable in Makefile.am.  They should never be edited
  here.  All but one of them can be updated from respective upstreams
  with "make fetch" (this should be done especially before releases).
  The only exceptions are help2man (install the current version) and
  'lib/COPYING' (from FSF), which should be updated by hand whenever the
  GPL gets updated (which shouldn't happen that often anyway :-).

* All changes that are not trivial bug fixes must be mentioned in NEWS.

* Changes which are potentially controversial, require a non-trivial
  plan, or must be implemented gradually with a roadmap spanning several
  releases (either minor or major) should be discussed on the list,
  and have a proper entry in the PLANS directory.  This entry should be
  always committed in the "maint" branch, even if the change it deals
  with is only for the master branch, or a topic branch.  Usually, in
  addition to this, it is useful to open a "wishlist" report on the
  Automake debbugs tracker, to keep the idea more visible, and have the
  discussions surrounding it easily archived in a central place.

===========================================================================
= Setting the development environment

* In development, ./GNUmakefile is used, not (the generated) ./Makefile.
  Run make V=1 to see the commands that are run.

* The required and optional dependencies used by Automake and its test suite
  can be automatically fetched using the GNU Guix package manager with the
  following command:

  $ guix environment automake --ad-hoc \
      gettext help2man texinfo libtool flex bison dejagnu zip icedtea \
      python gcc-toolchain gfortran pkg-config vala

  For other environments, you'll need to install the equivalent.

* To run the bin/automake or bin/aclocal scripts in a checkout, it is
  necessary to set PERL5LIB, as in:
     am=/path/to/automake/checkout
     env PERL5LIB=$am/lib $am/bin/automake --help
     env PERL5LIB=$am/lib $am/bin/aclocal --help

============================================================================
= Naming

* Automake's convention is that internal AC_SUBSTs and make variables
  should be named with a leading 'am__', and internally generated targets
  should be named with a leading 'am--'.  This convention, although in
  place from at least February 2001, isn't yet universally used.
  But all new code should use it.

  We used to use '_am_' as the prefix for an internal AC_SUBSTs.
  However, it turns out that NEWS-OS 4.2R complains if a Makefile
  variable begins with the underscore character.  Yay for them.
  I changed the target naming convention just to be safe.

* If you'd like to read some general background on automake and the
  other GNU autotools, you might try this not-too-long web page (not
  affiliated with GNU):
  https://www.linux.com/news/best-practices-autotools/

============================================================================
= Editing '.am' files

* For variables, always use $(...) and not ${...}.

* Prefer ':' over 'true', mostly for consistency with existing code.

* Use '##' comments liberally.  Comment anything even remotely unusual,
  and even usual things, to help future readers of the code understand.

* Never use basename or dirname.  Instead, use sed.

* Do not use 'cd' within back-quotes, use '$(am__cd)' instead.
  Otherwise the directory name may be printed, depending on CDPATH.
  More generally, do not ever use plain 'cd' together with a relative
  directory that does not start with a dot, or you might end up in one
  computed with CDPATH.

* For install and uninstall rules, if a loop is required, it should be
  silent.  Then the body of the loop itself should print each "important"
  command it runs.  The printed commands should be preceded by a single
  space.

* Ensure install rules do not create any installation directory where
  nothing is to be actually installed.  See automake bug#11030.

============================================================================
= Editing automake.in and aclocal.in

* Indent using GNU style.  For historical reasons, the perl code
  contains portions indented using Larry Wall's style (perl-mode's
  default), and other portions using the GNU style (cperl-mode's
  default).  Write new code using GNU style.

* Don't use & for function calls, unless really required.
  The use of & prevents prototypes from being checked.

============================================================================
= Automake versioning and compatibility scheme

* There are three kinds of automake releases:

    - new major releases (e.g., 2.0, 5.0)
    - new minor releases (e.g., 1.14, 2.1)
    - micro a.k.a. "bug-fixing" releases (e.g., 1.13.2, 2.0.1, 3.5.17).

  A new major release should have the major version number bumped, and
  the minor and micro version numbers reset to zero.  A new minor release
  should have the major version number unchanged, the minor version number
  bumped, and the micro version number reset to zero.  Finally, a new
  micro version should have the major and minor version numbers unchanged,
  and the micro version number bumped by one.

  For example, the first minor version after 1.13.2 will be 1.14; the
  first bug-fixing version after 1.14 that will be 1.14.1; the first
  new major version after all such releases will be 2.0; the first
  bug-fixing version after 2.0 will be 2.0.1; and a further bug-fixing
  version after 2.0.1 will be 2.0.2.

* Micro releases should be just bug-fixing releases; no new features
  should be added, and ideally, only trivial bugs, recent regressions,
  or documentation issues should be addressed by them.  On the other
  hand, it's OK to include testsuite work and even testsuite refactoring
  in a micro version, since a regression there is not going to annoy or
  inconvenience Automake users, but only the Automake developers.

* Minor releases can introduce new "safe" features, do non-trivial but
  mostly safe code clean-ups, and even add new runtime warnings (rigorously
  non-fatal).  But they shouldn't include any backward incompatible change,
  nor contain any potentially destabilizing refactoring or sweeping change,
  nor introduce new features whose implementation might be liable to cause
  bugs or regressions in existing code.  However, it might be acceptable to
  introduce very limited and localized backward-incompatibilities, *only*
  if that is necessary to fix non-trivial bugs, address serious performance
  issues, or greatly enhance usability.  But please, do this sparsely and
  rarely!

* Major releases can introduce backward-incompatibilities (albeit such
  incompatibilities should be announced well in advance, and a smooth
  transition plan prepared for them), and try more risky and daring
  refactorings and code cleanups.  Still, backward incompatibilities are
  extremely undesirable and should be avoided at all costs.

* For more information, refer to the extensive discussion associated
  with automake bug#13578.

============================================================================
= Working with git

* To regenerate dependent files created by aclocal and automake,
  use the 'bootstrap' script.  It uses the code from the source
  tree, so the resulting files (aclocal.m4 and Makefile.in) should
  be the same as you would get if you install this version of
  automake and use it to generate those files.  Be sure to have the
  latest stable version of Autoconf installed and available early
  in your PATH. To get a faithful and correct rebuild, run:
    ./bootstrap && ./config.status --recheck && make clean all
  (per https://bugs.gnu.org/11347)

* The Automake git tree currently carries three basic branches: 'master',
  'next' and 'maint'.

* The 'master' branch is where the development of the next release
  takes place.  It should be kept in a stable, almost-releasable state,
  to simplify testing and deploying of new minor version.  Note that
  this is not a hard rule, and such "stability" is not expected to be
  absolute (emergency releases are cut from the 'maint' branch anyway).

* When planning a release a dedicated branch should be created and after
  the release is done, the release branch is to be merged both into the
  'master' branch and the 'maint' branch.

* Besides merges from release branches, the 'maint' branch can contain
  fixes for regressions, trivial bugs, or documentation issues, that
  will be part of an emergency regression-fixing or security releases.
  As a consequence it should always be kept in a releasable state and no
  "active" development should be done whatsoever.

* The 'next' branch is reserved for the development of the next major
  release.  Experimenting a little is OK here, but don't let the branch
  grow too unstable; if you need to do exploratory programming or
  over-arching change, you should use a dedicated topic branch, and
  only merge that back once it is reasonably stable.

* The 'master' branch should be kept regularly merged into the 'next'
  branch.  It is advisable to merge only after a set of related
  commits have been applied, to avoid introducing too much noise in
  the history.

* There may be a number of longer-lived feature branches for new
  developments.  They should be based off of a common ancestor of all
  active branches to which the feature should or might be merged later.

* When merging, prefer 'git merge --log' over plain 'git merge', so that
  a later 'git log' gives an indication of which actual patches were
  merged even when they don't appear early in the list.

* The 'master', 'maint' and 'next' branches should not be rewound,
  i.e., should always fast-forward, except maybe for privacy issues.
  For feature branches, the announcement for the branch should
  document the rewinding policy.
  If a topic branch is expected to be rewound, it is good practice to put
  it in the 'experimental/*' namespace; for example, a rewindable branch
  dealing with Vala support could be named like "experimental/vala-work".

* If you need to trivially fix a change after a commit, e.g., a typo in
  the NEWS entry, edit the file and then:
    git commit --amend --no-edit NEWS
    git commit --amend --date="$(date -R)" # update date of commit

* If you want to just completely lose your local changes:
    git fetch && git reset --hard origin && git checkout && git submodule update
  (the submodule stuff is for gnulib).

* The preferred way to create a patch to mail around:
    git format-patch --stdout -1 >/tmp/some-patch.diff
  which can then be applied with:
    git am mboxfile

============================================================================
= Writing a good commit message

* Here is the general format that Automake's commit messages are expected
  to follow.  See the further points below for clarifications and minor
  corrections.

      topic: brief description (this is the "summary line")

      <reference to relevant bugs, if any>

      Here goes a more detailed explanation of why the commit is needed,
      and a general overview of what it does, and how.  This section
      should almost always be provided, possibly only with the exception
      of obvious fixes or very trivial changes.

      And if the detailed explanation is quite long or detailed, you can
      want to break it in more paragraphs.

      Then you can add references to relevant mailing list discussions
      (if any), with proper links.  But don't take this as an excuse for
      writing incomplete commit messages!  The "distilled" conclusions
      reached in such discussions should have been placed in the
      paragraphs above.

      Finally, here you can thank people that motivated or helped the
      change.  So, thanks to John Doe for bringing up the issue, and to
      J. Random Hacker for providing suggestions and testing the patch.

      <detailed list of touched files>

* The <detailed list of touched files> should usually be provided (but
  for short or trivial changes), and should follow the GNU guidelines
  for ChangeLog entries (described explicitly in the GNU Coding
  Standards); it might be something of this sort:

    * some/file (func1): Improved frobnication.
    (func2): Adjusted accordingly.
    * another/file (foo, bar): Likewise.
    * t/foo.sh: New test.
    * t/list-of-tests.mk (handwritten_TESTS): Add it.
    * doc/automake.texi (Some Node): Document it.
    * NEWS: mention it.

* If your commit fixes an automake bug registered in the tracker (say
  numbered 1234), you should put the following line after the summary
  line:

      Fixes automake bug https://bugs.gnu.org/1234.

* If your commit is just related to the given bug report, but does not
  fix it, you might want to add a line like this instead:

      Related to automake bug https://bugs.gnu.org/1234.

* When referring to older commits, use 'git describe' output as pointer.
  But also try to identify the given commit by date and/or summary line
  if possible.  Examples:

      Since yesterday's commit, v1.11-2019-g4d2bf42, ...

      ... removed in commit 'v1.11-1674-g02e9072' of 2012-01-01,
      "dist: ditch support for lzma"...

* If the commit is a tiny change that is exempt from copyright paperwork, the
  commit message should contain a separate line after the detailed list of
  touched files like the following:

      Copyright-paperwork-exempt: yes

* Generally write the commit message in present tense.

============================================================================
= Test suite

* See file 't/README' for more information.

* Use "make check" and "make maintainer-check" liberally.  It is often
  useful to set VERBOSE=1 for more reporting on what is being done.

* Export the 'keep_testdirs' environment variable to "yes" to keep
  *.dir test directories for successful tests also.

* Use Perl coverage information to ensure your new code is thoroughly
  tested by your new tests.

* To run the tests, you should install expect, shar, language compilers,
  gettext macros.  Anything you don't install won't be tested.  The test
  suite will report on tests skipped due to software not available.

* Run the test suite in parallel (e.g., "make -j12 check"), both so it
  doesn't take forever and because that is what most users will do.  You
  can also parallelize the makes that run inside each test with, e.g.:
    make check AM_TESTSUITE_MAKE="make -j$(( 1*$(nproc) + 1 ))"
  If you like, try different levels of parallelization to see what
  runs the fastest on your machine.  We'll use -j12 in this document.

* To summarize, here is a typical make check invocation:
    make -j12 VERBOSE=1 check keep_testdirs=yes

* Then check t/test-suite.log for the overall results.  The directory
  t/TESTNAME.dir is where the work will be left, if the test fails.

* You can run a single test, with, e.g.,
    make check TESTS='t/aclocal-acdir.sh'

  where t/aclocal-acdir.sh can be any t/*.sh test, including a new one
  you are writing.  You may want to add --no-print-dir to silence GNU
  make about the many cd commands, and/or env VERBOSE=1 to get more
  information about what make is running.

* Sometimes you may want to see when each test starts running, and not
  just when they complete.  This can be done by setting TESTS_ENVIRONMENT,
  as in:
    make -j12 VERBOSE=1 TESTS_ENVIRONMENT='echo RUNNING: "$$f";' check

* Run "make maintainer-check" before commit.  Watch out for trailing spaces.
  It may be useful to run it more verbose:
    make AM_V_GEN= VERBOSE=1 maintainer-check

* After "make -j12 check" succeeds. run "make -j12 distcheck" before
  pushing a commit, since that exercises yet more of the code.

* To un-silence (some) of what make does, use make V=1.
  For yet more verbosity, make VERBOSE=1.

* To set up a new test, first write the test file in t/good-name.sh.
  Choose a name that fits with existing ones, as best you can devise.

  - You'll likely want to copy material from an existing test, which is
  fine and good; depending on how much is copied, it may be useful to
  mention the other test(s) you used.

  - Nevertheless, start the copyright year list in the new file fresh,
  with the current year.

  - You can run the new test on its own with
    make check TESTS='t/good-name.sh'

  - During development of a new test, it can be useful to end it with
    "exit 33" (or whatever random value) to force it to fail even when it
    would otherwise succeed, so you can inspect the test directory to be
    sure things worked as expected.

  - At some point before releasing, add the test to the appropriate
  variable in t/list-of-tests.mk, most likely the (alphabetical)
  handwritten_TESTS.

============================================================================
= Bug tracker

* Automake uses the debbugs instance at https://bugs.gnu.org.  Email
  from the tracker is sent to bug-automake@gnu.org, and vice versa.
  (https://gnu.org/s/automake for all the mailing lists; you should subscribe.)

* To see all open bugs (and recently closed ones):
    https://debbugs.gnu.org/cgi/pkgreport.cgi?pkg=automake

* For a full search form, initialized to show bugs tagged confirmed:
    https://debbugs.gnu.org/cgi/pkgreport.cgi?package=automake;include=tags%3Aconfirmed

* We use the "confirmed" tag to mean bugs that have been reviewed, are
  evidently valid, but no one is currently working or plans to work on
  them.  Thus they are good candidates for new volunteers to get involved.

* To download the so-called maintainer mbox for a bug, say 12345:
    https://debbugs.gnu.org/cgi/bugreport.cgi?bug=12345;mbox=yes;mboxmaint=yes
  Only the maintainer mbox consistently has the bug# prefix on Subject:
  lines, so it is generally the most usable.

* To close a bug, you can mail (or bcc) to 12345-done@debbugs.gnu.org.
  It's best to do this with a note saying that the bug is being closed
  because the fix was pushed, or whatever the reason.

* To add tags "help" and "confirmed" to bug 12345, mail to
  control@debbugs.gnu.org with a one-line body:
    tags 12345 + help confirmed

* In general, all bug operations are done by mail.  Reference information:
    https://debbugs.gnu.org/server-control.html # dev info

============================================================================
= Release procedure

* The steps outlined here are meant to be followed for alpha and stable
  releases as well.  Where differences are expected, they will be
  explicitly described.

* Fetch new versions of the files that are maintained by the FSF by
  running "make fetch".  help2man has to be updated separately.  In case
  any file in the automake repository has been updated, commit and
  re-run the testsuite.

* Ensure that the copyright notices of the distributed files are up to
  date.  The maintainer-only target "update-copyright" can help with this.

* Check NEWS; in particular, ensure that all the relevant differences
  with the last release are actually reported.

* Update the version number in configure.ac.
  (The idea is that every other alpha number will be a net release.
  The repository will always have its own "odd" number so we can easily
  distinguish net and repo versions.)

* Run these commands, in this order (as mentioned, adjust -j as desired):
    make bootstrap
    make -j12 check keep_testdirs=yes
    make maintainer-check
    make -j12 distcheck                                # regular distcheck
    make -j12 distcheck AM_TESTSUITE_MAKE="make -j$j"  # parallelize makes
    make -j12 check-no-trailing-backslash-in-recipes
    make -j12 check-cc-no-c-o

  It is also advised to run "git clean -fdx" before invoking the
  bootstrap, to ensure a really clean rebuild.  However, it must
  be done carefully, because that command will remove *all* the
  files that are not tracked by git!

* Run "make git-tag-release".
  This will run the maintainer checks, verify that the local git
  repository and working tree are clean and up-to-date, and create
  a proper signed git tag for the release (based on the contents
  of $(VERSION)).

* Run "make git-upload-release".
  This will first verify that you are releasing from a tagged version
  and that the local git repository and working tree are clean and
  up-to-date, and will then run "make dist" to create the tarballs,
  and invoke the 'gnupload' script sign and upload them to the correct
  locations.  In case you need to sign with a non-default key, you can
  use "make GNUPLOADFLAGS='--user KEY' git-upload-release".

* For stable releases you'll have to update the manuals at www.gnu.org.

  - Generate manuals (with the help of the standard gendocs.sh script):
       make web-manual

    The ready-to-be-uploaded manuals (in several formats) will be left
    in the 'doc/web-manuals' directory.

  - Commit the updated manuals to web CVS:
      make web-manual-update

    If your local username is different from your username at Savannah,
    you'll have to override the 'CVS_USER' make variable accordingly;
    for example:
      make web-manual-update CVS_USER=slattarini

  - Check for link errors, fix them, recheck until convergence:
    <http://validator.w3.org/checklink>

* Create an announcement message with "make announcement".  Edit the
  generated 'announcement' file appropriately, in particularly filling
  in by hand any "TODO" left in there.

* Update version number in configure.ac to next alpha number.
  Re-run ./bootstrap and commit.

* Don't forget to "git push" your changes so they appear in the public
  git tree.

* Send the announcement generated in the earlier steps at least to
  <autotools-announce@gnu.org> and <automake@gnu.org>.  If the release
  is a stable one, the announcement must also go to <info-gnu@gnu.org>;
  if it is an alpha or beta release, announcement should be sent also
  to <platform-testers@gnu.org>, to maximize the possibility of early
  testing on exotic or proprietary systems.  Finally, copy an abridged
  version of the announcement into the NEWS feed at:
  <https://savannah.gnu.org/projects/automake>.
  Be sure to link a  version to the complete announcement (from
  the version you sent to the automake list, as get archived on
  <https://lists.gnu.org/archive/html/automake/>).

---------
Copyright (C) 2003-2023 Free Software Foundation, Inc.

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.

Local Variables:
mode: text
End: