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 ### Make sure configure is newer than configure.in.
130 if [ "x`ls -t configure configure.in | head -1`" != "xconfigure" ]; then
131 echo "\`./configure.in' is newer than \`./configure'" >&2
132 echo "Running autoconf" >&2
133 autoconf ||
{ x
=$?
; echo Autoconf FAILED
! >&2; exit $x; }
136 ### Update getdate.c.
137 (cd lib-src
; make -f Makefile getdate.c YACC
="bison -y")
139 echo "Updating Info files"
143 echo "Updating finder-inf.el"
145 (cd lisp
; ..
/src
/emacs
-batch -l finder
-f finder-compile-keywords-make-dist
)
147 echo "Recompiling Lisp files"
149 src
/emacs
-batch -f batch-byte-recompile-directory lisp
151 echo "Updating autoloads"
153 src
/emacs
-batch -f batch-update-autoloads lisp
155 echo "Making lisp/MANIFEST"
157 (cd lisp
; head -1 [!=]*.el |
grep '^;' |
sed -e 's/;;; //' > MANIFEST
)
159 echo "Creating staging directory: \`${tempparent}'"
162 tempdir
="${tempparent}/${emacsname}"
164 ### This trap ensures that the staging directory will be cleaned up even
165 ### when the script is interrupted in mid-career.
166 if [ "${clean_up}" = yes ]; then
167 trap "echo 'Interrupted...cleaning up the staging directory'; rm -rf ${tempparent}; exit 1" 1 2 15
170 echo "Creating top directory: \`${tempdir}'"
173 ### We copy in the top-level files before creating the subdirectories in
174 ### hopes that this will make the top-level files appear first in the
175 ### tar file; this means that people can start reading the INSTALL and
176 ### README while the rest of the tar file is still unpacking. Whoopee.
177 echo "Making links to top-level files"
178 ln GETTING.GNU.SOFTWARE INSTALL PROBLEMS README BUGS move-if-change
${tempdir}
179 ln ChangeLog Makefile.
in configure configure.
in ${tempdir}
180 ln config.bat make-dist update-subdirs vpath.
sed ${tempdir}
181 ### Copy these files; they're cross-filesystem symlinks.
182 cp mkinstalldirs
${tempdir}
183 cp config.sub
${tempdir}
184 cp config.guess
${tempdir}
185 cp install.sh
${tempdir}
187 echo "Updating version number in README"
190 '$1 " " $2 " " $3 " " $4 " " $5 == "This directory tree holds version" { $6 = version; print $0 }
191 $1 " " $2 " " $3 " " $4 " " $5 != "This directory tree holds version"' \
192 version
=${version} README
> tmp.README
193 mv tmp.README README
)
196 echo "Creating subdirectories"
197 for subdir
in lisp lisp
/term site-lisp \
198 src src
/m src
/s src
/bitmaps lib-src oldXMenu lwlib \
199 nt nt
/inc nt
/inc
/sys nt
/inc
/arpa nt
/inc
/netinet \
200 etc etc
/e lock cpp info man msdos vms
; do
201 mkdir
${tempdir}/${subdir}
204 echo "Making links to \`lisp'"
205 ### Don't distribute TAGS, =*.el files, site-init.el, site-load.el, or default.el.
207 ln [a-zA-Z
]*.el ..
/${tempdir}/lisp
208 ln [a-zA-Z
]*.elc ..
/${tempdir}/lisp
209 ln [a-zA-Z
]*.dat ..
/${tempdir}/lisp
210 ## simula.el doesn't keep abbreviations in simula.defns any more.
211 ## ln [a-zA-Z]*.defns ../${tempdir}/lisp
212 ln ChangeLog Makefile makefile.nt ChangeLog.? README ..
/${tempdir}/lisp
213 cd ..
/${tempdir}/lisp
216 rm -f site-init site-init.el site-init.elc
217 rm -f site-load site-load.el site-load.elc
218 rm -f site-start site-start.el site-start.elc
219 rm -f default default.el default.elc
)
221 #echo "Making links to \`lisp/calc-2.02'"
222 #### Don't distribute =*.el files, TAGS or backups.
224 # ln [a-zA-Z]*.el ../../${tempdir}/lisp/calc-2.02
225 # ln [a-zA-Z]*.elc ../../${tempdir}/lisp/calc-2.02
226 # ln calc.info* calc.texinfo calc-refcard.* ../../${tempdir}/lisp/calc-2.02
227 # ln INSTALL Makefile README README.prev ../../${tempdir}/lisp/calc-2.02
228 # cd ../../${tempdir}/lisp/calc-2.02
231 echo "Making links to \`lisp/term'"
232 ### Don't distribute =*.el files or TAGS.
234 ln [a-zA-Z
]*.el ..
/..
/${tempdir}/lisp
/term
235 ln [a-zA-Z
]*.elc ..
/..
/${tempdir}/lisp
/term
236 ln README ..
/..
/${tempdir}/lisp
/term
239 echo "Making links to \`src'"
240 ### Don't distribute =*.[ch] files, or the configured versions of
241 ### config.in, paths.in, or Makefile.in, or TAGS.
243 echo " (If we can't link gmalloc.c, that's okay.)"
244 ln [a-zA-Z
]*.c ..
/${tempdir}/src
245 ## Might be a symlink to a file on another filesystem.
246 test -f ..
/${tempdir}/src
/gmalloc.c ||
cp gmalloc.c ..
/${tempdir}/src
247 ln [a-zA-Z
]*.h ..
/${tempdir}/src
248 ln [a-zA-Z
]*.s ..
/${tempdir}/src
249 ln README Makefile.
in ChangeLog ChangeLog.? config.
in paths.
in \
251 ln makefile.nt ..
/${tempdir}/src
252 ln .gdbinit .dbxinit ..
/${tempdir}/src
253 ln *.opt vms-pp.trans ..
/${tempdir}/src
255 rm -f config.h paths.h Makefile Makefile.c
258 echo "Making links to \`src/bitmaps'"
260 ln README
*.xbm ..
/..
/${tempdir}/src
/bitmaps
)
262 echo "Making links to \`src/m'"
264 # We call files for miscellaneous input (to linker etc) .inp.
265 ln README
[a-zA-Z0-9
]*.h
*.inp ..
/..
/${tempdir}/src
/m
)
267 echo "Making links to \`src/s'"
269 ln README
[a-zA-Z0-9
]*.h ..
/..
/${tempdir}/src
/s
)
271 echo "Making links to \`lib-src'"
273 ln [a-zA-Z
]*.
[chy
] ..
/${tempdir}/lib-src
274 ln ChangeLog Makefile.
in README testfile vcdiff ..
/${tempdir}/lib-src
275 ln emacs.csh rcs2log rcs-checkin makefile.nt ..
/${tempdir}/lib-src
276 cd ..
/${tempdir}/lib-src
277 rm -f getdate.tab.c y.tab.c y.tab.h Makefile.c
280 echo "Making links to \`nt'"
282 ln emacs.ico emacs.rc config.nt
[a-z
]*.
in [a-z
]*.c ..
/${tempdir}/nt
283 ln [a-z
]*.bat
[a-z
]*.h makefile.def makefile.nt ..
/${tempdir}/nt
284 ln TODO ChangeLog INSTALL README ..
/${tempdir}/nt
)
286 echo "Making links to \`nt/inc'"
288 ln [a-z
]*.h ..
/..
/${tempdir}/nt
/inc
)
290 echo "Making links to \`nt/inc/sys'"
292 ln [a-z
]*.h ..
/..
/..
/${tempdir}/nt
/inc
/sys
)
294 echo "Making links to \`nt/inc/arpa'"
296 ln [a-z
]*.h ..
/..
/..
/${tempdir}/nt
/inc
/arpa
)
298 echo "Making links to \`nt/inc/netinet'"
300 ln [a-z
]*.h ..
/..
/..
/${tempdir}/nt
/inc
/netinet
)
302 echo "Making links to \`msdos'"
304 ln ChangeLog emacs.ico emacs.pif ..
/${tempdir}/msdos
305 ln mainmake mainmake.v2
sed*.inp ..
/${tempdir}/msdos
306 cd ..
/${tempdir}/msdos
309 echo "Making links to \`oldXMenu'"
311 ln *.c
*.h
*.
in ..
/${tempdir}/oldXMenu
312 ln README Imakefile ChangeLog ..
/${tempdir}/oldXMenu
313 ln compile.com descrip.mms ..
/${tempdir}/oldXMenu
)
315 echo "Making links to \`lwlib'"
317 ln *.c
*.h
*.
in ..
/${tempdir}/lwlib
318 ln README Imakefile ChangeLog ..
/${tempdir}/lwlib
319 cd ..
/${tempdir}/lwlib
322 echo "Making links to \`etc'"
323 ### Don't distribute = files, TAGS, DOC files, backups, autosaves, or
326 ln `ls -d * | grep -v 'RCS' | grep -v 'Old' | grep -v '^e$'` ..
/${tempdir}/etc
328 rm -f DOC
* *~ \
#*\# *.dvi *.log *.orig *.rej *,v =* core
331 echo "Making links to \`etc/e'"
333 ln `ls -d * | grep -v 'RCS'` ..
/..
/${tempdir}/etc
/e
334 cd ..
/..
/${tempdir}/etc
/e
335 rm -f *~ \
#*\# *,v =* core)
337 echo "Making links to \`cpp'"
339 ln cccp.c cexp.y Makefile README ..
/${tempdir}/cpp
)
341 echo "Making links to \`info'"
342 # Don't distribute backups or autosaves.
344 ln [a-zA-Z
]* ..
/${tempdir}/info
345 cd ..
/${tempdir}/info
346 # Avoid an error when expanding the wildcards later.
347 ln emacs dummy~
; ln emacs \
#dummy\#
350 echo "Making links to \`man'"
352 ln *.texi
*.aux
*.cps
*.fns
*.kys
*.vrs ..
/${tempdir}/man
353 test -f README
&& ln README ..
/${tempdir}/man
354 test -f Makefile.
in && ln Makefile.
in ..
/${tempdir}/man
355 ln ChangeLog split-man ..
/${tempdir}/man
356 cp texinfo.tex ..
/${tempdir}/man
358 rm -f \
#*\# =* *~ core emacs-index* *.Z *.z xmail
359 rm -f emacs.?? termcap.?? gdb.??
*.log
*.toc
*.dvi
*.oaux
)
361 echo "Making links to \`vms'"
363 ln [0-9a-zA-Z]* ..
/${tempdir}/vms
367 ### It would be nice if they could all be symlinks to etc's copy, but
368 ### you're not supposed to have any symlinks in distribution tar files.
369 echo "Making sure copying notices are all copies of \`etc/COPYING'"
370 rm -f ${tempdir}/etc
/COPYING
371 cp etc
/COPYING
${tempdir}/etc
/COPYING
372 for subdir
in lisp src lib-src info msdos
; do
373 if [ -f ${tempdir}/${subdir}/COPYING
]; then
374 rm ${tempdir}/${subdir}/COPYING
376 cp etc
/COPYING
${tempdir}/${subdir}
379 #### Make sure that there aren't any hard links between files in the
380 #### distribution; people with afs can't deal with that. Okay,
381 #### actually we just re-copy anything with a link count greater
382 #### than two. (Yes, strictly greater than 2 is correct; since we
383 #### created these files by linking them in from the original tree,
384 #### they'll have exactly two links normally.)
386 #### Commented out since it's not strictly necessary; it should suffice
387 #### to just break the link on alloca.c.
388 #echo "Breaking intra-tree links."
389 #find ${tempdir} ! -type d -links +2 \
390 # -exec cp -p {} $$ \; -exec rm -f {} \; -exec mv $$ {} \;
391 rm -f $tempdir/lib-src
/alloca.c
392 cp $tempdir/src
/alloca.c
$tempdir/lib-src
/alloca.c
394 if [ "${newer}" ]; then
395 echo "Removing files older than $newer"
396 ## We remove .elc files unconditionally, on the theory that anyone picking
397 ## up an incremental distribution already has a running Emacs to byte-compile
399 find ${tempparent} \( -name '*.elc' -o ! -newer ${newer} \) -exec rm -f {} \
;
402 if [ "${make_tar}" = yes ]; then
403 if [ "${default_gzip}" = "" ]; then
404 echo "Looking for gzip"
405 temppath
=`echo $PATH | sed 's/^:/.:/
410 for dir in ${temppath}; do
411 if [ -f ${dir}/gzip ]; then echo 'gzip --best'; exit 0; fi
416 case "${default_gzip}" in
417 compress* ) gzip_extension
=.Z
;;
418 * ) gzip_extension
=.gz
;;
420 echo "Creating tar file"
421 (cd ${tempparent} ; tar cvf
- ${emacsname} ) \
423 > ${emacsname}.
tar${gzip_extension}
426 if [ "${clean_up}" = yes ]; then
427 echo "Cleaning up the staging directory"
430 (cd ${tempparent}; mv ${emacsname} ..
)
434 ### make-dist ends here