* README: Remove some unnecessary detail.
[emacs.git] / build-aux / make-info-dir
blob3f927382ded1913bf281d1a64ff8ba6f630cfc14
1 #!/bin/sh
3 ### make-info-dir - create info/dir, for systems without install-info
5 ## Copyright (C) 2013-2014 Free Software Foundation, Inc.
7 ## Author: Glenn Morris <rgm@gnu.org>
8 ## Maintainer: emacs-devel@gnu.org
10 ## This file is part of GNU Emacs.
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.
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.
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/>.
25 ### Commentary:
27 ## Generate info/dir, for systems without install-info.
28 ## Expects to be called from top-level Emacs source directory.
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.
34 ### Code:
36 if test $# -ne 1; then
37 echo "Specify destination file"
38 exit 1
41 outfile=$1
43 echo "Creating $outfile..."
45 if test -f "$outfile"; then
46 echo "$outfile already present"
47 exit 1
50 ## Header contains non-printing characters, so this is more
51 ## reliable than using echo.
52 basefile=build-aux/dir_top
54 if test ! -f "$basefile"; then
55 echo "$basefile not found"
56 exit 1
60 cp $basefile $outfile
63 ## FIXME inefficient looping.
64 ## What we should do is loop once over files, collecting topic and
65 ## direntry information for each. Then loop over topics and write
66 ## out the results. But that seems to require associative arrays,
67 ## and I do not know how to do that with portable sh.
68 ## Could use Emacs instead of sh, but till now info generation does
69 ## not require Emacs to have been built.
70 for topic in "Texinfo documentation system" "Emacs" "Emacs lisp" \
71 "Emacs editing modes" "Emacs network features" "Emacs misc features" \
72 "Emacs lisp libraries"; do
74 cat - <<EOF >> $outfile
76 $topic
77 EOF
78 ## Bit faster than doc/*/*.texi.
79 for file in doc/emacs/emacs.texi doc/lispintro/emacs-lisp-intro.texi \
80 doc/lispref/elisp.texi doc/misc/*.texi; do
82 ## FIXME do not ignore w32 if OS is w32.
83 case $file in
84 *-xtra.texi|*efaq-w32.texi|*doclicense.texi) continue ;;
85 esac
87 dircat=`sed -n -e 's/@value{emacsname}/Emacs/' -e 's/^@dircategory //p' $file`
89 ## TODO warn about unknown topics.
90 ## (check-info in top-level Makefile does that.)
91 test "$dircat" = "$topic" || continue
94 sed -n -e 's/@value{emacsname}/Emacs/' \
95 -e 's/@acronym{\([A-Z]*\)}/\1/' \
96 -e '/^@direntry/,/^@end direntry/ s/^\([^@]\)/\1/p' \
97 $file >> $outfile
99 done
100 done
102 echo "Created $outfile"
104 exit 0
106 ### make-info-dir ends here