aboutsummaryrefslogtreecommitdiffstats
path: root/admin/make-manuals
diff options
context:
space:
mode:
authorGlenn Morris2018-07-05 21:50:18 -0700
committerGlenn Morris2018-07-05 21:50:18 -0700
commit6cfc7a7b1bc3989e6d2cc271222ff7ce4eb23b5e (patch)
tree2e5620f06b5fbb8fcc289e53f5861b783af1a268 /admin/make-manuals
parentb73cde5e2815c531df7f5fd13e214a7d92f78239 (diff)
downloademacs-6cfc7a7b1bc3989e6d2cc271222ff7ce4eb23b5e.tar.gz
emacs-6cfc7a7b1bc3989e6d2cc271222ff7ce4eb23b5e.zip
Automate upload of Emacs manuals to gnu.org
* admin/make-manuals, admin/upload-manuals: New scripts. * admin/admin.el (make-manuals, make-manuals-dist): Handle batch mode. * admin/make-tarball.txt: Update web-page details.
Diffstat (limited to 'admin/make-manuals')
-rwxr-xr-xadmin/make-manuals214
1 files changed, 214 insertions, 0 deletions
diff --git a/admin/make-manuals b/admin/make-manuals
new file mode 100755
index 00000000000..7b9f6a28718
--- /dev/null
+++ b/admin/make-manuals
@@ -0,0 +1,214 @@
1#!/bin/bash
2### make-manuals - create the Emacs manuals to upload to the gnu.org website
3
4## Copyright 2018 Free Software Foundation, Inc.
5
6## Author: Glenn Morris <rgm@gnu.org>
7
8## This file is part of GNU Emacs.
9
10## GNU Emacs is free software: you can redistribute it and/or modify
11## it under the terms of the GNU General Public License as published by
12## the Free Software Foundation, either version 3 of the License, or
13## (at your option) any later version.
14
15## GNU Emacs is distributed in the hope that it will be useful,
16## but WITHOUT ANY WARRANTY; without even the implied warranty of
17## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18## GNU General Public License for more details.
19
20## You should have received a copy of the GNU General Public License
21## along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
22
23### Commentary:
24
25## This is a helper script to create the Emacs manuals as used on the
26## gnu.org website. After this, use upload-manuals to upload them.
27##
28## Usage:
29## Call from the top-level directory of an Emacs source tree.
30## This should normally be a release.
31## The info files should exist.
32
33### Code:
34
35die () # write error to stderr and exit
36{
37 [ $# -gt 0 ] && echo "$PN: $@" >&2
38 exit 1
39}
40
41PN=${0##*/} # basename of script
42
43usage ()
44{
45 cat 1>&2 <<EOF
46Usage: ${PN} [-c] [-e emacs]
47Create the Emacs manuals for the gnu.org website.
48Call this script from the top-level of the Emacs source tree that
49contains the manuals you want to use (normally a release).
50The admin/ directory is required.
51Options:
52-c: do not delete any pre-existing $outdir/ directory
53-e: Emacs executable to use (default $emacs)
54EOF
55 exit 1
56}
57
58
59## Defaults.
60continue=
61emacs=emacs
62
63## Parameters.
64outdir=manual
65gzip="gzip --best --no-name"
66tar="tar --numeric-owner --owner=0 --group=0 --mode=go+u,go-w"
67## Requires GNU tar >= 1.28 so that the tarballs are more reproducible.
68## (Personally I think this is way OOT. I'm not even sure if anyone
69## uses these tarfiles, let alone cares whether they are reproducible.)
70tar --help | grep -- '--sort.*name' >& /dev/null && tar="$tar --sort=name"
71
72while getopts ":hce:" option ; do
73 case $option in
74 (h) usage ;;
75
76 (c) continue=t ;;
77
78 (e) emacs=$OPTARG ;;
79
80 (\?) die "Bad option -$OPTARG" ;;
81
82 (:) die "Option -$OPTARG requires an argument" ;;
83
84 (*) die "getopts error" ;;
85 esac
86done
87shift $(( --OPTIND ))
88OPTIND=1
89
90[ $# -eq 0 ] || usage
91
92
93[ -e admin/admin.el ] || die "admin/admin.el not found"
94
95
96tempfile=/tmp/$PN.$$
97trap "rm -f $tempfile 2> /dev/null" EXIT
98
99
100[ "$continue" ] || rm -rf $outdir
101
102if [ -e $outdir ]; then
103 ## Speed up repeat invocation.
104 echo "Re-using existing $outdir/ directory"
105
106else
107
108 ## This creates the manuals in a manual/ directory.
109 ## Note makeinfo >= 5 is much slower than makeinfo 4.
110 echo "Making manuals (slow)..."
111 $emacs --batch -Q -l admin/admin.el -f make-manuals \
112 >| $tempfile 2>&1 || {
113 cat $tempfile 1>&2
114
115 die "error running make-manuals"
116 }
117fi
118
119find $outdir -name '*~' -exec rm {} +
120
121
122echo "Adding compressed html files..."
123for f in emacs elisp; do
124 $tar -C $outdir/html_node -cf - $f | $gzip \
125 > $outdir/$f.html_node.tar.gz || die "error for $f"
126done
127
128
129echo "Making manual tarfiles..."
130$emacs --batch -Q -l admin/admin.el -f make-manuals-dist \
131 >| $tempfile || {
132
133 cat $tempfile 1>&2
134
135 die "error running make-manuals-dist"
136}
137
138o=$outdir/texi
139mkdir -p $o
140
141for f in $outdir/*.tar; do
142 of=${f##*/}
143 of=${of#emacs-}
144 of=${of%%-[0-9]*}.texi.tar
145 of=${of/lispintro/eintr}
146 of=${of/lispref/elisp}
147 of=${of/manual/emacs}
148 of=$o/$of
149 mv $f $of
150 $gzip $of || die "error compressing $f"
151done
152
153
154echo "Making refcards..."
155make -C etc/refcards dist >| $tempfile 2>&1 || {
156 cat $tempfile 1>&2
157 die "failed make dist"
158}
159
160## This may hang if eg german.sty is missing.
161make -k -C etc/refcards pdf >| $tempfile 2>&1 || {
162 cat $tempfile 1>&2
163 echo "Warning: ignored failure(s) from make pdf"
164}
165
166## Newer Texlive only provide mex (used by pl refcards) for pdf, AFAICS.
167make -k -C etc/refcards ps >| $tempfile 2>&1 || {
168 cat $tempfile 1>&2
169 echo "Warning: ignored failure(s) from make ps"
170}
171
172## Note that in the website, refcards/ is not a subdirectory of manual/.
173refdir=$outdir/refcards
174
175mkdir -p $refdir
176
177mv etc/refcards/emacs-refcards.tar $refdir
178$gzip $refdir/emacs-refcards.tar
179
180for fmt in pdf ps; do
181
182 o=$refdir/$fmt
183
184 mkdir -p $o
185
186 [ $fmt = pdf ] && {
187 cp etc/refcards/*.$fmt $o
188 rm $o/gnus-logo.pdf
189 continue
190 }
191
192 for f in etc/refcards/*.$fmt; do
193 $gzip < $f > $o/${f##*/}.gz
194 done
195done
196
197make -C etc/refcards extraclean > /dev/null
198
199
200echo "Adding compressed info files..."
201
202o=$outdir/info
203mkdir -p $o
204
205for f in eintr.info elisp.info emacs.info; do
206
207 $gzip < info/$f > $o/$f.gz || die "error for $f"
208done
209
210
211echo "Finished OK, you might want to run upload-manuals now"
212
213
214exit 0