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