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.
|
7259
|
65 shortversion=`grep 'defconst[ ]*emacs-version' lisp/version.el \
|
7755
|
66 | sed -e 's/^.*"\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/'`
|
7259
|
67 version=`grep 'defconst[ ]*emacs-version' lisp/version.el \
|
|
68 | sed -e 's/^[^"]*"\([^"]*\)".*$/\1/'`
|
616
|
69 if [ ! "${version}" ]; then
|
7259
|
70 echo "${progname}: can't find current Emacs version in \`./lisp/version.el'." >&2
|
616
|
71 exit 1
|
|
72 fi
|
|
73
|
7755
|
74 echo $version and $shortversion
|
|
75
|
7259
|
76 if grep -s "GNU Emacs version ${shortversion}" ./man/emacs.texi > /dev/null; then
|
2959
|
77 true
|
|
78 else
|
|
79 echo "You must update the version number in \`./man/emacs.texi'"
|
3422
|
80 sleep 5
|
2959
|
81 fi
|
|
82
|
5206
|
83 ### Make sure we don't already have a directory emacs-${version}.
|
|
84
|
|
85 emacsname="emacs-${version}${new_extension}"
|
|
86
|
|
87 if [ -d ${emacsname} ]
|
|
88 then
|
|
89 echo Directory "${emacsname}" already exists >&2
|
|
90 exit 1
|
|
91 fi
|
|
92
|
1628
|
93 ### Make sure the subdirectory is available.
|
992
|
94 tempparent="make-dist.tmp.$$"
|
616
|
95 if [ -d ${tempparent} ]; then
|
992
|
96 echo "${progname}: staging directory \`${tempparent}' already exists.
|
|
97 Perhaps a previous invocation of \`${progname}' failed to clean up after
|
|
98 itself. Check that directories whose names are of the form
|
|
99 \`make-dist.tmp.NNNNN' don't contain any important information, remove
|
|
100 them, and try again." >&2
|
616
|
101 exit 1
|
|
102 fi
|
|
103
|
3144
|
104 ### Check for .elc files with no corresponding .el file.
|
|
105 ls -1 lisp/*.el | sed 's/\.el$/.elc/' > /tmp/el
|
|
106 ls -1 lisp/*.elc > /tmp/elc
|
3146
|
107 bogosities="`comm -13 /tmp/el /tmp/elc`"
|
|
108 if [ "${bogosities}" != "" ]; then
|
|
109 echo "The following .elc files have no corresponding .el files:"
|
|
110 echo "${bogosities}"
|
|
111 fi
|
3155
|
112 rm -f /tmp/el /tmp/elc
|
3144
|
113
|
3258
|
114 ### Make sure configure is newer than configure.in.
|
|
115 if [ "x`ls -t configure configure.in | head -1`" != "xconfigure" ]; then
|
4740
|
116 echo "\`./configure.in' seems to be newer than \`./configure.'" >&2
|
3258
|
117 echo "Attempting to run autoconf." >&2
|
|
118 autoconf
|
|
119 fi
|
|
120
|
3374
|
121 ### Update getdate.c.
|
7259
|
122 (cd lib-src; make -f Makefile getdate.c YACC="bison -y")
|
3374
|
123
|
8345
|
124 echo "Updating Info files."
|
|
125
|
|
126 (cd man; make info)
|
|
127
|
8201
|
128 echo "Updating finder-inf.el."
|
|
129
|
|
130 ### update finder-inf.el.
|
|
131 (cd src; emacs -batch -l finder -f finder-compile-keywords)
|
|
132
|
992
|
133 echo "Creating staging directory: \`${tempparent}'"
|
5206
|
134
|
616
|
135 mkdir ${tempparent}
|
|
136 tempdir="${tempparent}/${emacsname}"
|
|
137
|
1628
|
138 ### This trap ensures that the staging directory will be cleaned up even
|
|
139 ### when the script is interrupted in mid-career.
|
994
|
140 if [ "${clean_up}" = yes ]; then
|
|
141 trap "echo 'Interrupted...cleaning up the staging directory.'; rm -rf ${tempparent}; exit 1" 1 2 15
|
|
142 fi
|
|
143
|
992
|
144 echo "Creating top directory: \`${tempdir}'"
|
616
|
145 mkdir ${tempdir}
|
|
146
|
1628
|
147 ### We copy in the top-level files before creating the subdirectories in
|
|
148 ### hopes that this will make the top-level files appear first in the
|
|
149 ### tar file; this means that people can start reading the INSTALL and
|
|
150 ### README while the rest of the tar file is still unpacking. Whoopee.
|
992
|
151 echo "Making links to top-level files."
|
7883
|
152 ln GETTING.GNU.SOFTWARE INSTALL PROBLEMS README BUGS move-if-change ${tempdir}
|
5028
|
153 ln ChangeLog Makefile.in build-ins.in configure configure.in ${tempdir}
|
7259
|
154 ln config.bat make-dist vpath.sed ${tempdir}
|
5206
|
155 ### Copy these files; they're cross-filesystem symlinks.
|
1628
|
156 cp config.sub ${tempdir}
|
3374
|
157 cp config.guess ${tempdir}
|
5206
|
158 cp install.sh ${tempdir}
|
616
|
159
|
2959
|
160 echo "Updating version number in README."
|
|
161 (cd ${tempdir}
|
|
162 awk \
|
|
163 '$1 " " $2 " " $3 " " $4 " " $5 == "This directory tree holds version" { $6 = version; print $0 }
|
|
164 $1 " " $2 " " $3 " " $4 " " $5 != "This directory tree holds version"' \
|
|
165 version=${version} README > tmp.README
|
|
166 mv tmp.README README)
|
|
167
|
|
168
|
616
|
169 echo "Creating subdirectories."
|
1901
|
170 # I think we're not going to distribute anything in external-lisp, so
|
|
171 # I've removed it from this list.
|
4018
|
172 for subdir in lisp lisp/term site-lisp \
|
5629
|
173 src src/m src/s src/bitmaps lib-src oldXMenu lwlib \
|
5471
|
174 etc lock cpp info man msdos shortnames vms; do
|
616
|
175 mkdir ${tempdir}/${subdir}
|
|
176 done
|
|
177
|
992
|
178 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
|
179 ### Don't distribute TAGS, =*.el files, site-init.el, site-load.el, or default.el.
|
616
|
180 (cd lisp
|
|
181 ln [a-zA-Z]*.el ../${tempdir}/lisp
|
|
182 ln [a-zA-Z]*.elc ../${tempdir}/lisp
|
5033
|
183 ln [a-zA-Z]*.dat ../${tempdir}/lisp
|
1628
|
184 ## simula.el doesn't keep abbreviations in simula.defns any more.
|
|
185 ## ln [a-zA-Z]*.defns ../${tempdir}/lisp
|
7315
|
186 ln ChangeLog Makefile ChangeLog.? README dired.todo ../${tempdir}/lisp
|
616
|
187 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
|
188 rm -f TAGS =*
|
616
|
189 rm -f site-init site-init.el site-init.elc
|
999
|
190 rm -f site-load site-load.el site-load.elc
|
|
191 rm -f default default.el default.elc)
|
616
|
192
|
2676
|
193 #echo "Making links to \`lisp/calc-2.02'."
|
|
194 #### Don't distribute =*.el files, TAGS or backups.
|
|
195 #(cd lisp/calc-2.02
|
|
196 # ln [a-zA-Z]*.el ../../${tempdir}/lisp/calc-2.02
|
|
197 # ln [a-zA-Z]*.elc ../../${tempdir}/lisp/calc-2.02
|
|
198 # ln calc.info* calc.texinfo calc-refcard.* ../../${tempdir}/lisp/calc-2.02
|
|
199 # ln INSTALL Makefile README README.prev ../../${tempdir}/lisp/calc-2.02
|
|
200 # cd ../../${tempdir}/lisp/calc-2.02
|
|
201 # rm -f *~ TAGS)
|
1792
|
202
|
992
|
203 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
|
204 ### Don't distribute =*.el files or TAGS.
|
616
|
205 (cd lisp/term
|
|
206 ln [a-zA-Z]*.el ../../${tempdir}/lisp/term
|
|
207 ln [a-zA-Z]*.elc ../../${tempdir}/lisp/term
|
3817
|
208 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
|
209 rm -f =* TAGS)
|
616
|
210
|
1901
|
211 ### 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
|
212 ### ### Don't distribute =*.el files or TAGS.
|
1901
|
213 ### (cd external-lisp
|
|
214 ### ln [a-zA-Z]*.el ../${tempdir}/external-lisp
|
|
215 ### 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
|
216 ### 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
|
217 ### rm -f =* TAGS)
|
992
|
218
|
|
219 echo "Making links to \`src'."
|
1628
|
220 ### Don't distribute =*.[ch] files, or the configured versions of
|
4795
|
221 ### config.h.in, paths.h.in, or Makefile.in.in, or TAGS.
|
616
|
222 (cd src
|
1628
|
223 echo " (If we can't link gmalloc.c, that's okay.)"
|
616
|
224 ln [a-zA-Z]*.c ../${tempdir}/src
|
1628
|
225 ## Might be a symlink to a file on another filesystem.
|
1946
|
226 test -f ../${tempdir}/src/gmalloc.c || cp gmalloc.c ../${tempdir}/src
|
616
|
227 ln [a-zA-Z]*.h ../${tempdir}/src
|
|
228 ln [a-zA-Z]*.s ../${tempdir}/src
|
5713
76d9b1408e5c
Distribute {src,lisp}/ChangeLog.? instead of {src,lisp}/OChangeLog.
Roland McGrath <roland@gnu.org>
diff
changeset
|
229 ln README Makefile.in.in ChangeLog ChangeLog.? config.h.in paths.h.in \
|
616
|
230 ../${tempdir}/src
|
4489
|
231 ln .gdbinit .dbxinit ../${tempdir}/src
|
2927
|
232 ln *.opt vms-pp.trans ../${tempdir}/src
|
616
|
233 cd ../${tempdir}/src
|
999
|
234 rm -f config.h paths.h Makefile
|
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
|
2180
|
237 echo "Making links to \`src/bitmaps'."
|
|
238 (cd src/bitmaps
|
|
239 ln README *.xbm ../../${tempdir}/src/bitmaps)
|
|
240
|
992
|
241 echo "Making links to \`src/m'."
|
616
|
242 (cd src/m
|
8578
|
243 # We call files for miscellaneous input (to linker etc) .inp.
|
|
244 ln README [a-zA-Z0-9]*.h *.inp ../../${tempdir}/src/m)
|
616
|
245
|
992
|
246 echo "Making links to \`src/s'."
|
616
|
247 (cd src/s
|
8578
|
248 ln README [a-zA-Z0-9]*.h *.inp ../../${tempdir}/src/s)
|
616
|
249
|
992
|
250 echo "Making links to \`lib-src'."
|
616
|
251 (cd lib-src
|
2971
|
252 ln [a-zA-Z]*.[chy] [a-zA-Z]*.lex ../${tempdir}/lib-src
|
7259
|
253 ln ChangeLog Makefile.in.in README testfile vcdiff ../${tempdir}/lib-src
|
|
254 ln emacs.csh rcs2log rcs-checkin ../${tempdir}/lib-src
|
992
|
255 cd ../${tempdir}/lib-src
|
4644
|
256 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
|
257 rm -f =* TAGS)
|
616
|
258
|
5471
|
259 echo "Making links to \`msdos'."
|
|
260 (cd msdos
|
|
261 ln ChangeLog emacs.ico emacs.pif ../${tempdir}/msdos
|
8178
|
262 ln mainmake sed[1234].inp ../${tempdir}/msdos
|
5471
|
263 cd ../${tempdir}/msdos
|
|
264 rm -f =*)
|
|
265
|
992
|
266 echo "Making links to \`oldXMenu'."
|
616
|
267 (cd oldXMenu
|
2832
47d8f937a4bc
* make-dist: Include any *.in files in oldXMenu in the distribution.
Jim Blandy <jimb@redhat.com>
diff
changeset
|
268 ln *.c *.h *.in ../${tempdir}/oldXMenu
|
2833
|
269 ln README Imakefile ChangeLog ../${tempdir}/oldXMenu
|
2487
|
270 ln compile.com descrip.mms ../${tempdir}/oldXMenu)
|
616
|
271
|
5629
|
272 echo "Making links to \`lwlib'."
|
|
273 (cd lwlib
|
|
274 ln *.c *.h *.in ../${tempdir}/lwlib
|
|
275 ln README Imakefile ChangeLog ../${tempdir}/lwlib)
|
|
276
|
992
|
277 echo "Making links to \`etc'."
|
2487
|
278 ### Don't distribute = files, TAGS, DOC files, backups, autosaves, or
|
|
279 ### tex litter.
|
616
|
280 (cd etc
|
2487
|
281 ln `ls -d * | grep -v 'RCS' | grep -v 'Old'` ../${tempdir}/etc
|
616
|
282 cd ../${tempdir}/etc
|
2487
|
283 rm -f DOC* *~ \#*\# *.dvi *.log *,v =* core
|
|
284 rm -f TAGS)
|
616
|
285
|
1792
|
286 echo "Making links to \`cpp'."
|
|
287 (cd cpp
|
|
288 ln cccp.c cexp.y Makefile README ../${tempdir}/cpp)
|
|
289
|
2792
|
290 echo "Making links to \`info'."
|
|
291 # Don't distribute backups or autosaves.
|
|
292 (cd info
|
|
293 ln [a-zA-Z]* ../${tempdir}/info
|
|
294 cd ../${tempdir}/info
|
|
295 # Avoid an error when expanding the wildcards later.
|
|
296 ln emacs dummy~ ; ln emacs \#dummy\#
|
|
297 rm -f *~ \#*\# core)
|
1792
|
298
|
|
299 echo "Making links to \`man'."
|
|
300 (cd man
|
4970
|
301 ln *.texi *.aux *.cps *.fns *.kys *.vrs ../${tempdir}/man
|
1942
|
302 test -f README && ln README ../${tempdir}/man
|
|
303 test -f Makefile && ln Makefile ../${tempdir}/man
|
2676
|
304 ln ChangeLog split-man ../${tempdir}/man
|
5322
|
305 cp texinfo.tex texindex.c getopt.c ../${tempdir}/man
|
2684
|
306 cd ../${tempdir}/man
|
2676
|
307 rm -f \#*\# =* *~ core emacs-index* *.Z *.z xmail
|
|
308 rm -f emacs.?? termcap.?? gdb.?? *.log *.toc *.dvi *.oaux)
|
616
|
309
|
992
|
310 echo "Making links to \`shortnames'."
|
616
|
311 (cd shortnames
|
|
312 ln *.c ../${tempdir}/shortnames
|
|
313 ln Makefile reserved special ../${tempdir}/shortnames)
|
|
314
|
1364
|
315 echo "Making links to \`vms'."
|
|
316 (cd vms
|
|
317 ln [0-9a-zA-Z]* ../${tempdir}/vms
|
|
318 cd ../${tempdir}/vms
|
|
319 rm -f *~)
|
|
320
|
1700
|
321 ### It would be nice if they could all be symlinks to etc's copy, but
|
|
322 ### you're not supposed to have any symlinks in distribution tar files.
|
|
323 echo "Making sure copying notices are all copies of \`etc/COPYING'."
|
992
|
324 rm -f ${tempdir}/etc/COPYING
|
|
325 cp etc/COPYING ${tempdir}/etc/COPYING
|
5471
|
326 for subdir in lisp src lib-src info shortnames msdos; do
|
616
|
327 if [ -f ${tempdir}/${subdir}/COPYING ]; then
|
|
328 rm ${tempdir}/${subdir}/COPYING
|
|
329 fi
|
1790
|
330 cp etc/COPYING ${tempdir}/${subdir}
|
616
|
331 done
|
|
332
|
2986
|
333 #### Make sure that there aren't any hard links between files in the
|
|
334 #### distribution; people with afs can't deal with that. Okay,
|
|
335 #### actually we just re-copy anything with a link count greater
|
|
336 #### than two.
|
|
337 echo "Breaking intra-tree links."
|
3022
|
338 find ${tempdir} ! -type d -links +2 \
|
5184
|
339 -exec cp -p {} $$ \; -exec rm -f {} \; -exec mv $$ {} \;
|
2986
|
340
|
992
|
341 if [ "${newer}" ]; then
|
|
342 echo "Removing files older than $newer."
|
1628
|
343 ## We remove .elc files unconditionally, on the theory that anyone picking
|
|
344 ## up an incremental distribution already has a running Emacs to byte-compile
|
|
345 ## them with.
|
992
|
346 find ${tempparent} \( -name '*.elc' -o ! -newer ${newer} \) -exec rm -f {} \;
|
|
347 fi
|
|
348
|
621
|
349 if [ "${make_tar}" = yes ]; then
|
2254
|
350 if [ "${default_gzip}" = "" ]; then
|
|
351 echo "Looking for gzip."
|
|
352 temppath=`echo $PATH | sed 's/^:/.:/
|
|
353 s/::/:.:/g
|
|
354 s/:$/:./
|
|
355 s/:/ /g'`
|
|
356 default_gzip=`(
|
|
357 for dir in ${temppath}; do
|
|
358 if [ -f ${dir}/gzip ]; then echo 'gzip --best'; exit 0; fi
|
|
359 done
|
|
360 echo compress
|
|
361 )`
|
|
362 fi
|
2487
|
363 case "${default_gzip}" in
|
|
364 compress* ) gzip_extension=.Z ;;
|
3818
ec5cc4995395
* make-dist: If using gzip, create distribution with '.gz' extension.
Jim Blandy <jimb@redhat.com>
diff
changeset
|
365 * ) gzip_extension=.gz ;;
|
2487
|
366 esac
|
621
|
367 echo "Creating tar file."
|
2487
|
368 (cd ${tempparent} ; tar cvf - ${emacsname} ) \
|
|
369 | ${default_gzip} \
|
|
370 > ${emacsname}.tar${gzip_extension}
|
621
|
371 fi
|
616
|
372
|
621
|
373 if [ "${clean_up}" = yes ]; then
|
616
|
374 echo "Cleaning up the staging directory."
|
2487
|
375 rm -rf ${tempparent}
|
5206
|
376 else
|
|
377 (cd ${tempparent}; mv ${emacsname} ..)
|
|
378 rm -rf ${tempparent}
|
616
|
379 fi
|
994
|
380
|
1628
|
381 ### make-dist ends here
|