2 ### quick-install-emacs --- do a halfway-decent job of installing emacs quickly
4 ## Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
5 ## Free Software Foundation, Inc.
7 ## Author: Miles Bader <miles@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, or (at your option)
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; see the file COPYING. If not, write to the
23 ## Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 ## Boston, MA 02110-1301, USA.
28 ## This script is mainly intended for emacs maintainer or pretesters who
29 ## install emacs very often. See the --help output for more details.
32 PUBLIC_LIBSRC_BINARIES
='b2m emacsclient etags ctags ebrowse'
33 PUBLIC_LIBSRC_SCRIPTS
='grep-changelog rcs-checkin'
35 AVOID
="CVS -DIC README COPYING ChangeLog ~ [.]orig$ [.]rej$ Makefile makefile stamp-subdir [.]cvsignore [.]arch-ids [{]arch[}] [.][cho]$ make-docfile testfile test-distrib"
37 # Prune old binaries lying around in the source tree
39 # Re-install files even if they already exist
41 # Command verbose flag
46 # Install commands (if the user specifies the `--verbose' option, it is
47 # passed to these commands, so that feature only works if these commands
54 # Used to execute commands once once we create them
59 # avoid non-standard command output from non-C locales
60 unset LANG LC_ALL LC_MESSAGES
63 USAGE
="Usage: $me [OPTION...] BUILD_TREE [PREFIX]"
64 TRY
="Try "\
`"$me --help' for more information."
66 # Parse command-line options
86 -n, --dry-run print installation commands instead of
89 -f, --force install even files that haven't changed
90 -v, --verbose print messages describing what is done
92 -p, --prune prune old generated files
93 -P, --no-prune don't prune old generated files (default)
94 --prune-only prune old generated files, but don't install
96 --help display this help and exit
97 --version output version information and exit
99 $me install emacs \`incrementally
,' that is, it will
100 install only those files that have changed since the last time it was
101 invoked, and remove any obsolete files from the installation
102 directories. It also uses hard-links into the source and build trees to
103 do the install, so it uses much less space than the default Makefile
104 install target; however, this also means that $me can
105 not install onto a disk partition other than the one on which the source
106 and build directories reside.
108 Optionally, $me can also remove old versions of
109 automatically generated files that are version-specific (such as the
110 versioned emacs executables in the \`src' directory
, and the DOC-
* files
111 in the \
`etc' directory). The latter action is called \`pruning
,' and
112 can be enabled using the \`-p' or \
`--prune' options.
120 Written by Miles Bader <miles@gnu.org>
125 # split concatenated single-letter options apart
127 set -- `echo $FIRST |
sed 's/-\(.\)\(.*\)/-\1 -\2/'` "$@"
130 echo 1>&2 "$me: unrecognized option "\`"$1'"
139 LINK_CMD
="$LINK $VERBOSE"
140 REMOVE_CMD
="$REMOVE $VERBOSE"
144 2) BUILD
="$1"; prefix
="$2";;
152 if test ! -d "$BUILD"; then
153 echo 1>&2 "$me: $BUILD: Build tree not found"
155 elif test ! -r "$BUILD/config.status"; then
156 echo 1>&2 "$me: $BUILD: Not a proper build tree, config.status not found"
160 CONFIG_STATUS
="$BUILD/config.status"
163 if ! sed -n "s/^s\(.\)@$1@\1\(|#_!!_#|\)*\(.*\)\1.*$/\3/p" $CONFIG_STATUS |
sed q |
grep ''
165 echo 1>&2 "$me: $1: Configuration variable not found in $CONFIG_STATUS"
170 test x
"$SRC" = x
&& { SRC
="`get_config_var srcdir`" ||
exit 4 ; }
171 test x
"$prefix" = x
&& { prefix
="`get_config_var prefix`" ||
exit 4 ; }
172 test x
"$ARCH" = x
&& { ARCH
="`get_config_var host`" ||
exit 4 ; }
174 VERSION
=`grep 'defconst[ ]*emacs-version' $SRC/lisp/version.el \
175 | sed -e 's/^[^"]*"\([^"]*\)".*$/\1/'`
177 DST_SHARE
="$prefix/share/emacs/$VERSION"
178 DST_BIN
="$prefix/bin"
179 DST_LIBEXEC
="$prefix/libexec/emacs/$VERSION/$ARCH"
180 DST_INFO
="$prefix/info"
184 if ! test -d "$1"; then
185 $MKDIR $VERBOSE "$1" 2>&1 |
sed "s/^mkdir:/$me:/" 1>&2
189 maybe_mkdir
"$DST_BIN"
190 maybe_mkdir
"$DST_SHARE"
191 maybe_mkdir
"$DST_SHARE/site-lisp"
192 maybe_mkdir
"$DST_LIBEXEC"
193 maybe_mkdir
"$DST_INFO"
195 ( # start of command-generating sub-shell
198 if test x
"$PRUNE" != xno
; then
199 for D
in `ls -1t $BUILD/etc/DOC-* | sed 1d`; do
203 for D
in `ls -1t $BUILD/src/emacs-$VERSION.* | sed 1d`; do
209 test x
"$PRUNE" = xonly
&& exit 0
213 if test "$FORCE" = yes ||
! cmp -s $1 $2; then
218 maybe_emit_copy
$BUILD/src
/emacs
$DST_BIN/emacs
219 maybe_emit_copy
$BUILD/src
/emacs
$DST_BIN/emacs-
$VERSION
221 for F
in $PUBLIC_LIBSRC_BINARIES; do
222 maybe_emit_copy
$BUILD/lib-src
/$F $DST_BIN/$F
224 for F
in $PUBLIC_LIBSRC_SCRIPTS; do
225 maybe_emit_copy
$SRC/lib-src
/$F $DST_BIN/$F
228 if test x
"$SRC" = x
"$BUILD"; then
234 for SUBDIR
in lisp leim etc lib-src info
; do
238 AVOID_PAT
="`echo "($AVOID)" | tr ' ' '|'`"
240 # Set subdir-specific values
243 DST
="$DST_SHARE/$SUBDIR"
246 DST
="$DST_SHARE/$SUBDIR"
247 # COPYING is in the avoid list, but there should be a copy of it in
248 # the install etc dir, so make that here.
249 FORCED
="$DST/COPYING"
253 AVOID_PAT
="`echo "($AVOID ($PUBLIC_LIBSRC_BINARIES $PUBLIC_LIBSRC_SCRIPTS)\$
)" | tr ' ' '|'`"
262 if [ -d $PFX/$SUBDIR ]; then
263 for DIR
in `(cd $PFX/$SUBDIR; find . -type d -print | sed 's@^./@@')`; do
264 if [ -d $DST/$DIR ]; then
265 echo Directory
$DST/$DIR exists
267 echo Directory
$DST/$DIR non-existant
268 if [ "`echo $DIR | egrep -v "$AVOID_PAT"`" ]; then
269 maybe_mkdir
$DST/$DIR
273 diff -sqr $PFX/$SUBDIR $DST
277 src_pat = "^'"$SRC"'/'"$SUBDIR"'/"
278 build_pat = "^'"$BUILD"'/'"$SUBDIR"'/"
279 dst_pat = "^'"$DST"'/"
280 dst_pfx = "'"$DST"'/"
281 avoid_pat = "'"$AVOID_PAT"'"
282 force = ("'"$FORCE"'" == "yes")
283 shared = ("'"$SHARED"'" == "yes")
284 init_bool_array(pruned, "'"$PRUNED"'")
285 init_bool_array(forced, "'"$FORCED"'")
287 function init_bool_array(array, string, a,k)
293 function install(src, dst)
295 if (! (src in pruned)) {
301 function update(src, dst, copy)
313 function uninstall(dst)
319 if ($2 ~ avoid_pat) {
327 if ($4 ~ avoid_pat && !($4 in forced))
329 else if ($NF == "identical")
330 update($2, $4, force)
344 if (subdir ~ src_pat)
345 sub (src_pat, "", subdir)
347 sub (build_pat, "", subdir)
349 dst = dst_pfx subdir $4
350 if (! (dst ~ avoid_pat))
357 print "'"$REMOVE_CMD"' " f
359 print "'"$LINK_CMD"' " f " " cp[f]
366 # arch-tag: 9322b572-9755-4cf7-a67a-21e6505f1477