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 newer than the given timestamp file. This is useful
37 ## for creating incremental or patch distributions
44 echo "${progname}: Unrecognized argument: $1" >&2
51 ### Make sure we're running in the right place.
52 if [ ! -d src
-o ! -f src
/lisp.h
-o ! -d lisp
-o ! -f lisp
/version.el
]; then
53 echo "${progname}: Can't find \`src/lisp.h' and \`lisp/version.el'." >&2
54 echo "${progname} must be run in the top directory of the Emacs" >&2
55 echo "distribution tree. Cd to that directory and try again." >&2
59 ### Find out which version of Emacs this is.
60 version
=`grep 'defconst[ ]*emacs-version' lisp/version.el \
61 | sed -e 's/^.*"\([0-9][0-9]*\.[0-9][0-9]*\)\..*$/\1/'`
62 if [ ! "${version}" ]; then
63 echo "${progname}: can't find current emacs version in \`./lisp/version.el'." >&2
67 ### Make sure the subdirectory is available.
68 tempparent
="make-dist.tmp.$$"
69 if [ -d ${tempparent} ]; then
70 echo "${progname}: staging directory \`${tempparent}' already exists.
71 Perhaps a previous invocation of \`${progname}' failed to clean up after
72 itself. Check that directories whose names are of the form
73 \`make-dist.tmp.NNNNN' don't contain any important information, remove
74 them, and try again." >&2
78 echo "Creating staging directory: \`${tempparent}'"
80 emacsname
="emacs-${version}${new_extension}"
81 tempdir
="${tempparent}/${emacsname}"
83 ### This trap ensures that the staging directory will be cleaned up even
84 ### when the script is interrupted in mid-career.
85 if [ "${clean_up}" = yes ]; then
86 trap "echo 'Interrupted...cleaning up the staging directory.'; rm -rf ${tempparent}; exit 1" 1 2 15
89 echo "Creating top directory: \`${tempdir}'"
92 ### We copy in the top-level files before creating the subdirectories in
93 ### hopes that this will make the top-level files appear first in the
94 ### tar file; this means that people can start reading the INSTALL and
95 ### README while the rest of the tar file is still unpacking. Whoopee.
96 echo "Making links to top-level files."
97 ln GETTING.GNU.SOFTWARE INSTALL PROBLEMS README move-if-change
${tempdir}
98 ln ChangeLog Makefile.
in build-install.
in configure
${tempdir}
99 ln make-dist
${tempdir}
100 ### Copy config.sub; it's a cross-filesystem symlink.
101 cp config.sub
${tempdir}
103 echo "Creating subdirectories."
104 # I think we're not going to distribute anything in external-lisp, so
105 # I've removed it from this list.
106 for subdir
in lisp lisp
/calc-2.02 lisp
/term local-lisp \
107 src src
/m src
/s lib-src oldXMenu \
108 etc lock cpp info man shortnames vms
; do
109 mkdir
${tempdir}/${subdir}
112 echo "Making links to \`lisp'."
113 ### Don't distribute =*.el files, site-init.el, site-load.el, or default.el.
115 ln [a-zA-Z
]*.el ..
/${tempdir}/lisp
116 ln [a-zA-Z
]*.elc ..
/${tempdir}/lisp
117 ## simula.el doesn't keep abbreviations in simula.defns any more.
118 ## ln [a-zA-Z]*.defns ../${tempdir}/lisp
119 ln ChangeLog README ..
/${tempdir}/lisp
120 cd ..
/${tempdir}/lisp
121 rm -f site-init site-init.el site-init.elc
122 rm -f site-load site-load.el site-load.elc
123 rm -f default default.el default.elc
)
125 echo "Making links to \`lisp/calc-2.02'."
126 ### Don't distribute =*.el files or backups.
128 ln [a-zA-Z
]*.el ..
/..
/${tempdir}/lisp
/calc-2.02
129 ln [a-zA-Z
]*.elc ..
/..
/${tempdir}/lisp
/calc-2.02
130 ln calc.info
* calc.texinfo calc-refcard.
* ..
/..
/${tempdir}/lisp
/calc-2.02
131 ln INSTALL Makefile README README.prev ..
/..
/${tempdir}/lisp
/calc-2.02
132 cd ..
/..
/${tempdir}/lisp
/calc-2.02
135 echo "Making links to \`lisp/term'."
136 ### Don't distribute =*.el files.
138 ln [a-zA-Z
]*.el ..
/..
/${tempdir}/lisp
/term
139 ln [a-zA-Z
]*.elc ..
/..
/${tempdir}/lisp
/term
140 ln README ..
/..
/${tempdir}/lisp
/term
)
142 ### echo "Making links to \`external-lisp'."
143 ### ### Don't distribute =*.el files.
144 ### (cd external-lisp
145 ### ln [a-zA-Z]*.el ../${tempdir}/external-lisp
146 ### ln [a-zA-Z]*.elc ../${tempdir}/external-lisp
147 ### ln ChangeLog README ../${tempdir}/external-lisp)
149 echo "Making links to \`src'."
150 ### Don't distribute =*.[ch] files, or the configured versions of
151 ### config.h.in, paths.h.in, or Makefile.in.
153 echo " (If we can't link gmalloc.c, that's okay.)"
154 ln [a-zA-Z
]*.c ..
/${tempdir}/src
155 ## Might be a symlink to a file on another filesystem.
156 test -f ..
/${tempdir}/src
/gmalloc.c ||
cp gmalloc.c ..
/${tempdir}/src
157 ln [a-zA-Z
]*.h ..
/${tempdir}/src
158 ln [a-zA-Z
]*.s ..
/${tempdir}/src
159 ln README Makefile.
in ymakefile ChangeLog config.h.
in paths.h.
in \
161 ln .gdbinit .dbxinit ..
/${tempdir}/src
162 ln *.opt vms-pp.trans ..
/${tempdir}/src
164 rm -f config.h paths.h Makefile
165 if [ -z "${newer}" ]; then
166 etags
*.h
*.c ..
/lisp
/*.el
169 echo "Making links to \`src/m'."
171 ln README
[a-zA-Z0-9
]*.h ..
/..
/${tempdir}/src
/m
)
173 echo "Making links to \`src/s'."
175 ln README
[a-zA-Z0-9
]*.h ..
/..
/${tempdir}/src
/s
)
177 echo "Making links to \`lib-src'."
179 ln [a-zA-Z
]*.
[chy
] [a-zA-Z
]*.
lex [a-zA-Z
]*.com ..
/${tempdir}/lib-src
180 ln ChangeLog Makefile.
in README testfile vcdiff rcs2log ..
/${tempdir}/lib-src
181 ln emacs.csh ..
/${tempdir}/lib-src
182 cd ..
/${tempdir}/lib-src
183 rm -f getdate.c getdate.tab.c y.tab.c y.tab.h
)
185 echo "Making links to \`oldXMenu'."
187 ln *.c
*.h ..
/${tempdir}/oldXMenu
188 ln README Makefile Imakefile ChangeLog ..
/${tempdir}/oldXMenu
)
190 echo "Making links to \`etc'."
191 ### Don't distribute DOC files, backups, autosaves, or tex litter.
193 ln [0-9a-zA-Z]* ..
/${tempdir}/etc
195 rm -f DOC
* *~ \
#*\# *.dvi *.log *,v core)
197 echo "Making links to \`cpp'."
199 ln cccp.c cexp.y Makefile README ..
/${tempdir}/cpp
)
201 ###!! echo "Making links to \`info'."
202 ###!! # Don't distribute backups or autosaves.
204 ###!! ln [a-zA-Z]* ../${tempdir}/info
205 ###!! cd ../${tempdir}/info
206 ###!! # Avoid an error when expanding the wildcards later.
207 ###!! ln emacs dummy~ ; ln emacs \#dummy\#
208 ###!! rm -f *~ \#*\# core)
210 echo "Making links to \`man'."
212 ln *.tex
*.texinfo
*.texi
*.aux
*.cps
*.fns
*.kys
*.vrs ..
/${tempdir}/man
213 ln *.c ..
/${tempdir}/man
214 test -f README
&& ln README ..
/${tempdir}/man
215 test -f Makefile
&& ln Makefile ..
/${tempdir}/man
216 ln ChangeLog split-man ..
/${tempdir}/man
)
218 echo "Making links to \`shortnames'."
220 ln *.c ..
/${tempdir}/shortnames
221 ln Makefile reserved special ..
/${tempdir}/shortnames
)
223 echo "Making links to \`vms'."
225 ln [0-9a-zA-Z]* ..
/${tempdir}/vms
229 ### It would be nice if they could all be symlinks to etc's copy, but
230 ### you're not supposed to have any symlinks in distribution tar files.
231 echo "Making sure copying notices are all copies of \`etc/COPYING'."
232 rm -f ${tempdir}/etc
/COPYING
233 cp etc
/COPYING
${tempdir}/etc
/COPYING
234 # I think we're not going to distribute anything in external-lisp, so
235 # I've removed it from this list.
236 for subdir
in lisp src lib-src info shortnames
; do
237 if [ -f ${tempdir}/${subdir}/COPYING
]; then
238 rm ${tempdir}/${subdir}/COPYING
240 cp etc
/COPYING
${tempdir}/${subdir}
243 if [ "${newer}" ]; then
244 echo "Removing files older than $newer."
245 ## We remove .elc files unconditionally, on the theory that anyone picking
246 ## up an incremental distribution already has a running Emacs to byte-compile
248 find ${tempparent} \( -name '*.elc' -o ! -newer ${newer} \) -exec rm -f {} \
;
251 if [ "${make_tar}" = yes ]; then
252 echo "Creating tar file."
253 (cd ${tempparent}; tar cvf - ${emacsname}) | compress > ${emacsname}.
tar.Z
256 if [ "${clean_up}" = yes ]; then
257 echo "Cleaning up the staging directory."
261 ### make-dist ends here