]> code.delx.au - gnu-emacs/blob - make-dist
(long): Don't update getdate.c.
[gnu-emacs] / make-dist
1 #!/bin/sh
2
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.
8
9 # Copyright (C) 1995 Free Software Foundation, Inc.
10 #
11 # This file is part of GNU Emacs.
12 #
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)
16 # any later version.
17 #
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.
22 #
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.
26
27 progname="$0"
28
29 ### Exit if a command fails.
30 ### set -e
31
32 ### Print out each line we read, for debugging's sake.
33 ### set -v
34
35 clean_up=no
36 make_tar=no
37 newer=""
38
39 while [ $# -gt 0 ]; do
40 case "$1" in
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.
43 "--clean-up" )
44 clean_up=yes
45 ;;
46 ## This option tells make-dist to make a tar file.
47 "--tar" )
48 make_tar=yes
49 ;;
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.
53 "--newer")
54 newer="$2"
55 new_extension=".new"
56 shift
57 ;;
58 ## This option tells make-dist to use `compress' instead of gzip.
59 ## Normally, make-dist uses gzip whenever it is present.
60 "--compress")
61 default_gzip="compress"
62 ;;
63 * )
64 echo "${progname}: Unrecognized argument: $1" >&2
65 exit 1
66 ;;
67 esac
68 shift
69 done
70
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
76 exit 1
77 fi
78
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
86 exit 1
87 fi
88
89 echo Version numbers are $version and $shortversion
90
91 if grep -s "GNU Emacs version ${shortversion}" ./man/emacs.texi > /dev/null; then
92 true
93 else
94 echo "You must update the version number in \`./man/emacs.texi'"
95 sleep 5
96 fi
97
98 ### Make sure we don't already have a directory emacs-${version}.
99
100 emacsname="emacs-${version}${new_extension}"
101
102 if [ -d ${emacsname} ]
103 then
104 echo Directory "${emacsname}" already exists >&2
105 exit 1
106 fi
107
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
116 exit 1
117 fi
118
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:"
125 echo "${bogosities}"
126 fi
127 rm -f /tmp/el /tmp/elc
128
129 ### Check for .el files that would overflow the 14-char limit if compiled.
130 long=`find lisp -name '???????????*.el' -print`
131 if [ "$long" != "" ]; then
132 echo "The following .el file names are too long:"
133 echo "$long"
134 fi
135
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; }
141 fi
142
143 echo "Updating Info files"
144
145 (cd man; make info)
146
147 echo "Updating finder-inf.el"
148
149 (cd lisp; ../src/emacs -batch -l finder -f finder-compile-keywords-make-dist)
150
151 echo "Recompiling Lisp files"
152
153 src/emacs -batch -f batch-byte-recompile-directory lisp
154
155 echo "Updating autoloads"
156
157 src/emacs -batch -f batch-update-autoloads lisp
158
159 echo "Making lisp/MANIFEST"
160
161 (cd lisp; head -1 [!=]*.el | grep '^;' | sed -e 's/;;; //' > MANIFEST)
162
163 echo "Creating staging directory: \`${tempparent}'"
164
165 mkdir ${tempparent}
166 tempdir="${tempparent}/${emacsname}"
167
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
172 fi
173
174 echo "Creating top directory: \`${tempdir}'"
175 mkdir ${tempdir}
176
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}
190
191 echo "Updating version number in README"
192 (cd ${tempdir}
193 awk \
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)
198
199
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}
206 done
207
208 echo "Making links to \`lisp'"
209 ### Don't distribute TAGS, =*.el files, site-init.el, site-load.el, or default.el.
210 (cd lisp
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
218 rm -f TAGS =*
219 rm -f subdirs.el
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)
224
225 #echo "Making links to \`lisp/calc-2.02'"
226 #### Don't distribute =*.el files, TAGS or backups.
227 #(cd lisp/calc-2.02
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
233 # rm -f *~ TAGS)
234
235 echo "Making links to \`lisp/term'"
236 ### Don't distribute =*.el files or TAGS.
237 (cd lisp/term
238 ln [a-zA-Z]*.el ../../${tempdir}/lisp/term
239 ln [a-zA-Z]*.elc ../../${tempdir}/lisp/term
240 ln README ../../${tempdir}/lisp/term
241 rm -f =* TAGS)
242
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.
246 (cd src
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 \
254 ../${tempdir}/src
255 ln makefile.nt ../${tempdir}/src
256 ln .gdbinit .dbxinit ../${tempdir}/src
257 ln *.opt vms-pp.trans ../${tempdir}/src
258 cd ../${tempdir}/src
259 rm -f config.h paths.h Makefile Makefile.c
260 rm -f =* TAGS)
261
262 echo "Making links to \`src/bitmaps'"
263 (cd src/bitmaps
264 ln README *.xbm ../../${tempdir}/src/bitmaps)
265
266 echo "Making links to \`src/m'"
267 (cd 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)
270
271 echo "Making links to \`src/s'"
272 (cd src/s
273 ln README [a-zA-Z0-9]*.h ../../${tempdir}/src/s)
274
275 echo "Making links to \`lib-src'"
276 (cd 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
282 rm -f =* TAGS)
283
284 echo "Making links to \`nt'"
285 (cd 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)
289
290 echo "Making links to \`nt/inc'"
291 (cd nt/inc
292 ln [a-z]*.h ../../${tempdir}/nt/inc)
293
294 echo "Making links to \`nt/inc/sys'"
295 (cd nt/inc/sys
296 ln [a-z]*.h ../../../${tempdir}/nt/inc/sys)
297
298 echo "Making links to \`nt/inc/arpa'"
299 (cd nt/inc/arpa
300 ln [a-z]*.h ../../../${tempdir}/nt/inc/arpa)
301
302 echo "Making links to \`nt/inc/netinet'"
303 (cd nt/inc/netinet
304 ln [a-z]*.h ../../../${tempdir}/nt/inc/netinet)
305
306 echo "Making links to \`msdos'"
307 (cd msdos
308 ln ChangeLog emacs.ico emacs.pif ../${tempdir}/msdos
309 ln mainmake mainmake.v2 sed*.inp ../${tempdir}/msdos
310 cd ../${tempdir}/msdos
311 rm -f =*)
312
313 echo "Making links to \`oldXMenu'"
314 (cd oldXMenu
315 ln *.c *.h *.in ../${tempdir}/oldXMenu
316 ln README Imakefile ChangeLog ../${tempdir}/oldXMenu
317 ln compile.com descrip.mms ../${tempdir}/oldXMenu)
318
319 echo "Making links to \`lwlib'"
320 (cd lwlib
321 ln *.c *.h *.in ../${tempdir}/lwlib
322 ln README Imakefile ChangeLog ../${tempdir}/lwlib
323 cd ../${tempdir}/lwlib
324 rm -f lwlib-Xol*)
325
326 echo "Making links to \`etc'"
327 ### Don't distribute = files, TAGS, DOC files, backups, autosaves, or
328 ### tex litter.
329 (cd etc
330 ln `ls -d * | grep -v 'RCS' | grep -v 'Old' | grep -v '^e$'` ../${tempdir}/etc
331 cd ../${tempdir}/etc
332 rm -f DOC* *~ \#*\# *.dvi *.log *.orig *.rej *,v =* core
333 rm -f TAGS)
334
335 echo "Making links to \`etc/e'"
336 (cd etc/e
337 ln `ls -d * | grep -v 'RCS'` ../../${tempdir}/etc/e
338 cd ../../${tempdir}/etc/e
339 rm -f *~ \#*\# *,v =* core)
340
341 echo "Making links to \`cpp'"
342 (cd cpp
343 ln cccp.c cexp.y Makefile README ../${tempdir}/cpp)
344
345 echo "Making links to \`info'"
346 # Don't distribute backups or autosaves.
347 (cd info
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\#
352 rm -f *~ \#*\# core)
353
354 echo "Making links to \`man'"
355 (cd 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
361 cd ../${tempdir}/man
362 rm -f \#*\# =* *~ core emacs-index* *.Z *.z xmail
363 rm -f emacs.?? termcap.?? gdb.?? *.log *.toc *.dvi *.oaux)
364
365 echo "Making links to \`vms'"
366 (cd vms
367 ln [0-9a-zA-Z]* ../${tempdir}/vms
368 cd ../${tempdir}/vms
369 rm -f *~)
370
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
379 fi
380 cp etc/COPYING ${tempdir}/${subdir}
381 done
382
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.)
389 ####
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
397
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
402 ## them with.
403 find ${tempparent} \( -name '*.elc' -o ! -newer ${newer} \) -exec rm -f {} \;
404 fi
405
406 if [ "${make_tar}" = yes ]; then
407 if [ "${default_gzip}" = "" ]; then
408 echo "Looking for gzip"
409 temppath=`echo $PATH | sed 's/^:/.:/
410 s/::/:.:/g
411 s/:$/:./
412 s/:/ /g'`
413 default_gzip=`(
414 for dir in ${temppath}; do
415 if [ -f ${dir}/gzip ]; then echo 'gzip --best'; exit 0; fi
416 done
417 echo compress
418 )`
419 fi
420 case "${default_gzip}" in
421 compress* ) gzip_extension=.Z ;;
422 * ) gzip_extension=.gz ;;
423 esac
424 echo "Creating tar file"
425 (cd ${tempparent} ; tar cvf - ${emacsname} ) \
426 | ${default_gzip} \
427 > ${emacsname}.tar${gzip_extension}
428 fi
429
430 if [ "${clean_up}" = yes ]; then
431 echo "Cleaning up the staging directory"
432 rm -rf ${tempparent}
433 else
434 (cd ${tempparent}; mv ${emacsname} ..)
435 rm -rf ${tempparent}
436 fi
437
438 ### make-dist ends here