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