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 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.
41 while [ $# -gt 0 ]; do
43 ## This option tells make-dist to delete the staging directory
44 ## when done. It is useless to use this unless you make a tar file.
48 ## This option tells make-dist to make a tar file.
52 ## This option tells make-dist not to recompile or do analogous things.
56 ## This option tells make-dist to make the distribution normally, then
57 ## remove all files older than the given timestamp file. This is useful
58 ## for creating incremental or patch distributions.
64 ## This option tells make-dist to use `compress' instead of gzip.
65 ## Normally, make-dist uses gzip whenever it is present.
67 default_gzip
="compress"
70 echo "${progname}: Unrecognized argument: $1" >&2
77 ### Make sure we're running in the right place.
78 if [ ! -d src
-o ! -f src
/lisp.h
-o ! -d lisp
-o ! -f lisp
/version.el
]; then
79 echo "${progname}: Can't find \`src/lisp.h' and \`lisp/version.el'." >&2
80 echo "${progname} must be run in the top directory of the Emacs" >&2
81 echo "distribution tree. cd to that directory and try again." >&2
85 ### Find where to run Emacs.
94 echo You must specify the EMACS environment variable
2>&1
100 ### Find out which version of Emacs this is.
101 shortversion
=`grep 'defconst[ ]*emacs-version' lisp/version.el \
102 | sed -e 's/^.*"\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/'`
103 version
=`grep 'defconst[ ]*emacs-version' lisp/version.el \
104 | sed -e 's/^[^"]*"\([^"]*\)".*$/\1/'`
105 if [ ! "${version}" ]; then
106 echo "${progname}: can't find current Emacs version in \`./lisp/version.el'" >&2
110 echo Version numbers are
$version and
$shortversion
112 if [ $update = yes ];
114 if grep -s "GNU Emacs version ${shortversion}" .
/man
/emacs.texi
> /dev
/null
; then
117 echo "You must update the version number in \`./man/emacs.texi'"
122 ### Make sure we don't already have a directory emacs-${version}.
124 emacsname
="emacs-${version}${new_extension}"
126 if [ -d ${emacsname} ]
128 echo Directory
"${emacsname}" already exists
>&2
132 ### Make sure the subdirectory is available.
133 tempparent
="make-dist.tmp.$$"
134 if [ -d ${tempparent} ]; then
135 echo "${progname}: staging directory \`${tempparent}' already exists.
136 Perhaps a previous invocation of \`${progname}' failed to clean up after
137 itself. Check that directories whose names are of the form
138 \`make-dist.tmp.NNNNN' don't contain any important information, remove
139 them, and try again." >&2
143 ### Check for .elc files with no corresponding .el file.
144 ls -1 lisp
/*.el |
sed 's/\.el$/.elc/' > /tmp
/el
145 ls -1 lisp
/*.elc
> /tmp
/elc
146 bogosities
="`comm -13 /tmp/el /tmp/elc`"
147 if [ "${bogosities}" != "" ]; then
148 echo "The following .elc files have no corresponding .el files:"
151 rm -f /tmp
/el
/tmp
/elc
153 ### Check for .el files that would overflow the 14-char limit if compiled.
154 long
=`find lisp -name '[a-zA-Z0-9]??????????*.el' -print`
155 if [ "$long" != "" ]; then
156 echo "The following .el file names are too long:"
160 ### Make sure configure is newer than configure.in.
161 if [ "x`ls -t configure configure.in | head -1`" != "xconfigure" ]; then
162 echo "\`./configure.in' is newer than \`./configure'" >&2
163 echo "Running autoconf" >&2
164 autoconf ||
{ x
=$?
; echo Autoconf FAILED
! >&2; exit $x; }
167 if [ $update = yes ];
169 echo "Updating Info files"
173 echo "Updating finder-inf.el"
175 (cd lisp
; $EMACS -batch -l finder
-f finder-compile-keywords-make-dist
)
177 echo "Recompiling Lisp files"
179 $EMACS -batch -f batch-byte-recompile-directory lisp
181 echo "Updating autoloads"
183 $EMACS -batch -f batch-update-autoloads lisp
186 echo "Making lisp/MANIFEST"
188 (cd lisp
; head -1 [!=]*.el |
grep '^;' |
sed -e 's/;;; //' > MANIFEST
)
190 echo "Creating staging directory: \`${tempparent}'"
193 tempdir
="${tempparent}/${emacsname}"
195 ### This trap ensures that the staging directory will be cleaned up even
196 ### when the script is interrupted in mid-career.
197 if [ "${clean_up}" = yes ]; then
198 trap "echo 'Interrupted...cleaning up the staging directory'; rm -rf ${tempparent}; exit 1" 1 2 15
201 echo "Creating top directory: \`${tempdir}'"
204 ### We copy in the top-level files before creating the subdirectories in
205 ### hopes that this will make the top-level files appear first in the
206 ### tar file; this means that people can start reading the INSTALL and
207 ### README while the rest of the tar file is still unpacking. Whoopee.
208 echo "Making links to top-level files"
209 ln GETTING.GNU.SOFTWARE INSTALL PROBLEMS README BUGS move-if-change
${tempdir}
210 ln ChangeLog Makefile.
in configure configure.
in ${tempdir}
211 ln config.bat make-dist update-subdirs vpath.
sed ${tempdir}
212 ### Copy these files; they're cross-filesystem symlinks.
213 cp mkinstalldirs
${tempdir}
214 cp config.sub
${tempdir}
215 cp config.guess
${tempdir}
216 cp install.sh
${tempdir}
218 echo "Updating version number in README"
221 '$1 " " $2 " " $3 " " $4 " " $5 == "This directory tree holds version" { $6 = version; print $0 }
222 $1 " " $2 " " $3 " " $4 " " $5 != "This directory tree holds version"' \
223 version
=${version} README
> tmp.README
224 mv tmp.README README
)
227 echo "Creating subdirectories"
228 for subdir
in lisp lisp
/term lisp
/language site-lisp \
229 src src
/m src
/s src
/bitmaps lib-src oldXMenu lwlib \
230 nt nt
/inc nt
/inc
/sys nt
/inc
/arpa nt
/inc
/netinet \
231 etc etc
/e lock cpp info man msdos vms
; do
232 mkdir
${tempdir}/${subdir}
235 echo "Making links to \`lisp'"
236 ### Don't distribute TAGS, =*.el files, site-init.el, site-load.el, or default.el.
238 ln [a-zA-Z
]*.el ..
/${tempdir}/lisp
239 ln [a-zA-Z
]*.elc ..
/${tempdir}/lisp
240 ln [a-zA-Z
]*.dat ..
/${tempdir}/lisp
241 ## simula.el doesn't keep abbreviations in simula.defns any more.
242 ## ln [a-zA-Z]*.defns ../${tempdir}/lisp
243 ln ChangeLog Makefile makefile.nt ChangeLog.? README ..
/${tempdir}/lisp
244 cd ..
/${tempdir}/lisp
247 rm -f site-init site-init.el site-init.elc
248 rm -f site-load site-load.el site-load.elc
249 rm -f site-start site-start.el site-start.elc
250 rm -f default default.el default.elc
)
252 #echo "Making links to \`lisp/calc-2.02'"
253 #### Don't distribute =*.el files, TAGS or backups.
255 # ln [a-zA-Z]*.el ../../${tempdir}/lisp/calc-2.02
256 # ln [a-zA-Z]*.elc ../../${tempdir}/lisp/calc-2.02
257 # ln calc.info* calc.texinfo calc-refcard.* ../../${tempdir}/lisp/calc-2.02
258 # ln INSTALL Makefile README README.prev ../../${tempdir}/lisp/calc-2.02
259 # cd ../../${tempdir}/lisp/calc-2.02
262 echo "Making links to \`lisp/term'"
263 ### Don't distribute =*.el files or TAGS.
265 ln [a-zA-Z
]*.el ..
/..
/${tempdir}/lisp
/term
266 ln [a-zA-Z
]*.elc ..
/..
/${tempdir}/lisp
/term
267 ln README ..
/..
/${tempdir}/lisp
/term
270 echo "Making links to \`lisp/term'"
271 ### Don't distribute =*.el files or TAGS.
273 ln [a-zA-Z
]*.el ..
/..
/${tempdir}/lisp
/language
274 ln [a-zA-Z
]*.elc ..
/..
/${tempdir}/lisp
/language
277 echo "Making links to \`src'"
278 ### Don't distribute =*.[ch] files, or the configured versions of
279 ### config.in, paths.in, or Makefile.in, or TAGS.
281 echo " (It is ok if ln fails in some cases.)"
282 ln [a-zA-Z
]*.c ..
/${tempdir}/src
283 ln [a-zA-Z
]*.h ..
/${tempdir}/src
284 ln [a-zA-Z
]*.s ..
/${tempdir}/src
285 ln [a-zA-Z
]*.
in ..
/${tempdir}/src
286 ln [a-zA-Z
]*.opt ..
/${tempdir}/src
287 ## If we ended up with a symlink, or if we did not get anything
288 ## due to a cross-device symlink, copy the file.
289 for file in [a-zA-Z
]*.
[hcs
] [a-zA-Z
]*.
in [a-zA-Z
]*.opt
; do
290 if test -f ..
/${tempdir}/src
/$file; then
291 # test -f appears to succeed for a symlink
292 if test -L ..
/${tempdir}/src
/$file; then
293 rm ..
/${tempdir}/src
/$file
294 cp $file ..
/${tempdir}/src
295 chmod a-w ..
/${tempdir}/src
/$file
298 rm ..
/${tempdir}/src
/$file
299 cp $file ..
/${tempdir}/src
300 chmod a-w ..
/${tempdir}/src
/$file
303 ln README ChangeLog ChangeLog.
*[0-9] ..
/${tempdir}/src
304 ln makefile.nt vms-pp.trans ..
/${tempdir}/src
305 ln .gdbinit .dbxinit ..
/${tempdir}/src
307 rm -f config.h paths.h Makefile Makefile.c
310 echo "Making links to \`src/bitmaps'"
312 ln README
*.xbm ..
/..
/${tempdir}/src
/bitmaps
)
314 echo "Making links to \`src/m'"
316 # We call files for miscellaneous input (to linker etc) .inp.
317 ln README
[a-zA-Z0-9
]*.h
*.inp ..
/..
/${tempdir}/src
/m
)
319 echo "Making links to \`src/s'"
321 ln README
[a-zA-Z0-9
]*.h ..
/..
/${tempdir}/src
/s
)
323 echo "Making links to \`lib-src'"
325 ln [a-zA-Z
]*.
[chy
] ..
/${tempdir}/lib-src
326 ln ChangeLog Makefile.
in README testfile vcdiff ..
/${tempdir}/lib-src
327 ln emacs.csh rcs2log rcs-checkin makefile.nt ..
/${tempdir}/lib-src
328 ## If we ended up with a symlink, or if we did not get anything
329 ## due to a cross-device symlink, copy the file.
330 for file in [a-zA-Z
]*.
[chy
]; do
331 if test -f ..
/${tempdir}/lib-src
/$file; then
332 # test -f appears to succeed for a symlink
333 if test -L ..
/${tempdir}/lib-src
/$file; then
334 rm ..
/${tempdir}/lib-src
/$file
335 cp $file ..
/${tempdir}/lib-src
336 chmod a-w ..
/${tempdir}/lib-src
/$file
339 rm ..
/${tempdir}/lib-src
/$file
340 cp $file ..
/${tempdir}/lib-src
341 chmod a-w ..
/${tempdir}/lib-src
/$file
344 cd ..
/${tempdir}/lib-src
348 echo "Making links to \`nt'"
350 ln emacs.ico emacs.rc config.nt
[a-z
]*.
in [a-z
]*.c ..
/${tempdir}/nt
351 ln [a-z
]*.bat
[a-z
]*.h makefile.def makefile.nt ..
/${tempdir}/nt
352 ln TODO ChangeLog INSTALL README ..
/${tempdir}/nt
)
354 echo "Making links to \`nt/inc'"
356 ln [a-z
]*.h ..
/..
/${tempdir}/nt
/inc
)
358 echo "Making links to \`nt/inc/sys'"
360 ln [a-z
]*.h ..
/..
/..
/${tempdir}/nt
/inc
/sys
)
362 echo "Making links to \`nt/inc/arpa'"
364 ln [a-z
]*.h ..
/..
/..
/${tempdir}/nt
/inc
/arpa
)
366 echo "Making links to \`nt/inc/netinet'"
368 ln [a-z
]*.h ..
/..
/..
/${tempdir}/nt
/inc
/netinet
)
370 echo "Making links to \`msdos'"
372 ln ChangeLog emacs.ico emacs.pif ..
/${tempdir}/msdos
373 ln is_exec.c sigaction.c mainmake mainmake.v2
sed*.inp ..
/${tempdir}/msdos
374 cd ..
/${tempdir}/msdos
377 echo "Making links to \`oldXMenu'"
379 ln *.c
*.h
*.
in ..
/${tempdir}/oldXMenu
380 ln README Imakefile ChangeLog ..
/${tempdir}/oldXMenu
381 ln compile.com descrip.mms ..
/${tempdir}/oldXMenu
)
383 echo "Making links to \`lwlib'"
385 ln *.c
*.h
*.
in ..
/${tempdir}/lwlib
386 ln README Imakefile ChangeLog ..
/${tempdir}/lwlib
387 cd ..
/${tempdir}/lwlib
390 echo "Making links to \`etc'"
391 ### Don't distribute = files, TAGS, DOC files, backups, autosaves, or
394 ln `ls -d * | grep -v 'RCS' | grep -v 'Old' | grep -v '^e$'` ..
/${tempdir}/etc
396 rm -f DOC
* *~ \
#*\# *.dvi *.log *.orig *.rej *,v =* core
399 echo "Making links to \`etc/e'"
401 ln `ls -d * | grep -v 'RCS'` ..
/..
/${tempdir}/etc
/e
402 cd ..
/..
/${tempdir}/etc
/e
403 rm -f *~ \
#*\# *,v =* core)
405 echo "Making links to \`cpp'"
407 ln cccp.c cexp.y Makefile README ..
/${tempdir}/cpp
)
409 echo "Making links to \`info'"
410 # Don't distribute backups or autosaves.
412 ln [a-zA-Z
]* ..
/${tempdir}/info
413 cd ..
/${tempdir}/info
414 # Avoid an error when expanding the wildcards later.
415 ln emacs dummy~
; ln emacs \
#dummy\#
418 echo "Making links to \`man'"
420 ln *.texi
*.aux
*.cps
*.fns
*.kys
*.vrs ..
/${tempdir}/man
421 test -f README
&& ln README ..
/${tempdir}/man
422 test -f Makefile.
in && ln Makefile.
in ..
/${tempdir}/man
423 ln ChangeLog split-man ..
/${tempdir}/man
424 cp texinfo.tex ..
/${tempdir}/man
426 rm -f \
#*\# =* *~ core emacs-index* *.Z *.z xmail
427 rm -f emacs.?? termcap.?? gdb.??
*.log
*.toc
*.dvi
*.oaux
)
429 echo "Making links to \`vms'"
431 ln [0-9a-zA-Z]* ..
/${tempdir}/vms
435 ### It would be nice if they could all be symlinks to etc's copy, but
436 ### you're not supposed to have any symlinks in distribution tar files.
437 echo "Making sure copying notices are all copies of \`etc/COPYING'"
438 rm -f ${tempdir}/etc
/COPYING
439 cp etc
/COPYING
${tempdir}/etc
/COPYING
440 for subdir
in lisp src lib-src info msdos
; do
441 if [ -f ${tempdir}/${subdir}/COPYING
]; then
442 rm ${tempdir}/${subdir}/COPYING
444 cp etc
/COPYING
${tempdir}/${subdir}
447 #### Make sure that there aren't any hard links between files in the
448 #### distribution; people with afs can't deal with that. Okay,
449 #### actually we just re-copy anything with a link count greater
450 #### than two. (Yes, strictly greater than 2 is correct; since we
451 #### created these files by linking them in from the original tree,
452 #### they'll have exactly two links normally.)
454 #### Commented out since it's not strictly necessary; it should suffice
455 #### to just break the link on alloca.c.
456 #echo "Breaking intra-tree links."
457 #find ${tempdir} ! -type d -links +2 \
458 # -exec cp -p {} $$ \; -exec rm -f {} \; -exec mv $$ {} \;
459 rm -f $tempdir/lib-src
/alloca.c
460 cp $tempdir/src
/alloca.c
$tempdir/lib-src
/alloca.c
462 if [ "${newer}" ]; then
463 echo "Removing files older than $newer"
464 ## We remove .elc files unconditionally, on the theory that anyone picking
465 ## up an incremental distribution already has a running Emacs to byte-compile
467 find ${tempparent} \( -name '*.elc' -o ! -newer ${newer} \) -exec rm -f {} \
;
470 if [ "${make_tar}" = yes ]; then
471 if [ "${default_gzip}" = "" ]; then
472 echo "Looking for gzip"
473 temppath
=`echo $PATH | sed 's/^:/.:/
478 for dir in ${temppath}; do
479 if [ -f ${dir}/gzip ]; then echo 'gzip --best'; exit 0; fi
484 case "${default_gzip}" in
485 compress* ) gzip_extension
=.Z
;;
486 * ) gzip_extension
=.gz
;;
488 echo "Creating tar file"
489 (cd ${tempparent} ; tar cvf
- ${emacsname} ) \
491 > ${emacsname}.
tar${gzip_extension}
494 if [ "${clean_up}" = yes ]; then
495 echo "Cleaning up the staging directory"
498 (cd ${tempparent}; mv ${emacsname} ..
)
502 ### make-dist ends here