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.
11 ### Exit if a command fails.
14 ### Print out each line we read, for debugging's sake.
21 while [ $# -gt 0 ]; do
23 ## This option tells make-dist not to delete the staging directory
24 ## after it's done making the tar file.
28 ## This option tells make-dist not to make a tar file. Since it's
29 ## rather pointless to build the whole staging directory and then
30 ## nuke it, using this option also selects '--no-clean-up'.
35 ## This option tells make-dist to make the distribution normally, then
36 ## remove all files older than the given timestamp file. This is useful
37 ## for creating incremental or patch distributions.
43 ## This option tells make-dist to use `compress' instead of gzip.
44 ## Normally, make-dist uses gzip whenever it is present.
46 default_gzip
="compress"
49 echo "${progname}: Unrecognized argument: $1" >&2
56 ### Make sure we're running in the right place.
57 if [ ! -d src
-o ! -f src
/lisp.h
-o ! -d lisp
-o ! -f lisp
/version.el
]; then
58 echo "${progname}: Can't find \`src/lisp.h' and \`lisp/version.el'." >&2
59 echo "${progname} must be run in the top directory of the Emacs" >&2
60 echo "distribution tree. Cd to that directory and try again." >&2
64 ### Find out which version of Emacs this is.
65 version
=`grep 'defconst[ ]*emacs-version' lisp/version.el \
66 | sed -e 's/^.*"\([0-9][0-9]*\.[0-9][0-9]*\)\..*$/\1/'`
67 if [ ! "${version}" ]; then
68 echo "${progname}: can't find current emacs version in \`./lisp/version.el'." >&2
72 if grep -s "GNU Emacs version ${version}" .
/man
/emacs.texi
> /dev
/null
; then
75 echo "You must update the version number in \`./man/emacs.texi'"
79 ### Make sure the subdirectory is available.
80 tempparent
="make-dist.tmp.$$"
81 if [ -d ${tempparent} ]; then
82 echo "${progname}: staging directory \`${tempparent}' already exists.
83 Perhaps a previous invocation of \`${progname}' failed to clean up after
84 itself. Check that directories whose names are of the form
85 \`make-dist.tmp.NNNNN' don't contain any important information, remove
86 them, and try again." >&2
90 ### Check for .elc files with no corresponding .el file.
91 ls -1 lisp
/*.el |
sed 's/\.el$/.elc/' > /tmp
/el
92 ls -1 lisp
/*.elc
> /tmp
/elc
93 bogosities
="`comm -13 /tmp/el /tmp/elc`"
94 if [ "${bogosities}" != "" ]; then
95 echo "The following .elc files have no corresponding .el files:"
98 rm -f /tmp
/el
/tmp
/elc
100 ### Make sure configure is newer than configure.in.
101 if [ "x`ls -t configure configure.in | head -1`" != "xconfigure" ]; then
102 echo "`./configure.in' seems to be newer than `./configure.'" >&2
103 echo "Attempting to run autoconf." >&2
107 echo "Creating staging directory: \`${tempparent}'"
109 emacsname
="emacs-${version}${new_extension}"
110 tempdir
="${tempparent}/${emacsname}"
112 ### This trap ensures that the staging directory will be cleaned up even
113 ### when the script is interrupted in mid-career.
114 if [ "${clean_up}" = yes ]; then
115 trap "echo 'Interrupted...cleaning up the staging directory.'; rm -rf ${tempparent}; exit 1" 1 2 15
118 echo "Creating top directory: \`${tempdir}'"
121 ### We copy in the top-level files before creating the subdirectories in
122 ### hopes that this will make the top-level files appear first in the
123 ### tar file; this means that people can start reading the INSTALL and
124 ### README while the rest of the tar file is still unpacking. Whoopee.
125 echo "Making links to top-level files."
126 ln GETTING.GNU.SOFTWARE INSTALL PROBLEMS README move-if-change
${tempdir}
127 ln ChangeLog Makefile.
in build-install.
in configure configure.
in ${tempdir}
128 ln make-dist
${tempdir}
129 ### Copy config.sub; it's a cross-filesystem symlink.
130 cp config.sub
${tempdir}
132 echo "Updating version number in README."
135 '$1 " " $2 " " $3 " " $4 " " $5 == "This directory tree holds version" { $6 = version; print $0 }
136 $1 " " $2 " " $3 " " $4 " " $5 != "This directory tree holds version"' \
137 version
=${version} README
> tmp.README
138 mv tmp.README README
)
141 echo "Creating subdirectories."
142 # I think we're not going to distribute anything in external-lisp, so
143 # I've removed it from this list.
144 for subdir
in lisp lisp
/term site-lisp \
145 src src
/m src
/s src
/bitmaps lib-src oldXMenu \
146 etc lock cpp info man shortnames vms
; do
147 mkdir
${tempdir}/${subdir}
150 echo "Making links to \`lisp'."
151 ### Don't distribute TAGS, =*.el files, site-init.el, site-load.el, or default.el.
153 ln [a-zA-Z
]*.el ..
/${tempdir}/lisp
154 ln [a-zA-Z
]*.elc ..
/${tempdir}/lisp
155 ## simula.el doesn't keep abbreviations in simula.defns any more.
156 ## ln [a-zA-Z]*.defns ../${tempdir}/lisp
157 ln ChangeLog README ..
/${tempdir}/lisp
158 cd ..
/${tempdir}/lisp
160 rm -f site-init site-init.el site-init.elc
161 rm -f site-load site-load.el site-load.elc
162 rm -f default default.el default.elc
)
164 #echo "Making links to \`lisp/calc-2.02'."
165 #### Don't distribute =*.el files, TAGS or backups.
167 # ln [a-zA-Z]*.el ../../${tempdir}/lisp/calc-2.02
168 # ln [a-zA-Z]*.elc ../../${tempdir}/lisp/calc-2.02
169 # ln calc.info* calc.texinfo calc-refcard.* ../../${tempdir}/lisp/calc-2.02
170 # ln INSTALL Makefile README README.prev ../../${tempdir}/lisp/calc-2.02
171 # cd ../../${tempdir}/lisp/calc-2.02
174 echo "Making links to \`lisp/term'."
175 ### Don't distribute =*.el files or TAGS.
177 ln [a-zA-Z
]*.el ..
/..
/${tempdir}/lisp
/term
178 ln [a-zA-Z
]*.elc ..
/..
/${tempdir}/lisp
/term
179 ln README ChangeLog ..
/..
/${tempdir}/lisp
/term
182 ### echo "Making links to \`external-lisp'."
183 ### ### Don't distribute =*.el files or TAGS.
184 ### (cd external-lisp
185 ### ln [a-zA-Z]*.el ../${tempdir}/external-lisp
186 ### ln [a-zA-Z]*.elc ../${tempdir}/external-lisp
187 ### ln ChangeLog README ../${tempdir}/external-lisp
190 echo "Making links to \`src'."
191 ### Don't distribute =*.[ch] files, or the configured versions of
192 ### config.h.in, paths.h.in, or Makefile.in, or TAGS.
194 echo " (If we can't link gmalloc.c, that's okay.)"
195 ln [a-zA-Z
]*.c ..
/${tempdir}/src
196 ## Might be a symlink to a file on another filesystem.
197 test -f ..
/${tempdir}/src
/gmalloc.c ||
cp gmalloc.c ..
/${tempdir}/src
198 ln [a-zA-Z
]*.h ..
/${tempdir}/src
199 ln [a-zA-Z
]*.s ..
/${tempdir}/src
200 ln README Makefile.
in ymakefile ChangeLog config.h.
in paths.h.
in \
202 ln .gdbinit .dbxinit ..
/${tempdir}/src
203 ln *.opt vms-pp.trans ..
/${tempdir}/src
205 rm -f config.h paths.h Makefile
206 if [ -z "${newer}" ]; then
207 etags
*.h
*.c ..
/lisp
/*.el
211 echo "Making links to \`src/bitmaps'."
213 ln README
*.xbm ..
/..
/${tempdir}/src
/bitmaps
)
215 echo "Making links to \`src/m'."
217 ln README
[a-zA-Z0-9
]*.h ..
/..
/${tempdir}/src
/m
)
219 echo "Making links to \`src/s'."
221 ln README
[a-zA-Z0-9
]*.h ..
/..
/${tempdir}/src
/s
)
223 echo "Making links to \`lib-src'."
225 ln [a-zA-Z
]*.
[chy
] [a-zA-Z
]*.
lex ..
/${tempdir}/lib-src
226 ln ChangeLog Makefile.
in README testfile vcdiff rcs2log ..
/${tempdir}/lib-src
227 ln emacs.csh rcs-checkin ..
/${tempdir}/lib-src
228 cd ..
/${tempdir}/lib-src
229 rm -f getdate.c getdate.tab.c y.tab.c y.tab.h
232 echo "Making links to \`oldXMenu'."
234 ln *.c
*.h
*.
in ..
/${tempdir}/oldXMenu
235 ln README Imakefile ChangeLog ..
/${tempdir}/oldXMenu
236 ln compile.com descrip.mms ..
/${tempdir}/oldXMenu
)
238 echo "Making links to \`etc'."
239 ### Don't distribute = files, TAGS, DOC files, backups, autosaves, or
242 ln `ls -d * | grep -v 'RCS' | grep -v 'Old'` ..
/${tempdir}/etc
244 rm -f DOC
* *~ \
#*\# *.dvi *.log *,v =* core
247 echo "Making links to \`cpp'."
249 ln cccp.c cexp.y Makefile README ..
/${tempdir}/cpp
)
251 echo "Making links to \`info'."
252 # Don't distribute backups or autosaves.
254 ln [a-zA-Z
]* ..
/${tempdir}/info
255 cd ..
/${tempdir}/info
256 # Avoid an error when expanding the wildcards later.
257 ln emacs dummy~
; ln emacs \
#dummy\#
260 echo "Making links to \`man'."
262 ln *.texinfo
*.texi
*.aux
*.cps
*.fns
*.kys
*.vrs ..
/${tempdir}/man
263 test -f README
&& ln README ..
/${tempdir}/man
264 test -f Makefile
&& ln Makefile ..
/${tempdir}/man
265 ln ChangeLog split-man ..
/${tempdir}/man
266 cp texinfo.tex texindex.c ..
/${tempdir}/man
268 rm -f \
#*\# =* *~ core emacs-index* *.Z *.z xmail
269 rm -f emacs.?? termcap.?? gdb.??
*.log
*.toc
*.dvi
*.oaux
)
271 echo "Making links to \`shortnames'."
273 ln *.c ..
/${tempdir}/shortnames
274 ln Makefile reserved special ..
/${tempdir}/shortnames
)
276 echo "Making links to \`vms'."
278 ln [0-9a-zA-Z]* ..
/${tempdir}/vms
282 ### It would be nice if they could all be symlinks to etc's copy, but
283 ### you're not supposed to have any symlinks in distribution tar files.
284 echo "Making sure copying notices are all copies of \`etc/COPYING'."
285 rm -f ${tempdir}/etc
/COPYING
286 cp etc
/COPYING
${tempdir}/etc
/COPYING
287 # I think we're not going to distribute anything in external-lisp, so
288 # I've removed it from this list.
289 for subdir
in lisp src lib-src info shortnames
; do
290 if [ -f ${tempdir}/${subdir}/COPYING
]; then
291 rm ${tempdir}/${subdir}/COPYING
293 cp etc
/COPYING
${tempdir}/${subdir}
296 #### Make sure that there aren't any hard links between files in the
297 #### distribution; people with afs can't deal with that. Okay,
298 #### actually we just re-copy anything with a link count greater
300 echo "Breaking intra-tree links."
301 find ${tempdir} ! -type d
-links +2 \
302 -exec cp {} $$ \
; -exec rm -f {} \
; -exec mv $$
{} \
;
304 if [ "${newer}" ]; then
305 echo "Removing files older than $newer."
306 ## We remove .elc files unconditionally, on the theory that anyone picking
307 ## up an incremental distribution already has a running Emacs to byte-compile
309 find ${tempparent} \( -name '*.elc' -o ! -newer ${newer} \) -exec rm -f {} \
;
312 if [ "${make_tar}" = yes ]; then
313 if [ "${default_gzip}" = "" ]; then
314 echo "Looking for gzip."
315 temppath
=`echo $PATH | sed 's/^:/.:/
320 for dir in ${temppath}; do
321 if [ -f ${dir}/gzip ]; then echo 'gzip --best'; exit 0; fi
326 case "${default_gzip}" in
327 compress* ) gzip_extension
=.Z
;;
328 * ) gzip_extension
=.z
;;
330 echo "Creating tar file."
331 (cd ${tempparent} ; tar cvf
- ${emacsname} ) \
333 > ${emacsname}.
tar${gzip_extension}
336 if [ "${clean_up}" = yes ]; then
337 echo "Cleaning up the staging directory."
341 ### make-dist ends here