Merged from emacs@sv.gnu.org.
[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
667f78d7 9# Copyright (C) 1995, 1997, 1998, 2000, 2001, 2002, 2005, 2006
33740d04 10# Free Software Foundation, Inc.
4c9c1174
KH
11#
12# This file is part of GNU Emacs.
13#
14# GNU Emacs is free software; you can redistribute it and/or modify
15# it under the terms of the GNU General Public License as published by
16# the Free Software Foundation; either version 2, or (at your option)
17# any later version.
18#
19# GNU Emacs is distributed in the hope that it will be useful,
20# but WITHOUT ANY WARRANTY; without even the implied warranty of
21# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22# GNU General Public License for more details.
23#
24# You should have received a copy of the GNU General Public License
1fb87c77 25# along with GNU Emacs; see the file COPYING. If not, write to the
0d07bc90
LK
26# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
27# Boston, MA 02110-1301, USA.
4c9c1174 28
f7dbcf3c
JB
29progname="$0"
30
76fb0a58 31### Exit if a command fails.
8c28d444 32#set -e
f7dbcf3c 33
76fb0a58 34### Print out each line we read, for debugging's sake.
8c28d444 35#set -v
f7dbcf3c 36
8df317a6
GM
37LANGUAGE=C
38LC_ALL=C
39LC_MESSAGES=
40LANG=
41export LANGUAGE LC_ALL LC_MESSAGES LANG
42
ccd57f4d 43## Don't restrict access to any files.
67ffab69
RS
44umask 0
45
c75cfabd 46update=yes
e4e1c623 47check=yes
f22edcea
RS
48clean_up=no
49make_tar=no
1260d6ba 50newer=""
f7dbcf3c
JB
51
52while [ $# -gt 0 ]; do
53 case "$1" in
f22edcea
RS
54 ## This option tells make-dist to delete the staging directory
55 ## when done. It is useless to use this unless you make a tar file.
56 "--clean-up" )
57 clean_up=yes
4746118a 58 ;;
f22edcea
RS
59 ## This option tells make-dist to make a tar file.
60 "--tar" )
61 make_tar=yes
f7dbcf3c 62 ;;
c75cfabd
RS
63 ## This option tells make-dist not to recompile or do analogous things.
64 "--no-update" )
65 update=no
66 ;;
e4e1c623
RS
67 ## This option says don't check for bad file names, etc.
68 "--no-check" )
69 check=no
70 ;;
76fb0a58 71 ## This option tells make-dist to make the distribution normally, then
7b9cd64c
ER
72 ## remove all files older than the given timestamp file. This is useful
73 ## for creating incremental or patch distributions.
1260d6ba 74 "--newer")
ef15f270
JB
75 newer="$2"
76 new_extension=".new"
1260d6ba
ER
77 shift
78 ;;
922ac4c5
JB
79 ## This option tells make-dist to use `compress' instead of gzip.
80 ## Normally, make-dist uses gzip whenever it is present.
81 "--compress")
82 default_gzip="compress"
83 ;;
2a714d4e
GM
84
85 "--snapshot")
86 clean_up=yes
87 make_tar=yes
88 update=no
89 check=no
90 ;;
91
92 "--help")
93 echo "Usage: ${progname} [options]"
94 echo ""
95 echo " --clean-up delete staging directories when done"
96 echo " --compress use compress instead of gzip"
97 echo " --newer=TIME don't include files older than TIME"
98 echo " --no-check don't check for bad file names etc."
99 echo " --no-update don't recompile or do analogous things"
100 echo " --snapshot same as --clean-up --no-update --tar --no-check"
101 echo " --tar make a tar file"
102 echo ""
103 exit 0
104 ;;
105
f7dbcf3c
JB
106 * )
107 echo "${progname}: Unrecognized argument: $1" >&2
108 exit 1
109 ;;
110 esac
111 shift
112done
113
76fb0a58 114### Make sure we're running in the right place.
f7dbcf3c 115if [ ! -d src -o ! -f src/lisp.h -o ! -d lisp -o ! -f lisp/version.el ]; then
1260d6ba
ER
116 echo "${progname}: Can't find \`src/lisp.h' and \`lisp/version.el'." >&2
117 echo "${progname} must be run in the top directory of the Emacs" >&2
0d122844 118 echo "distribution tree. cd to that directory and try again." >&2
f7dbcf3c
JB
119 exit 1
120fi
121
c75cfabd 122### Find where to run Emacs.
fcea5346
KH
123### (We don't accept EMACS=t as an answer, since that probably only means
124### that the shell is running in an Emacs window.)
c75cfabd
RS
125if [ $update = yes ];
126then
59d05d2d 127 unset EMACS_UNIBYTE
c75cfabd
RS
128 if [ -f src/emacs ];
129 then
130 EMACS=`pwd`/src/emacs
131 else
fcea5346 132 if [ "x$EMACS" = "x" -o "x$EMACS" = "xt" ];
177c0ea7 133 then
c75cfabd
RS
134 echo You must specify the EMACS environment variable 2>&1
135 exit 1
136 fi
137 fi
138fi
139
76fb0a58 140### Find out which version of Emacs this is.
0e0186f1 141shortversion=`grep 'defconst[ ]*emacs-version' lisp/version.el \
47d105b0 142 | sed -e 's/^.*"\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/'`
0e0186f1
RS
143version=`grep 'defconst[ ]*emacs-version' lisp/version.el \
144 | sed -e 's/^[^"]*"\([^"]*\)".*$/\1/'`
f7dbcf3c 145if [ ! "${version}" ]; then
21764d60 146 echo "${progname}: can't find current Emacs version in \`./lisp/version.el'" >&2
f7dbcf3c
JB
147 exit 1
148fi
149
21764d60 150echo Version numbers are $version and $shortversion
47d105b0 151
c75cfabd
RS
152if [ $update = yes ];
153then
ad4c2ff2 154 if grep -s "@set EMACSVER *${shortversion}" ./man/emacs.texi > /dev/null; then
c75cfabd
RS
155 true
156 else
157 echo "You must update the version number in \`./man/emacs.texi'"
158 sleep 5
159 fi
f753e9aa
JB
160fi
161
bb160193
RS
162### Make sure we don't already have a directory emacs-${version}.
163
164emacsname="emacs-${version}${new_extension}"
165
166if [ -d ${emacsname} ]
167then
168 echo Directory "${emacsname}" already exists >&2
169 exit 1
170fi
171
76fb0a58 172### Make sure the subdirectory is available.
1260d6ba 173tempparent="make-dist.tmp.$$"
f7dbcf3c 174if [ -d ${tempparent} ]; then
1260d6ba
ER
175 echo "${progname}: staging directory \`${tempparent}' already exists.
176Perhaps a previous invocation of \`${progname}' failed to clean up after
177itself. Check that directories whose names are of the form
178\`make-dist.tmp.NNNNN' don't contain any important information, remove
179them, and try again." >&2
f7dbcf3c
JB
180 exit 1
181fi
182
e4e1c623
RS
183### Find where to run Emacs.
184if [ $check = yes ];
185then
186 ### Check for .elc files with no corresponding .el file.
fb0797ca 187 ls -1 lisp/[a-zA-Z]*.el lisp/[a-z]*/[a-zA-Z0-9]*.el \
5eea385d 188 leim/[a-z]*/[a-z]*.el | sed 's/\.el$/.elc/' > /tmp/el
fb0797ca 189 ls -1 lisp/[a-zA-Z]*.elc lisp/[a-z]*/[a-zA-Z0-9]*.elc \
5eea385d 190 leim/[a-z]*/[a-z]*.elc > /tmp/elc
e4e1c623
RS
191 bogosities="`comm -13 /tmp/el /tmp/elc`"
192 if [ "${bogosities}" != "" ]; then
193 echo "The following .elc files have no corresponding .el files:"
194 echo "${bogosities}"
8615e792 195 fi
e4e1c623
RS
196 rm -f /tmp/el /tmp/elc
197
198 ### Check for .el files with no corresponding .elc file.
fb0797ca 199 ls -1 lisp/[a-zA-Z]*.el lisp/[a-z]*/[a-zA-Z0-9]*.el \
33740d04 200 leim/[a-z]*/[a-z]*.el > /tmp/el
fb0797ca 201 ls -1 lisp/[a-zA-Z]*.elc lisp/[a-z]*/[a-zA-Z0-9]*.elc \
33740d04 202 leim/[a-z]*/[a-z]*.elc | sed 's/\.elc$/.el/' > /tmp/elc
e4e1c623
RS
203 losers="`comm -23 /tmp/el /tmp/elc`"
204 bogosities=
205 for file in $losers; do
33740d04 206 if ! grep -q "no-byte-compile: t" $file; then
e4e1c623
RS
207 case $file in
208 site-init.el | site-load.el | site-start.el | default.el)
209 ;;
e4e1c623
RS
210 *)
211 bogosities="$file $bogosities"
212 ;;
213 esac
214 fi
215 done
216 if [ x"${bogosities}" != x"" ]; then
217 echo "The following .el files have no corresponding .elc files:"
218 echo "${bogosities}"
219 fi
220 rm -f /tmp/el /tmp/elc
f5674423
KH
221fi
222
b4e84d5d 223### Make sure configure is newer than configure.in.
a8a8fcfa 224if [ "x`ls -t configure configure.in | sed q`" != "xconfigure" ]; then
21764d60
KH
225 echo "\`./configure.in' is newer than \`./configure'" >&2
226 echo "Running autoconf" >&2
28335560 227 autoconf || { x=$?; echo Autoconf FAILED! >&2; exit $x; }
b4e84d5d
JB
228fi
229
a49eb675
AS
230### Make sure src/config-in.stamp is newer than configure.in.
231if [ "x`ls -t src/stamp-h.in configure.in | sed q`" != "xsrc/stamp-h.in" ]; then
232 echo "\`./configure.in' is newer than \`./src/stamp-h.in'" >&2
233 echo "Running autoheader" >&2
234 autoheader || { x=$?; echo Autoheader FAILED! >&2; exit $x; }
235 rm -f src/stamp-h.in
236 echo timestamp > src/stamp-h.in
237fi
238
c75cfabd
RS
239if [ $update = yes ];
240then
241 echo "Updating Info files"
870cfc55 242 (cd man; make -f Makefile.in srcdir=. info)
1d951084 243 (cd lispref; make -f Makefile.in srcdir=. info)
df926aaa 244 (cd lispintro; make -f Makefile.in SHELL=/bin/sh srcdir=. info VPATH=.)
980ab937 245
e888d449 246 echo "Updating finder, custom and autoload data"
59d05d2d 247 (cd lisp; make updates EMACS="$EMACS")
7cf45b04 248
5eea385d
GM
249 if test -f leim/leim-list.el; then
250 echo "Updating leim-list.el"
251 (cd leim; make leim-list.el EMACS="$EMACS")
252 fi
29c98ed3
RS
253
254 echo "Recompiling Lisp files"
29c98ed3 255 $EMACS -batch -f batch-byte-recompile-directory lisp leim
c75cfabd 256fi
0588a761 257
f07eebe0
KH
258echo "Making lisp/MANIFEST"
259
73494596
RS
260(cd lisp;
261 files=`echo [!=]*.el | sed -e 's/ subdirs.el / /' -e 's/ default.el / /'`
262 for dir in [!=]*; do
5eea385d
GM
263 if [ -d $dir ] && [ $dir != term ] && [ $dir != CVS ] && [ $dir != RCS ]
264 then
73494596
RS
265 echo $dir
266 thisdir=`echo $dir/[!=]*.el | sed -e 's/ subdirs.el / /'`
267 files="$files $thisdir"
268 fi
269 done
a8a8fcfa
PE
270 for file in $files
271 do sed -n 's/^;;; //p; q' $file
272 done | sort > MANIFEST)
f07eebe0 273
1260d6ba 274echo "Creating staging directory: \`${tempparent}'"
bb160193 275
f7dbcf3c 276mkdir ${tempparent}
f7dbcf3c
JB
277tempdir="${tempparent}/${emacsname}"
278
76fb0a58
JB
279### This trap ensures that the staging directory will be cleaned up even
280### when the script is interrupted in mid-career.
00c00348 281if [ "${clean_up}" = yes ]; then
21764d60 282 trap "echo 'Interrupted...cleaning up the staging directory'; rm -rf ${tempparent}; exit 1" 1 2 15
00c00348
ER
283fi
284
1260d6ba 285echo "Creating top directory: \`${tempdir}'"
f7dbcf3c
JB
286mkdir ${tempdir}
287
76fb0a58
JB
288### We copy in the top-level files before creating the subdirectories in
289### hopes that this will make the top-level files appear first in the
290### tar file; this means that people can start reading the INSTALL and
291### README while the rest of the tar file is still unpacking. Whoopee.
21764d60 292echo "Making links to top-level files"
ed5882b9 293ln AUTHORS FTP INSTALL README BUGS move-if-change ${tempdir}
bcea38a3 294ln ChangeLog Makefile.in configure configure.in ${tempdir}
6f8b09f3 295ln config.bat make-dist update-subdirs vpath.sed ${tempdir}
bb160193 296### Copy these files; they're cross-filesystem symlinks.
a4888c88 297cp mkinstalldirs ${tempdir}
76fb0a58 298cp config.sub ${tempdir}
2ed56345 299cp config.guess ${tempdir}
dc7717ab 300cp install-sh ${tempdir}
f7dbcf3c 301
21764d60 302echo "Updating version number in README"
f753e9aa
JB
303(cd ${tempdir}
304 awk \
305 '$1 " " $2 " " $3 " " $4 " " $5 == "This directory tree holds version" { $6 = version; print $0 }
306 $1 " " $2 " " $3 " " $4 " " $5 != "This directory tree holds version"' \
307 version=${version} README > tmp.README
af559a4e 308 mv -f tmp.README README)
f753e9aa
JB
309
310
21764d60 311echo "Creating subdirectories"
3716a206 312for subdir in lisp site-lisp lispref lispintro \
05494c29 313 leim leim/CXTERM-DIC leim/MISC-DIC \
ca111811 314 leim/SKK-DIC leim/ja-dic leim/quail \
c660c0a7 315 src src/m src/s src/bitmaps lib-src oldXMenu lwlib \
5ec8424f 316 nt nt/inc nt/inc/sys nt/inc/arpa nt/inc/netinet nt/icons \
29dd7a69 317 etc etc/e \
ffda926c 318 etc/images etc/images/ezimage etc/images/gnus etc/images/gud \
ad7a98ae
RF
319 etc/images/icons etc/images/low-color etc/images/mail \
320 etc/images/smilies etc/tree-widget etc/tree-widget/default \
321 etc/tree-widget/folder info man m4 msdos vms mac mac/inc \
322 mac/inc/sys mac/src mac/Emacs.app mac/Emacs.app/Contents \
e0f712ba
AC
323 mac/Emacs.app/Contents/MacOS mac/Emacs.app/Contents/Resources \
324 mac/Emacs.app/Contents/Resources/English.lproj
b3635775
GM
325do
326 echo " ${tempdir}/${subdir}"
f7dbcf3c
JB
327 mkdir ${tempdir}/${subdir}
328done
329
67ffab69 330echo "Making links to \`lisp' and its subdirectories"
7b9cd64c 331### Don't distribute TAGS, =*.el files, site-init.el, site-load.el, or default.el.
f7dbcf3c
JB
332(cd lisp
333 ln [a-zA-Z]*.el ../${tempdir}/lisp
334 ln [a-zA-Z]*.elc ../${tempdir}/lisp
8d2197ac 335 ln [a-zA-Z]*.dat ../${tempdir}/lisp
a1363c1d 336 for img in [a-zA-Z]*.xpm [a-zA-Z]*.xbm [a-zA-Z]*.pbm; do
365949b7
GM
337 # If there are no images, the shell won't expand the pattern.
338 if [ -f $img ]; then
339 ln $img ../${tempdir}/lisp
340 fi
341 done
76fb0a58
JB
342 ## simula.el doesn't keep abbreviations in simula.defns any more.
343 ## ln [a-zA-Z]*.defns ../${tempdir}/lisp
fb0797ca
LK
344 ln ChangeLog ChangeLog.*[0-9] ../${tempdir}/lisp
345 ln Makefile.in makefile.w32-in ../${tempdir}/lisp
5eea385d 346 test -f README && ln README ../${tempdir}/lisp
67ffab69
RS
347 (cd ../${tempdir}/lisp
348 rm -f TAGS =*
349 rm -f site-init site-init.el site-init.elc
350 rm -f site-load site-load.el site-load.elc
351 rm -f site-start site-start.el site-start.elc
352 rm -f default default.el default.elc
353 )
354
355 ## Find all subdirs of lisp dir
356 for file in `find . -type d -print`; do
357 case $file in
5eea385d 358 . | .. | */Old | */CVS | */RCS | */=*)
177c0ea7 359 ;;
67ffab69
RS
360 *)
361 if [ -d $file ]; then
362 subdirs="$file $subdirs"
363 fi
364 ;;
365 esac
366 done
367
368 for file in $subdirs; do
369 echo " lisp/$file"
370 mkdir ../${tempdir}/lisp/$file
b3635775
GM
371 ln $file/[a-zA-Z0-9]*.el ../${tempdir}/lisp/$file
372 ln $file/[a-zA-Z0-9]*.elc ../${tempdir}/lisp/$file
373 for img in $file/[a-zA-Z]*.xpm $file/[a-zA-Z]*.xbm $file/[a-zA-Z]*.pbm; do
365949b7
GM
374 if [ -f $img ]; then
375 ln $img ../${tempdir}/lisp/$file
376 fi
377 done
67ffab69
RS
378 if [ -f $file/README ]; then
379 ln $file/README ../${tempdir}/lisp/$file
380 fi
b3635775 381
dcf3ff7f
RS
382 if [ -f $file/ChangeLog ]; then
383 ln $file/ChangeLog ../${tempdir}/lisp/$file
fb0797ca 384 for f in $file/ChangeLog.*[0-9]; do
b3635775
GM
385 if [ -f $f ]; then
386 ln $f ../${tempdir}/lisp/$file
387 fi
388 done
dcf3ff7f 389 fi
67ffab69 390 done )
a78c106d 391
ca111811 392echo "Making links to \`leim' and its subdirectories"
91741841
RS
393### Don't distribute TAGS, or =*.el files.
394(cd leim
561bd1a1 395 ln makefile.w32-in ../${tempdir}/leim
ca111811
EZ
396 ln ChangeLog README ../${tempdir}/leim
397
398 ln CXTERM-DIC/*.tit ../${tempdir}/leim/CXTERM-DIC
399 ln SKK-DIC/README SKK-DIC/SKK-JISYO.L ../${tempdir}/leim/SKK-DIC
400 ln MISC-DIC/*.* ../${tempdir}/leim/MISC-DIC
401 ln ja-dic/*.el ja-dic/*.elc ../${tempdir}/leim/ja-dic
402 ln Makefile.in ../${tempdir}/leim/Makefile.in
1d390bd8 403 ln leim-ext.el ../${tempdir}/leim/leim-ext.el
fb0797ca
LK
404 ## Lisp files that start with a capital are generated from TIT
405 ## dictionaries so we don't distribute them.
ca111811
EZ
406 ln quail/[a-z]*.el quail/[a-z]*.elc ../${tempdir}/leim/quail
407 rm -f ../${tempdir}/leim/quail/quick-b5.*
408 rm -f ../${tempdir}/leim/quail/quick-cns.*
409 rm -f ../${tempdir}/leim/quail/tsang-b5.*
410 rm -f ../${tempdir}/leim/quail/tsang-cns.*
411
412 cd ../${tempdir}/leim
91741841
RS
413 rm -f TAGS =* */=*)
414
21764d60 415echo "Making links to \`src'"
76fb0a58 416### Don't distribute =*.[ch] files, or the configured versions of
c3f1e1a9 417### config.in, paths.in, or Makefile.in, or TAGS.
f7dbcf3c 418(cd src
c75cfabd 419 echo " (It is ok if ln fails in some cases.)"
f7dbcf3c
JB
420 ln [a-zA-Z]*.c ../${tempdir}/src
421 ln [a-zA-Z]*.h ../${tempdir}/src
422 ln [a-zA-Z]*.s ../${tempdir}/src
c75cfabd
RS
423 ln [a-zA-Z]*.in ../${tempdir}/src
424 ln [a-zA-Z]*.opt ../${tempdir}/src
425 ## If we ended up with a symlink, or if we did not get anything
426 ## due to a cross-device symlink, copy the file.
427 for file in [a-zA-Z]*.[hcs] [a-zA-Z]*.in [a-zA-Z]*.opt; do
428 if test -f ../${tempdir}/src/$file; then
429 # test -f appears to succeed for a symlink
430 if test -L ../${tempdir}/src/$file; then
431 rm ../${tempdir}/src/$file
62dfdaf0 432 cp -p $file ../${tempdir}/src
c75cfabd
RS
433 chmod a-w ../${tempdir}/src/$file
434 fi
435 else
436 rm ../${tempdir}/src/$file
62dfdaf0 437 cp -p $file ../${tempdir}/src
c75cfabd
RS
438 chmod a-w ../${tempdir}/src/$file
439 fi
440 done
441 ln README ChangeLog ChangeLog.*[0-9] ../${tempdir}/src
561bd1a1 442 ln makefile.w32-in ../${tempdir}/src
990ee059 443 ln .gdbinit .dbxinit ../${tempdir}/src
f7dbcf3c 444 cd ../${tempdir}/src
8c28d444 445 rm -f config.h epaths.h Makefile Makefile.c
7b9cd64c 446 rm -f =* TAGS)
f7dbcf3c 447
21764d60 448echo "Making links to \`src/bitmaps'"
690eca32
JB
449(cd src/bitmaps
450 ln README *.xbm ../../${tempdir}/src/bitmaps)
451
21764d60 452echo "Making links to \`src/m'"
f7dbcf3c 453(cd src/m
facbb78e
RS
454 # We call files for miscellaneous input (to linker etc) .inp.
455 ln README [a-zA-Z0-9]*.h *.inp ../../${tempdir}/src/m)
f7dbcf3c 456
21764d60 457echo "Making links to \`src/s'"
f7dbcf3c 458(cd src/s
77427171 459 ln README [a-zA-Z0-9]*.h ../../${tempdir}/src/s)
f7dbcf3c 460
21764d60 461echo "Making links to \`lib-src'"
f7dbcf3c 462(cd lib-src
375f1bd7 463 ln [a-zA-Z]*.[chy] ../${tempdir}/lib-src
c3f1e1a9 464 ln ChangeLog Makefile.in README testfile vcdiff ../${tempdir}/lib-src
561bd1a1 465 ln grep-changelog rcs2log rcs-checkin ../${tempdir}/lib-src
b3635775 466 ln makefile.w32-in ../${tempdir}/lib-src
c75cfabd
RS
467 ## If we ended up with a symlink, or if we did not get anything
468 ## due to a cross-device symlink, copy the file.
469 for file in [a-zA-Z]*.[chy]; do
470 if test -f ../${tempdir}/lib-src/$file; then
471 # test -f appears to succeed for a symlink
472 if test -L ../${tempdir}/lib-src/$file; then
473 rm ../${tempdir}/lib-src/$file
474 cp $file ../${tempdir}/lib-src
475 chmod a-w ../${tempdir}/lib-src/$file
476 fi
477 else
478 rm ../${tempdir}/lib-src/$file
479 cp $file ../${tempdir}/lib-src
480 chmod a-w ../${tempdir}/lib-src/$file
481 fi
482 done
1260d6ba 483 cd ../${tempdir}/lib-src
c75cfabd 484 rm -f Makefile.c
9eff9fe3 485 rm -f getopt.h
7b9cd64c 486 rm -f =* TAGS)
f7dbcf3c 487
9eff9fe3
PE
488echo "Making links to \`m4'"
489(cd m4
490 ln *.m4 ../${tempdir}/m4)
491
21764d60 492echo "Making links to \`nt'"
391b3748 493(cd nt
bcea38a3
PJ
494 ln emacs.rc config.nt [a-z]*.c ../${tempdir}/nt
495 ln nmake.defs gmake.defs subdirs.el ../${tempdir}/nt
561bd1a1 496 ln [a-z]*.bat [a-z]*.h ../${tempdir}/nt
bcea38a3 497 ln ChangeLog INSTALL README makefile.w32-in ../${tempdir}/nt)
391b3748 498
21764d60 499echo "Making links to \`nt/inc'"
391b3748 500(cd nt/inc
77427171 501 ln [a-z]*.h ../../${tempdir}/nt/inc)
391b3748 502
21764d60 503echo "Making links to \`nt/inc/sys'"
391b3748 504(cd nt/inc/sys
77427171 505 ln [a-z]*.h ../../../${tempdir}/nt/inc/sys)
391b3748 506
e827bc37
RS
507echo "Making links to \`nt/inc/arpa'"
508(cd nt/inc/arpa
509 ln [a-z]*.h ../../../${tempdir}/nt/inc/arpa)
510
511echo "Making links to \`nt/inc/netinet'"
512(cd nt/inc/netinet
513 ln [a-z]*.h ../../../${tempdir}/nt/inc/netinet)
514
5ec8424f
GV
515echo "Making links to \`nt/icons'"
516(cd nt/icons
d6dc647f
JR
517 ln [a-z]*.ico ../../${tempdir}/nt/icons
518 ln [a-z]*.cur ../../${tempdir}/nt/icons)
5ec8424f 519
b3635775
GM
520echo "Making links to \`mac'"
521(cd mac
522 ln ChangeLog INSTALL README *.xml *.MPW ../${tempdir}/mac)
523
524echo "Making links to \`mac/inc'"
525(cd mac/inc
526 ln [a-z]*.h ../../${tempdir}/mac/inc)
527
528echo "Making links to \`mac/inc/sys'"
529(cd mac/inc/sys
530 ln [a-z]*.h ../../../${tempdir}/mac/inc/sys)
531
532echo "Making links to \`mac/src'"
533(cd mac/src
534 ln [a-z]*.c *.r ../../${tempdir}/mac/src)
535
e0f712ba
AC
536echo "Making links to \`mac/Emacs.app/Contents'"
537(cd mac/Emacs.app/Contents
538 ln Info.plist PkgInfo ../../../${tempdir}/mac/Emacs.app/Contents)
539
540echo "Making links to \`mac/Emacs.app/Contents/Resources/English.lproj'"
541(cd mac/Emacs.app/Contents/Resources/English.lproj
542 ln InfoPlist.strings ../../../../../${tempdir}/mac/Emacs.app/Contents/Resources/English.lproj)
177c0ea7 543
21764d60 544echo "Making links to \`msdos'"
52d7b2e5
RS
545(cd msdos
546 ln ChangeLog emacs.ico emacs.pif ../${tempdir}/msdos
7fd85d56 547 ln is_exec.c sigaction.c mainmake mainmake.v2 sed*.inp ../${tempdir}/msdos
52d7b2e5
RS
548 cd ../${tempdir}/msdos
549 rm -f =*)
550
21764d60 551echo "Making links to \`oldXMenu'"
f7dbcf3c 552(cd oldXMenu
8bdbf9ed 553 ln *.c *.h *.in ../${tempdir}/oldXMenu
df1ec566 554 ln README Imakefile ChangeLog ../${tempdir}/oldXMenu
f395c83a 555 ln compile.com descrip.mms ../${tempdir}/oldXMenu)
f7dbcf3c 556
21764d60 557echo "Making links to \`lwlib'"
c660c0a7
RS
558(cd lwlib
559 ln *.c *.h *.in ../${tempdir}/lwlib
ebb81677 560 ln README ChangeLog ../${tempdir}/lwlib)
c660c0a7 561
21764d60 562echo "Making links to \`etc'"
f395c83a
JB
563### Don't distribute = files, TAGS, DOC files, backups, autosaves, or
564### tex litter.
d4fa890c 565### Don't distribute gfdl.1, since no man page references it.
f7dbcf3c 566(cd etc
561bd1a1
EZ
567 files=`ls -d * | grep -v CVS | grep -v RCS | grep -v 'Old' | grep -v '^e$' \
568 | grep -v '^images$' | grep -v '^tree-widget$'`
7a6ee7ae 569 ln $files ../${tempdir}/etc
98d4c1d0
RS
570 ## If we ended up with a symlink, or if we did not get anything
571 ## due to a cross-device symlink, copy the file.
7a6ee7ae 572 for file in $files; do
98d4c1d0
RS
573 if test -f ../${tempdir}/etc/$file; then
574 # test -f appears to succeed for a symlink
575 if test -L ../${tempdir}/etc/$file; then
576 rm ../${tempdir}/etc/$file
577 cp $file ../${tempdir}/etc
578 chmod a-w ../${tempdir}/etc/$file
579 fi
580 else
581 rm ../${tempdir}/etc/$file
582 cp $file ../${tempdir}/etc
583 chmod a-w ../${tempdir}/etc/$file
584 fi
585 done
f7dbcf3c 586 cd ../${tempdir}/etc
d4fa890c 587 rm -f fns*.el gfdl.1
23a58692 588 rm -f DOC* *~ \#*\# *.dvi *.log *.orig *.rej *,v =* core
f395c83a 589 rm -f TAGS)
f7dbcf3c 590
21764d60 591echo "Making links to \`etc/e'"
f08ad882 592(cd etc/e
5eea385d 593 ln `ls -d * | grep -v CVS | grep -v RCS` ../../${tempdir}/etc/e
a6903f09 594 cd ../../${tempdir}/etc/e
375f1bd7 595 rm -f *~ \#*\# *,v =* core)
f08ad882 596
36eaa68f
RF
597echo "Making links to \`etc/images'"
598(cd etc/images
599 for img in [a-zA-Z]*.xpm [a-zA-Z]*.xbm [a-zA-Z]*.pbm; do
600 if [ -f $img ]; then
601 ln $img ../../${tempdir}/etc/images
602 fi
603 done)
604
ad7a98ae 605for dir in etc/images/ezimage etc/images/gnus etc/images/gud etc/images/icons \
ffda926c 606 etc/images/low-color etc/images/mail etc/images/smilies \
29dd7a69 607 etc/tree-widget/default etc/tree-widget/folder ; do
561bd1a1
EZ
608 echo "Making links to \`${dir}'"
609 (cd ${dir}
610 ln `ls -d * | grep -v CVS | grep -v RCS` ../../../${tempdir}/${dir}
611 cd ../../../${tempdir}/${dir}
612 rm -f *~ \#*\# *,v =* core)
613done
614
21764d60 615echo "Making links to \`info'"
66afa119
RS
616# Don't distribute backups or autosaves.
617(cd info
b3635775 618 ln `find . -type f -print | grep -v CVS | grep -v RCS | grep -v cvsignore` ../${tempdir}/info
5eea385d 619 #ln [a-zA-Z]* ../${tempdir}/info
66afa119
RS
620 cd ../${tempdir}/info
621 # Avoid an error when expanding the wildcards later.
622 ln emacs dummy~ ; ln emacs \#dummy\#
623 rm -f *~ \#*\# core)
fda4e8f6 624
21764d60 625echo "Making links to \`man'"
fda4e8f6 626(cd man
298c8970 627 ln *.texi *.aux *.cps *.fns *.kys *.vrs ../${tempdir}/man
5e808bc0 628 test -f README && ln README ../${tempdir}/man
f08ad882 629 test -f Makefile.in && ln Makefile.in ../${tempdir}/man
5eea385d
GM
630 ln ChangeLog ../${tempdir}/man
631 test -f split-man && ln split-man ../${tempdir}/man
f4500bec 632 cp texinfo.tex ../${tempdir}/man
4f8cc93a 633 cd ../${tempdir}/man
56c31c87
RS
634 rm -f \#*\# =* *~ core emacs-index* *.Z *.z xmail
635 rm -f emacs.?? termcap.?? gdb.?? *.log *.toc *.dvi *.oaux)
f7dbcf3c 636
1d951084
EZ
637echo "Making links to \`lispref'"
638(cd lispref
ae2230df 639 ln `ls -1 *.texi` ../${tempdir}/lispref
3d5ac4d9
EZ
640 ln *.aux *.cps *.fns *.kys *.vrs ../${tempdir}/lispref
641 ln *.txt *.el spellfile tindex.pl ../${tempdir}/lispref
1d951084
EZ
642 test -f README && ln README ../${tempdir}/lispref
643 test -f Makefile.in && ln Makefile.in ../${tempdir}/lispref
644 ln ChangeLog ../${tempdir}/lispref
645 cd ../${tempdir}/lispref
646 rm -f \#*\# =* *~ core elisp-index* *.Z *.z xmail
647 rm -f elisp.?? *.log *.toc *.dvi *.oaux)
648
3716a206
EZ
649echo "Making links to \`lispintro'"
650(cd lispintro
651 ln *.texi *.aux *.cps *.fns *.kys *.vrs *.eps ../${tempdir}/lispintro
652 test -f texinfo.tex && ln texinfo.tex ../${tempdir}/lispintro
653 test -f README && ln README ../${tempdir}/lispintro
654 test -f Makefile.in && ln Makefile.in ../${tempdir}/lispintro
655 ln ChangeLog ../${tempdir}/lispintro
656 cd ../${tempdir}/lispintro
657 rm -f \#*\# =* *~ core *.Z *.z xmail
658 rm -f emacs-lisp-intro.?? *.log *.toc *.dvi *.oaux)
659
21764d60 660echo "Making links to \`vms'"
40eef465 661(cd vms
5eea385d 662 test -f README && ln README ../${tempdir}/vms
40eef465
JB
663 cd ../${tempdir}/vms
664 rm -f *~)
665
6ab508db 666### It would be nice if they could all be symlinks to top-level copy, but
c87b230f 667### you're not supposed to have any symlinks in distribution tar files.
fd4bc580 668echo "Making sure copying notices are all copies of \`COPYING'"
860484dd 669for subdir in . etc info leim lib-src lisp lwlib mac msdos nt src; do
b37017c6 670 rm -f ${tempdir}/${subdir}/COPYING
fd4bc580 671 cp COPYING ${tempdir}/${subdir}
f7dbcf3c
JB
672done
673
5b8def65
JB
674#### Make sure that there aren't any hard links between files in the
675#### distribution; people with afs can't deal with that. Okay,
676#### actually we just re-copy anything with a link count greater
375f1bd7
KH
677#### than two. (Yes, strictly greater than 2 is correct; since we
678#### created these files by linking them in from the original tree,
679#### they'll have exactly two links normally.)
bb7e0f81 680####
908ff139 681#### Commented out since it's not strictly necessary; it should suffice
bb7e0f81 682#### to just break the link on alloca.c.
9b23a6c7
RS
683#echo "Breaking intra-tree links."
684#find ${tempdir} ! -type d -links +2 \
685# -exec cp -p {} $$ \; -exec rm -f {} \; -exec mv $$ {} \;
bb7e0f81
KH
686rm -f $tempdir/lib-src/alloca.c
687cp $tempdir/src/alloca.c $tempdir/lib-src/alloca.c
5b8def65 688
1260d6ba 689if [ "${newer}" ]; then
21764d60 690 echo "Removing files older than $newer"
76fb0a58
JB
691 ## We remove .elc files unconditionally, on the theory that anyone picking
692 ## up an incremental distribution already has a running Emacs to byte-compile
693 ## them with.
1260d6ba
ER
694 find ${tempparent} \( -name '*.elc' -o ! -newer ${newer} \) -exec rm -f {} \;
695fi
696
4746118a 697if [ "${make_tar}" = yes ]; then
922ac4c5 698 if [ "${default_gzip}" = "" ]; then
21764d60 699 echo "Looking for gzip"
922ac4c5
JB
700 temppath=`echo $PATH | sed 's/^:/.:/
701 s/::/:.:/g
702 s/:$/:./
703 s/:/ /g'`
704 default_gzip=`(
705 for dir in ${temppath}; do
706 if [ -f ${dir}/gzip ]; then echo 'gzip --best'; exit 0; fi
707 done
708 echo compress
709 )`
710 fi
f395c83a
JB
711 case "${default_gzip}" in
712 compress* ) gzip_extension=.Z ;;
0dc610dd 713 * ) gzip_extension=.gz ;;
f395c83a 714 esac
ca111811 715 echo "Creating tar file"
f395c83a
JB
716 (cd ${tempparent} ; tar cvf - ${emacsname} ) \
717 | ${default_gzip} \
718 > ${emacsname}.tar${gzip_extension}
4746118a 719fi
f7dbcf3c 720
4746118a 721if [ "${clean_up}" = yes ]; then
21764d60 722 echo "Cleaning up the staging directory"
f395c83a 723 rm -rf ${tempparent}
bb160193 724else
ca111811 725 (cd ${tempparent}; mv ${emacsname} ..)
bb160193 726 rm -rf ${tempparent}
f7dbcf3c 727fi
00c00348 728
ab5796a9 729# arch-tag: 26e3eb50-a394-4ab2-82b2-d8e5af500de7
76fb0a58 730### make-dist ends here