aboutsummaryrefslogtreecommitdiffstats
path: root/admin
diff options
context:
space:
mode:
authorGlenn Morris2013-11-04 23:54:03 -0800
committerGlenn Morris2013-11-04 23:54:03 -0800
commit4dde498bceb259c0ce670a846224da39a118459b (patch)
tree4921ecdf1f78a92095cded1b598acc3ac42b7ffc /admin
parentceb486d4970c9080d2974d6852de9e9eb846d990 (diff)
downloademacs-4dde498bceb259c0ce670a846224da39a118459b.tar.gz
emacs-4dde498bceb259c0ce670a846224da39a118459b.zip
Remove the autogen/ directory
Ref: http://lists.gnu.org/archive/html/emacs-devel/2013-10/msg00806.html * autogen: Remove directory. Move update_autogen to admin/. * autogen.sh: Remove reference to copy_autogen. * GNUmakefile (configure): * Makefile.in (bootstrap): Do not try to run copy_autogen. * config.bat: Use msdos/autogen rather than autogen. * admin/update_autogen: Move here from ../autogen. (usage): Update. Remove -l, add -A. (autogendir): New variable. (ldefs_flag): Default to set. (genfiles): Reduce to only ms-dos relevant files. (main): Make checking autogen sources optional. Make copying of autogen files optional. * msdos/autogen/config.in: * msdos/autogen/Makefile.in: Move here from ../autogen. * nt/INSTALL: Remove reference to copy_autogen. * nt/config.nt: Comment.
Diffstat (limited to 'admin')
-rw-r--r--admin/ChangeLog10
-rwxr-xr-xadmin/update_autogen322
2 files changed, 332 insertions, 0 deletions
diff --git a/admin/ChangeLog b/admin/ChangeLog
index 680792c12b7..b43fdbc4333 100644
--- a/admin/ChangeLog
+++ b/admin/ChangeLog
@@ -1,3 +1,13 @@
12013-11-05 Glenn Morris <rgm@gnu.org>
2
3 * update_autogen: Move here from ../autogen.
4 (usage): Update. Remove -l, add -A.
5 (autogendir): New variable.
6 (ldefs_flag): Default to set.
7 (genfiles): Reduce to only ms-dos relevant files.
8 (main): Make checking autogen sources optional.
9 Make copying of autogen files optional.
10
12013-10-30 Glenn Morris <rgm@gnu.org> 112013-10-30 Glenn Morris <rgm@gnu.org>
2 12
3 * unidata/unidata-gen.el (unidata-gen-files): Use pop. 13 * unidata/unidata-gen.el (unidata-gen-files): Use pop.
diff --git a/admin/update_autogen b/admin/update_autogen
new file mode 100755
index 00000000000..316c9330b62
--- /dev/null
+++ b/admin/update_autogen
@@ -0,0 +1,322 @@
1#!/bin/bash
2### update_autogen - update some auto-generated files in the Emacs tree
3
4## Copyright (C) 2011-2013 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 <http://www.gnu.org/licenses/>.
22
23### Commentary:
24
25## This is a helper script to update some generated files in the Emacs
26## repository. This is suitable for running from cron.
27## Only Emacs maintainers need use this, so it uses bash features.
28##
29## By default, it updates the versioned loaddefs-like files in lisp,
30## except ldefs-boot.el.
31
32### Code:
33
34die () # write error to stderr and exit
35{
36 [ $# -gt 0 ] && echo "$PN: $@" >&2
37 exit 1
38}
39
40PN=${0##*/} # basename of script
41PD=${0%/*}
42
43[ "$PD" = "$0" ] && PD=. # if PATH includes PWD
44
45## This should be the admin directory.
46cd $PD
47cd ../
48[ -d admin ] || die "Could not locate admin directory"
49
50
51usage ()
52{
53 cat 1>&2 <<EOF
54Usage: ${PN} [-f] [-c] [-q] [-A dir] [-L] [-C] [-- make-flags]
55Update some auto-generated files in the Emacs tree.
56By default, only does the versioned loaddefs-like files in lisp/.
57This requires a build. Passes any non-option args to make (eg -- -j2).
58Options:
59-f: force an update even if the source files are locally modified.
60-c: if the update succeeds and the generated files are modified,
61 commit them (caution).
62-q: be quiet; only give error messages, not status messages.
63-A: only update autotools files, copying into specified dir.
64-L: also update ldefs-boot.el.
65-C: start from a clean state. Slower, but more correct.
66EOF
67 exit 1
68}
69
70
71## Defaults.
72
73force=
74commit=
75quiet=
76clean=
77autogendir= # was "autogen"
78ldefs_flag=1
79lboot_flag=
80
81## Parameters.
82ldefs_in=lisp/loaddefs.el
83ldefs_out=lisp/ldefs-boot.el
84sources="configure.ac lib/Makefile.am"
85## Files to copy into autogendir.
86## Everything:
87genfiles="
88 configure aclocal.m4 src/config.in lib/Makefile.in
89 build-aux/compile build-aux/config.guess build-aux/config.sub
90 build-aux/depcomp build-aux/install-sh build-aux/missing
91"
92## msdos-only:
93genfiles="src/config.in lib/Makefile.in"
94
95for g in $genfiles; do
96 basegen="$basegen ${g##*/}"
97done
98
99[ "$basegen" ] || die "internal error"
100
101tempfile=/tmp/$PN.$$
102
103trap "rm -f $tempfile 2> /dev/null" EXIT
104
105
106while getopts ":hcfqA:CL" option ; do
107 case $option in
108 (h) usage ;;
109
110 (c) commit=1 ;;
111
112 (f) force=1 ;;
113
114 (q) quiet=1 ;;
115
116 (A) autogendir=$OPTARG
117 [ -d "$autogendir" ] || die "No autogen directory: $autogendir"
118 ;;
119
120 (C) clean=1 ;;
121
122 (L) lboot_flag=1 ;;
123
124 (\?) die "Bad option -$OPTARG" ;;
125
126 (:) die "Option -$OPTARG requires an argument" ;;
127
128 (*) die "getopts error" ;;
129 esac
130done
131shift $(( --OPTIND ))
132OPTIND=1
133
134
135## Does not work 100% because a lot of Emacs batch output comes on stderr (?).
136[ "$quiet" ] && exec 1> /dev/null
137
138
139echo "Running bzr status..."
140
141bzr status -S ${autogendir:+$sources} ${ldefs_flag:+lisp} >| $tempfile || \
142 die "bzr status error for input files"
143
144## The lisp portion could be more permissive, eg only care about .el files.
145while read stat file; do
146
147 case $stat in
148 M)
149 echo "Locally modified: $file"
150 [ "$force" ] || die "There are local modifications"
151 ;;
152
153 *) die "Unexpected status ($stat) for $file" ;;
154 esac
155done < $tempfile
156
157
158## Probably this is overkill, and there's no need to "bootstrap" just
159## for making autoloads.
160[ "$clean" ] && {
161
162 echo "Running 'make maintainer-clean'..."
163
164 make maintainer-clean #|| die "Cleaning error"
165
166 rm -f $ldefs_in
167}
168
169
170echo "Running autoreconf..."
171
172autoreconf ${clean:+-f} -i -I m4 2>| $tempfile
173
174retval=$?
175
176## Annoyingly, autoreconf puts the "installing `./foo' messages on stderr.
177if [ "$quiet" ]; then
178 grep -v 'installing `\.' $tempfile 1>&2
179else
180 cat "$tempfile" 1>&2
181fi
182
183[ $retval -ne 0 ] && die "autoreconf error"
184
185
186## Uses global $commit.
187commit ()
188{
189 local type=$1
190 shift
191
192 [ $# -gt 0 ] || {
193 echo "No files were modified"
194 return 0
195 }
196
197 echo "Modified file(s): $@"
198
199 [ "$commit" ] || return 0
200
201 echo "Committing..."
202
203 ## bzr status output is always relative to top-level, not PWD.
204 bzr commit -m "Auto-commit of $type files." "$@" || return $?
205
206 echo "Committed files: $@"
207} # function commit
208
209
210[ "$autogendir" ] && {
211
212 oldpwd=$PWD
213
214 cp $genfiles $autogendir/
215
216 cd $autogendir || die "cd error for $autogendir"
217
218 echo "Checking status of generated files..."
219
220 bzr status -S $basegen >| $tempfile || \
221 die "bzr status error for generated files"
222
223 modified=
224
225 while read stat file; do
226
227 [ "$stat" != "M" ] && \
228 die "Unexpected status ($stat) for generated $file"
229
230 modified="$modified $file"
231
232 done < $tempfile
233
234 cd $oldpwd
235
236 commit "generated" $modified || die "bzr commit error"
237
238 exit 0
239} # $autogendir
240
241
242[ "$ldefs_flag" ] || exit 0
243
244
245echo "Finding loaddef targets..."
246
247sed -n -e '/^AUTOGEN_VCS/,/^$/ s/\\//p' lisp/Makefile.in | \
248 sed '/AUTOGEN_VCS/d' >| $tempfile || die "sed error"
249
250genfiles=
251
252while read genfile; do
253
254 [ -r lisp/$genfile ] || die "Unable to read $genfile"
255
256 genfiles="$genfiles $genfile"
257done < $tempfile
258
259
260[ "$genfiles" ] || die "Error setting genfiles"
261
262
263[ -e Makefile ] || {
264 echo "Running ./configure..."
265
266 ## Minimize required packages.
267 ./configure --without-x || die "configure error"
268}
269
270
271## Build the minimum needed to get the autoloads.
272echo "Running lib/ make..."
273
274make -C lib "$@" all || die "make lib error"
275
276
277echo "Running src/ make..."
278
279make -C src "$@" bootstrap-emacs || die "make src error"
280
281
282echo "Running lisp/ make..."
283
284make -C lisp "$@" autoloads EMACS=../src/bootstrap-emacs || die "make src error"
285
286
287## Ignore comment differences.
288[ ! "$lboot_flag" ] || \
289 diff -q -I '^;' $ldefs_in $ldefs_out || \
290 cp $ldefs_in $ldefs_out || die "cp ldefs_boot error"
291
292
293cd lisp
294
295echo "Checking status of loaddef files..."
296
297## It probably would be fine to just check+commit lisp/, since
298## making autoloads should not effect any other files. But better
299## safe than sorry.
300bzr status -S $genfiles ${ldefs_out#lisp/} >| $tempfile || \
301 die "bzr status error for generated files"
302
303
304modified=
305
306while read stat file; do
307
308 [ "$stat" != "M" ] && die "Unexpected status ($stat) for generated $file"
309 modified="$modified $file"
310
311done < $tempfile
312
313
314cd ../
315
316
317commit "loaddefs" $modified || die "bzr commit error"
318
319
320exit 0
321
322### update_autogen ends here