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 Free Software Foundation, Inc.
11 # This file is part of GNU Emacs.
13 # GNU Emacs is free software; you can redistribute it and/or modify
14 # it under the terms of the GNU General Public License as published by
15 # the Free Software Foundation; either version 2, or (at your option)
18 # GNU Emacs is distributed in the hope that it will be useful,
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 # GNU General Public License for more details.
23 # You should have received a copy of the GNU General Public License
24 # along with GNU Emacs; see the file COPYING. If not, write to the
25 # Free Software Foundation, Inc., 59 Temple Place - Suite 330,
26 # Boston, MA 02111-1307, USA.
30 ### Exit if a command fails.
33 ### Print out each line we read, for debugging's sake.
36 ## Don't restrict access to any files.
45 while [ $# -gt 0 ]; do
47 ## This option tells make-dist to delete the staging directory
48 ## when done. It is useless to use this unless you make a tar file.
52 ## This option tells make-dist to make a tar file.
56 ## This option tells make-dist not to recompile or do analogous things.
60 ## This option says don't check for bad file names, etc.
64 ## This option tells make-dist to make the distribution normally, then
65 ## remove all files older than the given timestamp file. This is useful
66 ## for creating incremental or patch distributions.
72 ## This option tells make-dist to use `compress' instead of gzip.
73 ## Normally, make-dist uses gzip whenever it is present.
75 default_gzip
="compress"
78 echo "${progname}: Unrecognized argument: $1" >&2
85 ### Make sure we're running in the right place.
86 if [ ! -d src
-o ! -f src
/lisp.h
-o ! -d lisp
-o ! -f lisp
/version.el
]; then
87 echo "${progname}: Can't find \`src/lisp.h' and \`lisp/version.el'." >&2
88 echo "${progname} must be run in the top directory of the Emacs" >&2
89 echo "distribution tree. cd to that directory and try again." >&2
93 ### Find where to run Emacs.
94 ### (We don't accept EMACS=t as an answer, since that probably only means
95 ### that the shell is running in an Emacs window.)
100 EMACS
=`pwd`/src
/emacs
102 if [ "x$EMACS" = "x" -o "x$EMACS" = "xt" ];
104 echo You must specify the EMACS environment variable
2>&1
110 ### Find out which version of Emacs this is.
111 shortversion
=`grep 'defconst[ ]*emacs-version' lisp/version.el \
112 | sed -e 's/^.*"\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/'`
113 version
=`grep 'defconst[ ]*emacs-version' lisp/version.el \
114 | sed -e 's/^[^"]*"\([^"]*\)".*$/\1/'`
115 if [ ! "${version}" ]; then
116 echo "${progname}: can't find current Emacs version in \`./lisp/version.el'" >&2
120 echo Version numbers are
$version and
$shortversion
122 if [ $update = yes ];
124 if grep -s "GNU Emacs version ${shortversion}" .
/man
/emacs.texi
> /dev
/null
; then
127 echo "You must update the version number in \`./man/emacs.texi'"
132 ### Make sure we don't already have a directory emacs-${version}.
134 emacsname
="emacs-${version}${new_extension}"
136 if [ -d ${emacsname} ]
138 echo Directory
"${emacsname}" already exists
>&2
142 ### Make sure the subdirectory is available.
143 tempparent
="make-dist.tmp.$$"
144 if [ -d ${tempparent} ]; then
145 echo "${progname}: staging directory \`${tempparent}' already exists.
146 Perhaps a previous invocation of \`${progname}' failed to clean up after
147 itself. Check that directories whose names are of the form
148 \`make-dist.tmp.NNNNN' don't contain any important information, remove
149 them, and try again." >&2
153 ### Find where to run Emacs.
156 ### Check for .elc files with no corresponding .el file.
157 ls -1 lisp
/[a-z
]*.el lisp
/[a-z
]*/[a-z
]*.el \
158 leim
/[a-z
]*.el leim
/[a-z
]*/[a-z
]*.el |
sed 's/\.el$/.elc/' > /tmp
/el
159 ls -1 lisp
/[a-z
]*.elc lisp
/[a-z
]*/[a-z
]*.elc \
160 leim
/[a-z
]*.elc leim
/[a-z
]*/[a-z
]*.elc
> /tmp
/elc
161 bogosities
="`comm -13 /tmp/el /tmp/elc`"
162 if [ "${bogosities}" != "" ]; then
163 echo "The following .elc files have no corresponding .el files:"
166 rm -f /tmp
/el
/tmp
/elc
168 ### Check for .el files with no corresponding .elc file.
169 (cd lisp
; ls -1 [a-z
]*.el
[a-z
]*/[a-z
]*.el
; \
170 cd ..
/leim
; ls -1 [a-z
]*.el
[a-z
]*/[a-z
]*.el
) > /tmp
/el
171 (cd lisp
; ls -1 [a-z
]*.elc
[a-z
]*/[a-z
]*.elc
; \
172 cd ..
/leim
; ls -1 [a-z
]*.elc
[a-z
]*/[a-z
]*.elc
) |
sed 's/\.elc$/.el/' > /tmp
/elc
173 losers
="`comm -23 /tmp/el /tmp/elc`"
175 for file in $losers; do
176 file1
=`echo $file | sed -e "s|.*/||"`
177 if ! grep -q "dontcompilefiles:.* $file1\($\| \)" lisp
/Makefile
; then
179 site-init.el | site-load.el | site-start.el | default.el
)
184 bogosities
="$file $bogosities"
189 if [ x
"${bogosities}" != x
"" ]; then
190 echo "The following .el files have no corresponding .elc files:"
193 rm -f /tmp
/el
/tmp
/elc
195 ### Check for .el files that would overflow the 14-char limit if compiled.
196 long
=`find lisp leim -name '[a-zA-Z0-9]??????????*.el' -print`
197 if [ "$long" != "" ]; then
198 echo "The following .el file names are too long:"
203 ### Make sure configure is newer than configure.in.
204 if [ "x`ls -t configure configure.in | head -1`" != "xconfigure" ]; then
205 echo "\`./configure.in' is newer than \`./configure'" >&2
206 echo "Running autoconf" >&2
207 autoconf ||
{ x
=$?
; echo Autoconf FAILED
! >&2; exit $x; }
210 if [ $update = yes ];
212 echo "Updating Info files"
214 (cd man
; make -f Makefile.
in srcdir
=. info
)
216 echo "Updating finder, custom and autoload data"
218 (cd lisp
; make updates EMACS
=$EMACS)
220 echo "Updating leim-list.el"
222 (cd leim
; make leim-list.el EMACS
=$EMACS)
224 echo "Recompiling Lisp files"
226 $EMACS -batch -f batch-byte-recompile-directory lisp leim
229 echo "Making lisp/MANIFEST"
232 files
=`echo [!=]*.el | sed -e 's/ subdirs.el / /' -e 's/ default.el / /'`
234 if [ -d $dir ] && [ $dir != term
] && [ $dir != RCS
]; then
236 thisdir
=`echo $dir/[!=]*.el | sed -e 's/ subdirs.el / /'`
237 files
="$files $thisdir"
240 head -1 $files |
grep '^;' |
sed -e 's/;;; //' |
sort > MANIFEST
)
242 echo "Creating staging directory: \`${tempparent}'"
245 tempdir
="${tempparent}/${emacsname}"
247 ### This trap ensures that the staging directory will be cleaned up even
248 ### when the script is interrupted in mid-career.
249 if [ "${clean_up}" = yes ]; then
250 trap "echo 'Interrupted...cleaning up the staging directory'; rm -rf ${tempparent}; exit 1" 1 2 15
253 echo "Creating top directory: \`${tempdir}'"
256 ### We copy in the top-level files before creating the subdirectories in
257 ### hopes that this will make the top-level files appear first in the
258 ### tar file; this means that people can start reading the INSTALL and
259 ### README while the rest of the tar file is still unpacking. Whoopee.
260 echo "Making links to top-level files"
261 ln GETTING.GNU.SOFTWARE INSTALL README BUGS move-if-change
${tempdir}
262 ln ChangeLog Makefile.
in configure configure.
in ${tempdir}
263 ln config.bat make-dist update-subdirs vpath.
sed ${tempdir}
264 ### Copy these files; they're cross-filesystem symlinks.
265 cp mkinstalldirs
${tempdir}
266 cp config.sub
${tempdir}
267 cp config.guess
${tempdir}
268 cp install.sh
${tempdir}
270 echo "Updating version number in README"
273 '$1 " " $2 " " $3 " " $4 " " $5 == "This directory tree holds version" { $6 = version; print $0 }
274 $1 " " $2 " " $3 " " $4 " " $5 != "This directory tree holds version"' \
275 version
=${version} README
> tmp.README
276 mv -f tmp.README README
)
279 echo "Creating subdirectories"
280 for subdir
in lisp site-lisp leim real-leim real-leim
/CXTERM-DIC \
281 real-leim
/SKK-DIC real-leim
/skk real-leim
/quail \
282 src src
/m src
/s src
/bitmaps lib-src oldXMenu lwlib \
283 nt nt
/inc nt
/inc
/sys nt
/inc
/arpa nt
/inc
/netinet nt
/icons \
284 etc etc
/e lock info man msdos vms
; do
285 mkdir
${tempdir}/${subdir}
288 echo "Initializing \`leim' subdirectory"
289 cp leim-Makefile.
in ${tempdir}/leim
/Makefile.
in
291 echo "Making links to \`lisp' and its subdirectories"
292 ### Don't distribute TAGS, =*.el files, site-init.el, site-load.el, or default.el.
294 ln [a-zA-Z
]*.el ..
/${tempdir}/lisp
295 ln [a-zA-Z
]*.elc ..
/${tempdir}/lisp
296 ln [a-zA-Z
]*.dat ..
/${tempdir}/lisp
297 ## simula.el doesn't keep abbreviations in simula.defns any more.
298 ## ln [a-zA-Z]*.defns ../${tempdir}/lisp
299 ln ChangeLog Makefile makefile.nt ChangeLog.? README ..
/${tempdir}/lisp
300 (cd ..
/${tempdir}/lisp
302 rm -f site-init site-init.el site-init.elc
303 rm -f site-load site-load.el site-load.elc
304 rm -f site-start site-start.el site-start.elc
305 rm -f default default.el default.elc
308 ## Find all subdirs of lisp dir
309 for file in `find . -type d -print`; do
311 . | .. |
*/Old |
*/RCS |
*/=*)
314 if [ -d $file ]; then
315 subdirs
="$file $subdirs"
321 for file in $subdirs; do
323 mkdir ..
/${tempdir}/lisp
/$file
324 ln $file/[a-zA-Z
]*.el ..
/${tempdir}/lisp
/$file
325 ln $file/[a-zA-Z
]*.elc ..
/${tempdir}/lisp
/$file
326 if [ -f $file/README
]; then
327 ln $file/README ..
/${tempdir}/lisp
/$file
329 if [ -f $file/ChangeLog
]; then
330 ln $file/ChangeLog ..
/${tempdir}/lisp
/$file
334 echo "Making links to \`leim' and its subdirectories for the LEIM distribution"
335 ### Don't distribute TAGS, or =*.el files.
337 ln Makefile.
in makefile.nt ..
/${tempdir}/real-leim
338 ln ChangeLog README ..
/${tempdir}/real-leim
340 ln CXTERM-DIC
/*.tit ..
/${tempdir}/real-leim
/CXTERM-DIC
341 ln SKK-DIC
/README SKK-DIC
/SKK-JISYO.L ..
/${tempdir}/real-leim
/SKK-DIC
342 ln skk
/*.el skk
/*.elc ..
/${tempdir}/real-leim
/skk
343 ln quail
/*.el quail
/*.elc ..
/${tempdir}/real-leim
/quail
345 cd ..
/${tempdir}/real-leim
348 ### Move the real-leim directory outside of Emacs proper.
350 mkdir
${emacsname}-leim
351 mkdir
${emacsname}-leim/${emacsname}
352 mv ${emacsname}/real-leim ${emacsname}-leim/${emacsname}/leim
)
354 echo "Making links to \`src'"
355 ### Don't distribute =*.[ch] files, or the configured versions of
356 ### config.in, paths.in, or Makefile.in, or TAGS.
358 echo " (It is ok if ln fails in some cases.)"
359 ln [a-zA-Z
]*.c ..
/${tempdir}/src
360 ln [a-zA-Z
]*.h ..
/${tempdir}/src
361 ln [a-zA-Z
]*.s ..
/${tempdir}/src
362 ln [a-zA-Z
]*.
in ..
/${tempdir}/src
363 ln [a-zA-Z
]*.opt ..
/${tempdir}/src
364 ## If we ended up with a symlink, or if we did not get anything
365 ## due to a cross-device symlink, copy the file.
366 for file in [a-zA-Z
]*.
[hcs
] [a-zA-Z
]*.
in [a-zA-Z
]*.opt
; do
367 if test -f ..
/${tempdir}/src
/$file; then
368 # test -f appears to succeed for a symlink
369 if test -L ..
/${tempdir}/src
/$file; then
370 rm ..
/${tempdir}/src
/$file
371 cp -p $file ..
/${tempdir}/src
372 chmod a-w ..
/${tempdir}/src
/$file
375 rm ..
/${tempdir}/src
/$file
376 cp -p $file ..
/${tempdir}/src
377 chmod a-w ..
/${tempdir}/src
/$file
380 ln README ChangeLog ChangeLog.
*[0-9] ..
/${tempdir}/src
381 ln makefile.nt vms-pp.trans ..
/${tempdir}/src
382 ln .gdbinit .dbxinit ..
/${tempdir}/src
384 rm -f config.h paths.h Makefile Makefile.c
387 echo "Making links to \`src/bitmaps'"
389 ln README
*.xbm ..
/..
/${tempdir}/src
/bitmaps
)
391 echo "Making links to \`src/m'"
393 # We call files for miscellaneous input (to linker etc) .inp.
394 ln README
[a-zA-Z0-9
]*.h
*.inp ..
/..
/${tempdir}/src
/m
)
396 echo "Making links to \`src/s'"
398 ln README
[a-zA-Z0-9
]*.h ..
/..
/${tempdir}/src
/s
)
400 echo "Making links to \`lib-src'"
402 ln [a-zA-Z
]*.
[chy
] ..
/${tempdir}/lib-src
403 ln ChangeLog Makefile.
in README testfile vcdiff ..
/${tempdir}/lib-src
404 ln emacs.csh rcs2log rcs-checkin makefile.nt ..
/${tempdir}/lib-src
405 ## If we ended up with a symlink, or if we did not get anything
406 ## due to a cross-device symlink, copy the file.
407 for file in [a-zA-Z
]*.
[chy
]; do
408 if test -f ..
/${tempdir}/lib-src
/$file; then
409 # test -f appears to succeed for a symlink
410 if test -L ..
/${tempdir}/lib-src
/$file; then
411 rm ..
/${tempdir}/lib-src
/$file
412 cp $file ..
/${tempdir}/lib-src
413 chmod a-w ..
/${tempdir}/lib-src
/$file
416 rm ..
/${tempdir}/lib-src
/$file
417 cp $file ..
/${tempdir}/lib-src
418 chmod a-w ..
/${tempdir}/lib-src
/$file
421 cd ..
/${tempdir}/lib-src
425 echo "Making links to \`nt'"
427 ln emacs.ico emacs.rc config.nt
[a-z
]*.
in [a-z
]*.c ..
/${tempdir}/nt
428 ln [a-z
]*.bat
[a-z
]*.h makefile.def makefile.nt ..
/${tempdir}/nt
429 ln TODO ChangeLog INSTALL README ..
/${tempdir}/nt
)
431 echo "Making links to \`nt/inc'"
433 ln [a-z
]*.h ..
/..
/${tempdir}/nt
/inc
)
435 echo "Making links to \`nt/inc/sys'"
437 ln [a-z
]*.h ..
/..
/..
/${tempdir}/nt
/inc
/sys
)
439 echo "Making links to \`nt/inc/arpa'"
441 ln [a-z
]*.h ..
/..
/..
/${tempdir}/nt
/inc
/arpa
)
443 echo "Making links to \`nt/inc/netinet'"
445 ln [a-z
]*.h ..
/..
/..
/${tempdir}/nt
/inc
/netinet
)
447 echo "Making links to \`nt/icons'"
449 ln [a-z
]*.ico ..
/..
/${tempdir}/nt
/icons
)
451 echo "Making links to \`msdos'"
453 ln ChangeLog emacs.ico emacs.pif ..
/${tempdir}/msdos
454 ln is_exec.c sigaction.c mainmake mainmake.v2
sed*.inp ..
/${tempdir}/msdos
455 cd ..
/${tempdir}/msdos
458 echo "Making links to \`oldXMenu'"
460 ln *.c
*.h
*.
in ..
/${tempdir}/oldXMenu
461 ln README Imakefile ChangeLog ..
/${tempdir}/oldXMenu
462 ln compile.com descrip.mms ..
/${tempdir}/oldXMenu
)
464 echo "Making links to \`lwlib'"
466 ln *.c
*.h
*.
in ..
/${tempdir}/lwlib
467 ln README Imakefile ChangeLog ..
/${tempdir}/lwlib
468 cd ..
/${tempdir}/lwlib
471 echo "Making links to \`etc'"
472 ### Don't distribute = files, TAGS, DOC files, backups, autosaves, or
475 files
=`ls -d * | grep -v 'RCS' | grep -v 'Old' | grep -v '^e$'`
476 ln $files ..
/${tempdir}/etc
477 ## If we ended up with a symlink, or if we did not get anything
478 ## due to a cross-device symlink, copy the file.
479 for file in $files; do
480 if test -f ..
/${tempdir}/etc
/$file; then
481 # test -f appears to succeed for a symlink
482 if test -L ..
/${tempdir}/etc
/$file; then
483 rm ..
/${tempdir}/etc
/$file
484 cp $file ..
/${tempdir}/etc
485 chmod a-w ..
/${tempdir}/etc
/$file
488 rm ..
/${tempdir}/etc
/$file
489 cp $file ..
/${tempdir}/etc
490 chmod a-w ..
/${tempdir}/etc
/$file
495 rm -f DOC
* *~ \
#*\# *.dvi *.log *.orig *.rej *,v =* core
498 echo "Making links to \`etc/e'"
500 ln `ls -d * | grep -v 'RCS'` ..
/..
/${tempdir}/etc
/e
501 cd ..
/..
/${tempdir}/etc
/e
502 rm -f *~ \
#*\# *,v =* core)
504 echo "Making links to \`info'"
505 # Don't distribute backups or autosaves.
507 ln [a-zA-Z
]* ..
/${tempdir}/info
508 cd ..
/${tempdir}/info
509 # Avoid an error when expanding the wildcards later.
510 ln emacs dummy~
; ln emacs \
#dummy\#
513 echo "Making links to \`man'"
515 ln *.texi
*.aux
*.cps
*.fns
*.kys
*.vrs ..
/${tempdir}/man
516 test -f README
&& ln README ..
/${tempdir}/man
517 test -f Makefile.
in && ln Makefile.
in ..
/${tempdir}/man
518 ln ChangeLog split-man ..
/${tempdir}/man
519 cp texinfo.tex ..
/${tempdir}/man
521 rm -f \
#*\# =* *~ core emacs-index* *.Z *.z xmail
522 rm -f emacs.?? termcap.?? gdb.??
*.log
*.toc
*.dvi
*.oaux
)
524 echo "Making links to \`vms'"
526 ln [0-9a-zA-Z]* ..
/${tempdir}/vms
530 ### It would be nice if they could all be symlinks to etc's copy, but
531 ### you're not supposed to have any symlinks in distribution tar files.
532 echo "Making sure copying notices are all copies of \`etc/COPYING'"
533 rm -f ${tempdir}/etc
/COPYING
534 cp etc
/COPYING
${tempdir}/etc
/COPYING
535 for subdir
in lisp src lib-src info msdos
; do
536 if [ -f ${tempdir}/${subdir}/COPYING
]; then
537 rm ${tempdir}/${subdir}/COPYING
539 cp etc
/COPYING
${tempdir}/${subdir}
542 #### Make sure that there aren't any hard links between files in the
543 #### distribution; people with afs can't deal with that. Okay,
544 #### actually we just re-copy anything with a link count greater
545 #### than two. (Yes, strictly greater than 2 is correct; since we
546 #### created these files by linking them in from the original tree,
547 #### they'll have exactly two links normally.)
549 #### Commented out since it's not strictly necessary; it should suffice
550 #### to just break the link on alloca.c.
551 #echo "Breaking intra-tree links."
552 #find ${tempdir} ! -type d -links +2 \
553 # -exec cp -p {} $$ \; -exec rm -f {} \; -exec mv $$ {} \;
554 rm -f $tempdir/lib-src
/alloca.c
555 cp $tempdir/src
/alloca.c
$tempdir/lib-src
/alloca.c
557 if [ "${newer}" ]; then
558 echo "Removing files older than $newer"
559 ## We remove .elc files unconditionally, on the theory that anyone picking
560 ## up an incremental distribution already has a running Emacs to byte-compile
562 find ${tempparent} \( -name '*.elc' -o ! -newer ${newer} \) -exec rm -f {} \
;
565 if [ "${make_tar}" = yes ]; then
566 if [ "${default_gzip}" = "" ]; then
567 echo "Looking for gzip"
568 temppath
=`echo $PATH | sed 's/^:/.:/
573 for dir in ${temppath}; do
574 if [ -f ${dir}/gzip ]; then echo 'gzip --best'; exit 0; fi
579 case "${default_gzip}" in
580 compress* ) gzip_extension
=.Z
;;
581 * ) gzip_extension
=.gz
;;
583 echo "Creating tar files"
584 (cd ${tempparent} ; tar cvf
- ${emacsname} ) \
586 > ${emacsname}.
tar${gzip_extension}
587 (cd ${tempparent}/${emacsname}-leim ; tar cvf - ${emacsname} ) \
589 > ${emacsname}-leim.
tar${gzip_extension}
592 if [ "${clean_up}" = yes ]; then
593 echo "Cleaning up the staging directory"
596 (cd ${tempparent}; mv ${emacsname} ${emacsname}-leim ..
)
600 ### make-dist ends here