Mercurial > emacs
annotate admin/quick-install-emacs @ 104764:79d04de96b13
("ipa"): Set `forget-last-selection' to nil.
("ipa-x-sampa"): Set `forget-last-selection' to nil.
Set `deterministic' to nil.
("ipa"): Bind "g" to U+0261, and "tsh" to a list of "U+02A7",
"U+0074 U+0283", "U+0074 U+2040 U+0283".
("ipa-kirshenbaum", ipa-x-sampa"): Bind "g" to U+0261, and "tS"
to a list of "U+02A7", "U+0074 U+0283", "U+0074 U+2040 U+0283".
Fix comments.
author | Juri Linkov <juri@jurta.org> |
---|---|
date | Mon, 31 Aug 2009 18:11:35 +0000 |
parents | f4ab9c8bed3f |
children | 1d1d5d9bd884 |
rev | line source |
---|---|
39041 | 1 #!/bin/sh |
75454 | 2 ### quick-install-emacs --- do a halfway-decent job of installing emacs quickly |
3 | |
100971 | 4 ## Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 |
75454 | 5 ## Free Software Foundation, Inc. |
6 | |
7 ## Author: Miles Bader <miles@gnu.org> | |
8 | |
9 ## This file is part of GNU Emacs. | |
10 | |
94833
e6db9ee945b8
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
79744
diff
changeset
|
11 ## GNU Emacs is free software: you can redistribute it and/or modify |
75454 | 12 ## it under the terms of the GNU General Public License as published by |
94833
e6db9ee945b8
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
79744
diff
changeset
|
13 ## the Free Software Foundation, either version 3 of the License, or |
e6db9ee945b8
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
79744
diff
changeset
|
14 ## (at your option) any later version. |
39041 | 15 |
75454 | 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 | |
94833
e6db9ee945b8
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
79744
diff
changeset
|
22 ## along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
e6db9ee945b8
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
79744
diff
changeset
|
23 |
75454 | 24 |
25 ### Commentary: | |
26 | |
27 ## This script is mainly intended for emacs maintainer or pretesters who | |
28 ## install emacs very often. See the --help output for more details. | |
29 | |
39041 | 30 |
31 PUBLIC_LIBSRC_BINARIES='b2m emacsclient etags ctags ebrowse' | |
32 PUBLIC_LIBSRC_SCRIPTS='grep-changelog rcs-checkin' | |
33 | |
52634
bb955cc088f9
Revision: miles@gnu.org--gnu-2003/emacs--cvs-trunk--0--patch-62
Miles Bader <miles@gnu.org>
parents:
52506
diff
changeset
|
34 AVOID="CVS -DIC README COPYING ChangeLog ~ [.]orig$ [.]rej$ Makefile makefile stamp-subdir [.]cvsignore [.]arch-ids [{]arch[}] [.][cho]$ make-docfile testfile test-distrib" |
39041 | 35 |
36 # Prune old binaries lying around in the source tree | |
37 PRUNE=no | |
38 # Re-install files even if they already exist | |
39 FORCE=no | |
40 # Command verbose flag | |
41 VERBOSE='' | |
42 | |
43 me="`basename $0`" | |
44 | |
60340
f6384702a1b6
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-146
Miles Bader <miles@gnu.org>
parents:
52708
diff
changeset
|
45 # Install commands (if the user specifies the `--verbose' option, it is |
f6384702a1b6
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-146
Miles Bader <miles@gnu.org>
parents:
52708
diff
changeset
|
46 # passed to these commands, so that feature only works if these commands |
f6384702a1b6
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-146
Miles Bader <miles@gnu.org>
parents:
52708
diff
changeset
|
47 # implement it too) |
39041 | 48 LINK='cp -lf' |
49 COPY='cp -f' | |
50 REMOVE='rm -r' | |
60340
f6384702a1b6
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-146
Miles Bader <miles@gnu.org>
parents:
52708
diff
changeset
|
51 MKDIR='mkdir -p' |
39041 | 52 |
53 # Used to execute commands once once we create them | |
54 EXEC='sh' | |
55 | |
56 NAWK=/usr/bin/nawk | |
57 | |
49088
a22f8991ae27
Unset LANG etc. to avoid non-standard command output from non-C locales.
Miles Bader <miles@gnu.org>
parents:
45539
diff
changeset
|
58 # avoid non-standard command output from non-C locales |
a22f8991ae27
Unset LANG etc. to avoid non-standard command output from non-C locales.
Miles Bader <miles@gnu.org>
parents:
45539
diff
changeset
|
59 unset LANG LC_ALL LC_MESSAGES |
a22f8991ae27
Unset LANG etc. to avoid non-standard command output from non-C locales.
Miles Bader <miles@gnu.org>
parents:
45539
diff
changeset
|
60 |
39041 | 61 # Some messages |
62 USAGE="Usage: $me [OPTION...] BUILD_TREE [PREFIX]" | |
63 TRY="Try "\`"$me --help' for more information." | |
64 | |
65 # Parse command-line options | |
66 while :; do | |
67 case "$1" in | |
68 -n|--dry-run) | |
69 EXEC=cat; shift;; | |
70 -p|--prune) | |
71 PRUNE=yes; shift;; | |
72 -P|--no-prune) | |
73 PRUNE=no; shift;; | |
74 --prune-only) | |
75 PRUNE=only; shift;; | |
76 -f|--force) | |
77 FORCE=yes; shift;; | |
78 -v|--verbose) | |
79 VERBOSE="-v"; shift;; | |
80 --help) | |
81 cat <<EOF | |
82 $USAGE | |
83 Install emacs quickly | |
84 | |
85 -n, --dry-run print installation commands instead of | |
86 executing them | |
87 | |
88 -f, --force install even files that haven't changed | |
89 -v, --verbose print messages describing what is done | |
90 | |
91 -p, --prune prune old generated files | |
92 -P, --no-prune don't prune old generated files (default) | |
93 --prune-only prune old generated files, but don't install | |
94 | |
95 --help display this help and exit | |
96 --version output version information and exit | |
97 | |
98 $me install emacs \`incrementally,' that is, it will | |
99 install only those files that have changed since the last time it was | |
100 invoked, and remove any obsolete files from the installation | |
101 directories. It also uses hard-links into the source and build trees to | |
102 do the install, so it uses much less space than the default Makefile | |
103 install target; however, this also means that $me can | |
104 not install onto a disk partition other than the one on which the source | |
105 and build directories reside. | |
106 | |
107 Optionally, $me can also remove old versions of | |
108 automatically generated files that are version-specific (such as the | |
109 versioned emacs executables in the \`src' directory, and the DOC-* files | |
110 in the \`etc' directory). The latter action is called \`pruning,' and | |
111 can be enabled using the \`-p' or \`--prune' options. | |
112 EOF | |
113 exit 0 | |
114 ;; | |
115 --version) | |
116 cat <<EOF | |
49089 | 117 $me 1.6 |
39041 | 118 |
119 Written by Miles Bader <miles@gnu.org> | |
120 EOF | |
121 exit 0 | |
122 ;; | |
123 -[^-]?*) | |
124 # split concatenated single-letter options apart | |
125 FIRST="$1"; shift | |
126 set -- `echo $FIRST | sed 's/-\(.\)\(.*\)/-\1 -\2/'` "$@" | |
127 ;; | |
128 -*) | |
129 echo 1>&2 "$me: unrecognized option "\`"$1'" | |
130 echo 1>&2 "$TRY" | |
131 exit 1 | |
132 ;; | |
133 *) | |
134 break; | |
135 esac | |
136 done | |
137 | |
138 LINK_CMD="$LINK $VERBOSE" | |
139 REMOVE_CMD="$REMOVE $VERBOSE" | |
140 | |
141 case $# in | |
142 1) BUILD="$1";; | |
143 2) BUILD="$1"; prefix="$2";; | |
144 *) | |
145 echo 1>&2 "$USAGE" | |
146 echo 1>&2 "$TRY" | |
147 exit 1 | |
148 ;; | |
149 esac | |
150 | |
151 if test ! -d "$BUILD"; then | |
152 echo 1>&2 "$me: $BUILD: Build tree not found" | |
153 exit 2 | |
154 elif test ! -r "$BUILD/config.status"; then | |
155 echo 1>&2 "$me: $BUILD: Not a proper build tree, config.status not found" | |
156 exit 2 | |
157 fi | |
158 | |
159 CONFIG_STATUS="$BUILD/config.status" | |
52708
8f70aecafdb5
Revision: miles@gnu.org--gnu-2003/emacs--cvs-trunk--0--patch-68
Miles Bader <miles@gnu.org>
parents:
52634
diff
changeset
|
160 get_config_var () |
8f70aecafdb5
Revision: miles@gnu.org--gnu-2003/emacs--cvs-trunk--0--patch-68
Miles Bader <miles@gnu.org>
parents:
52634
diff
changeset
|
161 { |
103030
f4ab9c8bed3f
admin/quick-install-emacs: Update get_config_var for autoconf 2.62
Miles Bader <miles@gnu.org>
parents:
102491
diff
changeset
|
162 { sed -n "s/^S[[]\"$1\"[]]=\"\([^\"]*\)\"/\1/p" $CONFIG_STATUS | sed q | grep ''; } || |
f4ab9c8bed3f
admin/quick-install-emacs: Update get_config_var for autoconf 2.62
Miles Bader <miles@gnu.org>
parents:
102491
diff
changeset
|
163 { sed -n "s/^s\(.\)@$1@\1\(|#_!!_#|\)*\(.*\)\1.*$/\3/p" $CONFIG_STATUS | sed q | grep ''; } || |
f4ab9c8bed3f
admin/quick-install-emacs: Update get_config_var for autoconf 2.62
Miles Bader <miles@gnu.org>
parents:
102491
diff
changeset
|
164 { |
39041 | 165 echo 1>&2 "$me: $1: Configuration variable not found in $CONFIG_STATUS" |
166 exit 4 | |
103030
f4ab9c8bed3f
admin/quick-install-emacs: Update get_config_var for autoconf 2.62
Miles Bader <miles@gnu.org>
parents:
102491
diff
changeset
|
167 } |
39041 | 168 } |
169 | |
40064
90451d9e7e0e
Exit if we can't find some variable.
Miles Bader <miles@gnu.org>
parents:
39041
diff
changeset
|
170 test x"$SRC" = x && { SRC="`get_config_var srcdir`" || exit 4 ; } |
90451d9e7e0e
Exit if we can't find some variable.
Miles Bader <miles@gnu.org>
parents:
39041
diff
changeset
|
171 test x"$prefix" = x && { prefix="`get_config_var prefix`" || exit 4 ; } |
90451d9e7e0e
Exit if we can't find some variable.
Miles Bader <miles@gnu.org>
parents:
39041
diff
changeset
|
172 test x"$ARCH" = x && { ARCH="`get_config_var host`" || exit 4 ; } |
39041 | 173 |
45539
99b2cc9b795c
(VERSION): Calculate using the same method that configure.in uses.
Miles Bader <miles@gnu.org>
parents:
44112
diff
changeset
|
174 VERSION=`grep 'defconst[ ]*emacs-version' $SRC/lisp/version.el \ |
99b2cc9b795c
(VERSION): Calculate using the same method that configure.in uses.
Miles Bader <miles@gnu.org>
parents:
44112
diff
changeset
|
175 | sed -e 's/^[^"]*"\([^"]*\)".*$/\1/'` |
99b2cc9b795c
(VERSION): Calculate using the same method that configure.in uses.
Miles Bader <miles@gnu.org>
parents:
44112
diff
changeset
|
176 |
39041 | 177 DST_SHARE="$prefix/share/emacs/$VERSION" |
178 DST_BIN="$prefix/bin" | |
179 DST_LIBEXEC="$prefix/libexec/emacs/$VERSION/$ARCH" | |
102491
467e43a5edd5
quick-install-emacs: Be more clever about locating info directory
Miles Bader <miles@gnu.org>
parents:
100971
diff
changeset
|
180 |
467e43a5edd5
quick-install-emacs: Be more clever about locating info directory
Miles Bader <miles@gnu.org>
parents:
100971
diff
changeset
|
181 # There are various common places for the info dir to be, so try to |
467e43a5edd5
quick-install-emacs: Be more clever about locating info directory
Miles Bader <miles@gnu.org>
parents:
100971
diff
changeset
|
182 # use whatever's already there, defaulting to (and preferring) |
467e43a5edd5
quick-install-emacs: Be more clever about locating info directory
Miles Bader <miles@gnu.org>
parents:
100971
diff
changeset
|
183 # .../share/info. |
467e43a5edd5
quick-install-emacs: Be more clever about locating info directory
Miles Bader <miles@gnu.org>
parents:
100971
diff
changeset
|
184 # |
467e43a5edd5
quick-install-emacs: Be more clever about locating info directory
Miles Bader <miles@gnu.org>
parents:
100971
diff
changeset
|
185 DST_INFO='' |
467e43a5edd5
quick-install-emacs: Be more clever about locating info directory
Miles Bader <miles@gnu.org>
parents:
100971
diff
changeset
|
186 for D in "$prefix/share/info" "$prefix/info"; do |
467e43a5edd5
quick-install-emacs: Be more clever about locating info directory
Miles Bader <miles@gnu.org>
parents:
100971
diff
changeset
|
187 if test -d "$D"; then |
467e43a5edd5
quick-install-emacs: Be more clever about locating info directory
Miles Bader <miles@gnu.org>
parents:
100971
diff
changeset
|
188 DST_INFO="$D" |
467e43a5edd5
quick-install-emacs: Be more clever about locating info directory
Miles Bader <miles@gnu.org>
parents:
100971
diff
changeset
|
189 break |
467e43a5edd5
quick-install-emacs: Be more clever about locating info directory
Miles Bader <miles@gnu.org>
parents:
100971
diff
changeset
|
190 fi |
467e43a5edd5
quick-install-emacs: Be more clever about locating info directory
Miles Bader <miles@gnu.org>
parents:
100971
diff
changeset
|
191 done |
467e43a5edd5
quick-install-emacs: Be more clever about locating info directory
Miles Bader <miles@gnu.org>
parents:
100971
diff
changeset
|
192 DST_INFO=${DST_INFO:-"$prefix/share/info"} |
39041 | 193 |
52708
8f70aecafdb5
Revision: miles@gnu.org--gnu-2003/emacs--cvs-trunk--0--patch-68
Miles Bader <miles@gnu.org>
parents:
52634
diff
changeset
|
194 maybe_mkdir () |
8f70aecafdb5
Revision: miles@gnu.org--gnu-2003/emacs--cvs-trunk--0--patch-68
Miles Bader <miles@gnu.org>
parents:
52634
diff
changeset
|
195 { |
39041 | 196 if ! test -d "$1"; then |
60340
f6384702a1b6
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-146
Miles Bader <miles@gnu.org>
parents:
52708
diff
changeset
|
197 $MKDIR $VERBOSE "$1" 2>&1 | sed "s/^mkdir:/$me:/" 1>&2 |
39041 | 198 fi |
199 } | |
200 | |
201 maybe_mkdir "$DST_BIN" | |
202 maybe_mkdir "$DST_SHARE" | |
203 maybe_mkdir "$DST_SHARE/site-lisp" | |
204 maybe_mkdir "$DST_LIBEXEC" | |
205 maybe_mkdir "$DST_INFO" | |
206 | |
207 ( # start of command-generating sub-shell | |
208 | |
209 PRUNED="" | |
210 if test x"$PRUNE" != xno; then | |
44112
271a4f9d12fc
(PRUNED): Avoid "head -1" and "tail +2", as POSIX 1003.1-2001
Paul Eggert <eggert@twinsun.com>
parents:
40064
diff
changeset
|
211 for D in `ls -1t $BUILD/etc/DOC-* | sed 1d`; do |
39041 | 212 echo $REMOVE_CMD $D |
213 PRUNED="$PRUNED $D" | |
214 done | |
44112
271a4f9d12fc
(PRUNED): Avoid "head -1" and "tail +2", as POSIX 1003.1-2001
Paul Eggert <eggert@twinsun.com>
parents:
40064
diff
changeset
|
215 for D in `ls -1t $BUILD/src/emacs-$VERSION.* | sed 1d`; do |
39041 | 216 echo $REMOVE_CMD $D |
217 PRUNED="$PRUNED $D" | |
218 done | |
219 fi | |
220 | |
221 test x"$PRUNE" = xonly && exit 0 | |
222 | |
52708
8f70aecafdb5
Revision: miles@gnu.org--gnu-2003/emacs--cvs-trunk--0--patch-68
Miles Bader <miles@gnu.org>
parents:
52634
diff
changeset
|
223 maybe_emit_copy () |
8f70aecafdb5
Revision: miles@gnu.org--gnu-2003/emacs--cvs-trunk--0--patch-68
Miles Bader <miles@gnu.org>
parents:
52634
diff
changeset
|
224 { |
39041 | 225 if test "$FORCE" = yes || ! cmp -s $1 $2; then |
226 echo $LINK_CMD $1 $2 | |
227 fi | |
228 } | |
229 | |
230 maybe_emit_copy $BUILD/src/emacs $DST_BIN/emacs | |
231 maybe_emit_copy $BUILD/src/emacs $DST_BIN/emacs-$VERSION | |
232 | |
233 for F in $PUBLIC_LIBSRC_BINARIES; do | |
234 maybe_emit_copy $BUILD/lib-src/$F $DST_BIN/$F | |
235 done | |
236 for F in $PUBLIC_LIBSRC_SCRIPTS; do | |
237 maybe_emit_copy $SRC/lib-src/$F $DST_BIN/$F | |
238 done | |
239 | |
240 if test x"$SRC" = x"$BUILD"; then | |
241 PFXS="$BUILD" | |
242 else | |
243 PFXS="$SRC $BUILD" | |
244 fi | |
245 | |
246 for SUBDIR in lisp leim etc lib-src info; do | |
247 # defaults | |
248 SHARED=no | |
249 FORCED='' | |
250 AVOID_PAT="`echo "($AVOID)" | tr ' ' '|'`" | |
251 | |
252 # Set subdir-specific values | |
253 case $SUBDIR in | |
254 lisp|leim) | |
255 DST="$DST_SHARE/$SUBDIR" | |
256 ;; | |
257 etc) | |
258 DST="$DST_SHARE/$SUBDIR" | |
259 # COPYING is in the avoid list, but there should be a copy of it in | |
260 # the install etc dir, so make that here. | |
261 FORCED="$DST/COPYING" | |
262 ;; | |
263 lib-src) | |
264 DST="$DST_LIBEXEC" | |
265 AVOID_PAT="`echo "($AVOID ($PUBLIC_LIBSRC_BINARIES $PUBLIC_LIBSRC_SCRIPTS)\$)" | tr ' ' '|'`" | |
266 ;; | |
267 info) | |
268 DST="$DST_INFO" | |
269 SHARED=yes | |
270 ;; | |
271 esac | |
272 | |
273 for PFX in $PFXS; do | |
274 if [ -d $PFX/$SUBDIR ]; then | |
275 for DIR in `(cd $PFX/$SUBDIR; find . -type d -print | sed 's@^./@@')`; do | |
276 if [ -d $DST/$DIR ]; then | |
277 echo Directory $DST/$DIR exists | |
278 else | |
279 echo Directory $DST/$DIR non-existant | |
280 if [ "`echo $DIR | egrep -v "$AVOID_PAT"`" ]; then | |
281 maybe_mkdir $DST/$DIR | |
282 fi | |
283 fi | |
284 done | |
285 diff -sqr $PFX/$SUBDIR $DST | |
286 fi | |
287 done | $NAWK ' | |
288 BEGIN { | |
289 src_pat = "^'"$SRC"'/'"$SUBDIR"'/" | |
290 build_pat = "^'"$BUILD"'/'"$SUBDIR"'/" | |
291 dst_pat = "^'"$DST"'/" | |
292 dst_pfx = "'"$DST"'/" | |
293 avoid_pat = "'"$AVOID_PAT"'" | |
294 force = ("'"$FORCE"'" == "yes") | |
295 shared = ("'"$SHARED"'" == "yes") | |
296 init_bool_array(pruned, "'"$PRUNED"'") | |
297 init_bool_array(forced, "'"$FORCED"'") | |
298 } | |
299 function init_bool_array(array, string, a,k) | |
300 { | |
301 split (string, a) | |
302 for (k in a) | |
303 array[a[k]] = 1 | |
304 } | |
305 function install(src, dst) | |
306 { | |
307 if (! (src in pruned)) { | |
308 cp[src] = dst; | |
309 from[dst] = src; | |
310 delete rm[dst]; | |
311 } | |
312 } | |
313 function update(src, dst, copy) | |
314 { | |
315 if (src in pruned) { | |
316 rm[dst] = 1; | |
317 delete from[dst] | |
318 } else { | |
319 if (copy) | |
320 cp[src] = dst; | |
321 from[dst] = src; | |
322 delete rm[dst]; | |
323 } | |
324 } | |
325 function uninstall(dst) | |
326 { | |
327 if (!(dst in from)) | |
328 rm[dst] = 1; | |
329 } | |
330 /^Directory / { | |
331 if ($2 ~ avoid_pat) { | |
332 if ($NF == "exists") | |
333 uninstall($2) | |
334 } else | |
335 update(0, $2, 0) | |
336 next | |
337 } | |
338 /^Files / { | |
339 if ($4 ~ avoid_pat && !($4 in forced)) | |
340 uninstall($4) | |
341 else if ($NF == "identical") | |
342 update($2, $4, force) | |
343 else | |
344 update($2, $4, 1) | |
345 next | |
346 } | |
347 /^Only / { | |
348 pfx = $3 | |
349 sub (/:$/, "/", pfx) | |
350 | |
351 if (pfx ~ dst_pat) { | |
352 if (! shared) | |
353 uninstall(pfx $4) | |
354 } else { | |
355 subdir = pfx | |
356 if (subdir ~ src_pat) | |
357 sub (src_pat, "", subdir) | |
358 else | |
359 sub (build_pat, "", subdir) | |
360 | |
361 dst = dst_pfx subdir $4 | |
362 if (! (dst ~ avoid_pat)) | |
363 install(pfx $4, dst) | |
364 } | |
365 next | |
366 } | |
367 END { | |
368 for (f in rm) | |
369 print "'"$REMOVE_CMD"' " f | |
370 for (f in cp) | |
371 print "'"$LINK_CMD"' " f " " cp[f] | |
372 } | |
373 ' | |
374 done | |
375 | |
376 ) | eval $EXEC | |
52401 | 377 |
378 # arch-tag: 9322b572-9755-4cf7-a67a-21e6505f1477 |