Replace last-command-char with last-command-event.
[emacs.git] / make-dist
blob02c2c469402de190900e54fefb16fc1095ec5d10
1 #!/bin/sh
3 #### make-dist: create an Emacs distribution tar file from the current
4 #### source tree. This basically creates a duplicate directory
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.
9 # Copyright (C) 1995, 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005,
10 # 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
12 # This file is part of GNU Emacs.
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 3 of the License, or
17 # (at your option) any later version.
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.
24 # You should have received a copy of the GNU General Public License
25 # along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
28 progname="$0"
30 ### Exit if a command fails.
31 #set -e
33 ### Print out each line we read, for debugging's sake.
34 #set -v
36 LANGUAGE=C
37 LC_ALL=C
38 LC_MESSAGES=
39 LANG=
40 export LANGUAGE LC_ALL LC_MESSAGES LANG
42 ## Don't restrict access to any files.
43 umask 0
45 update=yes
46 check=yes
47 clean_up=no
48 make_tar=no
49 newer=""
51 while [ $# -gt 0 ]; do
52 case "$1" in
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
58 ## This option tells make-dist to make a tar file.
59 "--tar" )
60 make_tar=yes
62 ## This option tells make-dist not to recompile or do analogous things.
63 "--no-update" )
64 update=no
66 ## This option says don't check for bad file names, etc.
67 "--no-check" )
68 check=no
70 ## This option tells make-dist to make the distribution normally, then
71 ## remove all files older than the given timestamp file. This is useful
72 ## for creating incremental or patch distributions.
73 "--newer")
74 newer="$2"
75 new_extension=".new"
76 shift
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"
83 ## Same with bzip2.
84 "--bzip2")
85 default_gzip="bzip2"
87 ## Same with lzma.
88 "--lzma")
89 default_gzip="lzma"
92 "--snapshot")
93 clean_up=yes
94 make_tar=yes
95 update=no
96 check=no
99 "--help")
100 echo "Usage: ${progname} [options]"
101 echo ""
102 echo " --bzip2 use bzip2 instead of gzip"
103 echo " --clean-up delete staging directories when done"
104 echo " --compress use compress instead of gzip"
105 echo " --lzma use lzma instead of gzip"
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
116 echo "${progname}: Unrecognized argument: $1" >&2
117 exit 1
119 esac
120 shift
121 done
123 ### Make sure we're running in the right place.
124 if [ ! -d src -o ! -f src/lisp.h -o ! -d lisp -o ! -f lisp/version.el ]; then
125 echo "${progname}: Can't find \`src/lisp.h' and \`lisp/version.el'." >&2
126 echo "${progname} must be run in the top directory of the Emacs" >&2
127 echo "distribution tree. cd to that directory and try again." >&2
128 exit 1
131 ### Find where to run Emacs.
132 ### (Accept only absolute file names.)
133 if [ $update = yes ];
134 then
135 unset EMACS_UNIBYTE
136 if [ -f src/emacs ];
137 then
138 EMACS=`pwd`/src/emacs
139 else
140 case $EMACS in
141 /*) ;;
143 if [ ! -f "$EMACS" ]; then
144 echo "$0: You must set the EMACS environment variable " \
145 "to an absolute file name." 2>&1
146 exit 1
147 fi;;
148 esac
152 ### Find out which version of Emacs this is.
153 shortversion=`grep 'defconst[ ]*emacs-version' lisp/version.el \
154 | sed -e 's/^.*"\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/'`
155 version=`grep 'defconst[ ]*emacs-version' lisp/version.el \
156 | sed -e 's/^[^"]*"\([^"]*\)".*$/\1/'`
157 if [ ! "${version}" ]; then
158 echo "${progname}: can't find current Emacs version in \`./lisp/version.el'" >&2
159 exit 1
162 echo Version numbers are $version and $shortversion
164 if [ $update = yes ];
165 then
166 if grep -s "@set EMACSVER *${shortversion}" ./doc/emacs/emacs.texi > /dev/null; then
167 true
168 else
169 echo "You must update the version number in \`./doc/emacs/emacs.texi'"
170 sleep 5
174 ### Make sure we don't already have a directory emacs-${version}.
176 emacsname="emacs-${version}${new_extension}"
178 if [ -d ${emacsname} ]
179 then
180 echo Directory "${emacsname}" already exists >&2
181 exit 1
184 ### Make sure the subdirectory is available.
185 tempparent="make-dist.tmp.$$"
186 if [ -d ${tempparent} ]; then
187 echo "${progname}: staging directory \`${tempparent}' already exists.
188 Perhaps a previous invocation of \`${progname}' failed to clean up after
189 itself. Check that directories whose names are of the form
190 \`make-dist.tmp.NNNNN' don't contain any important information, remove
191 them, and try again." >&2
192 exit 1
195 ### Find where to run Emacs.
196 if [ $check = yes ];
197 then
198 ### Check for .elc files with no corresponding .el file.
199 ls -1 lisp/[a-zA-Z]*.el lisp/[a-z]*/[a-zA-Z0-9]*.el \
200 leim/[a-z]*/[a-z]*.el | sed 's/\.el$/.elc/' > /tmp/el
201 ls -1 lisp/[a-zA-Z]*.elc lisp/[a-z]*/[a-zA-Z0-9]*.elc \
202 leim/[a-z]*/[a-z]*.elc > /tmp/elc
203 bogosities="`comm -13 /tmp/el /tmp/elc`"
204 if [ "${bogosities}" != "" ]; then
205 echo "The following .elc files have no corresponding .el files:"
206 echo "${bogosities}"
208 rm -f /tmp/el /tmp/elc
210 ### Check for .el files with no corresponding .elc file.
211 ls -1 lisp/[a-zA-Z]*.el lisp/[a-z]*/[a-zA-Z0-9]*.el \
212 leim/[a-z]*/[a-z]*.el > /tmp/el
213 ls -1 lisp/[a-zA-Z]*.elc lisp/[a-z]*/[a-zA-Z0-9]*.elc \
214 leim/[a-z]*/[a-z]*.elc | sed 's/\.elc$/.el/' > /tmp/elc
215 losers="`comm -23 /tmp/el /tmp/elc`"
216 bogosities=
217 for file in $losers; do
218 if ! grep -q "no-byte-compile: t" $file; then
219 case $file in
220 site-init.el | site-load.el | site-start.el | default.el)
223 bogosities="$file $bogosities"
225 esac
227 done
228 if [ x"${bogosities}" != x"" ]; then
229 echo "The following .el files have no corresponding .elc files:"
230 echo "${bogosities}"
232 rm -f /tmp/el /tmp/elc
235 ### Make sure configure is newer than configure.in.
236 if [ "x`ls -t configure configure.in | sed q`" != "xconfigure" ]; then
237 echo "\`./configure.in' is newer than \`./configure'" >&2
238 echo "Running autoconf" >&2
239 autoconf || { x=$?; echo Autoconf FAILED! >&2; exit $x; }
242 ### Make sure src/config-in.stamp is newer than configure.in.
243 if [ "x`ls -t src/stamp-h.in configure.in | sed q`" != "xsrc/stamp-h.in" ]; then
244 echo "\`./configure.in' is newer than \`./src/stamp-h.in'" >&2
245 echo "Running autoheader" >&2
246 autoheader || { x=$?; echo Autoheader FAILED! >&2; exit $x; }
247 rm -f src/stamp-h.in
248 echo timestamp > src/stamp-h.in
251 if [ $update = yes ];
252 then
253 echo "Updating Info files"
254 (cd doc/emacs; make -f Makefile.in srcdir=. info)
255 (cd doc/misc; make -f Makefile.in srcdir=. info)
256 (cd doc/lispref; make -f Makefile.in srcdir=. info)
257 (cd doc/lispintro; make -f Makefile.in SHELL=/bin/sh srcdir=. info VPATH=.)
259 echo "Updating finder, custom and autoload data"
260 (cd lisp; make updates EMACS="$EMACS")
262 if test -f leim/leim-list.el; then
263 echo "Updating leim-list.el"
264 (cd leim; make leim-list.el EMACS="$EMACS")
267 echo "Recompiling Lisp files"
268 $EMACS -batch -f batch-byte-recompile-directory lisp leim
271 echo "Making lisp/MANIFEST"
273 (cd lisp;
274 files=`echo [!=]*.el | sed -e 's/ subdirs.el / /' -e 's/ default.el / /'`
275 for dir in [!=]*; do
276 if [ -d $dir ] && [ $dir != term ] && [ $dir != CVS ] && [ $dir != RCS ]
277 then
278 echo $dir
279 thisdir=`echo $dir/[!=]*.el | sed -e 's/ subdirs.el / /'`
280 files="$files $thisdir"
282 done
283 for file in $files
284 do sed -n 's/^;;; //p; q' $file
285 done | sort > MANIFEST)
287 echo "Creating staging directory: \`${tempparent}'"
289 mkdir ${tempparent}
290 tempdir="${tempparent}/${emacsname}"
292 ### This trap ensures that the staging directory will be cleaned up even
293 ### when the script is interrupted in mid-career.
294 if [ "${clean_up}" = yes ]; then
295 trap "echo 'Interrupted...cleaning up the staging directory'; rm -rf ${tempparent}; exit 1" 1 2 15
298 echo "Creating top directory: \`${tempdir}'"
299 mkdir ${tempdir}
301 ### We copy in the top-level files before creating the subdirectories in
302 ### hopes that this will make the top-level files appear first in the
303 ### tar file; this means that people can start reading the INSTALL and
304 ### README while the rest of the tar file is still unpacking. Whoopee.
305 echo "Making links to top-level files"
306 ln INSTALL README BUGS move-if-change ${tempdir}
307 ln ChangeLog Makefile.in configure configure.in ${tempdir}
308 ln config.bat make-dist update-subdirs vpath.sed .dir-locals.el ${tempdir}
309 ### Copy these files; they're cross-filesystem symlinks.
310 cp mkinstalldirs ${tempdir}
311 cp config.sub ${tempdir}
312 cp config.guess ${tempdir}
313 cp install-sh ${tempdir}
315 echo "Updating version number in README"
316 (cd ${tempdir}
317 awk \
318 '$1 " " $2 " " $3 " " $4 " " $5 == "This directory tree holds version" { $6 = version; print $0 }
319 $1 " " $2 " " $3 " " $4 " " $5 != "This directory tree holds version"' \
320 version=${version} README > tmp.README
321 mv -f tmp.README README)
324 echo "Creating subdirectories"
325 for subdir in lisp site-lisp \
326 leim leim/CXTERM-DIC leim/MISC-DIC \
327 leim/SKK-DIC leim/ja-dic leim/quail \
328 src src/m src/s src/bitmaps lib-src oldXMenu lwlib \
329 nt nt/inc nt/inc/sys nt/inc/arpa nt/inc/netinet nt/icons \
330 etc etc/charsets etc/e etc/gnus etc/nxml \
331 etc/images etc/images/ezimage etc/images/gnus etc/images/gud \
332 etc/images/icons etc/images/icons/hicolor \
333 etc/images/icons/hicolor/*x* etc/images/icons/hicolor/scalable \
334 etc/images/icons/hicolor/*/apps etc/images/icons/hicolor/*/mimetypes \
335 etc/images/low-color etc/images/mail \
336 etc/images/smilies etc/images/smilies/grayscale \
337 etc/images/smilies/medium etc/images/tree-widget \
338 etc/images/tree-widget/default etc/images/tree-widget/folder \
339 etc/refcards etc/schema etc/tutorials info doc doc/emacs \
340 doc/misc doc/man doc/lispref doc/lispintro m4 msdos \
341 nextstep nextstep/Cocoa nextstep/Cocoa/Emacs.base \
342 nextstep/Cocoa/Emacs.base/Contents \
343 nextstep/Cocoa/Emacs.base/Contents/Resources \
344 nextstep/Cocoa/Emacs.base/Contents/Resources/English.lproj \
345 nextstep/Cocoa/Emacs.base/Contents/Resources/preferences.nib \
346 nextstep/Cocoa/Emacs.xcodeproj \
347 nextstep/GNUstep \
348 nextstep/GNUstep/Emacs.base \
349 nextstep/GNUstep/Emacs.base/Resources \
350 nextstep/GNUstep/Emacs.base/Resources/preferences.gorm
352 echo " ${tempdir}/${subdir}"
353 mkdir ${tempdir}/${subdir}
354 done
356 echo "Making links to \`lisp' and its subdirectories"
357 ### Don't distribute TAGS, =*.el files, site-init.el, site-load.el, or default.el.
358 (cd lisp
359 ln [a-zA-Z]*.el ../${tempdir}/lisp
360 ln [a-zA-Z]*.elc ../${tempdir}/lisp
361 ## simula.el doesn't keep abbreviations in simula.defns any more.
362 ## ln [a-zA-Z]*.defns ../${tempdir}/lisp
363 ln ChangeLog ChangeLog.*[0-9] ../${tempdir}/lisp
364 ln Makefile.in makefile.w32-in ../${tempdir}/lisp
365 test -f README && ln README ../${tempdir}/lisp
366 (cd ../${tempdir}/lisp
367 rm -f TAGS =*
368 rm -f site-init site-init.el site-init.elc
369 rm -f site-load site-load.el site-load.elc
370 rm -f site-start site-start.el site-start.elc
371 rm -f default default.el default.elc
374 ## Find all subdirs of lisp dir
375 for file in `find . -type d -print`; do
376 case $file in
377 . | .. | */Old | */CVS | */RCS | */=*)
380 if [ -d $file ]; then
381 subdirs="$file $subdirs"
384 esac
385 done
387 for file in $subdirs; do
388 echo " lisp/$file"
389 mkdir -p ../${tempdir}/lisp/$file
390 ln $file/[a-zA-Z0-9]*.el ../${tempdir}/lisp/$file
391 ln $file/[a-zA-Z0-9]*.elc ../${tempdir}/lisp/$file
392 for img in $file/[a-zA-Z]*.xpm $file/[a-zA-Z]*.xbm $file/[a-zA-Z]*.pbm; do
393 if [ -f $img ]; then
394 ln $img ../${tempdir}/lisp/$file
396 done
397 if [ -f $file/README ]; then
398 ln $file/README ../${tempdir}/lisp/$file
401 if [ -f $file/ChangeLog ]; then
402 ln $file/ChangeLog ../${tempdir}/lisp/$file
403 for f in $file/ChangeLog.*[0-9]; do
404 if [ -f $f ]; then
405 ln $f ../${tempdir}/lisp/$file
407 done
409 done )
411 echo "Making links to \`leim' and its subdirectories"
412 ### Don't distribute TAGS, or =*.el files.
413 (cd leim
414 ln makefile.w32-in ../${tempdir}/leim
415 ln ChangeLog README ../${tempdir}/leim
417 ln CXTERM-DIC/*.tit ../${tempdir}/leim/CXTERM-DIC
418 ln SKK-DIC/README SKK-DIC/SKK-JISYO.L ../${tempdir}/leim/SKK-DIC
419 ln MISC-DIC/*.* ../${tempdir}/leim/MISC-DIC
420 ln ja-dic/*.el ja-dic/*.elc ../${tempdir}/leim/ja-dic
421 ln Makefile.in ../${tempdir}/leim/Makefile.in
422 ln leim-ext.el ../${tempdir}/leim/leim-ext.el
423 ## Lisp files that start with a capital are generated from TIT
424 ## dictionaries so we don't distribute them.
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.*
431 cd ../${tempdir}/leim
432 rm -f TAGS =* */=*)
434 echo "Making links to \`src'"
435 ### Don't distribute =*.[ch] files, or the configured versions of
436 ### config.in, paths.in, or Makefile.in, or TAGS.
437 (cd src
438 echo " (It is ok if ln fails in some cases.)"
439 ln [a-zA-Z]*.c ../${tempdir}/src
440 ln [a-zA-Z]*.h ../${tempdir}/src
441 ln [a-zA-Z]*.m ../${tempdir}/src
442 ln [a-zA-Z]*.in ../${tempdir}/src
443 ln [a-zA-Z]*.opt ../${tempdir}/src
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.
446 for file in [a-zA-Z]*.[hcs] [a-zA-Z]*.in [a-zA-Z]*.opt; do
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
451 cp -p $file ../${tempdir}/src
452 chmod a-w ../${tempdir}/src/$file
454 else
455 rm ../${tempdir}/src/$file
456 cp -p $file ../${tempdir}/src
457 chmod a-w ../${tempdir}/src/$file
459 done
460 ln README ChangeLog ChangeLog.*[0-9] ../${tempdir}/src
461 ln makefile.w32-in ../${tempdir}/src
462 ln .gdbinit .dbxinit ../${tempdir}/src
463 cd ../${tempdir}/src
464 rm -f config.h epaths.h Makefile Makefile.c
465 rm -f =* TAGS)
467 echo "Making links to \`src/bitmaps'"
468 (cd src/bitmaps
469 ln README *.xbm ../../${tempdir}/src/bitmaps)
471 echo "Making links to \`src/m'"
472 (cd src/m
473 # We call files for miscellaneous input (to linker etc) .inp.
474 ln README [a-zA-Z0-9]*.h *.inp ../../${tempdir}/src/m)
476 echo "Making links to \`src/s'"
477 (cd src/s
478 ln README [a-zA-Z0-9]*.h ../../${tempdir}/src/s)
480 echo "Making links to \`lib-src'"
481 (cd lib-src
482 ln [a-zA-Z]*.[chmy] ../${tempdir}/lib-src
483 ln ChangeLog Makefile.in README testfile vcdiff ../${tempdir}/lib-src
484 ln grep-changelog rcs2log rcs-checkin ../${tempdir}/lib-src
485 ln makefile.w32-in ../${tempdir}/lib-src
486 ## If we ended up with a symlink, or if we did not get anything
487 ## due to a cross-device symlink, copy the file.
488 for file in [a-zA-Z]*.[chy]; do
489 if test -f ../${tempdir}/lib-src/$file; then
490 # test -f appears to succeed for a symlink
491 if test -L ../${tempdir}/lib-src/$file; then
492 rm ../${tempdir}/lib-src/$file
493 cp $file ../${tempdir}/lib-src
494 chmod a-w ../${tempdir}/lib-src/$file
496 else
497 rm ../${tempdir}/lib-src/$file
498 cp $file ../${tempdir}/lib-src
499 chmod a-w ../${tempdir}/lib-src/$file
501 done
502 cd ../${tempdir}/lib-src
503 rm -f Makefile.c
504 rm -f getopt.h
505 rm -f =* TAGS)
507 echo "Making links to \`m4'"
508 (cd m4
509 ln *.m4 ../${tempdir}/m4)
511 echo "Making links to \`nt'"
512 (cd nt
513 ln emacs.manifest emacs.rc emacsclient.rc config.nt [a-z]*.c ../${tempdir}/nt
514 ln nmake.defs gmake.defs subdirs.el ../${tempdir}/nt
515 ln [a-z]*.bat [a-z]*.h ../${tempdir}/nt
516 ln ChangeLog INSTALL README makefile.w32-in ../${tempdir}/nt)
518 echo "Making links to \`nt/inc'"
519 (cd nt/inc
520 ln [a-z]*.h ../../${tempdir}/nt/inc)
522 echo "Making links to \`nt/inc/sys'"
523 (cd nt/inc/sys
524 ln [a-z]*.h ../../../${tempdir}/nt/inc/sys)
526 echo "Making links to \`nt/inc/arpa'"
527 (cd nt/inc/arpa
528 ln [a-z]*.h ../../../${tempdir}/nt/inc/arpa)
530 echo "Making links to \`nt/inc/netinet'"
531 (cd nt/inc/netinet
532 ln [a-z]*.h ../../../${tempdir}/nt/inc/netinet)
534 echo "Making links to \`nt/icons'"
535 (cd nt/icons
536 ln [a-z]*.ico ../../${tempdir}/nt/icons
537 ln [a-z]*.cur ../../${tempdir}/nt/icons)
539 echo "Making links to \`msdos'"
540 (cd msdos
541 ln ChangeLog emacs.ico emacs.pif ../${tempdir}/msdos
542 ln is_exec.c sigaction.c mainmake mainmake.v2 sed*.inp ../${tempdir}/msdos
543 cd ../${tempdir}/msdos
544 rm -f =*)
546 echo "Making links to \`nextstep'"
547 (cd nextstep
548 ln AUTHORS ChangeLog FOR-RELEASE README.txt compile ../${tempdir}/nextstep)
550 echo "Making links to \`nextstep/Cocoa/Emacs.base/Contents'"
551 (cd nextstep/Cocoa/Emacs.base/Contents
552 ln Info.plist PkgInfo ../../../../${tempdir}/nextstep/Cocoa/Emacs.base/Contents)
554 echo "Making links to \`nextstep/Cocoa/Emacs.base/Contents/Resources'"
555 (cd nextstep/Cocoa/Emacs.base/Contents/Resources
556 ln Credits.html Emacs.icns ../../../../../${tempdir}/nextstep/Cocoa/Emacs.base/Contents/Resources)
558 echo "Making links to \`nextstep/Cocoa/Emacs.base/Contents/Resources/English.lproj'"
559 (cd nextstep/Cocoa/Emacs.base/Contents/Resources/English.lproj
560 ln InfoPlist.strings ../../../../../../${tempdir}/nextstep/Cocoa/Emacs.base/Contents/Resources/English.lproj)
562 echo "Making links to \`nextstep/Cocoa/Emacs.base/Contents/Resources/preferences.nib'"
563 (cd nextstep/Cocoa/Emacs.base/Contents/Resources/preferences.nib
564 ln *.nib ../../../../../../${tempdir}/nextstep/Cocoa/Emacs.base/Contents/Resources/preferences.nib)
566 echo "Making links to \`nextstep/Cocoa/Emacs.xcodeproj'"
567 (cd nextstep/Cocoa/Emacs.xcodeproj
568 ln project.pbxproj ../../../${tempdir}/nextstep/Cocoa/Emacs.xcodeproj)
570 echo "Making links to \`nextstep/GNUstep/Emacs.base/Resources'"
571 (cd nextstep/GNUstep/Emacs.base/Resources
572 ln Emacs.desktop Info-gnustep.plist emacs.tiff ../../../../${tempdir}/nextstep/GNUstep/Emacs.base/Resources )
574 echo "Making links to \`nextstep/GNUstep/Emacs.base/Resources/preferences.gorm'"
575 (cd nextstep/GNUstep/Emacs.base/Resources/preferences.gorm
576 ln data.classes data.info objects.gorm ../../../../../${tempdir}/nextstep/GNUstep/Emacs.base/Resources/preferences.gorm )
578 echo "Making links to \`oldXMenu'"
579 (cd oldXMenu
580 ln *.c *.h *.in ../${tempdir}/oldXMenu
581 ln README ChangeLog ../${tempdir}/oldXMenu)
583 echo "Making links to \`lwlib'"
584 (cd lwlib
585 ln *.c *.h *.in ../${tempdir}/lwlib
586 ln README ChangeLog ../${tempdir}/lwlib)
588 echo "Making links to \`etc'"
589 ### Don't distribute = files, TAGS, DOC files, backups, autosaves, or
590 ### tex litter.
591 (cd etc
592 files=`ls -d * | grep -v CVS | grep -v RCS | grep -v 'Old' | grep -v '^e$' \
593 | grep -v '^charsets$' | grep -v '^gnus$' | grep -v '^images$' | grep -v '^nxml$' \
594 | grep -v '^refcards$' | grep -v '^tutorials$'| grep -v '^schema$'`
595 ln $files ../${tempdir}/etc
596 ## If we ended up with a symlink, or if we did not get anything
597 ## due to a cross-device symlink, copy the file.
598 for file in $files; do
599 if test -f ../${tempdir}/etc/$file; then
600 # test -f appears to succeed for a symlink
601 if test -L ../${tempdir}/etc/$file; then
602 rm ../${tempdir}/etc/$file
603 cp $file ../${tempdir}/etc
604 chmod a-w ../${tempdir}/etc/$file
606 else
607 rm ../${tempdir}/etc/$file
608 cp $file ../${tempdir}/etc
609 chmod a-w ../${tempdir}/etc/$file
611 done
612 cd ../${tempdir}/etc
613 rm -f fns*.el
614 rm -f DOC* *~ \#*\# *.dvi *.log *.orig *.rej *,v =* core
615 rm -f TAGS)
617 for dir in etc/charsets etc/e etc/gnus etc/nxml etc/tutorials etc/refcards etc/schema ; do
618 echo "Making links to \`${dir}'"
619 (cd ${dir}
620 ln `ls -d * | grep -v CVS | grep -v RCS` ../../${tempdir}/${dir}
621 cd ../../${tempdir}/${dir}
622 rm -f *~ \#*\# *,v =* core)
623 done
625 echo "Making links to \`etc/images'"
626 (cd etc/images
627 for f in *; do
628 [ -f "$f" ] || continue
629 case $f in
630 (*~|\#*\#|*,v|=*|core) continue ;;
631 esac
632 ln $f ../../${tempdir}/etc/images
633 done)
635 for dir in etc/images/ezimage etc/images/gnus etc/images/gud etc/images/icons \
636 etc/images/low-color etc/images/mail etc/images/smilies ; do
637 echo "Making links to \`${dir}'"
638 (cd ${dir}
639 for f in *; do
640 [ -f "$f" ] || continue
641 case $f in
642 (*~|\#*\#|*,v|=*|core) continue ;;
643 esac
644 ln $f ../../../${tempdir}/${dir}
645 done
647 done
649 for dir in etc/images/tree-widget/default etc/images/tree-widget/folder \
650 etc/images/smilies/grayscale etc/images/smilies/medium; do
651 echo "Making links to \`${dir}'"
652 (cd ${dir}
653 ln `ls -d * | grep -v CVS | grep -v RCS` ../../../../${tempdir}/${dir}
654 cd ../../../../${tempdir}/${dir}
655 rm -f *~ \#*\# *,v =* core)
656 done
658 for dir in etc/images/icons/hicolor/*/apps \
659 etc/images/icons/hicolor/*/mimetypes; do
660 echo "Making links to \`${dir}'"
661 (cd ${dir}
662 ln `ls -d * | grep -v CVS | grep -v RCS` ../../../../../../${tempdir}/${dir}
663 cd ../../../../../../${tempdir}/${dir}
664 rm -f *~ \#*\# *,v =* core)
665 done
667 echo "Making links to \`info'"
668 # Don't distribute backups or autosaves.
669 (cd info
670 ln `find . -type f -print | grep -v CVS | grep -v RCS | grep -v cvsignore` ../${tempdir}/info
671 #ln [a-zA-Z]* ../${tempdir}/info
672 cd ../${tempdir}/info
673 # Avoid an error when expanding the wildcards later.
674 ln emacs dummy~ ; ln emacs \#dummy\#
675 rm -f *~ \#*\# core .arch-inventory)
677 echo "Making links to \`doc/emacs'"
678 (cd doc/emacs
679 ln *.texi *.aux *.cps *.fns *.kys *.vrs ../../${tempdir}/doc/emacs
680 ln makefile.w32-in ../../${tempdir}/doc/emacs
681 test -f README && ln README ../../${tempdir}/doc/emacs
682 test -f Makefile.in && ln Makefile.in ../../${tempdir}/doc/emacs
683 ln ChangeLog ../../${tempdir}/doc/emacs
684 cp texinfo.tex ../../${tempdir}/doc/emacs
685 cd ../../${tempdir}/doc/emacs
686 rm -f \#*\# =* *~ core emacs-index* *.Z *.z xmail
687 rm -f emacs.?? termcap.?? gdb.?? *.log *.toc *.dvi *.oaux)
689 echo "Making links to \`doc/misc'"
690 (cd doc/misc
691 ln *.texi *.aux *.cps *.fns *.kys *.vrs ../../${tempdir}/doc/misc
692 ln makefile.w32-in ../../${tempdir}/doc/misc
693 test -f README && ln README ../../${tempdir}/doc/misc
694 test -f Makefile.in && ln Makefile.in ../../${tempdir}/doc/misc
695 ln ChangeLog ../../${tempdir}/doc/misc
696 cp texinfo.tex ../../${tempdir}/doc/misc
697 cd ../../${tempdir}/doc/misc
698 rm -f \#*\# =* *~ core emacs-index* *.Z *.z xmail
699 rm -f emacs.?? termcap.?? gdb.?? *.log *.toc *.dvi *.oaux)
701 echo "Making links to \`doc/lispref'"
702 (cd doc/lispref
703 ln `ls -1 *.texi` ../../${tempdir}/doc/lispref
704 ln *.aux *.cps *.fns *.kys *.vrs ../../${tempdir}/doc/lispref
705 ln *.txt *.el spellfile tindex.pl ../../${tempdir}/doc/lispref
706 ln makefile.w32-in ../../${tempdir}/doc/lispref
707 test -f README && ln README ../../${tempdir}/doc/lispref
708 test -f Makefile.in && ln Makefile.in ../../${tempdir}/doc/lispref
709 ln ChangeLog ../../${tempdir}/doc/lispref
710 cd ../../${tempdir}/doc/lispref
711 rm -f \#*\# =* *~ core elisp-index* *.Z *.z xmail
712 rm -f elisp.?? *.log *.toc *.dvi *.oaux)
714 echo "Making links to \`doc/lispintro'"
715 (cd doc/lispintro
716 ln *.texi *.aux *.cps *.fns *.kys *.vrs *.eps ../../${tempdir}/doc/lispintro
717 ln makefile.w32-in ../../${tempdir}/doc/lispintro
718 test -f texinfo.tex && ln texinfo.tex ../../${tempdir}/doc/lispintro
719 test -f README && ln README ../../${tempdir}/doc/lispintro
720 test -f Makefile.in && ln Makefile.in ../../${tempdir}/doc/lispintro
721 ln ChangeLog ../../${tempdir}/doc/lispintro
722 cd ../../${tempdir}/doc/lispintro
723 rm -f \#*\# =* *~ core *.Z *.z xmail
724 rm -f emacs-lisp-intro.?? *.log *.toc *.dvi *.oaux)
726 echo "Making links to \`doc/man'"
727 (cd doc/man
728 ln *.1 ../../${tempdir}/doc/man
729 ln ChangeLog ../../${tempdir}/doc/man)
731 ### It would be nice if they could all be symlinks to top-level copy, but
732 ### you're not supposed to have any symlinks in distribution tar files.
733 echo "Making sure copying notices are all copies of \`COPYING'"
734 for subdir in . etc info leim lib-src lisp lwlib msdos nt src; do
735 rm -f ${tempdir}/${subdir}/COPYING
736 cp COPYING ${tempdir}/${subdir}
737 done
739 if [ "${newer}" ]; then
740 echo "Removing files older than $newer"
741 ## We remove .elc files unconditionally, on the theory that anyone picking
742 ## up an incremental distribution already has a running Emacs to byte-compile
743 ## them with.
744 find ${tempparent} \( -name '*.elc' -o ! -newer ${newer} \) -exec rm -f {} \;
747 if [ "${make_tar}" = yes ]; then
748 if [ "${default_gzip}" = "" ]; then
749 echo "Looking for gzip"
750 temppath=`echo $PATH | sed 's/^:/.:/
751 s/::/:.:/g
752 s/:$/:./
753 s/:/ /g'`
754 default_gzip=`(
755 for dir in ${temppath}; do
756 if [ -f ${dir}/gzip ]; then echo 'gzip --best'; exit 0; fi
757 done
758 echo compress
761 case "${default_gzip}" in
762 bzip2) gzip_extension=.bz2 ;;
763 compress* ) gzip_extension=.Z ;;
764 lzma) gzip_extension=.lzma ;;
765 * ) gzip_extension=.gz ;;
766 esac
767 echo "Creating tar file"
768 (cd ${tempparent} ; tar cvf - ${emacsname} ) \
769 | ${default_gzip} \
770 > ${emacsname}.tar${gzip_extension}
773 if [ "${clean_up}" = yes ]; then
774 echo "Cleaning up the staging directory"
775 rm -rf ${tempparent}
776 else
777 (cd ${tempparent}; mv ${emacsname} ..)
778 rm -rf ${tempparent}
781 # arch-tag: 26e3eb50-a394-4ab2-82b2-d8e5af500de7
782 ### make-dist ends here