Moved most of vc-dir from vc.el to vc-dispatcher.el.
[bpt/emacs.git] / make-dist
CommitLineData
f7dbcf3c 1#!/bin/sh
76fb0a58
JB
2
3#### make-dist: create an Emacs distribution tar file from the current
1d650ff1 4#### source tree. This basically creates a duplicate directory
76fb0a58
JB
5#### structure, and then hard links into it only those files that should
6#### be distributed. This means that if you add a file with an odd name,
7#### you should make sure that this script will include it.
f7dbcf3c 8
e91081eb 9# Copyright (C) 1995, 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005,
37d6e313 10# 2006, 2007, 2008 Free Software Foundation, Inc.
4c9c1174
KH
11#
12# This file is part of GNU Emacs.
13#
14# GNU Emacs is free software; you can redistribute it and/or modify
15# it under the terms of the GNU General Public License as published by
e5086daf 16# the Free Software Foundation; either version 3, or (at your option)
4c9c1174
KH
17# any later version.
18#
19# GNU Emacs is distributed in the hope that it will be useful,
20# but WITHOUT ANY WARRANTY; without even the implied warranty of
21# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22# GNU General Public License for more details.
23#
24# You should have received a copy of the GNU General Public License
1fb87c77 25# along with GNU Emacs; see the file COPYING. If not, write to the
0d07bc90
LK
26# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
27# Boston, MA 02110-1301, USA.
4c9c1174 28
f7dbcf3c
JB
29progname="$0"
30
76fb0a58 31### Exit if a command fails.
8c28d444 32#set -e
f7dbcf3c 33
76fb0a58 34### Print out each line we read, for debugging's sake.
8c28d444 35#set -v
f7dbcf3c 36
8df317a6
GM
37LANGUAGE=C
38LC_ALL=C
39LC_MESSAGES=
40LANG=
41export LANGUAGE LC_ALL LC_MESSAGES LANG
42
ccd57f4d 43## Don't restrict access to any files.
67ffab69
RS
44umask 0
45
c75cfabd 46update=yes
e4e1c623 47check=yes
f22edcea
RS
48clean_up=no
49make_tar=no
1260d6ba 50newer=""
f7dbcf3c
JB
51
52while [ $# -gt 0 ]; do
53 case "$1" in
f22edcea
RS
54 ## This option tells make-dist to delete the staging directory
55 ## when done. It is useless to use this unless you make a tar file.
56 "--clean-up" )
57 clean_up=yes
4746118a 58 ;;
f22edcea
RS
59 ## This option tells make-dist to make a tar file.
60 "--tar" )
61 make_tar=yes
f7dbcf3c 62 ;;
c75cfabd
RS
63 ## This option tells make-dist not to recompile or do analogous things.
64 "--no-update" )
65 update=no
66 ;;
e4e1c623
RS
67 ## This option says don't check for bad file names, etc.
68 "--no-check" )
69 check=no
70 ;;
76fb0a58 71 ## This option tells make-dist to make the distribution normally, then
7b9cd64c
ER
72 ## remove all files older than the given timestamp file. This is useful
73 ## for creating incremental or patch distributions.
1260d6ba 74 "--newer")
ef15f270
JB
75 newer="$2"
76 new_extension=".new"
1260d6ba
ER
77 shift
78 ;;
922ac4c5
JB
79 ## This option tells make-dist to use `compress' instead of gzip.
80 ## Normally, make-dist uses gzip whenever it is present.
81 "--compress")
82 default_gzip="compress"
83 ;;
37d6e313
RF
84 ## Same with bzip2.
85 "--bzip2")
86 default_gzip="bzip2"
87 ;;
ed398055
GM
88 ## Same with lzma.
89 "--lzma")
90 default_gzip="lzma"
91 ;;
2a714d4e
GM
92
93 "--snapshot")
94 clean_up=yes
95 make_tar=yes
96 update=no
97 check=no
98 ;;
99
100 "--help")
101 echo "Usage: ${progname} [options]"
102 echo ""
8772b5a8 103 echo " --bzip2 use bzip2 instead of gzip"
2a714d4e
GM
104 echo " --clean-up delete staging directories when done"
105 echo " --compress use compress instead of gzip"
8772b5a8 106 echo " --lzma use lzma instead of gzip"
2a714d4e
GM
107 echo " --newer=TIME don't include files older than TIME"
108 echo " --no-check don't check for bad file names etc."
109 echo " --no-update don't recompile or do analogous things"
110 echo " --snapshot same as --clean-up --no-update --tar --no-check"
111 echo " --tar make a tar file"
112 echo ""
113 exit 0
114 ;;
115
f7dbcf3c
JB
116 * )
117 echo "${progname}: Unrecognized argument: $1" >&2
118 exit 1
119 ;;
120 esac
121 shift
122done
123
76fb0a58 124### Make sure we're running in the right place.
f7dbcf3c 125if [ ! -d src -o ! -f src/lisp.h -o ! -d lisp -o ! -f lisp/version.el ]; then
1260d6ba
ER
126 echo "${progname}: Can't find \`src/lisp.h' and \`lisp/version.el'." >&2
127 echo "${progname} must be run in the top directory of the Emacs" >&2
0d122844 128 echo "distribution tree. cd to that directory and try again." >&2
f7dbcf3c
JB
129 exit 1
130fi
131
c75cfabd 132### Find where to run Emacs.
4b1aaa8b 133### (Accept only absolute file names.)
c75cfabd
RS
134if [ $update = yes ];
135then
59d05d2d 136 unset EMACS_UNIBYTE
c75cfabd
RS
137 if [ -f src/emacs ];
138 then
139 EMACS=`pwd`/src/emacs
140 else
4b1aaa8b
PE
141 case $EMACS in
142 /*) ;;
143 *)
144 if [ ! -f "$EMACS" ]; then
145 echo "$0: You must specify the EMACS environment variable " \
146 "to an absolute file name." 2>&1
147 exit 1
148 fi;;
149 esac
c75cfabd
RS
150 fi
151fi
152
76fb0a58 153### Find out which version of Emacs this is.
0e0186f1 154shortversion=`grep 'defconst[ ]*emacs-version' lisp/version.el \
47d105b0 155 | sed -e 's/^.*"\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/'`
0e0186f1
RS
156version=`grep 'defconst[ ]*emacs-version' lisp/version.el \
157 | sed -e 's/^[^"]*"\([^"]*\)".*$/\1/'`
f7dbcf3c 158if [ ! "${version}" ]; then
21764d60 159 echo "${progname}: can't find current Emacs version in \`./lisp/version.el'" >&2
f7dbcf3c
JB
160 exit 1
161fi
162
21764d60 163echo Version numbers are $version and $shortversion
47d105b0 164
c75cfabd
RS
165if [ $update = yes ];
166then
d175b0ae 167 if grep -s "@set EMACSVER *${shortversion}" ./doc/emacs/emacs.texi > /dev/null; then
c75cfabd
RS
168 true
169 else
d175b0ae 170 echo "You must update the version number in \`./doc/emacs/emacs.texi'"
c75cfabd
RS
171 sleep 5
172 fi
f753e9aa
JB
173fi
174
bb160193
RS
175### Make sure we don't already have a directory emacs-${version}.
176
177emacsname="emacs-${version}${new_extension}"
178
179if [ -d ${emacsname} ]
180then
181 echo Directory "${emacsname}" already exists >&2
182 exit 1
183fi
184
76fb0a58 185### Make sure the subdirectory is available.
1260d6ba 186tempparent="make-dist.tmp.$$"
f7dbcf3c 187if [ -d ${tempparent} ]; then
1260d6ba
ER
188 echo "${progname}: staging directory \`${tempparent}' already exists.
189Perhaps a previous invocation of \`${progname}' failed to clean up after
190itself. Check that directories whose names are of the form
191\`make-dist.tmp.NNNNN' don't contain any important information, remove
192them, and try again." >&2
f7dbcf3c
JB
193 exit 1
194fi
195
e4e1c623
RS
196### Find where to run Emacs.
197if [ $check = yes ];
198then
199 ### Check for .elc files with no corresponding .el file.
fb0797ca 200 ls -1 lisp/[a-zA-Z]*.el lisp/[a-z]*/[a-zA-Z0-9]*.el \
5eea385d 201 leim/[a-z]*/[a-z]*.el | sed 's/\.el$/.elc/' > /tmp/el
fb0797ca 202 ls -1 lisp/[a-zA-Z]*.elc lisp/[a-z]*/[a-zA-Z0-9]*.elc \
5eea385d 203 leim/[a-z]*/[a-z]*.elc > /tmp/elc
e4e1c623
RS
204 bogosities="`comm -13 /tmp/el /tmp/elc`"
205 if [ "${bogosities}" != "" ]; then
206 echo "The following .elc files have no corresponding .el files:"
207 echo "${bogosities}"
8615e792 208 fi
e4e1c623
RS
209 rm -f /tmp/el /tmp/elc
210
211 ### Check for .el files with no corresponding .elc file.
fb0797ca 212 ls -1 lisp/[a-zA-Z]*.el lisp/[a-z]*/[a-zA-Z0-9]*.el \
33740d04 213 leim/[a-z]*/[a-z]*.el > /tmp/el
fb0797ca 214 ls -1 lisp/[a-zA-Z]*.elc lisp/[a-z]*/[a-zA-Z0-9]*.elc \
33740d04 215 leim/[a-z]*/[a-z]*.elc | sed 's/\.elc$/.el/' > /tmp/elc
e4e1c623
RS
216 losers="`comm -23 /tmp/el /tmp/elc`"
217 bogosities=
218 for file in $losers; do
33740d04 219 if ! grep -q "no-byte-compile: t" $file; then
e4e1c623
RS
220 case $file in
221 site-init.el | site-load.el | site-start.el | default.el)
222 ;;
e4e1c623
RS
223 *)
224 bogosities="$file $bogosities"
225 ;;
226 esac
227 fi
228 done
229 if [ x"${bogosities}" != x"" ]; then
230 echo "The following .el files have no corresponding .elc files:"
231 echo "${bogosities}"
232 fi
233 rm -f /tmp/el /tmp/elc
f5674423
KH
234fi
235
b4e84d5d 236### Make sure configure is newer than configure.in.
a8a8fcfa 237if [ "x`ls -t configure configure.in | sed q`" != "xconfigure" ]; then
21764d60
KH
238 echo "\`./configure.in' is newer than \`./configure'" >&2
239 echo "Running autoconf" >&2
28335560 240 autoconf || { x=$?; echo Autoconf FAILED! >&2; exit $x; }
b4e84d5d
JB
241fi
242
a49eb675
AS
243### Make sure src/config-in.stamp is newer than configure.in.
244if [ "x`ls -t src/stamp-h.in configure.in | sed q`" != "xsrc/stamp-h.in" ]; then
245 echo "\`./configure.in' is newer than \`./src/stamp-h.in'" >&2
246 echo "Running autoheader" >&2
247 autoheader || { x=$?; echo Autoheader FAILED! >&2; exit $x; }
248 rm -f src/stamp-h.in
249 echo timestamp > src/stamp-h.in
250fi
251
c75cfabd
RS
252if [ $update = yes ];
253then
254 echo "Updating Info files"
d175b0ae
RF
255 (cd doc/emacs; make -f Makefile.in srcdir=. info)
256 (cd doc/misc; make -f Makefile.in srcdir=. info)
257 (cd doc/lispref; make -f Makefile.in srcdir=. info)
258 (cd doc/lispintro; make -f Makefile.in SHELL=/bin/sh srcdir=. info VPATH=.)
980ab937 259
e888d449 260 echo "Updating finder, custom and autoload data"
59d05d2d 261 (cd lisp; make updates EMACS="$EMACS")
7cf45b04 262
5eea385d
GM
263 if test -f leim/leim-list.el; then
264 echo "Updating leim-list.el"
265 (cd leim; make leim-list.el EMACS="$EMACS")
266 fi
29c98ed3
RS
267
268 echo "Recompiling Lisp files"
29c98ed3 269 $EMACS -batch -f batch-byte-recompile-directory lisp leim
c75cfabd 270fi
0588a761 271
f07eebe0
KH
272echo "Making lisp/MANIFEST"
273
73494596
RS
274(cd lisp;
275 files=`echo [!=]*.el | sed -e 's/ subdirs.el / /' -e 's/ default.el / /'`
276 for dir in [!=]*; do
5eea385d
GM
277 if [ -d $dir ] && [ $dir != term ] && [ $dir != CVS ] && [ $dir != RCS ]
278 then
73494596
RS
279 echo $dir
280 thisdir=`echo $dir/[!=]*.el | sed -e 's/ subdirs.el / /'`
281 files="$files $thisdir"
282 fi
283 done
a8a8fcfa
PE
284 for file in $files
285 do sed -n 's/^;;; //p; q' $file
286 done | sort > MANIFEST)
f07eebe0 287
1260d6ba 288echo "Creating staging directory: \`${tempparent}'"
bb160193 289
f7dbcf3c 290mkdir ${tempparent}
f7dbcf3c
JB
291tempdir="${tempparent}/${emacsname}"
292
76fb0a58
JB
293### This trap ensures that the staging directory will be cleaned up even
294### when the script is interrupted in mid-career.
00c00348 295if [ "${clean_up}" = yes ]; then
21764d60 296 trap "echo 'Interrupted...cleaning up the staging directory'; rm -rf ${tempparent}; exit 1" 1 2 15
00c00348
ER
297fi
298
1260d6ba 299echo "Creating top directory: \`${tempdir}'"
f7dbcf3c
JB
300mkdir ${tempdir}
301
76fb0a58
JB
302### We copy in the top-level files before creating the subdirectories in
303### hopes that this will make the top-level files appear first in the
304### tar file; this means that people can start reading the INSTALL and
305### README while the rest of the tar file is still unpacking. Whoopee.
21764d60 306echo "Making links to top-level files"
3ada8b66 307ln INSTALL README BUGS move-if-change ${tempdir}
bcea38a3 308ln ChangeLog Makefile.in configure configure.in ${tempdir}
6f8b09f3 309ln config.bat make-dist update-subdirs vpath.sed ${tempdir}
bb160193 310### Copy these files; they're cross-filesystem symlinks.
a4888c88 311cp mkinstalldirs ${tempdir}
76fb0a58 312cp config.sub ${tempdir}
2ed56345 313cp config.guess ${tempdir}
dc7717ab 314cp install-sh ${tempdir}
f7dbcf3c 315
21764d60 316echo "Updating version number in README"
f753e9aa
JB
317(cd ${tempdir}
318 awk \
319 '$1 " " $2 " " $3 " " $4 " " $5 == "This directory tree holds version" { $6 = version; print $0 }
320 $1 " " $2 " " $3 " " $4 " " $5 != "This directory tree holds version"' \
321 version=${version} README > tmp.README
af559a4e 322 mv -f tmp.README README)
f753e9aa
JB
323
324
21764d60 325echo "Creating subdirectories"
d175b0ae 326for subdir in lisp site-lisp \
05494c29 327 leim leim/CXTERM-DIC leim/MISC-DIC \
ca111811 328 leim/SKK-DIC leim/ja-dic leim/quail \
c660c0a7 329 src src/m src/s src/bitmaps lib-src oldXMenu lwlib \
5ec8424f 330 nt nt/inc nt/inc/sys nt/inc/arpa nt/inc/netinet nt/icons \
0bd50841 331 etc etc/charsets etc/e etc/gnus etc/nxml \
ffda926c 332 etc/images etc/images/ezimage etc/images/gnus etc/images/gud \
d8981daf 333 etc/images/icons etc/images/icons/hicolor \
dc6150eb 334 etc/images/icons/hicolor/*x* etc/images/icons/hicolor/scalable \
10eae9dd 335 etc/images/icons/hicolor/*/apps etc/images/icons/hicolor/*/mimetypes \
d8981daf 336 etc/images/low-color etc/images/mail \
56bcdb80
GM
337 etc/images/smilies etc/images/smilies/grayscale \
338 etc/images/smilies/medium etc/images/tree-widget \
339 etc/images/tree-widget/default etc/images/tree-widget/folder \
3ada8b66
RF
340 etc/refcards etc/schema etc/tutorials info doc doc/emacs \
341 doc/misc doc/man doc/lispref doc/lispintro m4 msdos vms mac \
c0bc7978 342 mac/src mac/Emacs.app mac/Emacs.app/Contents \
e0f712ba
AC
343 mac/Emacs.app/Contents/MacOS mac/Emacs.app/Contents/Resources \
344 mac/Emacs.app/Contents/Resources/English.lproj
b3635775
GM
345do
346 echo " ${tempdir}/${subdir}"
f7dbcf3c
JB
347 mkdir ${tempdir}/${subdir}
348done
349
67ffab69 350echo "Making links to \`lisp' and its subdirectories"
7b9cd64c 351### Don't distribute TAGS, =*.el files, site-init.el, site-load.el, or default.el.
f7dbcf3c
JB
352(cd lisp
353 ln [a-zA-Z]*.el ../${tempdir}/lisp
354 ln [a-zA-Z]*.elc ../${tempdir}/lisp
8d2197ac 355 ln [a-zA-Z]*.dat ../${tempdir}/lisp
a1363c1d 356 for img in [a-zA-Z]*.xpm [a-zA-Z]*.xbm [a-zA-Z]*.pbm; do
365949b7
GM
357 # If there are no images, the shell won't expand the pattern.
358 if [ -f $img ]; then
359 ln $img ../${tempdir}/lisp
360 fi
361 done
76fb0a58
JB
362 ## simula.el doesn't keep abbreviations in simula.defns any more.
363 ## ln [a-zA-Z]*.defns ../${tempdir}/lisp
fb0797ca
LK
364 ln ChangeLog ChangeLog.*[0-9] ../${tempdir}/lisp
365 ln Makefile.in makefile.w32-in ../${tempdir}/lisp
5eea385d 366 test -f README && ln README ../${tempdir}/lisp
67ffab69
RS
367 (cd ../${tempdir}/lisp
368 rm -f TAGS =*
369 rm -f site-init site-init.el site-init.elc
370 rm -f site-load site-load.el site-load.elc
371 rm -f site-start site-start.el site-start.elc
372 rm -f default default.el default.elc
373 )
374
375 ## Find all subdirs of lisp dir
376 for file in `find . -type d -print`; do
377 case $file in
5eea385d 378 . | .. | */Old | */CVS | */RCS | */=*)
177c0ea7 379 ;;
67ffab69
RS
380 *)
381 if [ -d $file ]; then
382 subdirs="$file $subdirs"
383 fi
384 ;;
385 esac
386 done
387
388 for file in $subdirs; do
389 echo " lisp/$file"
3ada8b66 390 mkdir -p ../${tempdir}/lisp/$file
b3635775
GM
391 ln $file/[a-zA-Z0-9]*.el ../${tempdir}/lisp/$file
392 ln $file/[a-zA-Z0-9]*.elc ../${tempdir}/lisp/$file
393 for img in $file/[a-zA-Z]*.xpm $file/[a-zA-Z]*.xbm $file/[a-zA-Z]*.pbm; do
365949b7
GM
394 if [ -f $img ]; then
395 ln $img ../${tempdir}/lisp/$file
396 fi
397 done
67ffab69
RS
398 if [ -f $file/README ]; then
399 ln $file/README ../${tempdir}/lisp/$file
400 fi
b3635775 401
dcf3ff7f
RS
402 if [ -f $file/ChangeLog ]; then
403 ln $file/ChangeLog ../${tempdir}/lisp/$file
fb0797ca 404 for f in $file/ChangeLog.*[0-9]; do
b3635775
GM
405 if [ -f $f ]; then
406 ln $f ../${tempdir}/lisp/$file
407 fi
408 done
dcf3ff7f 409 fi
67ffab69 410 done )
a78c106d 411
ca111811 412echo "Making links to \`leim' and its subdirectories"
91741841
RS
413### Don't distribute TAGS, or =*.el files.
414(cd leim
561bd1a1 415 ln makefile.w32-in ../${tempdir}/leim
ca111811
EZ
416 ln ChangeLog README ../${tempdir}/leim
417
418 ln CXTERM-DIC/*.tit ../${tempdir}/leim/CXTERM-DIC
419 ln SKK-DIC/README SKK-DIC/SKK-JISYO.L ../${tempdir}/leim/SKK-DIC
420 ln MISC-DIC/*.* ../${tempdir}/leim/MISC-DIC
421 ln ja-dic/*.el ja-dic/*.elc ../${tempdir}/leim/ja-dic
422 ln Makefile.in ../${tempdir}/leim/Makefile.in
1d390bd8 423 ln leim-ext.el ../${tempdir}/leim/leim-ext.el
fb0797ca
LK
424 ## Lisp files that start with a capital are generated from TIT
425 ## dictionaries so we don't distribute them.
ca111811
EZ
426 ln quail/[a-z]*.el quail/[a-z]*.elc ../${tempdir}/leim/quail
427 rm -f ../${tempdir}/leim/quail/quick-b5.*
428 rm -f ../${tempdir}/leim/quail/quick-cns.*
429 rm -f ../${tempdir}/leim/quail/tsang-b5.*
430 rm -f ../${tempdir}/leim/quail/tsang-cns.*
431
432 cd ../${tempdir}/leim
91741841
RS
433 rm -f TAGS =* */=*)
434
21764d60 435echo "Making links to \`src'"
76fb0a58 436### Don't distribute =*.[ch] files, or the configured versions of
c3f1e1a9 437### config.in, paths.in, or Makefile.in, or TAGS.
f7dbcf3c 438(cd src
c75cfabd 439 echo " (It is ok if ln fails in some cases.)"
f7dbcf3c
JB
440 ln [a-zA-Z]*.c ../${tempdir}/src
441 ln [a-zA-Z]*.h ../${tempdir}/src
442 ln [a-zA-Z]*.s ../${tempdir}/src
c75cfabd
RS
443 ln [a-zA-Z]*.in ../${tempdir}/src
444 ln [a-zA-Z]*.opt ../${tempdir}/src
445 ## If we ended up with a symlink, or if we did not get anything
446 ## due to a cross-device symlink, copy the file.
447 for file in [a-zA-Z]*.[hcs] [a-zA-Z]*.in [a-zA-Z]*.opt; do
448 if test -f ../${tempdir}/src/$file; then
449 # test -f appears to succeed for a symlink
450 if test -L ../${tempdir}/src/$file; then
451 rm ../${tempdir}/src/$file
62dfdaf0 452 cp -p $file ../${tempdir}/src
c75cfabd
RS
453 chmod a-w ../${tempdir}/src/$file
454 fi
455 else
456 rm ../${tempdir}/src/$file
62dfdaf0 457 cp -p $file ../${tempdir}/src
c75cfabd
RS
458 chmod a-w ../${tempdir}/src/$file
459 fi
460 done
461 ln README ChangeLog ChangeLog.*[0-9] ../${tempdir}/src
561bd1a1 462 ln makefile.w32-in ../${tempdir}/src
990ee059 463 ln .gdbinit .dbxinit ../${tempdir}/src
f7dbcf3c 464 cd ../${tempdir}/src
8c28d444 465 rm -f config.h epaths.h Makefile Makefile.c
7b9cd64c 466 rm -f =* TAGS)
f7dbcf3c 467
21764d60 468echo "Making links to \`src/bitmaps'"
690eca32
JB
469(cd src/bitmaps
470 ln README *.xbm ../../${tempdir}/src/bitmaps)
471
21764d60 472echo "Making links to \`src/m'"
f7dbcf3c 473(cd src/m
facbb78e
RS
474 # We call files for miscellaneous input (to linker etc) .inp.
475 ln README [a-zA-Z0-9]*.h *.inp ../../${tempdir}/src/m)
f7dbcf3c 476
21764d60 477echo "Making links to \`src/s'"
f7dbcf3c 478(cd src/s
77427171 479 ln README [a-zA-Z0-9]*.h ../../${tempdir}/src/s)
f7dbcf3c 480
21764d60 481echo "Making links to \`lib-src'"
f7dbcf3c 482(cd lib-src
375f1bd7 483 ln [a-zA-Z]*.[chy] ../${tempdir}/lib-src
c3f1e1a9 484 ln ChangeLog Makefile.in README testfile vcdiff ../${tempdir}/lib-src
561bd1a1 485 ln grep-changelog rcs2log rcs-checkin ../${tempdir}/lib-src
b3635775 486 ln makefile.w32-in ../${tempdir}/lib-src
c75cfabd
RS
487 ## If we ended up with a symlink, or if we did not get anything
488 ## due to a cross-device symlink, copy the file.
489 for file in [a-zA-Z]*.[chy]; do
490 if test -f ../${tempdir}/lib-src/$file; then
491 # test -f appears to succeed for a symlink
492 if test -L ../${tempdir}/lib-src/$file; then
493 rm ../${tempdir}/lib-src/$file
494 cp $file ../${tempdir}/lib-src
495 chmod a-w ../${tempdir}/lib-src/$file
496 fi
497 else
498 rm ../${tempdir}/lib-src/$file
499 cp $file ../${tempdir}/lib-src
500 chmod a-w ../${tempdir}/lib-src/$file
501 fi
502 done
1260d6ba 503 cd ../${tempdir}/lib-src
c75cfabd 504 rm -f Makefile.c
9eff9fe3 505 rm -f getopt.h
7b9cd64c 506 rm -f =* TAGS)
f7dbcf3c 507
9eff9fe3
PE
508echo "Making links to \`m4'"
509(cd m4
510 ln *.m4 ../${tempdir}/m4)
511
21764d60 512echo "Making links to \`nt'"
391b3748 513(cd nt
a695ae76 514 ln emacs.manifest emacs.rc config.nt [a-z]*.c ../${tempdir}/nt
bcea38a3 515 ln nmake.defs gmake.defs subdirs.el ../${tempdir}/nt
561bd1a1 516 ln [a-z]*.bat [a-z]*.h ../${tempdir}/nt
bcea38a3 517 ln ChangeLog INSTALL README makefile.w32-in ../${tempdir}/nt)
391b3748 518
21764d60 519echo "Making links to \`nt/inc'"
391b3748 520(cd nt/inc
77427171 521 ln [a-z]*.h ../../${tempdir}/nt/inc)
391b3748 522
21764d60 523echo "Making links to \`nt/inc/sys'"
391b3748 524(cd nt/inc/sys
77427171 525 ln [a-z]*.h ../../../${tempdir}/nt/inc/sys)
391b3748 526
e827bc37
RS
527echo "Making links to \`nt/inc/arpa'"
528(cd nt/inc/arpa
529 ln [a-z]*.h ../../../${tempdir}/nt/inc/arpa)
530
531echo "Making links to \`nt/inc/netinet'"
532(cd nt/inc/netinet
533 ln [a-z]*.h ../../../${tempdir}/nt/inc/netinet)
534
5ec8424f
GV
535echo "Making links to \`nt/icons'"
536(cd nt/icons
d6dc647f
JR
537 ln [a-z]*.ico ../../${tempdir}/nt/icons
538 ln [a-z]*.cur ../../${tempdir}/nt/icons)
5ec8424f 539
b3635775
GM
540echo "Making links to \`mac'"
541(cd mac
c0bc7978 542 ln ChangeLog INSTALL README make-package ../${tempdir}/mac)
b3635775
GM
543
544echo "Making links to \`mac/src'"
545(cd mac/src
546 ln [a-z]*.c *.r ../../${tempdir}/mac/src)
547
e0f712ba
AC
548echo "Making links to \`mac/Emacs.app/Contents'"
549(cd mac/Emacs.app/Contents
550 ln Info.plist PkgInfo ../../../${tempdir}/mac/Emacs.app/Contents)
551
e278f0fe
YM
552echo "Making links to \`mac/Emacs.app/Contents/Resources'"
553(cd mac/Emacs.app/Contents/Resources
554 ln Emacs.icns ../../../../${tempdir}/mac/Emacs.app/Contents/Resources)
555
e0f712ba
AC
556echo "Making links to \`mac/Emacs.app/Contents/Resources/English.lproj'"
557(cd mac/Emacs.app/Contents/Resources/English.lproj
558 ln InfoPlist.strings ../../../../../${tempdir}/mac/Emacs.app/Contents/Resources/English.lproj)
177c0ea7 559
21764d60 560echo "Making links to \`msdos'"
52d7b2e5
RS
561(cd msdos
562 ln ChangeLog emacs.ico emacs.pif ../${tempdir}/msdos
7fd85d56 563 ln is_exec.c sigaction.c mainmake mainmake.v2 sed*.inp ../${tempdir}/msdos
52d7b2e5
RS
564 cd ../${tempdir}/msdos
565 rm -f =*)
566
21764d60 567echo "Making links to \`oldXMenu'"
f7dbcf3c 568(cd oldXMenu
8bdbf9ed 569 ln *.c *.h *.in ../${tempdir}/oldXMenu
10b9fe32 570 ln README ChangeLog ../${tempdir}/oldXMenu
f395c83a 571 ln compile.com descrip.mms ../${tempdir}/oldXMenu)
f7dbcf3c 572
21764d60 573echo "Making links to \`lwlib'"
c660c0a7
RS
574(cd lwlib
575 ln *.c *.h *.in ../${tempdir}/lwlib
ebb81677 576 ln README ChangeLog ../${tempdir}/lwlib)
c660c0a7 577
21764d60 578echo "Making links to \`etc'"
f395c83a
JB
579### Don't distribute = files, TAGS, DOC files, backups, autosaves, or
580### tex litter.
f7dbcf3c 581(cd etc
561bd1a1 582 files=`ls -d * | grep -v CVS | grep -v RCS | grep -v 'Old' | grep -v '^e$' \
0bd50841 583 | grep -v '^charsets$' | grep -v '^gnus$' | grep -v '^images$' | grep -v '^nxml$' \
916447e4 584 | grep -v '^refcards$' | grep -v '^tutorials$'| grep -v '^schema$'`
7a6ee7ae 585 ln $files ../${tempdir}/etc
98d4c1d0
RS
586 ## If we ended up with a symlink, or if we did not get anything
587 ## due to a cross-device symlink, copy the file.
7a6ee7ae 588 for file in $files; do
98d4c1d0
RS
589 if test -f ../${tempdir}/etc/$file; then
590 # test -f appears to succeed for a symlink
591 if test -L ../${tempdir}/etc/$file; then
592 rm ../${tempdir}/etc/$file
593 cp $file ../${tempdir}/etc
594 chmod a-w ../${tempdir}/etc/$file
595 fi
596 else
597 rm ../${tempdir}/etc/$file
598 cp $file ../${tempdir}/etc
599 chmod a-w ../${tempdir}/etc/$file
600 fi
601 done
f7dbcf3c 602 cd ../${tempdir}/etc
d175b0ae 603 rm -f fns*.el
23a58692 604 rm -f DOC* *~ \#*\# *.dvi *.log *.orig *.rej *,v =* core
f395c83a 605 rm -f TAGS)
f7dbcf3c 606
0bd50841 607for dir in etc/charsets etc/e etc/gnus etc/nxml etc/tutorials etc/refcards etc/schema ; do
561c44e8
RF
608 echo "Making links to \`${dir}'"
609 (cd ${dir}
610 ln `ls -d * | grep -v CVS | grep -v RCS` ../../${tempdir}/${dir}
611 cd ../../${tempdir}/${dir}
612 rm -f *~ \#*\# *,v =* core)
613done
f08ad882 614
36eaa68f
RF
615echo "Making links to \`etc/images'"
616(cd etc/images
10b9fe32 617 for img in README [a-zA-Z]*.xpm [a-zA-Z]*.xbm [a-zA-Z]*.pbm; do
36eaa68f
RF
618 if [ -f $img ]; then
619 ln $img ../../${tempdir}/etc/images
620 fi
621 done)
622
ad7a98ae 623for dir in etc/images/ezimage etc/images/gnus etc/images/gud etc/images/icons \
561c44e8 624 etc/images/low-color etc/images/mail etc/images/smilies ; do
561bd1a1
EZ
625 echo "Making links to \`${dir}'"
626 (cd ${dir}
627 ln `ls -d * | grep -v CVS | grep -v RCS` ../../../${tempdir}/${dir}
628 cd ../../../${tempdir}/${dir}
629 rm -f *~ \#*\# *,v =* core)
630done
631
56bcdb80 632for dir in etc/images/tree-widget/default etc/images/tree-widget/folder \
d8981daf 633 etc/images/smilies/grayscale etc/images/smilies/medium; do
561c44e8
RF
634 echo "Making links to \`${dir}'"
635 (cd ${dir}
636 ln `ls -d * | grep -v CVS | grep -v RCS` ../../../../${tempdir}/${dir}
637 cd ../../../../${tempdir}/${dir}
638 rm -f *~ \#*\# *,v =* core)
639done
640
10eae9dd
GM
641for dir in etc/images/icons/hicolor/*/apps \
642 etc/images/icons/hicolor/*/mimetypes; do
d8981daf
GM
643 echo "Making links to \`${dir}'"
644 (cd ${dir}
645 ln `ls -d * | grep -v CVS | grep -v RCS` ../../../../../../${tempdir}/${dir}
646 cd ../../../../../../${tempdir}/${dir}
647 rm -f *~ \#*\# *,v =* core)
648done
649
21764d60 650echo "Making links to \`info'"
66afa119
RS
651# Don't distribute backups or autosaves.
652(cd info
b3635775 653 ln `find . -type f -print | grep -v CVS | grep -v RCS | grep -v cvsignore` ../${tempdir}/info
5eea385d 654 #ln [a-zA-Z]* ../${tempdir}/info
66afa119
RS
655 cd ../${tempdir}/info
656 # Avoid an error when expanding the wildcards later.
657 ln emacs dummy~ ; ln emacs \#dummy\#
658 rm -f *~ \#*\# core)
fda4e8f6 659
d175b0ae
RF
660echo "Making links to \`doc/emacs'"
661(cd doc/emacs
662 ln *.texi *.aux *.cps *.fns *.kys *.vrs ../../${tempdir}/doc/emacs
663 ln makefile.w32-in ../../${tempdir}/doc/emacs
664 test -f README && ln README ../../${tempdir}/doc/emacs
665 test -f Makefile.in && ln Makefile.in ../../${tempdir}/doc/emacs
666 ln ChangeLog ../../${tempdir}/doc/emacs
667 cp texinfo.tex ../../${tempdir}/doc/emacs
668 cd ../../${tempdir}/doc/emacs
56c31c87
RS
669 rm -f \#*\# =* *~ core emacs-index* *.Z *.z xmail
670 rm -f emacs.?? termcap.?? gdb.?? *.log *.toc *.dvi *.oaux)
f7dbcf3c 671
d175b0ae
RF
672echo "Making links to \`doc/misc'"
673(cd doc/misc
674 ln *.texi *.aux *.cps *.fns *.kys *.vrs ../../${tempdir}/doc/misc
675 ln makefile.w32-in ../../${tempdir}/doc/misc
676 test -f README && ln README ../../${tempdir}/doc/misc
677 test -f Makefile.in && ln Makefile.in ../../${tempdir}/doc/misc
678 ln ChangeLog ../../${tempdir}/doc/misc
679 cp texinfo.tex ../../${tempdir}/doc/misc
680 cd ../../${tempdir}/doc/misc
681 rm -f \#*\# =* *~ core emacs-index* *.Z *.z xmail
682 rm -f emacs.?? termcap.?? gdb.?? *.log *.toc *.dvi *.oaux)
683
684echo "Making links to \`doc/lispref'"
685(cd doc/lispref
686 ln `ls -1 *.texi` ../../${tempdir}/doc/lispref
687 ln *.aux *.cps *.fns *.kys *.vrs ../../${tempdir}/doc/lispref
688 ln *.txt *.el spellfile tindex.pl ../../${tempdir}/doc/lispref
689 ln makefile.w32-in ../../${tempdir}/doc/lispref
690 test -f README && ln README ../../${tempdir}/doc/lispref
691 test -f Makefile.in && ln Makefile.in ../../${tempdir}/doc/lispref
692 ln ChangeLog ../../${tempdir}/doc/lispref
693 cd ../../${tempdir}/doc/lispref
1d951084
EZ
694 rm -f \#*\# =* *~ core elisp-index* *.Z *.z xmail
695 rm -f elisp.?? *.log *.toc *.dvi *.oaux)
696
d175b0ae
RF
697echo "Making links to \`doc/lispintro'"
698(cd doc/lispintro
699 ln *.texi *.aux *.cps *.fns *.kys *.vrs *.eps ../../${tempdir}/doc/lispintro
700 ln makefile.w32-in ../../${tempdir}/doc/lispintro
701 test -f texinfo.tex && ln texinfo.tex ../../${tempdir}/doc/lispintro
702 test -f README && ln README ../../${tempdir}/doc/lispintro
703 test -f Makefile.in && ln Makefile.in ../../${tempdir}/doc/lispintro
704 ln ChangeLog ../../${tempdir}/doc/lispintro
705 cd ../../${tempdir}/doc/lispintro
3716a206
EZ
706 rm -f \#*\# =* *~ core *.Z *.z xmail
707 rm -f emacs-lisp-intro.?? *.log *.toc *.dvi *.oaux)
708
d175b0ae
RF
709echo "Making links to \`doc/man'"
710(cd doc/man
31d0fa8c 711 ln *.1 ../../${tempdir}/doc/man)
d175b0ae 712
21764d60 713echo "Making links to \`vms'"
40eef465 714(cd vms
5eea385d 715 test -f README && ln README ../${tempdir}/vms
40eef465
JB
716 cd ../${tempdir}/vms
717 rm -f *~)
718
6ab508db 719### It would be nice if they could all be symlinks to top-level copy, but
c87b230f 720### you're not supposed to have any symlinks in distribution tar files.
fd4bc580 721echo "Making sure copying notices are all copies of \`COPYING'"
860484dd 722for subdir in . etc info leim lib-src lisp lwlib mac msdos nt src; do
b37017c6 723 rm -f ${tempdir}/${subdir}/COPYING
fd4bc580 724 cp COPYING ${tempdir}/${subdir}
f7dbcf3c
JB
725done
726
1260d6ba 727if [ "${newer}" ]; then
21764d60 728 echo "Removing files older than $newer"
76fb0a58
JB
729 ## We remove .elc files unconditionally, on the theory that anyone picking
730 ## up an incremental distribution already has a running Emacs to byte-compile
731 ## them with.
1260d6ba
ER
732 find ${tempparent} \( -name '*.elc' -o ! -newer ${newer} \) -exec rm -f {} \;
733fi
734
4746118a 735if [ "${make_tar}" = yes ]; then
922ac4c5 736 if [ "${default_gzip}" = "" ]; then
21764d60 737 echo "Looking for gzip"
922ac4c5
JB
738 temppath=`echo $PATH | sed 's/^:/.:/
739 s/::/:.:/g
740 s/:$/:./
741 s/:/ /g'`
742 default_gzip=`(
743 for dir in ${temppath}; do
744 if [ -f ${dir}/gzip ]; then echo 'gzip --best'; exit 0; fi
745 done
746 echo compress
747 )`
748 fi
f395c83a 749 case "${default_gzip}" in
37d6e313 750 bzip2) gzip_extension=.bz2 ;;
f395c83a 751 compress* ) gzip_extension=.Z ;;
ed398055 752 lzma) gzip_extension=.lzma ;;
0dc610dd 753 * ) gzip_extension=.gz ;;
f395c83a 754 esac
ca111811 755 echo "Creating tar file"
f395c83a
JB
756 (cd ${tempparent} ; tar cvf - ${emacsname} ) \
757 | ${default_gzip} \
758 > ${emacsname}.tar${gzip_extension}
4746118a 759fi
f7dbcf3c 760
4746118a 761if [ "${clean_up}" = yes ]; then
21764d60 762 echo "Cleaning up the staging directory"
f395c83a 763 rm -rf ${tempparent}
bb160193 764else
ca111811 765 (cd ${tempparent}; mv ${emacsname} ..)
bb160193 766 rm -rf ${tempparent}
f7dbcf3c 767fi
00c00348 768
ab5796a9 769# arch-tag: 26e3eb50-a394-4ab2-82b2-d8e5af500de7
76fb0a58 770### make-dist ends here