(MAKE_LOCK_NAME): Use size_byte.
[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
98d4c1d0 9# Copyright (C) 1995, 1997 Free Software Foundation, Inc.
4c9c1174
KH
10#
11# This file is part of GNU Emacs.
12#
13# GNU Emacs is free software; you can redistribute it and/or modify
14# it under the terms of the GNU General Public License as published by
15# the Free Software Foundation; either version 2, or (at your option)
16# any later version.
17#
18# GNU Emacs is distributed in the hope that it will be useful,
19# but WITHOUT ANY WARRANTY; without even the implied warranty of
20# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21# GNU General Public License for more details.
22#
23# You should have received a copy of the GNU General Public License
1fb87c77
KH
24# along with GNU Emacs; see the file COPYING. If not, write to the
25# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
26# Boston, MA 02111-1307, USA.
4c9c1174 27
f7dbcf3c
JB
28progname="$0"
29
76fb0a58
JB
30### Exit if a command fails.
31### set -e
f7dbcf3c 32
76fb0a58
JB
33### Print out each line we read, for debugging's sake.
34### set -v
f7dbcf3c 35
ccd57f4d 36## Don't restrict access to any files.
67ffab69
RS
37umask 0
38
c75cfabd 39update=yes
f22edcea
RS
40clean_up=no
41make_tar=no
1260d6ba 42newer=""
f7dbcf3c
JB
43
44while [ $# -gt 0 ]; do
45 case "$1" in
f22edcea
RS
46 ## This option tells make-dist to delete the staging directory
47 ## when done. It is useless to use this unless you make a tar file.
48 "--clean-up" )
49 clean_up=yes
4746118a 50 ;;
f22edcea
RS
51 ## This option tells make-dist to make a tar file.
52 "--tar" )
53 make_tar=yes
f7dbcf3c 54 ;;
c75cfabd
RS
55 ## This option tells make-dist not to recompile or do analogous things.
56 "--no-update" )
57 update=no
58 ;;
76fb0a58 59 ## This option tells make-dist to make the distribution normally, then
7b9cd64c
ER
60 ## remove all files older than the given timestamp file. This is useful
61 ## for creating incremental or patch distributions.
1260d6ba 62 "--newer")
ef15f270
JB
63 newer="$2"
64 new_extension=".new"
1260d6ba
ER
65 shift
66 ;;
922ac4c5
JB
67 ## This option tells make-dist to use `compress' instead of gzip.
68 ## Normally, make-dist uses gzip whenever it is present.
69 "--compress")
70 default_gzip="compress"
71 ;;
f7dbcf3c
JB
72 * )
73 echo "${progname}: Unrecognized argument: $1" >&2
74 exit 1
75 ;;
76 esac
77 shift
78done
79
76fb0a58 80### Make sure we're running in the right place.
f7dbcf3c 81if [ ! -d src -o ! -f src/lisp.h -o ! -d lisp -o ! -f lisp/version.el ]; then
1260d6ba
ER
82 echo "${progname}: Can't find \`src/lisp.h' and \`lisp/version.el'." >&2
83 echo "${progname} must be run in the top directory of the Emacs" >&2
0d122844 84 echo "distribution tree. cd to that directory and try again." >&2
f7dbcf3c
JB
85 exit 1
86fi
87
c75cfabd
RS
88### Find where to run Emacs.
89if [ $update = yes ];
90then
91 if [ -f src/emacs ];
92 then
93 EMACS=`pwd`/src/emacs
94 else
95 if [ x$EMACS = x ];
96 then
97 echo You must specify the EMACS environment variable 2>&1
98 exit 1
99 fi
100 fi
101fi
102
76fb0a58 103### Find out which version of Emacs this is.
0e0186f1 104shortversion=`grep 'defconst[ ]*emacs-version' lisp/version.el \
47d105b0 105 | sed -e 's/^.*"\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/'`
0e0186f1
RS
106version=`grep 'defconst[ ]*emacs-version' lisp/version.el \
107 | sed -e 's/^[^"]*"\([^"]*\)".*$/\1/'`
f7dbcf3c 108if [ ! "${version}" ]; then
21764d60 109 echo "${progname}: can't find current Emacs version in \`./lisp/version.el'" >&2
f7dbcf3c
JB
110 exit 1
111fi
112
21764d60 113echo Version numbers are $version and $shortversion
47d105b0 114
c75cfabd
RS
115if [ $update = yes ];
116then
117 if grep -s "GNU Emacs version ${shortversion}" ./man/emacs.texi > /dev/null; then
118 true
119 else
120 echo "You must update the version number in \`./man/emacs.texi'"
121 sleep 5
122 fi
f753e9aa
JB
123fi
124
bb160193
RS
125### Make sure we don't already have a directory emacs-${version}.
126
127emacsname="emacs-${version}${new_extension}"
128
129if [ -d ${emacsname} ]
130then
131 echo Directory "${emacsname}" already exists >&2
132 exit 1
133fi
134
76fb0a58 135### Make sure the subdirectory is available.
1260d6ba 136tempparent="make-dist.tmp.$$"
f7dbcf3c 137if [ -d ${tempparent} ]; then
1260d6ba
ER
138 echo "${progname}: staging directory \`${tempparent}' already exists.
139Perhaps a previous invocation of \`${progname}' failed to clean up after
140itself. Check that directories whose names are of the form
141\`make-dist.tmp.NNNNN' don't contain any important information, remove
142them, and try again." >&2
f7dbcf3c
JB
143 exit 1
144fi
145
9f7602fd 146### Check for .elc files with no corresponding .el file.
c2a3dd2e
KH
147ls -1 lisp/[a-z]*.el lisp/[a-z]*/[a-z]*.el \
148 leim/[a-z]*.el leim/[a-z]*/[a-z]*.el | sed 's/\.el$/.elc/' > /tmp/el
149ls -1 lisp/[a-z]*.elc lisp/[a-z]*/[a-z]*.elc \
150 leim/[a-z]*.elc leim/[a-z]*/[a-z]*.elc > /tmp/elc
254e10d8
JB
151bogosities="`comm -13 /tmp/el /tmp/elc`"
152if [ "${bogosities}" != "" ]; then
153 echo "The following .elc files have no corresponding .el files:"
154 echo "${bogosities}"
155fi
8f731fcc 156rm -f /tmp/el /tmp/elc
9f7602fd 157
8615e792 158### Check for .el files with no corresponding .elc file.
29c98ed3
RS
159((cd lisp; ls -1 [a-z]*.el [a-z]*/[a-z]*.el)
160 (cd leim; ls -1 [a-z]*.el [a-z]*/[a-z]*.el)) > /tmp/el
161((cd lisp; ls -1 [a-z]*.elc [a-z]*/[a-z]*.elc)
162 (cd leim; ls -1 [a-z]*.elc [a-z]*/[a-z]*.elc)) | sed 's/\.elc$/.el/' > /tmp/elc
8615e792 163losers="`comm -23 /tmp/el /tmp/elc`"
f298f0d2 164bogosities=
8615e792 165for file in $losers; do
b32ce17b
RS
166 file1=`echo $file | sed -e "s|.*/||"`
167 if ! grep -q "dontcompilefiles:.* $file1\($\| \)" lisp/Makefile; then
168 case $file in
169 site-init.el | site-load.el | site-start.el | default.el)
170 ;;
171 term/*)
172 ;;
173 *)
174 bogosities="$file $bogosities"
175 ;;
176 esac
8615e792
RS
177 fi
178done
91741841 179if [ x"${bogosities}" != x"" ]; then
f298f0d2 180 echo "The following .el files have no corresponding .elc files:"
8615e792
RS
181 echo "${bogosities}"
182fi
183rm -f /tmp/el /tmp/elc
184
f5674423 185### Check for .el files that would overflow the 14-char limit if compiled.
c2a3dd2e 186long=`find lisp leim -name '[a-zA-Z0-9]??????????*.el' -print`
f5674423
KH
187if [ "$long" != "" ]; then
188 echo "The following .el file names are too long:"
189 echo "$long"
190fi
191
b4e84d5d
JB
192### Make sure configure is newer than configure.in.
193if [ "x`ls -t configure configure.in | head -1`" != "xconfigure" ]; then
21764d60
KH
194 echo "\`./configure.in' is newer than \`./configure'" >&2
195 echo "Running autoconf" >&2
28335560 196 autoconf || { x=$?; echo Autoconf FAILED! >&2; exit $x; }
b4e84d5d
JB
197fi
198
c75cfabd
RS
199if [ $update = yes ];
200then
201 echo "Updating Info files"
980ab937 202
c75cfabd 203 (cd man; make info)
980ab937 204
e888d449 205 echo "Updating finder, custom and autoload data"
4f23c692 206
7cf45b04
RS
207 (cd lisp; make updates EMACS=$EMACS)
208
209 echo "Updating leim-list.el"
210
211 (cd leim; make leim-list.el EMACS=$EMACS)
29c98ed3
RS
212
213 echo "Recompiling Lisp files"
214
215 $EMACS -batch -f batch-byte-recompile-directory lisp leim
c75cfabd 216fi
0588a761 217
f07eebe0
KH
218echo "Making lisp/MANIFEST"
219
ce200cf3 220(cd lisp; head -1 [!=]*.el | grep '^;' | sed -e 's/;;; //' > MANIFEST)
f07eebe0 221
1260d6ba 222echo "Creating staging directory: \`${tempparent}'"
bb160193 223
f7dbcf3c 224mkdir ${tempparent}
f7dbcf3c
JB
225tempdir="${tempparent}/${emacsname}"
226
76fb0a58
JB
227### This trap ensures that the staging directory will be cleaned up even
228### when the script is interrupted in mid-career.
00c00348 229if [ "${clean_up}" = yes ]; then
21764d60 230 trap "echo 'Interrupted...cleaning up the staging directory'; rm -rf ${tempparent}; exit 1" 1 2 15
00c00348
ER
231fi
232
1260d6ba 233echo "Creating top directory: \`${tempdir}'"
f7dbcf3c
JB
234mkdir ${tempdir}
235
76fb0a58
JB
236### We copy in the top-level files before creating the subdirectories in
237### hopes that this will make the top-level files appear first in the
238### tar file; this means that people can start reading the INSTALL and
239### README while the rest of the tar file is still unpacking. Whoopee.
21764d60 240echo "Making links to top-level files"
525336b7 241ln GETTING.GNU.SOFTWARE INSTALL PROBLEMS README BUGS move-if-change ${tempdir}
ac4eff2d 242ln ChangeLog Makefile.in configure configure.in ${tempdir}
6f8b09f3 243ln config.bat make-dist update-subdirs vpath.sed ${tempdir}
bb160193 244### Copy these files; they're cross-filesystem symlinks.
a4888c88 245cp mkinstalldirs ${tempdir}
76fb0a58 246cp config.sub ${tempdir}
2ed56345 247cp config.guess ${tempdir}
bb160193 248cp install.sh ${tempdir}
f7dbcf3c 249
21764d60 250echo "Updating version number in README"
f753e9aa
JB
251(cd ${tempdir}
252 awk \
253 '$1 " " $2 " " $3 " " $4 " " $5 == "This directory tree holds version" { $6 = version; print $0 }
254 $1 " " $2 " " $3 " " $4 " " $5 != "This directory tree holds version"' \
255 version=${version} README > tmp.README
af559a4e 256 mv -f tmp.README README)
f753e9aa
JB
257
258
21764d60 259echo "Creating subdirectories"
91741841 260for subdir in lisp site-lisp leim real-leim real-leim/CXTERM-DIC \
5f8d02be 261 real-leim/SKK-DIC real-leim/skk real-leim/quail \
c660c0a7 262 src src/m src/s src/bitmaps lib-src oldXMenu lwlib \
e827bc37 263 nt nt/inc nt/inc/sys nt/inc/arpa nt/inc/netinet \
8e583b5d 264 etc etc/e lock cpp info man msdos vms; do
f7dbcf3c
JB
265 mkdir ${tempdir}/${subdir}
266done
267
91741841
RS
268echo "Initializing \`leim' subdirectory"
269cp leim-Makefile.in ${tempdir}/leim/Makefile.in
270
67ffab69 271echo "Making links to \`lisp' and its subdirectories"
7b9cd64c 272### Don't distribute TAGS, =*.el files, site-init.el, site-load.el, or default.el.
f7dbcf3c
JB
273(cd lisp
274 ln [a-zA-Z]*.el ../${tempdir}/lisp
275 ln [a-zA-Z]*.elc ../${tempdir}/lisp
8d2197ac 276 ln [a-zA-Z]*.dat ../${tempdir}/lisp
76fb0a58
JB
277 ## simula.el doesn't keep abbreviations in simula.defns any more.
278 ## ln [a-zA-Z]*.defns ../${tempdir}/lisp
3f7b30bf 279 ln ChangeLog Makefile makefile.nt ChangeLog.? README ../${tempdir}/lisp
67ffab69
RS
280 (cd ../${tempdir}/lisp
281 rm -f TAGS =*
282 rm -f site-init site-init.el site-init.elc
283 rm -f site-load site-load.el site-load.elc
284 rm -f site-start site-start.el site-start.elc
285 rm -f default default.el default.elc
286 )
287
288 ## Find all subdirs of lisp dir
289 for file in `find . -type d -print`; do
290 case $file in
762d80d1 291 . | .. | */Old | */RCS | */=*)
67ffab69
RS
292 ;;
293 *)
294 if [ -d $file ]; then
295 subdirs="$file $subdirs"
296 fi
297 ;;
298 esac
299 done
300
301 for file in $subdirs; do
302 echo " lisp/$file"
303 mkdir ../${tempdir}/lisp/$file
304 ln $file/[a-zA-Z]*.el ../${tempdir}/lisp/$file
305 ln $file/[a-zA-Z]*.elc ../${tempdir}/lisp/$file
306 if [ -f $file/README ]; then
307 ln $file/README ../${tempdir}/lisp/$file
308 fi
67ffab69 309 done )
a78c106d 310
91741841
RS
311echo "Making links to \`leim' and its subdirectories for the LEIM distribution"
312### Don't distribute TAGS, or =*.el files.
313(cd leim
314 ln Makefile.in makefile.nt ../${tempdir}/real-leim
9089d8d7 315 ln ChangeLog README ../${tempdir}/real-leim
91741841
RS
316
317 ln CXTERM-DIC/*.tit ../${tempdir}/real-leim/CXTERM-DIC
5f8d02be 318 ln SKK-DIC/README SKK-DIC/SKK-JISYO.L ../${tempdir}/real-leim/SKK-DIC
91741841
RS
319 ln skk/*.el skk/*.elc ../${tempdir}/real-leim/skk
320 ln quail/*.el quail/*.elc ../${tempdir}/real-leim/quail
321
322 cd ../${tempdir}/real-leim
323 rm -f TAGS =* */=*)
324
325### Move the real-leim directory outside of Emacs proper.
65fda17c
RS
326(cd ${tempparent}
327 mkdir ${emacsname}-leim
328 mkdir ${emacsname}-leim/${emacsname}
329 mv ${emacsname}/real-leim ${emacsname}-leim/${emacsname}/leim)
91741841 330
21764d60 331echo "Making links to \`src'"
76fb0a58 332### Don't distribute =*.[ch] files, or the configured versions of
c3f1e1a9 333### config.in, paths.in, or Makefile.in, or TAGS.
f7dbcf3c 334(cd src
c75cfabd 335 echo " (It is ok if ln fails in some cases.)"
f7dbcf3c
JB
336 ln [a-zA-Z]*.c ../${tempdir}/src
337 ln [a-zA-Z]*.h ../${tempdir}/src
338 ln [a-zA-Z]*.s ../${tempdir}/src
c75cfabd
RS
339 ln [a-zA-Z]*.in ../${tempdir}/src
340 ln [a-zA-Z]*.opt ../${tempdir}/src
341 ## If we ended up with a symlink, or if we did not get anything
342 ## due to a cross-device symlink, copy the file.
343 for file in [a-zA-Z]*.[hcs] [a-zA-Z]*.in [a-zA-Z]*.opt; do
344 if test -f ../${tempdir}/src/$file; then
345 # test -f appears to succeed for a symlink
346 if test -L ../${tempdir}/src/$file; then
347 rm ../${tempdir}/src/$file
62dfdaf0 348 cp -p $file ../${tempdir}/src
c75cfabd
RS
349 chmod a-w ../${tempdir}/src/$file
350 fi
351 else
352 rm ../${tempdir}/src/$file
62dfdaf0 353 cp -p $file ../${tempdir}/src
c75cfabd
RS
354 chmod a-w ../${tempdir}/src/$file
355 fi
356 done
357 ln README ChangeLog ChangeLog.*[0-9] ../${tempdir}/src
358 ln makefile.nt vms-pp.trans ../${tempdir}/src
990ee059 359 ln .gdbinit .dbxinit ../${tempdir}/src
f7dbcf3c 360 cd ../${tempdir}/src
a6903f09 361 rm -f config.h paths.h Makefile Makefile.c
7b9cd64c 362 rm -f =* TAGS)
f7dbcf3c 363
21764d60 364echo "Making links to \`src/bitmaps'"
690eca32
JB
365(cd src/bitmaps
366 ln README *.xbm ../../${tempdir}/src/bitmaps)
367
21764d60 368echo "Making links to \`src/m'"
f7dbcf3c 369(cd src/m
facbb78e
RS
370 # We call files for miscellaneous input (to linker etc) .inp.
371 ln README [a-zA-Z0-9]*.h *.inp ../../${tempdir}/src/m)
f7dbcf3c 372
21764d60 373echo "Making links to \`src/s'"
f7dbcf3c 374(cd src/s
77427171 375 ln README [a-zA-Z0-9]*.h ../../${tempdir}/src/s)
f7dbcf3c 376
21764d60 377echo "Making links to \`lib-src'"
f7dbcf3c 378(cd lib-src
375f1bd7 379 ln [a-zA-Z]*.[chy] ../${tempdir}/lib-src
c3f1e1a9 380 ln ChangeLog Makefile.in README testfile vcdiff ../${tempdir}/lib-src
391b3748 381 ln emacs.csh rcs2log rcs-checkin makefile.nt ../${tempdir}/lib-src
c75cfabd
RS
382 ## If we ended up with a symlink, or if we did not get anything
383 ## due to a cross-device symlink, copy the file.
384 for file in [a-zA-Z]*.[chy]; do
385 if test -f ../${tempdir}/lib-src/$file; then
386 # test -f appears to succeed for a symlink
387 if test -L ../${tempdir}/lib-src/$file; then
388 rm ../${tempdir}/lib-src/$file
389 cp $file ../${tempdir}/lib-src
390 chmod a-w ../${tempdir}/lib-src/$file
391 fi
392 else
393 rm ../${tempdir}/lib-src/$file
394 cp $file ../${tempdir}/lib-src
395 chmod a-w ../${tempdir}/lib-src/$file
396 fi
397 done
1260d6ba 398 cd ../${tempdir}/lib-src
c75cfabd 399 rm -f Makefile.c
7b9cd64c 400 rm -f =* TAGS)
f7dbcf3c 401
21764d60 402echo "Making links to \`nt'"
391b3748 403(cd nt
e827bc37 404 ln emacs.ico emacs.rc config.nt [a-z]*.in [a-z]*.c ../${tempdir}/nt
b47cc08a 405 ln [a-z]*.bat [a-z]*.h makefile.def makefile.nt ../${tempdir}/nt
3bb3cfe7 406 ln TODO ChangeLog INSTALL README ../${tempdir}/nt)
391b3748 407
21764d60 408echo "Making links to \`nt/inc'"
391b3748 409(cd nt/inc
77427171 410 ln [a-z]*.h ../../${tempdir}/nt/inc)
391b3748 411
21764d60 412echo "Making links to \`nt/inc/sys'"
391b3748 413(cd nt/inc/sys
77427171 414 ln [a-z]*.h ../../../${tempdir}/nt/inc/sys)
391b3748 415
e827bc37
RS
416echo "Making links to \`nt/inc/arpa'"
417(cd nt/inc/arpa
418 ln [a-z]*.h ../../../${tempdir}/nt/inc/arpa)
419
420echo "Making links to \`nt/inc/netinet'"
421(cd nt/inc/netinet
422 ln [a-z]*.h ../../../${tempdir}/nt/inc/netinet)
423
21764d60 424echo "Making links to \`msdos'"
52d7b2e5
RS
425(cd msdos
426 ln ChangeLog emacs.ico emacs.pif ../${tempdir}/msdos
7fd85d56 427 ln is_exec.c sigaction.c mainmake mainmake.v2 sed*.inp ../${tempdir}/msdos
52d7b2e5
RS
428 cd ../${tempdir}/msdos
429 rm -f =*)
430
21764d60 431echo "Making links to \`oldXMenu'"
f7dbcf3c 432(cd oldXMenu
8bdbf9ed 433 ln *.c *.h *.in ../${tempdir}/oldXMenu
df1ec566 434 ln README Imakefile ChangeLog ../${tempdir}/oldXMenu
f395c83a 435 ln compile.com descrip.mms ../${tempdir}/oldXMenu)
f7dbcf3c 436
21764d60 437echo "Making links to \`lwlib'"
c660c0a7
RS
438(cd lwlib
439 ln *.c *.h *.in ../${tempdir}/lwlib
72e7e784
KH
440 ln README Imakefile ChangeLog ../${tempdir}/lwlib
441 cd ../${tempdir}/lwlib
442 rm -f lwlib-Xol*)
c660c0a7 443
21764d60 444echo "Making links to \`etc'"
f395c83a
JB
445### Don't distribute = files, TAGS, DOC files, backups, autosaves, or
446### tex litter.
f7dbcf3c 447(cd etc
7a6ee7ae
RS
448 files=`ls -d * | grep -v 'RCS' | grep -v 'Old' | grep -v '^e$'`
449 ln $files ../${tempdir}/etc
98d4c1d0
RS
450 ## If we ended up with a symlink, or if we did not get anything
451 ## due to a cross-device symlink, copy the file.
7a6ee7ae 452 for file in $files; do
98d4c1d0
RS
453 if test -f ../${tempdir}/etc/$file; then
454 # test -f appears to succeed for a symlink
455 if test -L ../${tempdir}/etc/$file; then
456 rm ../${tempdir}/etc/$file
457 cp $file ../${tempdir}/etc
458 chmod a-w ../${tempdir}/etc/$file
459 fi
460 else
461 rm ../${tempdir}/etc/$file
462 cp $file ../${tempdir}/etc
463 chmod a-w ../${tempdir}/etc/$file
464 fi
465 done
f7dbcf3c 466 cd ../${tempdir}/etc
23a58692 467 rm -f DOC* *~ \#*\# *.dvi *.log *.orig *.rej *,v =* core
f395c83a 468 rm -f TAGS)
f7dbcf3c 469
21764d60 470echo "Making links to \`etc/e'"
f08ad882 471(cd etc/e
375f1bd7 472 ln `ls -d * | grep -v 'RCS'` ../../${tempdir}/etc/e
a6903f09 473 cd ../../${tempdir}/etc/e
375f1bd7 474 rm -f *~ \#*\# *,v =* core)
f08ad882 475
21764d60 476echo "Making links to \`cpp'"
fda4e8f6
JB
477(cd cpp
478 ln cccp.c cexp.y Makefile README ../${tempdir}/cpp)
479
21764d60 480echo "Making links to \`info'"
66afa119
RS
481# Don't distribute backups or autosaves.
482(cd info
483 ln [a-zA-Z]* ../${tempdir}/info
484 cd ../${tempdir}/info
485 # Avoid an error when expanding the wildcards later.
486 ln emacs dummy~ ; ln emacs \#dummy\#
487 rm -f *~ \#*\# core)
fda4e8f6 488
21764d60 489echo "Making links to \`man'"
fda4e8f6 490(cd man
298c8970 491 ln *.texi *.aux *.cps *.fns *.kys *.vrs ../${tempdir}/man
5e808bc0 492 test -f README && ln README ../${tempdir}/man
f08ad882 493 test -f Makefile.in && ln Makefile.in ../${tempdir}/man
56c31c87 494 ln ChangeLog split-man ../${tempdir}/man
375f1bd7 495 cp texinfo.tex ../${tempdir}/man
4f8cc93a 496 cd ../${tempdir}/man
56c31c87
RS
497 rm -f \#*\# =* *~ core emacs-index* *.Z *.z xmail
498 rm -f emacs.?? termcap.?? gdb.?? *.log *.toc *.dvi *.oaux)
f7dbcf3c 499
21764d60 500echo "Making links to \`vms'"
40eef465
JB
501(cd vms
502 ln [0-9a-zA-Z]* ../${tempdir}/vms
503 cd ../${tempdir}/vms
504 rm -f *~)
505
c87b230f
JB
506### It would be nice if they could all be symlinks to etc's copy, but
507### you're not supposed to have any symlinks in distribution tar files.
21764d60 508echo "Making sure copying notices are all copies of \`etc/COPYING'"
1260d6ba
ER
509rm -f ${tempdir}/etc/COPYING
510cp etc/COPYING ${tempdir}/etc/COPYING
8e583b5d 511for subdir in lisp src lib-src info msdos; do
f7dbcf3c
JB
512 if [ -f ${tempdir}/${subdir}/COPYING ]; then
513 rm ${tempdir}/${subdir}/COPYING
514 fi
96858c42 515 cp etc/COPYING ${tempdir}/${subdir}
f7dbcf3c
JB
516done
517
5b8def65
JB
518#### Make sure that there aren't any hard links between files in the
519#### distribution; people with afs can't deal with that. Okay,
520#### actually we just re-copy anything with a link count greater
375f1bd7
KH
521#### than two. (Yes, strictly greater than 2 is correct; since we
522#### created these files by linking them in from the original tree,
523#### they'll have exactly two links normally.)
bb7e0f81 524####
908ff139 525#### Commented out since it's not strictly necessary; it should suffice
bb7e0f81 526#### to just break the link on alloca.c.
9b23a6c7
RS
527#echo "Breaking intra-tree links."
528#find ${tempdir} ! -type d -links +2 \
529# -exec cp -p {} $$ \; -exec rm -f {} \; -exec mv $$ {} \;
bb7e0f81
KH
530rm -f $tempdir/lib-src/alloca.c
531cp $tempdir/src/alloca.c $tempdir/lib-src/alloca.c
5b8def65 532
1260d6ba 533if [ "${newer}" ]; then
21764d60 534 echo "Removing files older than $newer"
76fb0a58
JB
535 ## We remove .elc files unconditionally, on the theory that anyone picking
536 ## up an incremental distribution already has a running Emacs to byte-compile
537 ## them with.
1260d6ba
ER
538 find ${tempparent} \( -name '*.elc' -o ! -newer ${newer} \) -exec rm -f {} \;
539fi
540
4746118a 541if [ "${make_tar}" = yes ]; then
922ac4c5 542 if [ "${default_gzip}" = "" ]; then
21764d60 543 echo "Looking for gzip"
922ac4c5
JB
544 temppath=`echo $PATH | sed 's/^:/.:/
545 s/::/:.:/g
546 s/:$/:./
547 s/:/ /g'`
548 default_gzip=`(
549 for dir in ${temppath}; do
550 if [ -f ${dir}/gzip ]; then echo 'gzip --best'; exit 0; fi
551 done
552 echo compress
553 )`
554 fi
f395c83a
JB
555 case "${default_gzip}" in
556 compress* ) gzip_extension=.Z ;;
0dc610dd 557 * ) gzip_extension=.gz ;;
f395c83a 558 esac
91741841 559 echo "Creating tar files"
f395c83a
JB
560 (cd ${tempparent} ; tar cvf - ${emacsname} ) \
561 | ${default_gzip} \
562 > ${emacsname}.tar${gzip_extension}
65fda17c 563 (cd ${tempparent}/${emacsname}-leim ; tar cvf - ${emacsname} ) \
91741841
RS
564 | ${default_gzip} \
565 > ${emacsname}-leim.tar${gzip_extension}
4746118a 566fi
f7dbcf3c 567
4746118a 568if [ "${clean_up}" = yes ]; then
21764d60 569 echo "Cleaning up the staging directory"
f395c83a 570 rm -rf ${tempparent}
bb160193 571else
91741841 572 (cd ${tempparent}; mv ${emacsname} ${emacsname}-leim ..)
bb160193 573 rm -rf ${tempparent}
f7dbcf3c 574fi
00c00348 575
76fb0a58 576### make-dist ends here