616
|
1 #!/bin/sh
|
1628
|
2
|
|
3 #### make-dist: create an Emacs distribution tar file from the current
|
1688
|
4 #### source tree. This basically creates a duplicate directory
|
1628
|
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.
|
616
|
8
|
|
9 progname="$0"
|
|
10
|
1628
|
11 ### Exit if a command fails.
|
|
12 ### set -e
|
616
|
13
|
1628
|
14 ### Print out each line we read, for debugging's sake.
|
|
15 ### set -v
|
616
|
16
|
621
|
17 clean_up=yes
|
|
18 make_tar=yes
|
992
|
19 newer=""
|
616
|
20
|
|
21 while [ $# -gt 0 ]; do
|
|
22 case "$1" in
|
1628
|
23 ## This option tells make-dist not to delete the staging directory
|
|
24 ## after it's done making the tar file.
|
992
|
25 "--no-clean-up" )
|
621
|
26 clean_up=no
|
|
27 ;;
|
1628
|
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'.
|
621
|
31 "--no-tar" )
|
|
32 make_tar=no
|
|
33 clean_up=no
|
616
|
34 ;;
|
1628
|
35 ## This option tells make-dist to make the distribution normally, then
|
2263
4b57c6f61299
Corrected typo, fixed it to discard = and TAGS files in some cases where it
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
36 ## remove all files older than the given timestamp file. This is useful
|
4b57c6f61299
Corrected typo, fixed it to discard = and TAGS files in some cases where it
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
37 ## for creating incremental or patch distributions.
|
992
|
38 "--newer")
|
999
|
39 newer="$2"
|
|
40 new_extension=".new"
|
992
|
41 shift
|
|
42 ;;
|
2254
|
43 ## This option tells make-dist to use `compress' instead of gzip.
|
|
44 ## Normally, make-dist uses gzip whenever it is present.
|
|
45 "--compress")
|
|
46 default_gzip="compress"
|
|
47 ;;
|
616
|
48 * )
|
|
49 echo "${progname}: Unrecognized argument: $1" >&2
|
|
50 exit 1
|
|
51 ;;
|
|
52 esac
|
|
53 shift
|
|
54 done
|
|
55
|
1628
|
56 ### Make sure we're running in the right place.
|
616
|
57 if [ ! -d src -o ! -f src/lisp.h -o ! -d lisp -o ! -f lisp/version.el ]; then
|
992
|
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
|
4168
|
60 echo "distribution tree. cd to that directory and try again." >&2
|
616
|
61 exit 1
|
|
62 fi
|
|
63
|
1628
|
64 ### Find out which version of Emacs this is.
|
616
|
65 version=`grep 'defconst[ ]*emacs-version' lisp/version.el \
|
1112
|
66 | sed -e 's/^.*"\([0-9][0-9]*\.[0-9][0-9]*\)\..*$/\1/'`
|
616
|
67 if [ ! "${version}" ]; then
|
992
|
68 echo "${progname}: can't find current emacs version in \`./lisp/version.el'." >&2
|
616
|
69 exit 1
|
|
70 fi
|
|
71
|
2959
|
72 if grep -s "GNU Emacs version ${version}" ./man/emacs.texi > /dev/null; then
|
|
73 true
|
|
74 else
|
|
75 echo "You must update the version number in \`./man/emacs.texi'"
|
3422
|
76 sleep 5
|
2959
|
77 fi
|
|
78
|
1628
|
79 ### Make sure the subdirectory is available.
|
992
|
80 tempparent="make-dist.tmp.$$"
|
616
|
81 if [ -d ${tempparent} ]; then
|
992
|
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
|
616
|
87 exit 1
|
|
88 fi
|
|
89
|
3144
|
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
|
3146
|
93 bogosities="`comm -13 /tmp/el /tmp/elc`"
|
|
94 if [ "${bogosities}" != "" ]; then
|
|
95 echo "The following .elc files have no corresponding .el files:"
|
|
96 echo "${bogosities}"
|
|
97 fi
|
3155
|
98 rm -f /tmp/el /tmp/elc
|
3144
|
99
|
3258
|
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
|
|
104 autoconf
|
|
105 fi
|
|
106
|
3374
|
107 ### Update getdate.c.
|
|
108 (cd lib-src; make -f Makefile.in getdate.c)
|
|
109
|
992
|
110 echo "Creating staging directory: \`${tempparent}'"
|
616
|
111 mkdir ${tempparent}
|
999
|
112 emacsname="emacs-${version}${new_extension}"
|
616
|
113 tempdir="${tempparent}/${emacsname}"
|
|
114
|
1628
|
115 ### This trap ensures that the staging directory will be cleaned up even
|
|
116 ### when the script is interrupted in mid-career.
|
994
|
117 if [ "${clean_up}" = yes ]; then
|
|
118 trap "echo 'Interrupted...cleaning up the staging directory.'; rm -rf ${tempparent}; exit 1" 1 2 15
|
|
119 fi
|
|
120
|
992
|
121 echo "Creating top directory: \`${tempdir}'"
|
616
|
122 mkdir ${tempdir}
|
|
123
|
1628
|
124 ### We copy in the top-level files before creating the subdirectories in
|
|
125 ### hopes that this will make the top-level files appear first in the
|
|
126 ### tar file; this means that people can start reading the INSTALL and
|
|
127 ### README while the rest of the tar file is still unpacking. Whoopee.
|
992
|
128 echo "Making links to top-level files."
|
|
129 ln GETTING.GNU.SOFTWARE INSTALL PROBLEMS README move-if-change ${tempdir}
|
2625
|
130 ln ChangeLog Makefile.in build-install.in configure configure.in ${tempdir}
|
1574
|
131 ln make-dist ${tempdir}
|
3374
|
132 ### Copy config.guess and config.sub; they're cross-filesystem symlinks.
|
1628
|
133 cp config.sub ${tempdir}
|
3374
|
134 cp config.guess ${tempdir}
|
616
|
135
|
2959
|
136 echo "Updating version number in README."
|
|
137 (cd ${tempdir}
|
|
138 awk \
|
|
139 '$1 " " $2 " " $3 " " $4 " " $5 == "This directory tree holds version" { $6 = version; print $0 }
|
|
140 $1 " " $2 " " $3 " " $4 " " $5 != "This directory tree holds version"' \
|
|
141 version=${version} README > tmp.README
|
|
142 mv tmp.README README)
|
|
143
|
|
144
|
616
|
145 echo "Creating subdirectories."
|
1901
|
146 # I think we're not going to distribute anything in external-lisp, so
|
|
147 # I've removed it from this list.
|
4018
|
148 for subdir in lisp lisp/term site-lisp \
|
2180
|
149 src src/m src/s src/bitmaps lib-src oldXMenu \
|
1688
|
150 etc lock cpp info man shortnames vms; do
|
616
|
151 mkdir ${tempdir}/${subdir}
|
|
152 done
|
|
153
|
992
|
154 echo "Making links to \`lisp'."
|
2263
4b57c6f61299
Corrected typo, fixed it to discard = and TAGS files in some cases where it
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
155 ### Don't distribute TAGS, =*.el files, site-init.el, site-load.el, or default.el.
|
616
|
156 (cd lisp
|
|
157 ln [a-zA-Z]*.el ../${tempdir}/lisp
|
|
158 ln [a-zA-Z]*.elc ../${tempdir}/lisp
|
3818
ec5cc4995395
* make-dist: If using gzip, create distribution with '.gz' extension.
Jim Blandy <jimb@redhat.com>
diff
changeset
|
159 ln [a-zA-Z]*.dat forms.README ../${tempdir}/lisp
|
1628
|
160 ## simula.el doesn't keep abbreviations in simula.defns any more.
|
|
161 ## ln [a-zA-Z]*.defns ../${tempdir}/lisp
|
4492
|
162 ln ChangeLog OChangeLog README dired.todo ../${tempdir}/lisp
|
616
|
163 cd ../${tempdir}/lisp
|
2263
4b57c6f61299
Corrected typo, fixed it to discard = and TAGS files in some cases where it
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
164 rm -f TAGS =*
|
616
|
165 rm -f site-init site-init.el site-init.elc
|
999
|
166 rm -f site-load site-load.el site-load.elc
|
|
167 rm -f default default.el default.elc)
|
616
|
168
|
2676
|
169 #echo "Making links to \`lisp/calc-2.02'."
|
|
170 #### Don't distribute =*.el files, TAGS or backups.
|
|
171 #(cd lisp/calc-2.02
|
|
172 # ln [a-zA-Z]*.el ../../${tempdir}/lisp/calc-2.02
|
|
173 # ln [a-zA-Z]*.elc ../../${tempdir}/lisp/calc-2.02
|
|
174 # ln calc.info* calc.texinfo calc-refcard.* ../../${tempdir}/lisp/calc-2.02
|
|
175 # ln INSTALL Makefile README README.prev ../../${tempdir}/lisp/calc-2.02
|
|
176 # cd ../../${tempdir}/lisp/calc-2.02
|
|
177 # rm -f *~ TAGS)
|
1792
|
178
|
992
|
179 echo "Making links to \`lisp/term'."
|
2263
4b57c6f61299
Corrected typo, fixed it to discard = and TAGS files in some cases where it
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
180 ### Don't distribute =*.el files or TAGS.
|
616
|
181 (cd lisp/term
|
|
182 ln [a-zA-Z]*.el ../../${tempdir}/lisp/term
|
|
183 ln [a-zA-Z]*.elc ../../${tempdir}/lisp/term
|
3817
|
184 ln README ../../${tempdir}/lisp/term
|
2263
4b57c6f61299
Corrected typo, fixed it to discard = and TAGS files in some cases where it
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
185 rm -f =* TAGS)
|
616
|
186
|
1901
|
187 ### echo "Making links to \`external-lisp'."
|
2263
4b57c6f61299
Corrected typo, fixed it to discard = and TAGS files in some cases where it
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
188 ### ### Don't distribute =*.el files or TAGS.
|
1901
|
189 ### (cd external-lisp
|
|
190 ### ln [a-zA-Z]*.el ../${tempdir}/external-lisp
|
|
191 ### ln [a-zA-Z]*.elc ../${tempdir}/external-lisp
|
2263
4b57c6f61299
Corrected typo, fixed it to discard = and TAGS files in some cases where it
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
192 ### ln ChangeLog README ../${tempdir}/external-lisp
|
4b57c6f61299
Corrected typo, fixed it to discard = and TAGS files in some cases where it
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
193 ### rm -f =* TAGS)
|
992
|
194
|
|
195 echo "Making links to \`src'."
|
1628
|
196 ### Don't distribute =*.[ch] files, or the configured versions of
|
2263
4b57c6f61299
Corrected typo, fixed it to discard = and TAGS files in some cases where it
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
197 ### config.h.in, paths.h.in, or Makefile.in, or TAGS.
|
616
|
198 (cd src
|
1628
|
199 echo " (If we can't link gmalloc.c, that's okay.)"
|
616
|
200 ln [a-zA-Z]*.c ../${tempdir}/src
|
1628
|
201 ## Might be a symlink to a file on another filesystem.
|
1946
|
202 test -f ../${tempdir}/src/gmalloc.c || cp gmalloc.c ../${tempdir}/src
|
616
|
203 ln [a-zA-Z]*.h ../${tempdir}/src
|
|
204 ln [a-zA-Z]*.s ../${tempdir}/src
|
4492
|
205 ln README Makefile.in ymakefile ChangeLog OChangeLog config.h.in paths.h.in \
|
616
|
206 ../${tempdir}/src
|
4489
|
207 ln .gdbinit .dbxinit ../${tempdir}/src
|
2927
|
208 ln *.opt vms-pp.trans ../${tempdir}/src
|
616
|
209 cd ../${tempdir}/src
|
999
|
210 rm -f config.h paths.h Makefile
|
|
211 if [ -z "${newer}" ]; then
|
|
212 etags *.h *.c ../lisp/*.el
|
2263
4b57c6f61299
Corrected typo, fixed it to discard = and TAGS files in some cases where it
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
213 fi
|
4b57c6f61299
Corrected typo, fixed it to discard = and TAGS files in some cases where it
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
214 rm -f =* TAGS)
|
616
|
215
|
2180
|
216 echo "Making links to \`src/bitmaps'."
|
|
217 (cd src/bitmaps
|
|
218 ln README *.xbm ../../${tempdir}/src/bitmaps)
|
|
219
|
992
|
220 echo "Making links to \`src/m'."
|
616
|
221 (cd src/m
|
1574
|
222 ln README [a-zA-Z0-9]*.h ../../${tempdir}/src/m)
|
616
|
223
|
992
|
224 echo "Making links to \`src/s'."
|
616
|
225 (cd src/s
|
1574
|
226 ln README [a-zA-Z0-9]*.h ../../${tempdir}/src/s)
|
616
|
227
|
992
|
228 echo "Making links to \`lib-src'."
|
616
|
229 (cd lib-src
|
2971
|
230 ln [a-zA-Z]*.[chy] [a-zA-Z]*.lex ../${tempdir}/lib-src
|
992
|
231 ln ChangeLog Makefile.in README testfile vcdiff rcs2log ../${tempdir}/lib-src
|
2500
|
232 ln emacs.csh rcs-checkin ../${tempdir}/lib-src
|
992
|
233 cd ../${tempdir}/lib-src
|
4644
|
234 rm -f getdate.tab.c y.tab.c y.tab.h
|
2263
4b57c6f61299
Corrected typo, fixed it to discard = and TAGS files in some cases where it
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
235 rm -f =* TAGS)
|
616
|
236
|
992
|
237 echo "Making links to \`oldXMenu'."
|
616
|
238 (cd oldXMenu
|
2832
47d8f937a4bc
* make-dist: Include any *.in files in oldXMenu in the distribution.
Jim Blandy <jimb@redhat.com>
diff
changeset
|
239 ln *.c *.h *.in ../${tempdir}/oldXMenu
|
2833
|
240 ln README Imakefile ChangeLog ../${tempdir}/oldXMenu
|
2487
|
241 ln compile.com descrip.mms ../${tempdir}/oldXMenu)
|
616
|
242
|
992
|
243 echo "Making links to \`etc'."
|
2487
|
244 ### Don't distribute = files, TAGS, DOC files, backups, autosaves, or
|
|
245 ### tex litter.
|
616
|
246 (cd etc
|
2487
|
247 ln `ls -d * | grep -v 'RCS' | grep -v 'Old'` ../${tempdir}/etc
|
616
|
248 cd ../${tempdir}/etc
|
2487
|
249 rm -f DOC* *~ \#*\# *.dvi *.log *,v =* core
|
|
250 rm -f TAGS)
|
616
|
251
|
1792
|
252 echo "Making links to \`cpp'."
|
|
253 (cd cpp
|
|
254 ln cccp.c cexp.y Makefile README ../${tempdir}/cpp)
|
|
255
|
2792
|
256 echo "Making links to \`info'."
|
|
257 # Don't distribute backups or autosaves.
|
|
258 (cd info
|
|
259 ln [a-zA-Z]* ../${tempdir}/info
|
|
260 cd ../${tempdir}/info
|
|
261 # Avoid an error when expanding the wildcards later.
|
|
262 ln emacs dummy~ ; ln emacs \#dummy\#
|
|
263 rm -f *~ \#*\# core)
|
1792
|
264
|
|
265 echo "Making links to \`man'."
|
|
266 (cd man
|
2971
|
267 ln *.texinfo *.texi *.aux *.cps *.fns *.kys *.vrs ../${tempdir}/man
|
1942
|
268 test -f README && ln README ../${tempdir}/man
|
|
269 test -f Makefile && ln Makefile ../${tempdir}/man
|
2676
|
270 ln ChangeLog split-man ../${tempdir}/man
|
|
271 cp texinfo.tex texindex.c ../${tempdir}/man
|
2684
|
272 cd ../${tempdir}/man
|
2676
|
273 rm -f \#*\# =* *~ core emacs-index* *.Z *.z xmail
|
|
274 rm -f emacs.?? termcap.?? gdb.?? *.log *.toc *.dvi *.oaux)
|
616
|
275
|
992
|
276 echo "Making links to \`shortnames'."
|
616
|
277 (cd shortnames
|
|
278 ln *.c ../${tempdir}/shortnames
|
|
279 ln Makefile reserved special ../${tempdir}/shortnames)
|
|
280
|
1364
|
281 echo "Making links to \`vms'."
|
|
282 (cd vms
|
|
283 ln [0-9a-zA-Z]* ../${tempdir}/vms
|
|
284 cd ../${tempdir}/vms
|
|
285 rm -f *~)
|
|
286
|
1700
|
287 ### It would be nice if they could all be symlinks to etc's copy, but
|
|
288 ### you're not supposed to have any symlinks in distribution tar files.
|
|
289 echo "Making sure copying notices are all copies of \`etc/COPYING'."
|
992
|
290 rm -f ${tempdir}/etc/COPYING
|
|
291 cp etc/COPYING ${tempdir}/etc/COPYING
|
1997
|
292 # I think we're not going to distribute anything in external-lisp, so
|
|
293 # I've removed it from this list.
|
|
294 for subdir in lisp src lib-src info shortnames; do
|
616
|
295 if [ -f ${tempdir}/${subdir}/COPYING ]; then
|
|
296 rm ${tempdir}/${subdir}/COPYING
|
|
297 fi
|
1790
|
298 cp etc/COPYING ${tempdir}/${subdir}
|
616
|
299 done
|
|
300
|
2986
|
301 #### Make sure that there aren't any hard links between files in the
|
|
302 #### distribution; people with afs can't deal with that. Okay,
|
|
303 #### actually we just re-copy anything with a link count greater
|
|
304 #### than two.
|
|
305 echo "Breaking intra-tree links."
|
3022
|
306 find ${tempdir} ! -type d -links +2 \
|
|
307 -exec cp {} $$ \; -exec rm -f {} \; -exec mv $$ {} \;
|
2986
|
308
|
992
|
309 if [ "${newer}" ]; then
|
|
310 echo "Removing files older than $newer."
|
1628
|
311 ## We remove .elc files unconditionally, on the theory that anyone picking
|
|
312 ## up an incremental distribution already has a running Emacs to byte-compile
|
|
313 ## them with.
|
992
|
314 find ${tempparent} \( -name '*.elc' -o ! -newer ${newer} \) -exec rm -f {} \;
|
|
315 fi
|
|
316
|
621
|
317 if [ "${make_tar}" = yes ]; then
|
2254
|
318 if [ "${default_gzip}" = "" ]; then
|
|
319 echo "Looking for gzip."
|
|
320 temppath=`echo $PATH | sed 's/^:/.:/
|
|
321 s/::/:.:/g
|
|
322 s/:$/:./
|
|
323 s/:/ /g'`
|
|
324 default_gzip=`(
|
|
325 for dir in ${temppath}; do
|
|
326 if [ -f ${dir}/gzip ]; then echo 'gzip --best'; exit 0; fi
|
|
327 done
|
|
328 echo compress
|
|
329 )`
|
|
330 fi
|
2487
|
331 case "${default_gzip}" in
|
|
332 compress* ) gzip_extension=.Z ;;
|
3818
ec5cc4995395
* make-dist: If using gzip, create distribution with '.gz' extension.
Jim Blandy <jimb@redhat.com>
diff
changeset
|
333 * ) gzip_extension=.gz ;;
|
2487
|
334 esac
|
621
|
335 echo "Creating tar file."
|
2487
|
336 (cd ${tempparent} ; tar cvf - ${emacsname} ) \
|
|
337 | ${default_gzip} \
|
|
338 > ${emacsname}.tar${gzip_extension}
|
621
|
339 fi
|
616
|
340
|
621
|
341 if [ "${clean_up}" = yes ]; then
|
616
|
342 echo "Cleaning up the staging directory."
|
2487
|
343 rm -rf ${tempparent}
|
616
|
344 fi
|
994
|
345
|
1628
|
346 ### make-dist ends here
|