]> code.delx.au - gnu-emacs/blob - build-aux/make-info-dir
Stop keeping info/dir in the repository.
[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 Free Software Foundation, Inc.
6
7 ## Author: Glenn Morris <rgm@gnu.org>
8
9 ## This file is part of GNU Emacs.
10
11 ## GNU Emacs is free software: you can redistribute it and/or modify
12 ## it under the terms of the GNU General Public License as published by
13 ## the Free Software Foundation, either version 3 of the License, or
14 ## (at your option) any later version.
15
16 ## GNU Emacs is distributed in the hope that it will be useful,
17 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ## GNU General Public License for more details.
20
21 ## You should have received a copy of the GNU General Public License
22 ## along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
23
24 ### Commentary:
25
26 ## Generate info/dir, for systems without install-info.
27 ## Expects to be called from top-level Emacs source directory.
28
29 ## It only handles the case where info/dir is missing from the
30 ## installation directory. It does not handle info/dir being present
31 ## but missing some entries.
32
33 ### Code:
34
35 if test $# -ne 1; then
36 echo "Specify destination file"
37 exit 1
38 fi
39
40 outfile=$1
41
42 echo "Creating $outfile..."
43
44 if test -f "$outfile"; then
45 echo "$outfile already present"
46 exit 1
47 fi
48
49 ## Header contains non-printing characters, so this is more
50 ## reliable than using echo.
51 basefile=build-aux/dir_top
52
53 if test ! -f "$basefile"; then
54 echo "$basefile not found"
55 exit 1
56 fi
57
58
59 cp $basefile $outfile
60
61
62 ## FIXME inefficient looping.
63 for topic in "Texinfo documentation system" "Emacs" "GNU Emacs Lisp" \
64 "Emacs editing modes" "Emacs network features" "Emacs misc features" \
65 "Emacs lisp libraries"; do
66
67 cat - <<EOF >> $outfile
68
69 $topic
70 EOF
71 for file in info/*.info; do
72
73 ## FIXME do not ignore w32 if OS is w32.
74 case $file in
75 *-xtra.info|*efaq-w32.info) continue ;;
76 esac
77
78 dircat=`sed -n -e 's/^INFO-DIR-SECTION //p' $file`
79
80 ## TODO warn about unknown topics.
81 test "$dircat" = "$topic" || continue
82
83 sed -n -e '/^START-INFO-DIR-ENTRY/,/^END-INFO-DIR-ENTRY/ s/^\([^SE]\)/\1/p' \
84 $file >> $outfile
85
86 done
87 done
88
89 echo "Created $outfile"
90
91 exit 0
92
93 ### make-info-dir ends here