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 ### Make sure the subdirectory is available.
73 tempparent
="make-dist.tmp.$$"
74 if [ -d ${tempparent} ]; then
75 echo "${progname}: staging directory \`${tempparent}' already exists.
76 Perhaps a previous invocation of \`${progname}' failed to clean up after
77 itself. Check that directories whose names are of the form
78 \`make-dist.tmp.NNNNN' don't contain any important information, remove
79 them, and try again." >&2
83 echo "Creating staging directory: \`${tempparent}'"
85 emacsname
="emacs-${version}${new_extension}"
86 tempdir
="${tempparent}/${emacsname}"
88 ### This trap ensures that the staging directory will be cleaned up even
89 ### when the script is interrupted in mid-career.
90 if [ "${clean_up}" = yes ]; then
91 trap "echo 'Interrupted...cleaning up the staging directory.'; rm -rf ${tempparent}; exit 1" 1 2 15
94 echo "Creating top directory: \`${tempdir}'"
97 ### We copy in the top-level files before creating the subdirectories in
98 ### hopes that this will make the top-level files appear first in the
99 ### tar file; this means that people can start reading the INSTALL and
100 ### README while the rest of the tar file is still unpacking. Whoopee.
101 echo "Making links to top-level files."
102 ln GETTING.GNU.SOFTWARE INSTALL PROBLEMS README move-if-change
${tempdir}
103 ln ChangeLog Makefile.
in build-install.
in configure
${tempdir}
104 ln make-dist
${tempdir}
105 ### Copy config.sub; it's a cross-filesystem symlink.
106 cp config.sub
${tempdir}
108 echo "Creating subdirectories."
109 # I think we're not going to distribute anything in external-lisp, so
110 # I've removed it from this list.
111 for subdir
in lisp lisp
/calc-2.02 lisp
/term local-lisp \
112 src src
/m src
/s src
/bitmaps lib-src oldXMenu \
113 etc lock cpp info man shortnames vms
; do
114 mkdir
${tempdir}/${subdir}
117 echo "Making links to \`lisp'."
118 ### Don't distribute TAGS, =*.el files, site-init.el, site-load.el, or default.el.
120 ln [a-zA-Z
]*.el ..
/${tempdir}/lisp
121 ln [a-zA-Z
]*.elc ..
/${tempdir}/lisp
122 ## simula.el doesn't keep abbreviations in simula.defns any more.
123 ## ln [a-zA-Z]*.defns ../${tempdir}/lisp
124 ln ChangeLog README ..
/${tempdir}/lisp
125 cd ..
/${tempdir}/lisp
127 rm -f site-init site-init.el site-init.elc
128 rm -f site-load site-load.el site-load.elc
129 rm -f default default.el default.elc
)
131 echo "Making links to \`lisp/calc-2.02'."
132 ### Don't distribute =*.el files, TAGS or backups.
134 ln [a-zA-Z
]*.el ..
/..
/${tempdir}/lisp
/calc-2.02
135 ln [a-zA-Z
]*.elc ..
/..
/${tempdir}/lisp
/calc-2.02
136 ln calc.info
* calc.texinfo calc-refcard.
* ..
/..
/${tempdir}/lisp
/calc-2.02
137 ln INSTALL Makefile README README.prev ..
/..
/${tempdir}/lisp
/calc-2.02
138 cd ..
/..
/${tempdir}/lisp
/calc-2.02
141 echo "Making links to \`lisp/term'."
142 ### Don't distribute =*.el files or TAGS.
144 ln [a-zA-Z
]*.el ..
/..
/${tempdir}/lisp
/term
145 ln [a-zA-Z
]*.elc ..
/..
/${tempdir}/lisp
/term
146 ln README ChangeLog ..
/..
/${tempdir}/lisp
/term
149 ### echo "Making links to \`external-lisp'."
150 ### ### Don't distribute =*.el files or TAGS.
151 ### (cd external-lisp
152 ### ln [a-zA-Z]*.el ../${tempdir}/external-lisp
153 ### ln [a-zA-Z]*.elc ../${tempdir}/external-lisp
154 ### ln ChangeLog README ../${tempdir}/external-lisp
157 echo "Making links to \`src'."
158 ### Don't distribute =*.[ch] files, or the configured versions of
159 ### config.h.in, paths.h.in, or Makefile.in, or TAGS.
161 echo " (If we can't link gmalloc.c, that's okay.)"
162 ln [a-zA-Z
]*.c ..
/${tempdir}/src
163 ## Might be a symlink to a file on another filesystem.
164 test -f ..
/${tempdir}/src
/gmalloc.c ||
cp gmalloc.c ..
/${tempdir}/src
165 ln [a-zA-Z
]*.h ..
/${tempdir}/src
166 ln [a-zA-Z
]*.s ..
/${tempdir}/src
167 ln README Makefile.
in ymakefile ChangeLog config.h.
in paths.h.
in \
169 ln .gdbinit .dbxinit ..
/${tempdir}/src
170 ln *.opt vms-pp.trans ..
/${tempdir}/src
172 rm -f config.h paths.h Makefile
173 if [ -z "${newer}" ]; then
174 etags
*.h
*.c ..
/lisp
/*.el
178 echo "Making links to \`src/bitmaps'."
180 ln README
*.xbm ..
/..
/${tempdir}/src
/bitmaps
)
182 echo "Making links to \`src/m'."
184 ln README
[a-zA-Z0-9
]*.h ..
/..
/${tempdir}/src
/m
)
186 echo "Making links to \`src/s'."
188 ln README
[a-zA-Z0-9
]*.h ..
/..
/${tempdir}/src
/s
)
190 echo "Making links to \`lib-src'."
192 ln [a-zA-Z
]*.
[chy
] [a-zA-Z
]*.
lex [a-zA-Z
]*.com ..
/${tempdir}/lib-src
193 ln ChangeLog Makefile.
in README testfile vcdiff rcs2log ..
/${tempdir}/lib-src
194 ln emacs.csh rcs-checkin ..
/${tempdir}/lib-src
195 cd ..
/${tempdir}/lib-src
196 rm -f getdate.c getdate.tab.c y.tab.c y.tab.h
199 echo "Making links to \`oldXMenu'."
201 ln *.c
*.h ..
/${tempdir}/oldXMenu
202 ln README Makefile Imakefile ChangeLog ..
/${tempdir}/oldXMenu
203 ln compile.com descrip.mms ..
/${tempdir}/oldXMenu
)
205 echo "Making links to \`etc'."
206 ### Don't distribute = files, TAGS, DOC files, backups, autosaves, or
209 ln `ls -d * | grep -v 'RCS' | grep -v 'Old'` ..
/${tempdir}/etc
211 rm -f DOC
* *~ \
#*\# *.dvi *.log *,v =* core
214 echo "Making links to \`cpp'."
216 ln cccp.c cexp.y Makefile README ..
/${tempdir}/cpp
)
218 ###!! echo "Making links to \`info'."
219 ###!! # Don't distribute backups or autosaves.
221 ###!! ln [a-zA-Z]* ../${tempdir}/info
222 ###!! cd ../${tempdir}/info
223 ###!! # Avoid an error when expanding the wildcards later.
224 ###!! ln emacs dummy~ ; ln emacs \#dummy\#
225 ###!! rm -f *~ \#*\# core)
227 echo "Making links to \`man'."
229 ln *.tex
*.texinfo
*.texi
*.aux
*.cps
*.fns
*.kys
*.vrs ..
/${tempdir}/man
230 ln *.c ..
/${tempdir}/man
231 test -f README
&& ln README ..
/${tempdir}/man
232 test -f Makefile
&& ln Makefile ..
/${tempdir}/man
233 ln ChangeLog split-man ..
/${tempdir}/man
)
235 echo "Making links to \`shortnames'."
237 ln *.c ..
/${tempdir}/shortnames
238 ln Makefile reserved special ..
/${tempdir}/shortnames
)
240 echo "Making links to \`vms'."
242 ln [0-9a-zA-Z]* ..
/${tempdir}/vms
246 ### It would be nice if they could all be symlinks to etc's copy, but
247 ### you're not supposed to have any symlinks in distribution tar files.
248 echo "Making sure copying notices are all copies of \`etc/COPYING'."
249 rm -f ${tempdir}/etc
/COPYING
250 cp etc
/COPYING
${tempdir}/etc
/COPYING
251 # I think we're not going to distribute anything in external-lisp, so
252 # I've removed it from this list.
253 for subdir
in lisp src lib-src info shortnames
; do
254 if [ -f ${tempdir}/${subdir}/COPYING
]; then
255 rm ${tempdir}/${subdir}/COPYING
257 cp etc
/COPYING
${tempdir}/${subdir}
260 if [ "${newer}" ]; then
261 echo "Removing files older than $newer."
262 ## We remove .elc files unconditionally, on the theory that anyone picking
263 ## up an incremental distribution already has a running Emacs to byte-compile
265 find ${tempparent} \( -name '*.elc' -o ! -newer ${newer} \) -exec rm -f {} \
;
268 if [ "${make_tar}" = yes ]; then
269 if [ "${default_gzip}" = "" ]; then
270 echo "Looking for gzip."
271 temppath
=`echo $PATH | sed 's/^:/.:/
276 for dir in ${temppath}; do
277 if [ -f ${dir}/gzip ]; then echo 'gzip --best'; exit 0; fi
282 case "${default_gzip}" in
283 compress* ) gzip_extension
=.Z
;;
284 * ) gzip_extension
=.z
;;
286 echo "Creating tar file."
287 (cd ${tempparent} ; tar cvf
- ${emacsname} ) \
289 > ${emacsname}.
tar${gzip_extension}
292 if [ "${clean_up}" = yes ]; then
293 echo "Cleaning up the staging directory."
297 ### make-dist ends here