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