]> code.delx.au - gnu-emacs/blob - build-aux/make-info-dir
Fix shr.el/image build problem
[gnu-emacs] / build-aux / make-info-dir
1 #!/bin/sh
2
3 ### make-info-dir - create info/dir, for systems without install-info
4
5 ## Copyright (C) 2013-2016 Free Software Foundation, Inc.
6
7 ## Author: Glenn Morris <rgm@gnu.org>
8 ## Maintainer: emacs-devel@gnu.org
9
10 ## This file is part of GNU Emacs.
11
12 ## GNU Emacs is free software: you can redistribute it and/or modify
13 ## it under the terms of the GNU General Public License as published by
14 ## the Free Software Foundation, either version 3 of the License, or
15 ## (at your option) any later version.
16
17 ## GNU Emacs is distributed in the hope that it will be useful,
18 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ## GNU General Public License for more details.
21
22 ## You should have received a copy of the GNU General Public License
23 ## along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
24
25 ### Commentary:
26
27 ## Generate info/dir, for systems without install-info.
28 ## Expects to be called from top-level Emacs source directory.
29
30 ## It only handles the case where info/dir is missing from the
31 ## installation directory. It does not handle info/dir being present
32 ## but missing some entries.
33
34 ## Header contains non-printing characters, so this is more
35 ## reliable than using awk.
36 cat <"${1?}" || exit
37 shift
38
39 exec "${AWK-awk}" '
40 function detexinfo() {
41 gsub(/@value{emacsname}/, "Emacs")
42 gsub(/@[^{]*\{/, "")
43 gsub(/}/, "")
44 }
45 BEGIN {
46 ntopics = 0
47 topic[ntopics++] = "Texinfo documentation system"
48 topic[ntopics++] = "Emacs"
49 topic[ntopics++] = "Emacs lisp"
50 topic[ntopics++] = "Emacs editing modes"
51 topic[ntopics++] = "Emacs network features"
52 topic[ntopics++] = "Emacs misc features"
53 topic[ntopics++] = "Emacs lisp libraries"
54 topic[ntopics] = "Unknown category"
55 }
56 /^@dircategory / {
57 sub(/^@dircategory /, "")
58 detexinfo()
59 for (dircat = 0; dircat < ntopics && topic[dircat] != $0; dircat++)
60 continue;
61 }
62 /^@direntry/, /^@end direntry/ {
63 # FIXME do not ignore w32 if OS is w32.
64 if ($0 !~ /^@/ && $0 !~ /w32/) {
65 detexinfo()
66 data[dircat] = data[dircat] $0 "\n"
67 }
68 }
69 END {
70 for (dircat = 0; dircat <= ntopics; dircat++)
71 if (data[dircat])
72 printf "\n%s\n%s", topic[dircat], data[dircat]
73 }
74 ' "${@?}"