* etc/images/README: Add (un)checked.xpm
[bpt/emacs.git] / make-dist
CommitLineData
f7dbcf3c 1#!/bin/sh
baf81c55 2### make-dist: create an Emacs distribution tar file from current srcdir
76fb0a58 3
baf81c55
GM
4## Copyright (C) 1995, 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005,
5## 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
f7dbcf3c 6
baf81c55 7## This file is part of GNU Emacs.
b33ba812 8
baf81c55
GM
9## GNU Emacs is free software: you can redistribute it and/or modify
10## it under the terms of the GNU General Public License as published by
11## the Free Software Foundation, either version 3 of the License, or
12## (at your option) any later version.
b33ba812 13
baf81c55
GM
14## GNU Emacs is distributed in the hope that it will be useful,
15## but WITHOUT ANY WARRANTY; without even the implied warranty of
16## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17## GNU General Public License for more details.
b33ba812 18
baf81c55
GM
19## You should have received a copy of the GNU General Public License
20## along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
b33ba812 21
baf81c55
GM
22### Commentary:
23
24## This basically creates a duplicate directory structure, and then
25## hard links into it only those files that should be distributed.
26## This means that if you add a file with an odd name, you should make
27## sure that this script will include it.
28
29### Code:
4c9c1174 30
f7dbcf3c
JB
31progname="$0"
32
76fb0a58 33### Exit if a command fails.
8c28d444 34#set -e
f7dbcf3c 35
76fb0a58 36### Print out each line we read, for debugging's sake.
8c28d444 37#set -v
f7dbcf3c 38
8df317a6
GM
39LANGUAGE=C
40LC_ALL=C
41LC_MESSAGES=
42LANG=
43export LANGUAGE LC_ALL LC_MESSAGES LANG
44
ccd57f4d 45## Don't restrict access to any files.
67ffab69
RS
46umask 0
47
c75cfabd 48update=yes
e4e1c623 49check=yes
f22edcea
RS
50clean_up=no
51make_tar=no
b9f56298 52default_gzip=gzip
1260d6ba 53newer=""
f7dbcf3c
JB
54
55while [ $# -gt 0 ]; do
56 case "$1" in
f22edcea
RS
57 ## This option tells make-dist to delete the staging directory
58 ## when done. It is useless to use this unless you make a tar file.
59 "--clean-up" )
60 clean_up=yes
4746118a 61 ;;
f22edcea
RS
62 ## This option tells make-dist to make a tar file.
63 "--tar" )
64 make_tar=yes
f7dbcf3c 65 ;;
c75cfabd
RS
66 ## This option tells make-dist not to recompile or do analogous things.
67 "--no-update" )
68 update=no
69 ;;
e4e1c623
RS
70 ## This option says don't check for bad file names, etc.
71 "--no-check" )
72 check=no
73 ;;
76fb0a58 74 ## This option tells make-dist to make the distribution normally, then
7b9cd64c
ER
75 ## remove all files older than the given timestamp file. This is useful
76 ## for creating incremental or patch distributions.
1260d6ba 77 "--newer")
ef15f270
JB
78 newer="$2"
79 new_extension=".new"
1260d6ba
ER
80 shift
81 ;;
b9f56298 82 ## This option tells make-dist to use `bzip2' instead of gzip.
37d6e313
RF
83 "--bzip2")
84 default_gzip="bzip2"
85 ;;
ed398055
GM
86 ## Same with lzma.
87 "--lzma")
88 default_gzip="lzma"
89 ;;
2a714d4e
GM
90
91 "--snapshot")
92 clean_up=yes
93 make_tar=yes
94 update=no
95 check=no
96 ;;
97
98 "--help")
99 echo "Usage: ${progname} [options]"
100 echo ""
8772b5a8 101 echo " --bzip2 use bzip2 instead of gzip"
2a714d4e 102 echo " --clean-up delete staging directories when done"
8772b5a8 103 echo " --lzma use lzma instead of gzip"
2a714d4e
GM
104 echo " --newer=TIME don't include files older than TIME"
105 echo " --no-check don't check for bad file names etc."
106 echo " --no-update don't recompile or do analogous things"
107 echo " --snapshot same as --clean-up --no-update --tar --no-check"
108 echo " --tar make a tar file"
109 echo ""
110 exit 0
111 ;;
112
f7dbcf3c
JB
113 * )
114 echo "${progname}: Unrecognized argument: $1" >&2
115 exit 1
116 ;;
117 esac
118 shift
119done
120
76fb0a58 121### Make sure we're running in the right place.
c17e9c60
RF
122if [ ! -d src -o ! -f src/lisp.h -o ! -d lisp -o ! -f lisp/subr.el ]; then
123 echo "${progname}: Can't find \`src/lisp.h' and \`lisp/subr.el'." >&2
1260d6ba 124 echo "${progname} must be run in the top directory of the Emacs" >&2
0d122844 125 echo "distribution tree. cd to that directory and try again." >&2
f7dbcf3c
JB
126 exit 1
127fi
128
c75cfabd 129### Find where to run Emacs.
4b1aaa8b 130### (Accept only absolute file names.)
c75cfabd
RS
131if [ $update = yes ];
132then
59d05d2d 133 unset EMACS_UNIBYTE
c75cfabd
RS
134 if [ -f src/emacs ];
135 then
136 EMACS=`pwd`/src/emacs
137 else
4b1aaa8b
PE
138 case $EMACS in
139 /*) ;;
140 *)
141 if [ ! -f "$EMACS" ]; then
2906a94c 142 echo "$0: You must set the EMACS environment variable " \
4b1aaa8b
PE
143 "to an absolute file name." 2>&1
144 exit 1
145 fi;;
146 esac
c75cfabd
RS
147 fi
148fi
149
76fb0a58 150### Find out which version of Emacs this is.
3868ea09 151version=`sed -n '/char emacs_version/ s/^[^"]*"\([^"]*\)".*$/\1/p' src/emacs.c`
f7dbcf3c 152if [ ! "${version}" ]; then
c17e9c60 153 echo "${progname}: can't find current Emacs version in \`./src/emacs.c'" >&2
f7dbcf3c
JB
154 exit 1
155fi
156
37ea9179 157echo Version number is $version
47d105b0 158
b9f56298
GM
159if [ $update = yes ]; then
160 if ! grep -q "@set EMACSVER *${version}" doc/emacs/emacsver.texi || \
161 ! grep -q "tree holds version *${version}" README; then
162 echo "WARNING: README and/or emacsver.texi have the wrong version number"
163 echo "Consider running M-x set-version from admin/admin.el"
c75cfabd
RS
164 sleep 5
165 fi
f753e9aa
JB
166fi
167
bb160193
RS
168### Make sure we don't already have a directory emacs-${version}.
169
170emacsname="emacs-${version}${new_extension}"
171
172if [ -d ${emacsname} ]
173then
174 echo Directory "${emacsname}" already exists >&2
175 exit 1
176fi
177
76fb0a58 178### Make sure the subdirectory is available.
1260d6ba 179tempparent="make-dist.tmp.$$"
f7dbcf3c 180if [ -d ${tempparent} ]; then
1260d6ba
ER
181 echo "${progname}: staging directory \`${tempparent}' already exists.
182Perhaps a previous invocation of \`${progname}' failed to clean up after
183itself. Check that directories whose names are of the form
184\`make-dist.tmp.NNNNN' don't contain any important information, remove
185them, and try again." >&2
f7dbcf3c
JB
186 exit 1
187fi
188
f3dd02ea 189if [ $check = yes ]; then
fb0797ca 190 ls -1 lisp/[a-zA-Z]*.el lisp/[a-z]*/[a-zA-Z0-9]*.el \
7b1b676d
GM
191 lisp/[a-z]*/[a-z]*/[a-zA-Z0-9]*.el \
192 lisp/[a-z]*/[a-z]*/[a-z]*/[a-zA-Z0-9]*.el \
f3dd02ea
GM
193 leim/[a-z]*/[a-z]*.el > /tmp/el
194
fb0797ca 195 ls -1 lisp/[a-zA-Z]*.elc lisp/[a-z]*/[a-zA-Z0-9]*.elc \
7b1b676d
GM
196 lisp/[a-z]*/[a-z]*/[a-zA-Z0-9]*.elc \
197 lisp/[a-z]*/[a-z]*/[a-z]*/[a-zA-Z0-9]*.elc \
5eea385d 198 leim/[a-z]*/[a-z]*.elc > /tmp/elc
f3dd02ea
GM
199
200 ## Check for .elc files with no corresponding .el file.
201 sed 's/\.el$/.elc/' /tmp/el > /tmp/elelc
202
203 bogosities="`comm -13 /tmp/elelc /tmp/elc`"
204 if [ x"${bogosities}" != x"" ]; then
e4e1c623
RS
205 echo "The following .elc files have no corresponding .el files:"
206 echo "${bogosities}"
8615e792 207 fi
e4e1c623
RS
208
209 ### Check for .el files with no corresponding .elc file.
f3dd02ea
GM
210 sed 's/\.elc$/.el/' /tmp/elc > /tmp/elcel
211 losers="`comm -23 /tmp/el /tmp/elcel`"
212
213 rm -f /tmp/el /tmp/elc /tmp/elcel /tmp/elelc
214
e4e1c623
RS
215 bogosities=
216 for file in $losers; do
f3dd02ea
GM
217 grep -q "no-byte-compile: t" $file && continue
218 case $file in
219 site-init.el | site-load.el | site-start.el | default.el) continue ;;
220 esac
221
222 bogosities="$file $bogosities"
223
e4e1c623
RS
224 done
225 if [ x"${bogosities}" != x"" ]; then
226 echo "The following .el files have no corresponding .elc files:"
227 echo "${bogosities}"
228 fi
f5674423
KH
229fi
230
f3dd02ea 231if [ $update = yes ]; then
b4e84d5d 232
f3dd02ea
GM
233 ## Make sure configure is newer than configure.in.
234 if [ "x`ls -t configure configure.in | sed q`" != "xconfigure" ]; then
235 echo "\`./configure.in' is newer than \`./configure'" >&2
236 echo "Running autoconf" >&2
237 autoconf || { x=$?; echo Autoconf FAILED! >&2; exit $x; }
238 fi
239
240 ## Make sure src/stamp-h.in is newer than configure.in.
241 if [ "x`ls -t src/stamp-h.in configure.in | sed q`" != "xsrc/stamp-h.in" ]; then
242 echo "\`./configure.in' is newer than \`./src/stamp-h.in'" >&2
243 echo "Running autoheader" >&2
244 autoheader || { x=$?; echo Autoheader FAILED! >&2; exit $x; }
245 rm -f src/stamp-h.in
246 echo timestamp > src/stamp-h.in
247 fi
a49eb675 248
c75cfabd 249 echo "Updating Info files"
baf81c55
GM
250 (cd doc/emacs; make info)
251 (cd doc/misc; make info)
252 (cd doc/lispref; make info)
253 (cd doc/lispintro; make info)
980ab937 254
e888d449 255 echo "Updating finder, custom and autoload data"
59d05d2d 256 (cd lisp; make updates EMACS="$EMACS")
7cf45b04 257
5eea385d
GM
258 if test -f leim/leim-list.el; then
259 echo "Updating leim-list.el"
260 (cd leim; make leim-list.el EMACS="$EMACS")
261 fi
29c98ed3
RS
262
263 echo "Recompiling Lisp files"
29c98ed3 264 $EMACS -batch -f batch-byte-recompile-directory lisp leim
f3dd02ea 265fi # $update = yes
0588a761 266
1260d6ba 267echo "Creating staging directory: \`${tempparent}'"
bb160193 268
f7dbcf3c 269mkdir ${tempparent}
f7dbcf3c
JB
270tempdir="${tempparent}/${emacsname}"
271
76fb0a58
JB
272### This trap ensures that the staging directory will be cleaned up even
273### when the script is interrupted in mid-career.
00c00348 274if [ "${clean_up}" = yes ]; then
5c845a01 275 trap "echo 'Cleaning up the staging directory'; rm -rf ${tempparent}" EXIT
00c00348
ER
276fi
277
1260d6ba 278echo "Creating top directory: \`${tempdir}'"
f7dbcf3c
JB
279mkdir ${tempdir}
280
76fb0a58
JB
281### We copy in the top-level files before creating the subdirectories in
282### hopes that this will make the top-level files appear first in the
283### tar file; this means that people can start reading the INSTALL and
284### README while the rest of the tar file is still unpacking. Whoopee.
21764d60 285echo "Making links to top-level files"
3ada8b66 286ln INSTALL README BUGS move-if-change ${tempdir}
bcea38a3 287ln ChangeLog Makefile.in configure configure.in ${tempdir}
b08ddfb4 288ln config.bat make-dist update-subdirs vpath.sed .dir-locals.el ${tempdir}
baf81c55 289ln mkinstalldirs config.sub config.guess install-sh ${tempdir}
f7dbcf3c 290
21764d60 291echo "Creating subdirectories"
a6922616 292for subdir in site-lisp \
05494c29 293 leim leim/CXTERM-DIC leim/MISC-DIC \
ca111811 294 leim/SKK-DIC leim/ja-dic leim/quail \
c660c0a7 295 src src/m src/s src/bitmaps lib-src oldXMenu lwlib \
5ec8424f 296 nt nt/inc nt/inc/sys nt/inc/arpa nt/inc/netinet nt/icons \
a6922616
GM
297 `find etc lisp -type d` \
298 doc doc/emacs doc/misc doc/man doc/lispref doc/lispintro \
299 info m4 msdos \
2c369af7
GM
300 nextstep nextstep/Cocoa nextstep/Cocoa/Emacs.base \
301 nextstep/Cocoa/Emacs.base/Contents \
302 nextstep/Cocoa/Emacs.base/Contents/Resources \
303 nextstep/Cocoa/Emacs.base/Contents/Resources/English.lproj \
2c369af7
GM
304 nextstep/Cocoa/Emacs.xcodeproj \
305 nextstep/GNUstep \
306 nextstep/GNUstep/Emacs.base \
eeebcbb9 307 nextstep/GNUstep/Emacs.base/Resources
b3635775 308do
0da746de
GM
309 ## site-lisp for in-place installs (?).
310 [ "$subdir" = "site-lisp" ] || [ -d "$subdir" ] || \
311 echo "WARNING: $subdir not found, making anyway"
b3635775 312 echo " ${tempdir}/${subdir}"
f7dbcf3c
JB
313 mkdir ${tempdir}/${subdir}
314done
315
67ffab69 316echo "Making links to \`lisp' and its subdirectories"
a6922616
GM
317files=`find lisp \( -name '*.el' -o -name '*.elc' -o -name 'ChangeLog*' \
318 -o -name 'README*' \)`
319
baf81c55 320### Don't distribute site-init.el, site-load.el, or default.el.
a6922616
GM
321for file in lisp/Makefile.in lisp/makefile.w32-in $files; do
322 case $file in
323 */site-init*|*/site-load*|*/default*) continue ;;
324 esac
325 ln $file $tempdir/$file
326done
a78c106d 327
ca111811 328echo "Making links to \`leim' and its subdirectories"
91741841 329(cd leim
561bd1a1 330 ln makefile.w32-in ../${tempdir}/leim
ca111811 331 ln ChangeLog README ../${tempdir}/leim
4e1fb954 332 ln CXTERM-DIC/README CXTERM-DIC/*.tit ../${tempdir}/leim/CXTERM-DIC
ca111811 333 ln SKK-DIC/README SKK-DIC/SKK-JISYO.L ../${tempdir}/leim/SKK-DIC
4e1fb954 334 ln MISC-DIC/README MISC-DIC/*.* ../${tempdir}/leim/MISC-DIC
ca111811
EZ
335 ln ja-dic/*.el ja-dic/*.elc ../${tempdir}/leim/ja-dic
336 ln Makefile.in ../${tempdir}/leim/Makefile.in
1d390bd8 337 ln leim-ext.el ../${tempdir}/leim/leim-ext.el
4e1fb954
GM
338 ## Lisp files that start with a capital (also 4Corner.el) are
339 ## generated from TIT dictionaries so we don't distribute them.
ca111811
EZ
340 ln quail/[a-z]*.el quail/[a-z]*.elc ../${tempdir}/leim/quail
341 rm -f ../${tempdir}/leim/quail/quick-b5.*
342 rm -f ../${tempdir}/leim/quail/quick-cns.*
343 rm -f ../${tempdir}/leim/quail/tsang-b5.*
baf81c55 344 rm -f ../${tempdir}/leim/quail/tsang-cns.*)
91741841 345
21764d60 346echo "Making links to \`src'"
a6922616
GM
347### Don't distribute the configured versions of
348### config.in, paths.in, buildobj.h, or Makefile.in.
f7dbcf3c 349(cd src
c75cfabd 350 echo " (It is ok if ln fails in some cases.)"
baf81c55 351 ln [a-zA-Z]*.[chm] ../${tempdir}/src
c75cfabd 352 ln [a-zA-Z]*.in ../${tempdir}/src
9d5cf9b6 353 ln [a-zA-Z]*.mk ../${tempdir}/src
c75cfabd 354 ln README ChangeLog ChangeLog.*[0-9] ../${tempdir}/src
561bd1a1 355 ln makefile.w32-in ../${tempdir}/src
990ee059 356 ln .gdbinit .dbxinit ../${tempdir}/src
f7dbcf3c 357 cd ../${tempdir}/src
baf81c55 358 rm -f config.h epaths.h Makefile buildobj.h)
f7dbcf3c 359
21764d60 360echo "Making links to \`src/bitmaps'"
690eca32
JB
361(cd src/bitmaps
362 ln README *.xbm ../../${tempdir}/src/bitmaps)
363
21764d60 364echo "Making links to \`src/m'"
f7dbcf3c 365(cd src/m
521ee9b3 366 ln README [a-zA-Z0-9]*.h ../../${tempdir}/src/m)
f7dbcf3c 367
21764d60 368echo "Making links to \`src/s'"
f7dbcf3c 369(cd src/s
77427171 370 ln README [a-zA-Z0-9]*.h ../../${tempdir}/src/s)
f7dbcf3c 371
21764d60 372echo "Making links to \`lib-src'"
f7dbcf3c 373(cd lib-src
aa267dcf 374 ln [a-zA-Z]*.[ch] ../${tempdir}/lib-src
c3f1e1a9 375 ln ChangeLog Makefile.in README testfile vcdiff ../${tempdir}/lib-src
3fb78d1f 376 ln grep-changelog rcs2log rcs-checkin ../${tempdir}/lib-src
b3635775 377 ln makefile.w32-in ../${tempdir}/lib-src
1260d6ba 378 cd ../${tempdir}/lib-src
baf81c55 379 rm -f getopt.h)
f7dbcf3c 380
9eff9fe3
PE
381echo "Making links to \`m4'"
382(cd m4
383 ln *.m4 ../${tempdir}/m4)
384
b9f56298 385## Exclude README.W32 because it is specific to pre-built binaries(?).
21764d60 386echo "Making links to \`nt'"
391b3748 387(cd nt
baf81c55
GM
388 ln emacs.manifest emacs.rc emacsclient.rc config.nt ../${tempdir}/nt
389 ln emacs-src.tags nmake.defs gmake.defs subdirs.el ../${tempdir}/nt
390 ln [a-z]*.bat [a-z]*.[ch] ../${tempdir}/nt
b9f56298 391 ln ChangeLog INSTALL README makefile.w32-in ../${tempdir}/nt)
391b3748 392
b9f56298
GM
393echo "Making links to \`nt/inc' and its subdirectories"
394for f in `find nt/inc -type f -name '[a-z]*.h'`; do
395 ln $f $tempdir/$f
396done
e827bc37 397
5ec8424f
GV
398echo "Making links to \`nt/icons'"
399(cd nt/icons
4e1fb954 400 ln README [a-z]*.ico ../../${tempdir}/nt/icons
d6dc647f 401 ln [a-z]*.cur ../../${tempdir}/nt/icons)
5ec8424f 402
21764d60 403echo "Making links to \`msdos'"
52d7b2e5 404(cd msdos
4e1fb954 405 ln ChangeLog INSTALL README emacs.ico emacs.pif ../${tempdir}/msdos
baf81c55 406 ln is_exec.c sigaction.c mainmake.v2 sed*.inp ../${tempdir}/msdos)
52d7b2e5 407
2c369af7
GM
408echo "Making links to \`nextstep'"
409(cd nextstep
013b96cc 410 ln ChangeLog README INSTALL ../${tempdir}/nextstep)
2c369af7
GM
411
412echo "Making links to \`nextstep/Cocoa/Emacs.base/Contents'"
413(cd nextstep/Cocoa/Emacs.base/Contents
414 ln Info.plist PkgInfo ../../../../${tempdir}/nextstep/Cocoa/Emacs.base/Contents)
415
416echo "Making links to \`nextstep/Cocoa/Emacs.base/Contents/Resources'"
417(cd nextstep/Cocoa/Emacs.base/Contents/Resources
5338a639 418 ln Credits.html *.icns ../../../../../${tempdir}/nextstep/Cocoa/Emacs.base/Contents/Resources)
2c369af7
GM
419
420echo "Making links to \`nextstep/Cocoa/Emacs.base/Contents/Resources/English.lproj'"
421(cd nextstep/Cocoa/Emacs.base/Contents/Resources/English.lproj
422 ln InfoPlist.strings ../../../../../../${tempdir}/nextstep/Cocoa/Emacs.base/Contents/Resources/English.lproj)
423
2c369af7
GM
424echo "Making links to \`nextstep/Cocoa/Emacs.xcodeproj'"
425(cd nextstep/Cocoa/Emacs.xcodeproj
426 ln project.pbxproj ../../../${tempdir}/nextstep/Cocoa/Emacs.xcodeproj)
427
428echo "Making links to \`nextstep/GNUstep/Emacs.base/Resources'"
429(cd nextstep/GNUstep/Emacs.base/Resources
5338a639 430 ln Emacs.desktop Info-gnustep.plist README emacs.tiff ../../../../${tempdir}/nextstep/GNUstep/Emacs.base/Resources )
2c369af7 431
21764d60 432echo "Making links to \`oldXMenu'"
f7dbcf3c 433(cd oldXMenu
baf81c55 434 ln *.[ch] *.in ../${tempdir}/oldXMenu
7c2fb837 435 ln README ChangeLog ../${tempdir}/oldXMenu)
f7dbcf3c 436
21764d60 437echo "Making links to \`lwlib'"
c660c0a7 438(cd lwlib
baf81c55 439 ln *.[ch] *.in ../${tempdir}/lwlib
ebb81677 440 ln README ChangeLog ../${tempdir}/lwlib)
c660c0a7 441
6f3ed07f
GM
442echo "Making links to \`etc' and its subdirectories"
443for f in `find etc -type f`; do
444 case $f in
445 etc/DOC*) continue ;;
446 esac
d5e38a56 447 ln $f $tempdir/$f
d8981daf
GM
448done
449
21764d60 450echo "Making links to \`info'"
b9f56298 451ln `find info -type f -print` ${tempdir}/info
baf81c55 452
d175b0ae
RF
453echo "Making links to \`doc/emacs'"
454(cd doc/emacs
baf81c55 455 ln *.texi *.in makefile.w32-in ChangeLog* ../../${tempdir}/doc/emacs)
f7dbcf3c 456
d175b0ae
RF
457echo "Making links to \`doc/misc'"
458(cd doc/misc
baf81c55
GM
459 ln *.texi *.tex *.in makefile.w32-in gnus-news.el ChangeLog* ../../${tempdir}/doc/misc)
460
d175b0ae
RF
461echo "Making links to \`doc/lispref'"
462(cd doc/lispref
baf81c55 463 ln *.texi *.in makefile.w32-in README ChangeLog* ../../${tempdir}/doc/lispref
d175b0ae 464 ln *.txt *.el spellfile tindex.pl ../../${tempdir}/doc/lispref
baf81c55 465 ln two-volume.make ../../${tempdir}/doc/lispref)
1d951084 466
d175b0ae
RF
467echo "Making links to \`doc/lispintro'"
468(cd doc/lispintro
baf81c55
GM
469 ln *.texi *.in makefile.w32-in *.eps *.pdf ../../${tempdir}/doc/lispintro
470 ln README ChangeLog* ../../${tempdir}/doc/lispintro
471 cd ../../${tempdir}/doc/lispintro)
3716a206 472
d175b0ae
RF
473echo "Making links to \`doc/man'"
474(cd doc/man
baf81c55
GM
475 ln ChangeLog* *.1 ../../${tempdir}/doc/man
476 cd ../../${tempdir}/doc/man)
d175b0ae 477
6ab508db 478### It would be nice if they could all be symlinks to top-level copy, but
c87b230f 479### you're not supposed to have any symlinks in distribution tar files.
fd4bc580 480echo "Making sure copying notices are all copies of \`COPYING'"
9e2a2647 481for subdir in . etc info leim lib-src lisp lwlib msdos nt src; do
b37017c6 482 rm -f ${tempdir}/${subdir}/COPYING
fd4bc580 483 cp COPYING ${tempdir}/${subdir}
f7dbcf3c
JB
484done
485
1260d6ba 486if [ "${newer}" ]; then
21764d60 487 echo "Removing files older than $newer"
76fb0a58
JB
488 ## We remove .elc files unconditionally, on the theory that anyone picking
489 ## up an incremental distribution already has a running Emacs to byte-compile
490 ## them with.
1260d6ba
ER
491 find ${tempparent} \( -name '*.elc' -o ! -newer ${newer} \) -exec rm -f {} \;
492fi
493
baf81c55
GM
494## Don't distribute backups, autosaves, etc.
495echo "Removing unwanted files"
496find ${tempparent} \( -name '*~' -o -name '#*#' -o -name '.*ignore' -o -name '=*' -o -name 'TAGS' \) -exec rm -f {} \;
497
4746118a 498if [ "${make_tar}" = yes ]; then
b9f56298
GM
499 echo "Looking for $default_gzip"
500 found=0
501 temppath=`echo $PATH | sed -e 's/^:/.:/' -e 's/::/:.:/g' -e 's/:$/:./' \
502 -e 's/:/ /g'`
503 for dir in ${temppath}; do
504 [ -x ${dir}/$default_gzip ] || continue
505 found=1; break
506 done
507 if [ "$found" = "0" ]; then
508 echo "WARNING: \`$default_gzip' not found, will not compress" >&2
509 default_gzip=cat
922ac4c5 510 fi
f395c83a 511 case "${default_gzip}" in
b9f56298
GM
512 bzip2) gzip_extension=.bz2 ;;
513 lzma) gzip_extension=.lzma ;;
514 gzip) gzip_extension=.gz ; default_gzip="gzip --best";;
515 *) gzip_extension= ;;
f395c83a 516 esac
ca111811 517 echo "Creating tar file"
f395c83a
JB
518 (cd ${tempparent} ; tar cvf - ${emacsname} ) \
519 | ${default_gzip} \
520 > ${emacsname}.tar${gzip_extension}
4746118a 521fi
f7dbcf3c 522
5c845a01 523if [ "${clean_up}" != yes ]; then
ca111811 524 (cd ${tempparent}; mv ${emacsname} ..)
bb160193 525 rm -rf ${tempparent}
f7dbcf3c 526fi
00c00348 527
76fb0a58 528### make-dist ends here