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