(find-buffer-file-type-coding-system):
[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
67ffab69
RS
36## Don't protect any files.
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.
7a6ee7ae
RS
147ls -1 lisp/[a-z]*.el lisp/[a-z]*/[a-z]*.el | sed 's/\.el$/.elc/' > /tmp/el
148ls -1 lisp/[a-z]*.elc lisp/[a-z]*/[a-z]*.elc > /tmp/elc
254e10d8
JB
149bogosities="`comm -13 /tmp/el /tmp/elc`"
150if [ "${bogosities}" != "" ]; then
151 echo "The following .elc files have no corresponding .el files:"
152 echo "${bogosities}"
153fi
8f731fcc 154rm -f /tmp/el /tmp/elc
9f7602fd 155
8615e792 156### Check for .el files with no corresponding .elc file.
7a6ee7ae
RS
157(cd lisp; ls -1 [a-z]*.el [a-z]*/[a-z]*.el) > /tmp/el
158(cd lisp; ls -1 [a-z]*.elc [a-z]*/[a-z]*.elc) | sed 's/\.elc$/.el/' > /tmp/elc
8615e792 159losers="`comm -23 /tmp/el /tmp/elc`"
f298f0d2 160bogosities=
8615e792 161for file in $losers; do
b32ce17b
RS
162 file1=`echo $file | sed -e "s|.*/||"`
163 if ! grep -q "dontcompilefiles:.* $file1\($\| \)" lisp/Makefile; then
164 case $file in
165 site-init.el | site-load.el | site-start.el | default.el)
166 ;;
167 term/*)
168 ;;
169 *)
170 bogosities="$file $bogosities"
171 ;;
172 esac
8615e792
RS
173 fi
174done
91741841 175if [ x"${bogosities}" != x"" ]; then
f298f0d2 176 echo "The following .el files have no corresponding .elc files:"
8615e792
RS
177 echo "${bogosities}"
178fi
179rm -f /tmp/el /tmp/elc
180
f5674423 181### Check for .el files that would overflow the 14-char limit if compiled.
544174d9 182long=`find lisp -name '[a-zA-Z0-9]??????????*.el' -print`
f5674423
KH
183if [ "$long" != "" ]; then
184 echo "The following .el file names are too long:"
185 echo "$long"
186fi
187
b4e84d5d
JB
188### Make sure configure is newer than configure.in.
189if [ "x`ls -t configure configure.in | head -1`" != "xconfigure" ]; then
21764d60
KH
190 echo "\`./configure.in' is newer than \`./configure'" >&2
191 echo "Running autoconf" >&2
28335560 192 autoconf || { x=$?; echo Autoconf FAILED! >&2; exit $x; }
b4e84d5d
JB
193fi
194
c75cfabd
RS
195if [ $update = yes ];
196then
197 echo "Updating Info files"
980ab937 198
c75cfabd 199 (cd man; make info)
980ab937 200
c75cfabd 201 echo "Recompiling Lisp files"
21764d60 202
c75cfabd 203 $EMACS -batch -f batch-byte-recompile-directory lisp
21764d60 204
e888d449 205 echo "Updating finder, custom and autoload data"
4f23c692 206
e888d449 207 (cd lisp; make updates)
c75cfabd 208fi
0588a761 209
f07eebe0
KH
210echo "Making lisp/MANIFEST"
211
ce200cf3 212(cd lisp; head -1 [!=]*.el | grep '^;' | sed -e 's/;;; //' > MANIFEST)
f07eebe0 213
1260d6ba 214echo "Creating staging directory: \`${tempparent}'"
bb160193 215
f7dbcf3c 216mkdir ${tempparent}
f7dbcf3c
JB
217tempdir="${tempparent}/${emacsname}"
218
76fb0a58
JB
219### This trap ensures that the staging directory will be cleaned up even
220### when the script is interrupted in mid-career.
00c00348 221if [ "${clean_up}" = yes ]; then
21764d60 222 trap "echo 'Interrupted...cleaning up the staging directory'; rm -rf ${tempparent}; exit 1" 1 2 15
00c00348
ER
223fi
224
1260d6ba 225echo "Creating top directory: \`${tempdir}'"
f7dbcf3c
JB
226mkdir ${tempdir}
227
76fb0a58
JB
228### We copy in the top-level files before creating the subdirectories in
229### hopes that this will make the top-level files appear first in the
230### tar file; this means that people can start reading the INSTALL and
231### README while the rest of the tar file is still unpacking. Whoopee.
21764d60 232echo "Making links to top-level files"
525336b7 233ln GETTING.GNU.SOFTWARE INSTALL PROBLEMS README BUGS move-if-change ${tempdir}
ac4eff2d 234ln ChangeLog Makefile.in configure configure.in ${tempdir}
6f8b09f3 235ln config.bat make-dist update-subdirs vpath.sed ${tempdir}
bb160193 236### Copy these files; they're cross-filesystem symlinks.
a4888c88 237cp mkinstalldirs ${tempdir}
76fb0a58 238cp config.sub ${tempdir}
2ed56345 239cp config.guess ${tempdir}
bb160193 240cp install.sh ${tempdir}
f7dbcf3c 241
21764d60 242echo "Updating version number in README"
f753e9aa
JB
243(cd ${tempdir}
244 awk \
245 '$1 " " $2 " " $3 " " $4 " " $5 == "This directory tree holds version" { $6 = version; print $0 }
246 $1 " " $2 " " $3 " " $4 " " $5 != "This directory tree holds version"' \
247 version=${version} README > tmp.README
248 mv tmp.README README)
249
250
21764d60 251echo "Creating subdirectories"
91741841
RS
252for subdir in lisp site-lisp leim real-leim real-leim/CXTERM-DIC \
253 real-leim/SKK real-leim/skk real-leim/quail \
c660c0a7 254 src src/m src/s src/bitmaps lib-src oldXMenu lwlib \
e827bc37 255 nt nt/inc nt/inc/sys nt/inc/arpa nt/inc/netinet \
8e583b5d 256 etc etc/e lock cpp info man msdos vms; do
f7dbcf3c
JB
257 mkdir ${tempdir}/${subdir}
258done
259
91741841
RS
260echo "Initializing \`leim' subdirectory"
261cp leim-Makefile.in ${tempdir}/leim/Makefile.in
262
67ffab69 263echo "Making links to \`lisp' and its subdirectories"
7b9cd64c 264### Don't distribute TAGS, =*.el files, site-init.el, site-load.el, or default.el.
f7dbcf3c
JB
265(cd lisp
266 ln [a-zA-Z]*.el ../${tempdir}/lisp
267 ln [a-zA-Z]*.elc ../${tempdir}/lisp
8d2197ac 268 ln [a-zA-Z]*.dat ../${tempdir}/lisp
76fb0a58
JB
269 ## simula.el doesn't keep abbreviations in simula.defns any more.
270 ## ln [a-zA-Z]*.defns ../${tempdir}/lisp
3f7b30bf 271 ln ChangeLog Makefile makefile.nt ChangeLog.? README ../${tempdir}/lisp
67ffab69
RS
272 (cd ../${tempdir}/lisp
273 rm -f TAGS =*
274 rm -f site-init site-init.el site-init.elc
275 rm -f site-load site-load.el site-load.elc
276 rm -f site-start site-start.el site-start.elc
277 rm -f default default.el default.elc
278 )
279
280 ## Find all subdirs of lisp dir
281 for file in `find . -type d -print`; do
282 case $file in
762d80d1 283 . | .. | */Old | */RCS | */=*)
67ffab69
RS
284 ;;
285 *)
286 if [ -d $file ]; then
287 subdirs="$file $subdirs"
288 fi
289 ;;
290 esac
291 done
292
293 for file in $subdirs; do
294 echo " lisp/$file"
295 mkdir ../${tempdir}/lisp/$file
296 ln $file/[a-zA-Z]*.el ../${tempdir}/lisp/$file
297 ln $file/[a-zA-Z]*.elc ../${tempdir}/lisp/$file
298 if [ -f $file/README ]; then
299 ln $file/README ../${tempdir}/lisp/$file
300 fi
67ffab69 301 done )
a78c106d 302
91741841
RS
303echo "Making links to \`leim' and its subdirectories for the LEIM distribution"
304### Don't distribute TAGS, or =*.el files.
305(cd leim
306 ln Makefile.in makefile.nt ../${tempdir}/real-leim
307 ln ChangeLog.? README ../${tempdir}/real-leim
308
309 ln CXTERM-DIC/*.tit ../${tempdir}/real-leim/CXTERM-DIC
310 ln SKK/README SKK/SKK-JISYO.L ../${tempdir}/real-leim/SKK
311 ln skk/*.el skk/*.elc ../${tempdir}/real-leim/skk
312 ln quail/*.el quail/*.elc ../${tempdir}/real-leim/quail
313
314 cd ../${tempdir}/real-leim
315 rm -f TAGS =* */=*)
316
317### Move the real-leim directory outside of Emacs proper.
65fda17c
RS
318(cd ${tempparent}
319 mkdir ${emacsname}-leim
320 mkdir ${emacsname}-leim/${emacsname}
321 mv ${emacsname}/real-leim ${emacsname}-leim/${emacsname}/leim)
91741841 322
21764d60 323echo "Making links to \`src'"
76fb0a58 324### Don't distribute =*.[ch] files, or the configured versions of
c3f1e1a9 325### config.in, paths.in, or Makefile.in, or TAGS.
f7dbcf3c 326(cd src
c75cfabd 327 echo " (It is ok if ln fails in some cases.)"
f7dbcf3c
JB
328 ln [a-zA-Z]*.c ../${tempdir}/src
329 ln [a-zA-Z]*.h ../${tempdir}/src
330 ln [a-zA-Z]*.s ../${tempdir}/src
c75cfabd
RS
331 ln [a-zA-Z]*.in ../${tempdir}/src
332 ln [a-zA-Z]*.opt ../${tempdir}/src
333 ## If we ended up with a symlink, or if we did not get anything
334 ## due to a cross-device symlink, copy the file.
335 for file in [a-zA-Z]*.[hcs] [a-zA-Z]*.in [a-zA-Z]*.opt; do
336 if test -f ../${tempdir}/src/$file; then
337 # test -f appears to succeed for a symlink
338 if test -L ../${tempdir}/src/$file; then
339 rm ../${tempdir}/src/$file
340 cp $file ../${tempdir}/src
341 chmod a-w ../${tempdir}/src/$file
342 fi
343 else
344 rm ../${tempdir}/src/$file
345 cp $file ../${tempdir}/src
346 chmod a-w ../${tempdir}/src/$file
347 fi
348 done
349 ln README ChangeLog ChangeLog.*[0-9] ../${tempdir}/src
350 ln makefile.nt vms-pp.trans ../${tempdir}/src
990ee059 351 ln .gdbinit .dbxinit ../${tempdir}/src
f7dbcf3c 352 cd ../${tempdir}/src
a6903f09 353 rm -f config.h paths.h Makefile Makefile.c
7b9cd64c 354 rm -f =* TAGS)
f7dbcf3c 355
21764d60 356echo "Making links to \`src/bitmaps'"
690eca32
JB
357(cd src/bitmaps
358 ln README *.xbm ../../${tempdir}/src/bitmaps)
359
21764d60 360echo "Making links to \`src/m'"
f7dbcf3c 361(cd src/m
facbb78e
RS
362 # We call files for miscellaneous input (to linker etc) .inp.
363 ln README [a-zA-Z0-9]*.h *.inp ../../${tempdir}/src/m)
f7dbcf3c 364
21764d60 365echo "Making links to \`src/s'"
f7dbcf3c 366(cd src/s
77427171 367 ln README [a-zA-Z0-9]*.h ../../${tempdir}/src/s)
f7dbcf3c 368
21764d60 369echo "Making links to \`lib-src'"
f7dbcf3c 370(cd lib-src
375f1bd7 371 ln [a-zA-Z]*.[chy] ../${tempdir}/lib-src
c3f1e1a9 372 ln ChangeLog Makefile.in README testfile vcdiff ../${tempdir}/lib-src
391b3748 373 ln emacs.csh rcs2log rcs-checkin makefile.nt ../${tempdir}/lib-src
c75cfabd
RS
374 ## If we ended up with a symlink, or if we did not get anything
375 ## due to a cross-device symlink, copy the file.
376 for file in [a-zA-Z]*.[chy]; do
377 if test -f ../${tempdir}/lib-src/$file; then
378 # test -f appears to succeed for a symlink
379 if test -L ../${tempdir}/lib-src/$file; then
380 rm ../${tempdir}/lib-src/$file
381 cp $file ../${tempdir}/lib-src
382 chmod a-w ../${tempdir}/lib-src/$file
383 fi
384 else
385 rm ../${tempdir}/lib-src/$file
386 cp $file ../${tempdir}/lib-src
387 chmod a-w ../${tempdir}/lib-src/$file
388 fi
389 done
1260d6ba 390 cd ../${tempdir}/lib-src
c75cfabd 391 rm -f Makefile.c
7b9cd64c 392 rm -f =* TAGS)
f7dbcf3c 393
21764d60 394echo "Making links to \`nt'"
391b3748 395(cd nt
e827bc37 396 ln emacs.ico emacs.rc config.nt [a-z]*.in [a-z]*.c ../${tempdir}/nt
b47cc08a 397 ln [a-z]*.bat [a-z]*.h makefile.def makefile.nt ../${tempdir}/nt
3bb3cfe7 398 ln TODO ChangeLog INSTALL README ../${tempdir}/nt)
391b3748 399
21764d60 400echo "Making links to \`nt/inc'"
391b3748 401(cd nt/inc
77427171 402 ln [a-z]*.h ../../${tempdir}/nt/inc)
391b3748 403
21764d60 404echo "Making links to \`nt/inc/sys'"
391b3748 405(cd nt/inc/sys
77427171 406 ln [a-z]*.h ../../../${tempdir}/nt/inc/sys)
391b3748 407
e827bc37
RS
408echo "Making links to \`nt/inc/arpa'"
409(cd nt/inc/arpa
410 ln [a-z]*.h ../../../${tempdir}/nt/inc/arpa)
411
412echo "Making links to \`nt/inc/netinet'"
413(cd nt/inc/netinet
414 ln [a-z]*.h ../../../${tempdir}/nt/inc/netinet)
415
21764d60 416echo "Making links to \`msdos'"
52d7b2e5
RS
417(cd msdos
418 ln ChangeLog emacs.ico emacs.pif ../${tempdir}/msdos
7fd85d56 419 ln is_exec.c sigaction.c mainmake mainmake.v2 sed*.inp ../${tempdir}/msdos
52d7b2e5
RS
420 cd ../${tempdir}/msdos
421 rm -f =*)
422
21764d60 423echo "Making links to \`oldXMenu'"
f7dbcf3c 424(cd oldXMenu
8bdbf9ed 425 ln *.c *.h *.in ../${tempdir}/oldXMenu
df1ec566 426 ln README Imakefile ChangeLog ../${tempdir}/oldXMenu
f395c83a 427 ln compile.com descrip.mms ../${tempdir}/oldXMenu)
f7dbcf3c 428
21764d60 429echo "Making links to \`lwlib'"
c660c0a7
RS
430(cd lwlib
431 ln *.c *.h *.in ../${tempdir}/lwlib
72e7e784
KH
432 ln README Imakefile ChangeLog ../${tempdir}/lwlib
433 cd ../${tempdir}/lwlib
434 rm -f lwlib-Xol*)
c660c0a7 435
21764d60 436echo "Making links to \`etc'"
f395c83a
JB
437### Don't distribute = files, TAGS, DOC files, backups, autosaves, or
438### tex litter.
f7dbcf3c 439(cd etc
7a6ee7ae
RS
440 files=`ls -d * | grep -v 'RCS' | grep -v 'Old' | grep -v '^e$'`
441 ln $files ../${tempdir}/etc
98d4c1d0
RS
442 ## If we ended up with a symlink, or if we did not get anything
443 ## due to a cross-device symlink, copy the file.
7a6ee7ae 444 for file in $files; do
98d4c1d0
RS
445 if test -f ../${tempdir}/etc/$file; then
446 # test -f appears to succeed for a symlink
447 if test -L ../${tempdir}/etc/$file; then
448 rm ../${tempdir}/etc/$file
449 cp $file ../${tempdir}/etc
450 chmod a-w ../${tempdir}/etc/$file
451 fi
452 else
453 rm ../${tempdir}/etc/$file
454 cp $file ../${tempdir}/etc
455 chmod a-w ../${tempdir}/etc/$file
456 fi
457 done
f7dbcf3c 458 cd ../${tempdir}/etc
23a58692 459 rm -f DOC* *~ \#*\# *.dvi *.log *.orig *.rej *,v =* core
f395c83a 460 rm -f TAGS)
f7dbcf3c 461
21764d60 462echo "Making links to \`etc/e'"
f08ad882 463(cd etc/e
375f1bd7 464 ln `ls -d * | grep -v 'RCS'` ../../${tempdir}/etc/e
a6903f09 465 cd ../../${tempdir}/etc/e
375f1bd7 466 rm -f *~ \#*\# *,v =* core)
f08ad882 467
21764d60 468echo "Making links to \`cpp'"
fda4e8f6
JB
469(cd cpp
470 ln cccp.c cexp.y Makefile README ../${tempdir}/cpp)
471
21764d60 472echo "Making links to \`info'"
66afa119
RS
473# Don't distribute backups or autosaves.
474(cd info
475 ln [a-zA-Z]* ../${tempdir}/info
476 cd ../${tempdir}/info
477 # Avoid an error when expanding the wildcards later.
478 ln emacs dummy~ ; ln emacs \#dummy\#
479 rm -f *~ \#*\# core)
fda4e8f6 480
21764d60 481echo "Making links to \`man'"
fda4e8f6 482(cd man
298c8970 483 ln *.texi *.aux *.cps *.fns *.kys *.vrs ../${tempdir}/man
5e808bc0 484 test -f README && ln README ../${tempdir}/man
f08ad882 485 test -f Makefile.in && ln Makefile.in ../${tempdir}/man
56c31c87 486 ln ChangeLog split-man ../${tempdir}/man
375f1bd7 487 cp texinfo.tex ../${tempdir}/man
4f8cc93a 488 cd ../${tempdir}/man
56c31c87
RS
489 rm -f \#*\# =* *~ core emacs-index* *.Z *.z xmail
490 rm -f emacs.?? termcap.?? gdb.?? *.log *.toc *.dvi *.oaux)
f7dbcf3c 491
21764d60 492echo "Making links to \`vms'"
40eef465
JB
493(cd vms
494 ln [0-9a-zA-Z]* ../${tempdir}/vms
495 cd ../${tempdir}/vms
496 rm -f *~)
497
c87b230f
JB
498### It would be nice if they could all be symlinks to etc's copy, but
499### you're not supposed to have any symlinks in distribution tar files.
21764d60 500echo "Making sure copying notices are all copies of \`etc/COPYING'"
1260d6ba
ER
501rm -f ${tempdir}/etc/COPYING
502cp etc/COPYING ${tempdir}/etc/COPYING
8e583b5d 503for subdir in lisp src lib-src info msdos; do
f7dbcf3c
JB
504 if [ -f ${tempdir}/${subdir}/COPYING ]; then
505 rm ${tempdir}/${subdir}/COPYING
506 fi
96858c42 507 cp etc/COPYING ${tempdir}/${subdir}
f7dbcf3c
JB
508done
509
5b8def65
JB
510#### Make sure that there aren't any hard links between files in the
511#### distribution; people with afs can't deal with that. Okay,
512#### actually we just re-copy anything with a link count greater
375f1bd7
KH
513#### than two. (Yes, strictly greater than 2 is correct; since we
514#### created these files by linking them in from the original tree,
515#### they'll have exactly two links normally.)
bb7e0f81 516####
908ff139 517#### Commented out since it's not strictly necessary; it should suffice
bb7e0f81 518#### to just break the link on alloca.c.
9b23a6c7
RS
519#echo "Breaking intra-tree links."
520#find ${tempdir} ! -type d -links +2 \
521# -exec cp -p {} $$ \; -exec rm -f {} \; -exec mv $$ {} \;
bb7e0f81
KH
522rm -f $tempdir/lib-src/alloca.c
523cp $tempdir/src/alloca.c $tempdir/lib-src/alloca.c
5b8def65 524
1260d6ba 525if [ "${newer}" ]; then
21764d60 526 echo "Removing files older than $newer"
76fb0a58
JB
527 ## We remove .elc files unconditionally, on the theory that anyone picking
528 ## up an incremental distribution already has a running Emacs to byte-compile
529 ## them with.
1260d6ba
ER
530 find ${tempparent} \( -name '*.elc' -o ! -newer ${newer} \) -exec rm -f {} \;
531fi
532
4746118a 533if [ "${make_tar}" = yes ]; then
922ac4c5 534 if [ "${default_gzip}" = "" ]; then
21764d60 535 echo "Looking for gzip"
922ac4c5
JB
536 temppath=`echo $PATH | sed 's/^:/.:/
537 s/::/:.:/g
538 s/:$/:./
539 s/:/ /g'`
540 default_gzip=`(
541 for dir in ${temppath}; do
542 if [ -f ${dir}/gzip ]; then echo 'gzip --best'; exit 0; fi
543 done
544 echo compress
545 )`
546 fi
f395c83a
JB
547 case "${default_gzip}" in
548 compress* ) gzip_extension=.Z ;;
0dc610dd 549 * ) gzip_extension=.gz ;;
f395c83a 550 esac
91741841 551 echo "Creating tar files"
f395c83a
JB
552 (cd ${tempparent} ; tar cvf - ${emacsname} ) \
553 | ${default_gzip} \
554 > ${emacsname}.tar${gzip_extension}
65fda17c 555 (cd ${tempparent}/${emacsname}-leim ; tar cvf - ${emacsname} ) \
91741841
RS
556 | ${default_gzip} \
557 > ${emacsname}-leim.tar${gzip_extension}
4746118a 558fi
f7dbcf3c 559
4746118a 560if [ "${clean_up}" = yes ]; then
21764d60 561 echo "Cleaning up the staging directory"
f395c83a 562 rm -rf ${tempparent}
bb160193 563else
91741841 564 (cd ${tempparent}; mv ${emacsname} ${emacsname}-leim ..)
bb160193 565 rm -rf ${tempparent}
f7dbcf3c 566fi
00c00348 567
76fb0a58 568### make-dist ends here