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
25 # the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
29 ### Exit if a command fails.
32 ### Print out each line we read, for debugging's sake.
39 while [ $# -gt 0 ]; do
41 ## This option tells make-dist to delete the staging directory
42 ## when done. It is useless to use this unless you make a tar file.
46 ## This option tells make-dist to make a tar file.
50 ## This option tells make-dist to make the distribution normally, then
51 ## remove all files older than the given timestamp file. This is useful
52 ## for creating incremental or patch distributions.
58 ## This option tells make-dist to use `compress' instead of gzip.
59 ## Normally, make-dist uses gzip whenever it is present.
61 default_gzip
="compress"
64 echo "${progname}: Unrecognized argument: $1" >&2
71 ### Make sure we're running in the right place.
72 if [ ! -d src
-o ! -f src
/lisp.h
-o ! -d lisp
-o ! -f lisp
/version.el
]; then
73 echo "${progname}: Can't find \`src/lisp.h' and \`lisp/version.el'." >&2
74 echo "${progname} must be run in the top directory of the Emacs" >&2
75 echo "distribution tree. cd to that directory and try again." >&2
79 ### Find out which version of Emacs this is.
80 shortversion
=`grep 'defconst[ ]*emacs-version' lisp/version.el \
81 | sed -e 's/^.*"\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/'`
82 version
=`grep 'defconst[ ]*emacs-version' lisp/version.el \
83 | sed -e 's/^[^"]*"\([^"]*\)".*$/\1/'`
84 if [ ! "${version}" ]; then
85 echo "${progname}: can't find current Emacs version in \`./lisp/version.el'" >&2
89 echo Version numbers are
$version and
$shortversion
91 if grep -s "GNU Emacs version ${shortversion}" .
/man
/emacs.texi
> /dev
/null
; then
94 echo "You must update the version number in \`./man/emacs.texi'"
98 ### Make sure we don't already have a directory emacs-${version}.
100 emacsname
="emacs-${version}${new_extension}"
102 if [ -d ${emacsname} ]
104 echo Directory
"${emacsname}" already exists
>&2
108 ### Make sure the subdirectory is available.
109 tempparent
="make-dist.tmp.$$"
110 if [ -d ${tempparent} ]; then
111 echo "${progname}: staging directory \`${tempparent}' already exists.
112 Perhaps a previous invocation of \`${progname}' failed to clean up after
113 itself. Check that directories whose names are of the form
114 \`make-dist.tmp.NNNNN' don't contain any important information, remove
115 them, and try again." >&2
119 ### Check for .elc files with no corresponding .el file.
120 ls -1 lisp
/*.el |
sed 's/\.el$/.elc/' > /tmp
/el
121 ls -1 lisp
/*.elc
> /tmp
/elc
122 bogosities
="`comm -13 /tmp/el /tmp/elc`"
123 if [ "${bogosities}" != "" ]; then
124 echo "The following .elc files have no corresponding .el files:"
127 rm -f /tmp
/el
/tmp
/elc
129 ### Check for .el files that would overflow the 14-char limit if compiled.
130 long
=`find lisp -name '[a-zA-Z0-9]??????????*.el' -print`
131 if [ "$long" != "" ]; then
132 echo "The following .el file names are too long:"
136 ### Make sure configure is newer than configure.in.
137 if [ "x`ls -t configure configure.in | head -1`" != "xconfigure" ]; then
138 echo "\`./configure.in' is newer than \`./configure'" >&2
139 echo "Running autoconf" >&2
140 autoconf ||
{ x
=$?
; echo Autoconf FAILED
! >&2; exit $x; }
143 echo "Updating Info files"
147 echo "Updating finder-inf.el"
149 (cd lisp
; ..
/src
/emacs
-batch -l finder
-f finder-compile-keywords-make-dist
)
151 echo "Recompiling Lisp files"
153 src
/emacs
-batch -f batch-byte-recompile-directory lisp
155 echo "Updating autoloads"
157 src
/emacs
-batch -f batch-update-autoloads lisp
159 echo "Making lisp/MANIFEST"
161 (cd lisp
; head -1 [!=]*.el |
grep '^;' |
sed -e 's/;;; //' > MANIFEST
)
163 echo "Creating staging directory: \`${tempparent}'"
166 tempdir
="${tempparent}/${emacsname}"
168 ### This trap ensures that the staging directory will be cleaned up even
169 ### when the script is interrupted in mid-career.
170 if [ "${clean_up}" = yes ]; then
171 trap "echo 'Interrupted...cleaning up the staging directory'; rm -rf ${tempparent}; exit 1" 1 2 15
174 echo "Creating top directory: \`${tempdir}'"
177 ### We copy in the top-level files before creating the subdirectories in
178 ### hopes that this will make the top-level files appear first in the
179 ### tar file; this means that people can start reading the INSTALL and
180 ### README while the rest of the tar file is still unpacking. Whoopee.
181 echo "Making links to top-level files"
182 ln GETTING.GNU.SOFTWARE INSTALL PROBLEMS README BUGS move-if-change
${tempdir}
183 ln ChangeLog Makefile.
in configure configure.
in ${tempdir}
184 ln config.bat make-dist update-subdirs vpath.
sed ${tempdir}
185 ### Copy these files; they're cross-filesystem symlinks.
186 cp mkinstalldirs
${tempdir}
187 cp config.sub
${tempdir}
188 cp config.guess
${tempdir}
189 cp install.sh
${tempdir}
191 echo "Updating version number in README"
194 '$1 " " $2 " " $3 " " $4 " " $5 == "This directory tree holds version" { $6 = version; print $0 }
195 $1 " " $2 " " $3 " " $4 " " $5 != "This directory tree holds version"' \
196 version
=${version} README
> tmp.README
197 mv tmp.README README
)
200 echo "Creating subdirectories"
201 for subdir
in lisp lisp
/term site-lisp \
202 src src
/m src
/s src
/bitmaps lib-src oldXMenu lwlib \
203 nt nt
/inc nt
/inc
/sys nt
/inc
/arpa nt
/inc
/netinet \
204 etc etc
/e lock cpp info man msdos vms
; do
205 mkdir
${tempdir}/${subdir}
208 echo "Making links to \`lisp'"
209 ### Don't distribute TAGS, =*.el files, site-init.el, site-load.el, or default.el.
211 ln [a-zA-Z
]*.el ..
/${tempdir}/lisp
212 ln [a-zA-Z
]*.elc ..
/${tempdir}/lisp
213 ln [a-zA-Z
]*.dat ..
/${tempdir}/lisp
214 ## simula.el doesn't keep abbreviations in simula.defns any more.
215 ## ln [a-zA-Z]*.defns ../${tempdir}/lisp
216 ln ChangeLog Makefile makefile.nt ChangeLog.? README ..
/${tempdir}/lisp
217 cd ..
/${tempdir}/lisp
220 rm -f site-init site-init.el site-init.elc
221 rm -f site-load site-load.el site-load.elc
222 rm -f site-start site-start.el site-start.elc
223 rm -f default default.el default.elc
)
225 #echo "Making links to \`lisp/calc-2.02'"
226 #### Don't distribute =*.el files, TAGS or backups.
228 # ln [a-zA-Z]*.el ../../${tempdir}/lisp/calc-2.02
229 # ln [a-zA-Z]*.elc ../../${tempdir}/lisp/calc-2.02
230 # ln calc.info* calc.texinfo calc-refcard.* ../../${tempdir}/lisp/calc-2.02
231 # ln INSTALL Makefile README README.prev ../../${tempdir}/lisp/calc-2.02
232 # cd ../../${tempdir}/lisp/calc-2.02
235 echo "Making links to \`lisp/term'"
236 ### Don't distribute =*.el files or TAGS.
238 ln [a-zA-Z
]*.el ..
/..
/${tempdir}/lisp
/term
239 ln [a-zA-Z
]*.elc ..
/..
/${tempdir}/lisp
/term
240 ln README ..
/..
/${tempdir}/lisp
/term
243 echo "Making links to \`src'"
244 ### Don't distribute =*.[ch] files, or the configured versions of
245 ### config.in, paths.in, or Makefile.in, or TAGS.
247 echo " (If we can't link gmalloc.c, that's okay.)"
248 ln [a-zA-Z
]*.c ..
/${tempdir}/src
249 ## Might be a symlink to a file on another filesystem.
250 test -f ..
/${tempdir}/src
/gmalloc.c ||
cp gmalloc.c ..
/${tempdir}/src
251 ln [a-zA-Z
]*.h ..
/${tempdir}/src
252 ln [a-zA-Z
]*.s ..
/${tempdir}/src
253 ln README Makefile.
in ChangeLog ChangeLog.? config.
in paths.
in \
255 ln makefile.nt ..
/${tempdir}/src
256 ln .gdbinit .dbxinit ..
/${tempdir}/src
257 ln *.opt vms-pp.trans ..
/${tempdir}/src
259 rm -f config.h paths.h Makefile Makefile.c
262 echo "Making links to \`src/bitmaps'"
264 ln README
*.xbm ..
/..
/${tempdir}/src
/bitmaps
)
266 echo "Making links to \`src/m'"
268 # We call files for miscellaneous input (to linker etc) .inp.
269 ln README
[a-zA-Z0-9
]*.h
*.inp ..
/..
/${tempdir}/src
/m
)
271 echo "Making links to \`src/s'"
273 ln README
[a-zA-Z0-9
]*.h ..
/..
/${tempdir}/src
/s
)
275 echo "Making links to \`lib-src'"
277 ln [a-zA-Z
]*.
[chy
] ..
/${tempdir}/lib-src
278 ln ChangeLog Makefile.
in README testfile vcdiff ..
/${tempdir}/lib-src
279 ln emacs.csh rcs2log rcs-checkin makefile.nt ..
/${tempdir}/lib-src
280 cd ..
/${tempdir}/lib-src
281 rm -f getdate.tab.c y.tab.c y.tab.h Makefile.c
284 echo "Making links to \`nt'"
286 ln emacs.ico emacs.rc config.nt
[a-z
]*.
in [a-z
]*.c ..
/${tempdir}/nt
287 ln [a-z
]*.bat
[a-z
]*.h makefile.def makefile.nt ..
/${tempdir}/nt
288 ln TODO ChangeLog INSTALL README ..
/${tempdir}/nt
)
290 echo "Making links to \`nt/inc'"
292 ln [a-z
]*.h ..
/..
/${tempdir}/nt
/inc
)
294 echo "Making links to \`nt/inc/sys'"
296 ln [a-z
]*.h ..
/..
/..
/${tempdir}/nt
/inc
/sys
)
298 echo "Making links to \`nt/inc/arpa'"
300 ln [a-z
]*.h ..
/..
/..
/${tempdir}/nt
/inc
/arpa
)
302 echo "Making links to \`nt/inc/netinet'"
304 ln [a-z
]*.h ..
/..
/..
/${tempdir}/nt
/inc
/netinet
)
306 echo "Making links to \`msdos'"
308 ln ChangeLog emacs.ico emacs.pif ..
/${tempdir}/msdos
309 ln mainmake mainmake.v2
sed*.inp ..
/${tempdir}/msdos
310 cd ..
/${tempdir}/msdos
313 echo "Making links to \`oldXMenu'"
315 ln *.c
*.h
*.
in ..
/${tempdir}/oldXMenu
316 ln README Imakefile ChangeLog ..
/${tempdir}/oldXMenu
317 ln compile.com descrip.mms ..
/${tempdir}/oldXMenu
)
319 echo "Making links to \`lwlib'"
321 ln *.c
*.h
*.
in ..
/${tempdir}/lwlib
322 ln README Imakefile ChangeLog ..
/${tempdir}/lwlib
323 cd ..
/${tempdir}/lwlib
326 echo "Making links to \`etc'"
327 ### Don't distribute = files, TAGS, DOC files, backups, autosaves, or
330 ln `ls -d * | grep -v 'RCS' | grep -v 'Old' | grep -v '^e$'` ..
/${tempdir}/etc
332 rm -f DOC
* *~ \
#*\# *.dvi *.log *.orig *.rej *,v =* core
335 echo "Making links to \`etc/e'"
337 ln `ls -d * | grep -v 'RCS'` ..
/..
/${tempdir}/etc
/e
338 cd ..
/..
/${tempdir}/etc
/e
339 rm -f *~ \
#*\# *,v =* core)
341 echo "Making links to \`cpp'"
343 ln cccp.c cexp.y Makefile README ..
/${tempdir}/cpp
)
345 echo "Making links to \`info'"
346 # Don't distribute backups or autosaves.
348 ln [a-zA-Z
]* ..
/${tempdir}/info
349 cd ..
/${tempdir}/info
350 # Avoid an error when expanding the wildcards later.
351 ln emacs dummy~
; ln emacs \
#dummy\#
354 echo "Making links to \`man'"
356 ln *.texi
*.aux
*.cps
*.fns
*.kys
*.vrs ..
/${tempdir}/man
357 test -f README
&& ln README ..
/${tempdir}/man
358 test -f Makefile.
in && ln Makefile.
in ..
/${tempdir}/man
359 ln ChangeLog split-man ..
/${tempdir}/man
360 cp texinfo.tex ..
/${tempdir}/man
362 rm -f \
#*\# =* *~ core emacs-index* *.Z *.z xmail
363 rm -f emacs.?? termcap.?? gdb.??
*.log
*.toc
*.dvi
*.oaux
)
365 echo "Making links to \`vms'"
367 ln [0-9a-zA-Z]* ..
/${tempdir}/vms
371 ### It would be nice if they could all be symlinks to etc's copy, but
372 ### you're not supposed to have any symlinks in distribution tar files.
373 echo "Making sure copying notices are all copies of \`etc/COPYING'"
374 rm -f ${tempdir}/etc
/COPYING
375 cp etc
/COPYING
${tempdir}/etc
/COPYING
376 for subdir
in lisp src lib-src info msdos
; do
377 if [ -f ${tempdir}/${subdir}/COPYING
]; then
378 rm ${tempdir}/${subdir}/COPYING
380 cp etc
/COPYING
${tempdir}/${subdir}
383 #### Make sure that there aren't any hard links between files in the
384 #### distribution; people with afs can't deal with that. Okay,
385 #### actually we just re-copy anything with a link count greater
386 #### than two. (Yes, strictly greater than 2 is correct; since we
387 #### created these files by linking them in from the original tree,
388 #### they'll have exactly two links normally.)
390 #### Commented out since it's not strictly necessary; it should suffice
391 #### to just break the link on alloca.c.
392 #echo "Breaking intra-tree links."
393 #find ${tempdir} ! -type d -links +2 \
394 # -exec cp -p {} $$ \; -exec rm -f {} \; -exec mv $$ {} \;
395 rm -f $tempdir/lib-src
/alloca.c
396 cp $tempdir/src
/alloca.c
$tempdir/lib-src
/alloca.c
398 if [ "${newer}" ]; then
399 echo "Removing files older than $newer"
400 ## We remove .elc files unconditionally, on the theory that anyone picking
401 ## up an incremental distribution already has a running Emacs to byte-compile
403 find ${tempparent} \( -name '*.elc' -o ! -newer ${newer} \) -exec rm -f {} \
;
406 if [ "${make_tar}" = yes ]; then
407 if [ "${default_gzip}" = "" ]; then
408 echo "Looking for gzip"
409 temppath
=`echo $PATH | sed 's/^:/.:/
414 for dir in ${temppath}; do
415 if [ -f ${dir}/gzip ]; then echo 'gzip --best'; exit 0; fi
420 case "${default_gzip}" in
421 compress* ) gzip_extension
=.Z
;;
422 * ) gzip_extension
=.gz
;;
424 echo "Creating tar file"
425 (cd ${tempparent} ; tar cvf
- ${emacsname} ) \
427 > ${emacsname}.
tar${gzip_extension}
430 if [ "${clean_up}" = yes ]; then
431 echo "Cleaning up the staging directory"
434 (cd ${tempparent}; mv ${emacsname} ..
)
438 ### make-dist ends here