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.
40 while [ $# -gt 0 ]; do
42 ## This option tells make-dist to delete the staging directory
43 ## when done. It is useless to use this unless you make a tar file.
47 ## This option tells make-dist to make a tar file.
51 ## This option tells make-dist to make the distribution normally, then
52 ## remove all files older than the given timestamp file. This is useful
53 ## for creating incremental or patch distributions.
59 ## This option tells make-dist to use `compress' instead of gzip.
60 ## Normally, make-dist uses gzip whenever it is present.
62 default_gzip
="compress"
65 echo "${progname}: Unrecognized argument: $1" >&2
72 ### Make sure we're running in the right place.
73 if [ ! -d src
-o ! -f src
/lisp.h
-o ! -d lisp
-o ! -f lisp
/version.el
]; then
74 echo "${progname}: Can't find \`src/lisp.h' and \`lisp/version.el'." >&2
75 echo "${progname} must be run in the top directory of the Emacs" >&2
76 echo "distribution tree. cd to that directory and try again." >&2
80 ### Find out which version of Emacs this is.
81 shortversion
=`grep 'defconst[ ]*emacs-version' lisp/version.el \
82 | sed -e 's/^.*"\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/'`
83 version
=`grep 'defconst[ ]*emacs-version' lisp/version.el \
84 | sed -e 's/^[^"]*"\([^"]*\)".*$/\1/'`
85 if [ ! "${version}" ]; then
86 echo "${progname}: can't find current Emacs version in \`./lisp/version.el'" >&2
90 echo Version numbers are
$version and
$shortversion
92 if grep -s "GNU Emacs version ${shortversion}" .
/man
/emacs.texi
> /dev
/null
; then
95 echo "You must update the version number in \`./man/emacs.texi'"
99 ### Make sure we don't already have a directory emacs-${version}.
101 emacsname
="emacs-${version}${new_extension}"
103 if [ -d ${emacsname} ]
105 echo Directory
"${emacsname}" already exists
>&2
109 ### Make sure the subdirectory is available.
110 tempparent
="make-dist.tmp.$$"
111 if [ -d ${tempparent} ]; then
112 echo "${progname}: staging directory \`${tempparent}' already exists.
113 Perhaps a previous invocation of \`${progname}' failed to clean up after
114 itself. Check that directories whose names are of the form
115 \`make-dist.tmp.NNNNN' don't contain any important information, remove
116 them, and try again." >&2
120 ### Check for .elc files with no corresponding .el file.
121 ls -1 lisp
/*.el |
sed 's/\.el$/.elc/' > /tmp
/el
122 ls -1 lisp
/*.elc
> /tmp
/elc
123 bogosities
="`comm -13 /tmp/el /tmp/elc`"
124 if [ "${bogosities}" != "" ]; then
125 echo "The following .elc files have no corresponding .el files:"
128 rm -f /tmp
/el
/tmp
/elc
130 ### Check for .el files that would overflow the 14-char limit if compiled.
131 long
=`find lisp -name '[a-zA-Z0-9]??????????*.el' -print`
132 if [ "$long" != "" ]; then
133 echo "The following .el file names are too long:"
137 ### Make sure configure is newer than configure.in.
138 if [ "x`ls -t configure configure.in | head -1`" != "xconfigure" ]; then
139 echo "\`./configure.in' is newer than \`./configure'" >&2
140 echo "Running autoconf" >&2
141 autoconf ||
{ x
=$?
; echo Autoconf FAILED
! >&2; exit $x; }
144 echo "Updating Info files"
148 echo "Updating finder-inf.el"
150 (cd lisp
; ..
/src
/emacs
-batch -l finder
-f finder-compile-keywords-make-dist
)
152 echo "Recompiling Lisp files"
154 src
/emacs
-batch -f batch-byte-recompile-directory lisp
156 echo "Updating autoloads"
158 src
/emacs
-batch -f batch-update-autoloads lisp
160 echo "Making lisp/MANIFEST"
162 (cd lisp
; head -1 [!=]*.el |
grep '^;' |
sed -e 's/;;; //' > MANIFEST
)
164 echo "Creating staging directory: \`${tempparent}'"
167 tempdir
="${tempparent}/${emacsname}"
169 ### This trap ensures that the staging directory will be cleaned up even
170 ### when the script is interrupted in mid-career.
171 if [ "${clean_up}" = yes ]; then
172 trap "echo 'Interrupted...cleaning up the staging directory'; rm -rf ${tempparent}; exit 1" 1 2 15
175 echo "Creating top directory: \`${tempdir}'"
178 ### We copy in the top-level files before creating the subdirectories in
179 ### hopes that this will make the top-level files appear first in the
180 ### tar file; this means that people can start reading the INSTALL and
181 ### README while the rest of the tar file is still unpacking. Whoopee.
182 echo "Making links to top-level files"
183 ln GETTING.GNU.SOFTWARE INSTALL PROBLEMS README BUGS move-if-change
${tempdir}
184 ln ChangeLog Makefile.
in configure configure.
in ${tempdir}
185 ln config.bat make-dist update-subdirs vpath.
sed ${tempdir}
186 ### Copy these files; they're cross-filesystem symlinks.
187 cp mkinstalldirs
${tempdir}
188 cp config.sub
${tempdir}
189 cp config.guess
${tempdir}
190 cp install.sh
${tempdir}
192 echo "Updating version number in README"
195 '$1 " " $2 " " $3 " " $4 " " $5 == "This directory tree holds version" { $6 = version; print $0 }
196 $1 " " $2 " " $3 " " $4 " " $5 != "This directory tree holds version"' \
197 version
=${version} README
> tmp.README
198 mv tmp.README README
)
201 echo "Creating subdirectories"
202 for subdir
in lisp lisp
/term site-lisp \
203 src src
/m src
/s src
/bitmaps lib-src oldXMenu lwlib \
204 nt nt
/inc nt
/inc
/sys nt
/inc
/arpa nt
/inc
/netinet \
205 etc etc
/e lock cpp info man msdos vms
; do
206 mkdir
${tempdir}/${subdir}
209 echo "Making links to \`lisp'"
210 ### Don't distribute TAGS, =*.el files, site-init.el, site-load.el, or default.el.
212 ln [a-zA-Z
]*.el ..
/${tempdir}/lisp
213 ln [a-zA-Z
]*.elc ..
/${tempdir}/lisp
214 ln [a-zA-Z
]*.dat ..
/${tempdir}/lisp
215 ## simula.el doesn't keep abbreviations in simula.defns any more.
216 ## ln [a-zA-Z]*.defns ../${tempdir}/lisp
217 ln ChangeLog Makefile makefile.nt ChangeLog.? README ..
/${tempdir}/lisp
218 cd ..
/${tempdir}/lisp
221 rm -f site-init site-init.el site-init.elc
222 rm -f site-load site-load.el site-load.elc
223 rm -f site-start site-start.el site-start.elc
224 rm -f default default.el default.elc
)
226 #echo "Making links to \`lisp/calc-2.02'"
227 #### Don't distribute =*.el files, TAGS or backups.
229 # ln [a-zA-Z]*.el ../../${tempdir}/lisp/calc-2.02
230 # ln [a-zA-Z]*.elc ../../${tempdir}/lisp/calc-2.02
231 # ln calc.info* calc.texinfo calc-refcard.* ../../${tempdir}/lisp/calc-2.02
232 # ln INSTALL Makefile README README.prev ../../${tempdir}/lisp/calc-2.02
233 # cd ../../${tempdir}/lisp/calc-2.02
236 echo "Making links to \`lisp/term'"
237 ### Don't distribute =*.el files or TAGS.
239 ln [a-zA-Z
]*.el ..
/..
/${tempdir}/lisp
/term
240 ln [a-zA-Z
]*.elc ..
/..
/${tempdir}/lisp
/term
241 ln README ..
/..
/${tempdir}/lisp
/term
244 echo "Making links to \`src'"
245 ### Don't distribute =*.[ch] files, or the configured versions of
246 ### config.in, paths.in, or Makefile.in, or TAGS.
248 echo " (If we can't link gmalloc.c, that's okay.)"
249 ln [a-zA-Z
]*.c ..
/${tempdir}/src
250 ## Might be a symlink to a file on another filesystem.
251 test -f ..
/${tempdir}/src
/gmalloc.c ||
cp gmalloc.c ..
/${tempdir}/src
252 ln [a-zA-Z
]*.h ..
/${tempdir}/src
253 ln [a-zA-Z
]*.s ..
/${tempdir}/src
254 ln README Makefile.
in ChangeLog ChangeLog.? config.
in paths.
in \
256 ln makefile.nt ..
/${tempdir}/src
257 ln .gdbinit .dbxinit ..
/${tempdir}/src
258 ln *.opt vms-pp.trans ..
/${tempdir}/src
260 rm -f config.h paths.h Makefile Makefile.c
263 echo "Making links to \`src/bitmaps'"
265 ln README
*.xbm ..
/..
/${tempdir}/src
/bitmaps
)
267 echo "Making links to \`src/m'"
269 # We call files for miscellaneous input (to linker etc) .inp.
270 ln README
[a-zA-Z0-9
]*.h
*.inp ..
/..
/${tempdir}/src
/m
)
272 echo "Making links to \`src/s'"
274 ln README
[a-zA-Z0-9
]*.h ..
/..
/${tempdir}/src
/s
)
276 echo "Making links to \`lib-src'"
278 ln [a-zA-Z
]*.
[chy
] ..
/${tempdir}/lib-src
279 ln ChangeLog Makefile.
in README testfile vcdiff ..
/${tempdir}/lib-src
280 ln emacs.csh rcs2log rcs-checkin makefile.nt ..
/${tempdir}/lib-src
281 cd ..
/${tempdir}/lib-src
282 rm -f getdate.tab.c y.tab.c y.tab.h Makefile.c
285 echo "Making links to \`nt'"
287 ln emacs.ico emacs.rc config.nt
[a-z
]*.
in [a-z
]*.c ..
/${tempdir}/nt
288 ln [a-z
]*.bat
[a-z
]*.h makefile.def makefile.nt ..
/${tempdir}/nt
289 ln TODO ChangeLog INSTALL README ..
/${tempdir}/nt
)
291 echo "Making links to \`nt/inc'"
293 ln [a-z
]*.h ..
/..
/${tempdir}/nt
/inc
)
295 echo "Making links to \`nt/inc/sys'"
297 ln [a-z
]*.h ..
/..
/..
/${tempdir}/nt
/inc
/sys
)
299 echo "Making links to \`nt/inc/arpa'"
301 ln [a-z
]*.h ..
/..
/..
/${tempdir}/nt
/inc
/arpa
)
303 echo "Making links to \`nt/inc/netinet'"
305 ln [a-z
]*.h ..
/..
/..
/${tempdir}/nt
/inc
/netinet
)
307 echo "Making links to \`msdos'"
309 ln ChangeLog emacs.ico emacs.pif ..
/${tempdir}/msdos
310 ln is_exec.c sigaction.c mainmake mainmake.v2
sed*.inp ..
/${tempdir}/msdos
311 cd ..
/${tempdir}/msdos
314 echo "Making links to \`oldXMenu'"
316 ln *.c
*.h
*.
in ..
/${tempdir}/oldXMenu
317 ln README Imakefile ChangeLog ..
/${tempdir}/oldXMenu
318 ln compile.com descrip.mms ..
/${tempdir}/oldXMenu
)
320 echo "Making links to \`lwlib'"
322 ln *.c
*.h
*.
in ..
/${tempdir}/lwlib
323 ln README Imakefile ChangeLog ..
/${tempdir}/lwlib
324 cd ..
/${tempdir}/lwlib
327 echo "Making links to \`etc'"
328 ### Don't distribute = files, TAGS, DOC files, backups, autosaves, or
331 ln `ls -d * | grep -v 'RCS' | grep -v 'Old' | grep -v '^e$'` ..
/${tempdir}/etc
333 rm -f DOC
* *~ \
#*\# *.dvi *.log *.orig *.rej *,v =* core
336 echo "Making links to \`etc/e'"
338 ln `ls -d * | grep -v 'RCS'` ..
/..
/${tempdir}/etc
/e
339 cd ..
/..
/${tempdir}/etc
/e
340 rm -f *~ \
#*\# *,v =* core)
342 echo "Making links to \`cpp'"
344 ln cccp.c cexp.y Makefile README ..
/${tempdir}/cpp
)
346 echo "Making links to \`info'"
347 # Don't distribute backups or autosaves.
349 ln [a-zA-Z
]* ..
/${tempdir}/info
350 cd ..
/${tempdir}/info
351 # Avoid an error when expanding the wildcards later.
352 ln emacs dummy~
; ln emacs \
#dummy\#
355 echo "Making links to \`man'"
357 ln *.texi
*.aux
*.cps
*.fns
*.kys
*.vrs ..
/${tempdir}/man
358 test -f README
&& ln README ..
/${tempdir}/man
359 test -f Makefile.
in && ln Makefile.
in ..
/${tempdir}/man
360 ln ChangeLog split-man ..
/${tempdir}/man
361 cp texinfo.tex ..
/${tempdir}/man
363 rm -f \
#*\# =* *~ core emacs-index* *.Z *.z xmail
364 rm -f emacs.?? termcap.?? gdb.??
*.log
*.toc
*.dvi
*.oaux
)
366 echo "Making links to \`vms'"
368 ln [0-9a-zA-Z]* ..
/${tempdir}/vms
372 ### It would be nice if they could all be symlinks to etc's copy, but
373 ### you're not supposed to have any symlinks in distribution tar files.
374 echo "Making sure copying notices are all copies of \`etc/COPYING'"
375 rm -f ${tempdir}/etc
/COPYING
376 cp etc
/COPYING
${tempdir}/etc
/COPYING
377 for subdir
in lisp src lib-src info msdos
; do
378 if [ -f ${tempdir}/${subdir}/COPYING
]; then
379 rm ${tempdir}/${subdir}/COPYING
381 cp etc
/COPYING
${tempdir}/${subdir}
384 #### Make sure that there aren't any hard links between files in the
385 #### distribution; people with afs can't deal with that. Okay,
386 #### actually we just re-copy anything with a link count greater
387 #### than two. (Yes, strictly greater than 2 is correct; since we
388 #### created these files by linking them in from the original tree,
389 #### they'll have exactly two links normally.)
391 #### Commented out since it's not strictly necessary; it should suffice
392 #### to just break the link on alloca.c.
393 #echo "Breaking intra-tree links."
394 #find ${tempdir} ! -type d -links +2 \
395 # -exec cp -p {} $$ \; -exec rm -f {} \; -exec mv $$ {} \;
396 rm -f $tempdir/lib-src
/alloca.c
397 cp $tempdir/src
/alloca.c
$tempdir/lib-src
/alloca.c
399 if [ "${newer}" ]; then
400 echo "Removing files older than $newer"
401 ## We remove .elc files unconditionally, on the theory that anyone picking
402 ## up an incremental distribution already has a running Emacs to byte-compile
404 find ${tempparent} \( -name '*.elc' -o ! -newer ${newer} \) -exec rm -f {} \
;
407 if [ "${make_tar}" = yes ]; then
408 if [ "${default_gzip}" = "" ]; then
409 echo "Looking for gzip"
410 temppath
=`echo $PATH | sed 's/^:/.:/
415 for dir in ${temppath}; do
416 if [ -f ${dir}/gzip ]; then echo 'gzip --best'; exit 0; fi
421 case "${default_gzip}" in
422 compress* ) gzip_extension
=.Z
;;
423 * ) gzip_extension
=.gz
;;
425 echo "Creating tar file"
426 (cd ${tempparent} ; tar cvf
- ${emacsname} ) \
428 > ${emacsname}.
tar${gzip_extension}
431 if [ "${clean_up}" = yes ]; then
432 echo "Cleaning up the staging directory"
435 (cd ${tempparent}; mv ${emacsname} ..
)
439 ### make-dist ends here