Implement dots and dashes on PGTK
[emacs.git] / admin / make-manuals
blob477daa09a4c35bb3a20d02ea24f03c460b038c75
1 #!/bin/bash
2 ### make-manuals - create the Emacs manuals to upload to the gnu.org website
4 ## Copyright 2018-2024 Free Software Foundation, Inc.
6 ## Author: Glenn Morris <rgm@gnu.org>
7 ## Maintainer: emacs-devel@gnu.org
9 ## This file is part of GNU Emacs.
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.
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.
21 ## You should have received a copy of the GNU General Public License
22 ## along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
24 ### Commentary:
26 ## This is a helper script to create the Emacs manuals as used on the
27 ## gnu.org website. After this, use upload-manuals to upload them.
29 ## Usage:
30 ## Call from the top-level directory of an Emacs source tree.
31 ## This should normally be a release.
32 ## The info files should exist.
34 ### Code:
36 source "${0%/*}/emacs-shell-lib"
38 usage ()
40 cat 1>&2 <<EOF
41 Usage: ${PN} [-c] [-e emacs]
42 Create the Emacs manuals for the gnu.org website.
43 Call this script from the top-level of the Emacs source tree that
44 contains the manuals you want to use (normally a release).
45 The admin/ directory is required.
46 Options:
47 -c: do not delete any pre-existing $outdir/ directory
48 -e: Emacs executable to use (default $emacs)
49 EOF
50 exit 1
54 ## Defaults.
55 continue=
56 emacs=emacs
58 ## Parameters.
59 outdir=manual
60 gzip="gzip --best --no-name"
61 tar="tar --numeric-owner --owner=0 --group=0 --mode=go+u,go-w"
62 ## Requires GNU tar >= 1.28 so that the tarballs are more reproducible.
63 ## (Personally I think this is way OOT. I'm not even sure if anyone
64 ## uses these tarfiles, let alone cares whether they are reproducible.)
65 tar --help | grep -- '--sort.*name' >& /dev/null && tar="$tar --sort=name"
67 while getopts ":hce:" option ; do
68 case $option in
69 (h) usage ;;
71 (c) continue=t ;;
73 (e) emacs=$OPTARG ;;
75 (\?) die "Bad option -$OPTARG" ;;
77 (:) die "Option -$OPTARG requires an argument" ;;
79 (*) die "getopts error" ;;
80 esac
81 done
82 shift $(( --OPTIND ))
83 OPTIND=1
85 [ $# -eq 0 ] || usage
88 [ -e admin/admin.el ] || die "admin/admin.el not found"
91 tempfile="$(emacs_mktemp)"
94 [ "$continue" ] || rm -rf $outdir
96 if [ -e $outdir ]; then
97 ## Speed up repeat invocation.
98 echo "Re-using existing $outdir/ directory"
100 else
102 ## This creates the manuals in a manual/ directory.
103 ## Note makeinfo >= 5 is much slower than makeinfo 4.
104 echo "Making manuals (slow)..."
105 $emacs --batch -Q -l admin/admin.el -f make-manuals \
106 >| $tempfile 2>&1 || {
107 cat $tempfile 1>&2
109 die "error running make-manuals"
113 find $outdir -name '*~' -exec rm {} +
116 echo "Adding compressed html files..."
117 for f in emacs elisp; do
118 $tar -C $outdir/html_node -cf - $f | $gzip \
119 > $outdir/$f.html_node.tar.gz || die "error for $f"
120 done
123 echo "Making manual tarfiles..."
124 $emacs --batch -Q -l admin/admin.el -f make-manuals-dist \
125 >| $tempfile || {
127 cat $tempfile 1>&2
129 die "error running make-manuals-dist"
132 o=$outdir/texi
133 mkdir -p $o
135 for f in $outdir/*.tar; do
136 of=${f##*/}
137 of=${of#emacs-}
138 of=${of%%-[0-9]*}.texi.tar
139 of=${of/lispintro/eintr}
140 of=${of/lispref/elisp}
141 of=${of/manual/emacs}
142 of=$o/$of
143 mv $f $of
144 $gzip $of || die "error compressing $f"
145 done
148 echo "Making refcards..."
149 make -C etc/refcards dist >| $tempfile 2>&1 || {
150 cat $tempfile 1>&2
151 die "failed make dist"
154 ## This may hang if eg german.sty is missing.
155 make -k -C etc/refcards pdf >| $tempfile 2>&1 || {
156 cat $tempfile 1>&2
157 echo "Warning: ignored failure(s) from make pdf"
160 ## Newer Texlive only provide mex (used by pl refcards) for pdf, AFAICS.
161 make -k -C etc/refcards ps >| $tempfile 2>&1 || {
162 cat $tempfile 1>&2
163 echo "Warning: ignored failure(s) from make ps"
166 ## Note that in the website, refcards/ is not a subdirectory of manual/.
167 refdir=$outdir/refcards
169 mkdir -p $refdir
171 mv etc/refcards/emacs-refcards.tar $refdir
172 $gzip $refdir/emacs-refcards.tar
174 for fmt in pdf ps; do
176 o=$refdir/$fmt
178 mkdir -p $o
180 [ $fmt = pdf ] && {
181 cp etc/refcards/*.$fmt $o
182 rm $o/gnus-logo.pdf
183 continue
186 for f in etc/refcards/*.$fmt; do
187 $gzip < $f > $o/${f##*/}.gz
188 done
189 done
191 make -C etc/refcards extraclean > /dev/null
194 echo "Adding compressed info files..."
196 o=$outdir/info
197 mkdir -p $o
199 for f in eintr.info elisp.info emacs.info; do
201 $gzip < info/$f > $o/$f.gz || die "error for $f"
202 done
205 echo "Finished OK, you might want to run upload-manuals now"
208 exit 0