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 not to delete the staging directory
42 ## after it's done making the tar file.
46 ## This option tells make-dist not to make a tar file. Since it's
47 ## rather pointless to build the whole staging directory and then
48 ## nuke it, using this option also selects '--no-clean-up'.
53 ## This option tells make-dist to make the distribution normally, then
54 ## remove all files older than the given timestamp file. This is useful
55 ## for creating incremental or patch distributions.
61 ## This option tells make-dist to use `compress' instead of gzip.
62 ## Normally, make-dist uses gzip whenever it is present.
64 default_gzip
="compress"
67 echo "${progname}: Unrecognized argument: $1" >&2
74 ### Make sure we're running in the right place.
75 if [ ! -d src
-o ! -f src
/lisp.h
-o ! -d lisp
-o ! -f lisp
/version.el
]; then
76 echo "${progname}: Can't find \`src/lisp.h' and \`lisp/version.el'." >&2
77 echo "${progname} must be run in the top directory of the Emacs" >&2
78 echo "distribution tree. cd to that directory and try again." >&2
82 ### Find out which version of Emacs this is.
83 shortversion
=`grep 'defconst[ ]*emacs-version' lisp/version.el \
84 | sed -e 's/^.*"\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/'`
85 version
=`grep 'defconst[ ]*emacs-version' lisp/version.el \
86 | sed -e 's/^[^"]*"\([^"]*\)".*$/\1/'`
87 if [ ! "${version}" ]; then
88 echo "${progname}: can't find current Emacs version in \`./lisp/version.el'." >&2
92 echo $version and
$shortversion
94 if grep -s "GNU Emacs version ${shortversion}" .
/man
/emacs.texi
> /dev
/null
; then
97 echo "You must update the version number in \`./man/emacs.texi'"
101 ### Make sure we don't already have a directory emacs-${version}.
103 emacsname
="emacs-${version}${new_extension}"
105 if [ -d ${emacsname} ]
107 echo Directory
"${emacsname}" already exists
>&2
111 ### Make sure the subdirectory is available.
112 tempparent
="make-dist.tmp.$$"
113 if [ -d ${tempparent} ]; then
114 echo "${progname}: staging directory \`${tempparent}' already exists.
115 Perhaps a previous invocation of \`${progname}' failed to clean up after
116 itself. Check that directories whose names are of the form
117 \`make-dist.tmp.NNNNN' don't contain any important information, remove
118 them, and try again." >&2
122 ### Check for .elc files with no corresponding .el file.
123 ls -1 lisp
/*.el |
sed 's/\.el$/.elc/' > /tmp
/el
124 ls -1 lisp
/*.elc
> /tmp
/elc
125 bogosities
="`comm -13 /tmp/el /tmp/elc`"
126 if [ "${bogosities}" != "" ]; then
127 echo "The following .elc files have no corresponding .el files:"
130 rm -f /tmp
/el
/tmp
/elc
132 ### Make sure configure is newer than configure.in.
133 if [ "x`ls -t configure configure.in | head -1`" != "xconfigure" ]; then
134 echo "\`./configure.in' seems to be newer than \`./configure.'" >&2
135 echo "Attempting to run autoconf." >&2
139 ### Update getdate.c.
140 (cd lib-src
; make -f Makefile getdate.c YACC
="bison -y")
142 echo "Updating Info files."
146 echo "Updating finder-inf.el."
148 ### update finder-inf.el.
149 (cd lisp
; ..
/src
/emacs
-batch -l finder
-f finder-compile-keywords
)
150 (cd lisp
; ..
/src
/emacs
-batch -f batch-byte-compile finder-inf.el
)
152 echo "Making lisp/MANIFEST"
154 (cd lisp
; head -1 *.el |
grep '^;' |
sed -e 's/;;; //' > MANIFEST
)
156 echo "Creating staging directory: \`${tempparent}'"
159 tempdir
="${tempparent}/${emacsname}"
161 ### This trap ensures that the staging directory will be cleaned up even
162 ### when the script is interrupted in mid-career.
163 if [ "${clean_up}" = yes ]; then
164 trap "echo 'Interrupted...cleaning up the staging directory.'; rm -rf ${tempparent}; exit 1" 1 2 15
167 echo "Creating top directory: \`${tempdir}'"
170 ### We copy in the top-level files before creating the subdirectories in
171 ### hopes that this will make the top-level files appear first in the
172 ### tar file; this means that people can start reading the INSTALL and
173 ### README while the rest of the tar file is still unpacking. Whoopee.
174 echo "Making links to top-level files."
175 ln GETTING.GNU.SOFTWARE INSTALL PROBLEMS README BUGS move-if-change
${tempdir}
176 ln ChangeLog Makefile.
in configure configure.
in ${tempdir}
177 ln config.bat make-dist update-subdirs vpath.
sed ${tempdir}
178 ### Copy these files; they're cross-filesystem symlinks.
179 cp mkinstalldirs
${tempdir}
180 cp config.sub
${tempdir}
181 cp config.guess
${tempdir}
182 cp install.sh
${tempdir}
184 echo "Updating version number in README."
187 '$1 " " $2 " " $3 " " $4 " " $5 == "This directory tree holds version" { $6 = version; print $0 }
188 $1 " " $2 " " $3 " " $4 " " $5 != "This directory tree holds version"' \
189 version
=${version} README
> tmp.README
190 mv tmp.README README
)
193 echo "Creating subdirectories."
194 for subdir
in lisp lisp
/term site-lisp \
195 src src
/m src
/s src
/bitmaps lib-src oldXMenu lwlib \
196 nt nt
/inc nt
/inc
/sys \
197 etc etc
/e lock cpp info man msdos vms
; do
198 mkdir
${tempdir}/${subdir}
201 echo "Making links to \`lisp'."
202 ### Don't distribute TAGS, =*.el files, site-init.el, site-load.el, or default.el.
204 ln [a-zA-Z
]*.el ..
/${tempdir}/lisp
205 ln [a-zA-Z
]*.elc ..
/${tempdir}/lisp
206 ln [a-zA-Z
]*.dat ..
/${tempdir}/lisp
207 ## simula.el doesn't keep abbreviations in simula.defns any more.
208 ## ln [a-zA-Z]*.defns ../${tempdir}/lisp
209 ln ChangeLog Makefile makefile.nt ChangeLog.? README dired.todo ..
/${tempdir}/lisp
210 cd ..
/${tempdir}/lisp
212 rm -f site-init site-init.el site-init.elc
213 rm -f site-load site-load.el site-load.elc
214 rm -f site-start site-start.el site-start.elc
215 rm -f default default.el default.elc
)
217 #echo "Making links to \`lisp/calc-2.02'."
218 #### Don't distribute =*.el files, TAGS or backups.
220 # ln [a-zA-Z]*.el ../../${tempdir}/lisp/calc-2.02
221 # ln [a-zA-Z]*.elc ../../${tempdir}/lisp/calc-2.02
222 # ln calc.info* calc.texinfo calc-refcard.* ../../${tempdir}/lisp/calc-2.02
223 # ln INSTALL Makefile README README.prev ../../${tempdir}/lisp/calc-2.02
224 # cd ../../${tempdir}/lisp/calc-2.02
227 echo "Making links to \`lisp/term'."
228 ### Don't distribute =*.el files or TAGS.
230 ln [a-zA-Z
]*.el ..
/..
/${tempdir}/lisp
/term
231 ln [a-zA-Z
]*.elc ..
/..
/${tempdir}/lisp
/term
232 ln README ..
/..
/${tempdir}/lisp
/term
235 echo "Making links to \`src'."
236 ### Don't distribute =*.[ch] files, or the configured versions of
237 ### config.in, paths.in, or Makefile.in, or TAGS.
239 echo " (If we can't link gmalloc.c, that's okay.)"
240 ln [a-zA-Z
]*.c ..
/${tempdir}/src
241 ## Might be a symlink to a file on another filesystem.
242 test -f ..
/${tempdir}/src
/gmalloc.c ||
cp gmalloc.c ..
/${tempdir}/src
243 ln [a-zA-Z
]*.h ..
/${tempdir}/src
244 ln [a-zA-Z
]*.s ..
/${tempdir}/src
245 ln README Makefile.
in ChangeLog ChangeLog.? config.
in paths.
in \
247 ln makefile.nt ..
/${tempdir}/src
248 ln .gdbinit .dbxinit ..
/${tempdir}/src
249 ln *.opt vms-pp.trans ..
/${tempdir}/src
251 rm -f config.h paths.h Makefile Makefile.c
254 echo "Making links to \`src/bitmaps'."
256 ln README
*.xbm ..
/..
/${tempdir}/src
/bitmaps
)
258 echo "Making links to \`src/m'."
260 # We call files for miscellaneous input (to linker etc) .inp.
261 ln README
[a-zA-Z0-9
]*.h
*.inp ..
/..
/${tempdir}/src
/m
)
263 echo "Making links to \`src/s'."
265 ln README
[a-zA-Z0-9
]*.h ..
/..
/${tempdir}/src
/s
)
267 echo "Making links to \`lib-src'."
269 ln [a-zA-Z
]*.
[chy
] ..
/${tempdir}/lib-src
270 ln ChangeLog Makefile.
in README testfile vcdiff ..
/${tempdir}/lib-src
271 ln emacs.csh rcs2log rcs-checkin makefile.nt ..
/${tempdir}/lib-src
272 cd ..
/${tempdir}/lib-src
273 rm -f getdate.tab.c y.tab.c y.tab.h Makefile.c
276 echo "Making links to \`nt'."
278 ln emacs.ico emacs.rc config.nt config.w95
[a-z
]*.
in [a-z
]*.c ..
/${tempdir}/nt
279 ln [a-z
]*.bat
[a-z
]*.h makefile.def makefile.nt ..
/${tempdir}/nt
280 ln TODO ChangeLog INSTALL README ..
/${tempdir}/nt
)
282 echo "Making links to \`nt/inc'."
284 ln [a-z
]*.h ..
/..
/${tempdir}/nt
/inc
)
286 echo "Making links to \`nt/inc/sys'."
288 ln [a-z
]*.h ..
/..
/..
/${tempdir}/nt
/inc
/sys
)
290 echo "Making links to \`msdos'."
292 ln ChangeLog emacs.ico emacs.pif ..
/${tempdir}/msdos
293 ln mainmake
sed*.inp ..
/${tempdir}/msdos
294 cd ..
/${tempdir}/msdos
297 echo "Making links to \`oldXMenu'."
299 ln *.c
*.h
*.
in ..
/${tempdir}/oldXMenu
300 ln README Imakefile ChangeLog ..
/${tempdir}/oldXMenu
301 ln compile.com descrip.mms ..
/${tempdir}/oldXMenu
)
303 echo "Making links to \`lwlib'."
305 ln *.c
*.h
*.
in ..
/${tempdir}/lwlib
306 ln README Imakefile ChangeLog ..
/${tempdir}/lwlib
)
308 echo "Making links to \`etc'."
309 ### Don't distribute = files, TAGS, DOC files, backups, autosaves, or
312 ln `ls -d * | grep -v 'RCS' | grep -v 'Old' | grep -v '^e$'` ..
/${tempdir}/etc
314 rm -f DOC
* *~ \
#*\# *.dvi *.log *,v =* core
317 echo "Making links to \`etc/e'."
319 ln `ls -d * | grep -v 'RCS'` ..
/..
/${tempdir}/etc
/e
320 cd ..
/..
/${tempdir}/etc
/e
321 rm -f *~ \
#*\# *,v =* core)
323 echo "Making links to \`cpp'."
325 ln cccp.c cexp.y Makefile README ..
/${tempdir}/cpp
)
327 echo "Making links to \`info'."
328 # Don't distribute backups or autosaves.
330 ln [a-zA-Z
]* ..
/${tempdir}/info
331 cd ..
/${tempdir}/info
332 # Avoid an error when expanding the wildcards later.
333 ln emacs dummy~
; ln emacs \
#dummy\#
336 echo "Making links to \`man'."
338 ln *.texi
*.aux
*.cps
*.fns
*.kys
*.vrs ..
/${tempdir}/man
339 test -f README
&& ln README ..
/${tempdir}/man
340 test -f Makefile.
in && ln Makefile.
in ..
/${tempdir}/man
341 ln ChangeLog split-man ..
/${tempdir}/man
342 cp texinfo.tex ..
/${tempdir}/man
344 rm -f \
#*\# =* *~ core emacs-index* *.Z *.z xmail
345 rm -f emacs.?? termcap.?? gdb.??
*.log
*.toc
*.dvi
*.oaux
)
347 echo "Making links to \`vms'."
349 ln [0-9a-zA-Z]* ..
/${tempdir}/vms
353 ### It would be nice if they could all be symlinks to etc's copy, but
354 ### you're not supposed to have any symlinks in distribution tar files.
355 echo "Making sure copying notices are all copies of \`etc/COPYING'."
356 rm -f ${tempdir}/etc
/COPYING
357 cp etc
/COPYING
${tempdir}/etc
/COPYING
358 for subdir
in lisp src lib-src info msdos
; do
359 if [ -f ${tempdir}/${subdir}/COPYING
]; then
360 rm ${tempdir}/${subdir}/COPYING
362 cp etc
/COPYING
${tempdir}/${subdir}
365 #### Make sure that there aren't any hard links between files in the
366 #### distribution; people with afs can't deal with that. Okay,
367 #### actually we just re-copy anything with a link count greater
368 #### than two. (Yes, strictly greater than 2 is correct; since we
369 #### created these files by linking them in from the original tree,
370 #### they'll have exactly two links normally.)
372 #### Commented out since it's not stricly necessary; it should suffice
373 #### to just break the link on alloca.c.
374 #echo "Breaking intra-tree links."
375 #find ${tempdir} ! -type d -links +2 \
376 # -exec cp -p {} $$ \; -exec rm -f {} \; -exec mv $$ {} \;
377 rm -f $tempdir/lib-src
/alloca.c
378 cp $tempdir/src
/alloca.c
$tempdir/lib-src
/alloca.c
380 if [ "${newer}" ]; then
381 echo "Removing files older than $newer."
382 ## We remove .elc files unconditionally, on the theory that anyone picking
383 ## up an incremental distribution already has a running Emacs to byte-compile
385 find ${tempparent} \( -name '*.elc' -o ! -newer ${newer} \) -exec rm -f {} \
;
388 if [ "${make_tar}" = yes ]; then
389 if [ "${default_gzip}" = "" ]; then
390 echo "Looking for gzip."
391 temppath
=`echo $PATH | sed 's/^:/.:/
396 for dir in ${temppath}; do
397 if [ -f ${dir}/gzip ]; then echo 'gzip --best'; exit 0; fi
402 case "${default_gzip}" in
403 compress* ) gzip_extension
=.Z
;;
404 * ) gzip_extension
=.gz
;;
406 echo "Creating tar file."
407 (cd ${tempparent} ; tar cvf
- ${emacsname} ) \
409 > ${emacsname}.
tar${gzip_extension}
412 if [ "${clean_up}" = yes ]; then
413 echo "Cleaning up the staging directory."
416 (cd ${tempparent}; mv ${emacsname} ..
)
420 ### make-dist ends here