Mercurial > emacs
annotate make-dist @ 992:144a9a018e7c
*** empty log message ***
author | Eric S. Raymond <esr@snark.thyrsus.com> |
---|---|
date | Fri, 14 Aug 1992 17:44:31 +0000 |
parents | eca8812e61cd |
children | 5b2a1922c4d5 |
rev | line source |
---|---|
616 | 1 #!/bin/sh |
2 # | |
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. | |
8 | |
9 progname="$0" | |
10 | |
11 # Exit if a command fails. | |
12 set -e | |
13 | |
14 # Print out each line we read, for debugging's sake. | |
15 # set -v | |
16 | |
621 | 17 clean_up=yes |
18 make_tar=yes | |
992
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
19 newer="" |
616 | 20 |
21 while [ $# -gt 0 ]; do | |
22 case "$1" in | |
992
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
23 # This option tells make-dist not to delete the staging directory |
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
24 # after it's done making the tar file. |
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
25 "--no-clean-up" ) |
621 | 26 clean_up=no |
27 ;; | |
992
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
28 # This option tells make-dist not to make a tar file. Since it's |
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
29 # rather pointless to build the whole staging directory and then |
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
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 ;; |
992
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
35 # This option tells make-dist to make the distribution normally, then |
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
36 # remove all files newer than the given timestamp file. This is useful |
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
37 # for creating incremental or patch distributions |
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
38 "--newer") |
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
39 newer=$2 |
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
40 shift |
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
41 ;; |
616 | 42 * ) |
43 echo "${progname}: Unrecognized argument: $1" >&2 | |
44 exit 1 | |
45 ;; | |
46 esac | |
47 shift | |
48 done | |
49 | |
50 # Make sure we're running in the right place. | |
51 if [ ! -d src -o ! -f src/lisp.h -o ! -d lisp -o ! -f lisp/version.el ]; then | |
992
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
52 echo "${progname}: Can't find \`src/lisp.h' and \`lisp/version.el'." >&2 |
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
53 echo "${progname} must be run in the top directory of the Emacs" >&2 |
616 | 54 echo "distribution tree. Cd to that directory and try again." >&2 |
55 exit 1 | |
56 fi | |
57 | |
58 # Find out which version of Emacs this is. | |
59 version=`grep 'defconst[ ]*emacs-version' lisp/version.el \ | |
60 | sed -e 's/^.*"\([0-9]+\.[0-9]+\)\..*$/\1/'` | |
61 if [ ! "${version}" ]; then | |
992
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
62 echo "${progname}: can't find current emacs version in \`./lisp/version.el'." >&2 |
616 | 63 exit 1 |
64 fi | |
65 | |
66 # Make sure the subdirectory is available. | |
992
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
67 tempparent="make-dist.tmp.$$" |
616 | 68 if [ -d ${tempparent} ]; then |
992
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
69 echo "${progname}: staging directory \`${tempparent}' already exists. |
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
70 Perhaps a previous invocation of \`${progname}' failed to clean up after |
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
71 itself. Check that directories whose names are of the form |
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
72 \`make-dist.tmp.NNNNN' don't contain any important information, remove |
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
73 them, and try again." >&2 |
616 | 74 exit 1 |
75 fi | |
76 | |
992
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
77 echo "Creating staging directory: \`${tempparent}'" |
616 | 78 mkdir ${tempparent} |
79 emacsname="emacs-${version}" | |
80 tempdir="${tempparent}/${emacsname}" | |
81 | |
992
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
82 echo "Creating top directory: \`${tempdir}'" |
616 | 83 mkdir ${tempdir} |
84 | |
85 # We copy in the top-level files before creating the subdirectories in | |
86 # hopes that this will make the top-level files appear first in the | |
621 | 87 # tar file; this means that people can start reading the INSTALL and |
88 # README while the rest of the tar file is still unpacking. Whoopee. | |
992
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
89 echo "Making links to top-level files." |
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
90 ln GETTING.GNU.SOFTWARE INSTALL PROBLEMS README move-if-change ${tempdir} |
616 | 91 ln ChangeLog Makefile.in build-install.in configure make-dist ${tempdir} |
92 | |
93 echo "Creating subdirectories." | |
992
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
94 for subdir in lisp lisp/term local-lisp external-lisp \ |
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
95 src src/m src/s lib-src oldXMenu \ |
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
96 etc lock arch-lib cpp info man shortnames; do |
616 | 97 mkdir ${tempdir}/${subdir} |
98 done | |
99 | |
992
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
100 echo "Making links to \`lisp'." |
616 | 101 # Don't distribute =*.el files, site-init.el, or site-load.el. |
102 (cd lisp | |
103 ln [a-zA-Z]*.el ../${tempdir}/lisp | |
104 ln [a-zA-Z]*.elc ../${tempdir}/lisp | |
992
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
105 # simula.el doesn't keep abbreviations in simula.defns any more. |
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
106 # ln [a-zA-Z]*.defns ../${tempdir}/lisp |
616 | 107 ln ChangeLog README ../${tempdir}/lisp |
108 cd ../${tempdir}/lisp | |
109 rm -f site-init site-init.el site-init.elc | |
110 rm -f site-load site-load.el site-load.elc) | |
111 | |
992
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
112 echo "Making links to \`lisp/term'." |
616 | 113 # Don't distribute =*.el files. |
114 (cd lisp/term | |
115 ln [a-zA-Z]*.el ../../${tempdir}/lisp/term | |
116 ln [a-zA-Z]*.elc ../../${tempdir}/lisp/term | |
117 ln README ../../${tempdir}/lisp/term) | |
118 | |
992
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
119 echo "Making links to \`external-lisp'." |
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
120 # Don't distribute =*.el files. |
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
121 (cd external-lisp |
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
122 ln [a-zA-Z]*.el ../${tempdir}/external-lisp |
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
123 ln [a-zA-Z]*.elc ../${tempdir}/external-lisp |
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
124 ln ChangeLog README ../${tempdir}/external-lisp) |
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
125 |
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
126 echo "Making links to \`src'." |
616 | 127 # Don't distribute =*.[ch] files, or the configured versions of |
128 # config.h.in, paths.h.in, or Makefile.in. | |
129 (cd src | |
130 ln [a-zA-Z]*.c ../${tempdir}/src | |
131 ln [a-zA-Z]*.h ../${tempdir}/src | |
132 ln [a-zA-Z]*.s ../${tempdir}/src | |
133 ln README Makefile.in ymakefile ChangeLog config.h.in paths.h.in \ | |
134 ../${tempdir}/src | |
135 ln .gdbinit .dbxinit ../${tempdir}/src | |
136 ln *.com *.opt vms-pp.trans vmsbuild ../${tempdir}/src | |
137 cd ../${tempdir}/src | |
992
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
138 rm -f config.h paths.h Makefile |
616 | 139 etags *.h *.c ../lisp/*.el) |
140 | |
992
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
141 echo "Making links to \`src/m'." |
616 | 142 (cd src/m |
143 ln README *.h ../../${tempdir}/src/m) | |
144 | |
992
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
145 echo "Making links to \`src/s'." |
616 | 146 (cd src/s |
147 ln README *.h ../../${tempdir}/src/s) | |
148 | |
992
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
149 echo "Making links to \`lib-src'." |
616 | 150 (cd lib-src |
151 ln [a-zA-Z]*.c [a-zA-Z]*.h [a-zA-Z]*.y [a-zA-Z]*.lex ../${tempdir}/lib-src | |
992
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
152 ln ChangeLog Makefile.in README testfile vcdiff rcs2log ../${tempdir}/lib-src |
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
153 cd ../${tempdir}/lib-src |
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
154 rm -f getdate.c getdate.tab.c y.tab.c y.tab.h) |
616 | 155 |
992
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
156 echo "Making links to \`oldXMenu'." |
616 | 157 (cd oldXMenu |
158 ln *.c *.h ../${tempdir}/oldXMenu | |
159 ln README Makefile Imakefile ChangeLog ../${tempdir}/oldXMenu) | |
160 | |
992
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
161 echo "Making links to \`etc'." |
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
162 # Don't distribute TAGS, DOC files, backups, autosaves, or tex litter. |
616 | 163 (cd etc |
164 ln [0-9a-zA-Z]* ../${tempdir}/etc | |
165 cd ../${tempdir}/etc | |
166 # Avoid an error when expanding the wildcards later. | |
167 for dummy in DOC-dummy dummy~ \#dummy\# dummy.dvi dummy.log; do | |
168 ln MACHINES ${dummy} | |
169 done | |
992
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
170 rm -f TAGS DOC* *~ \#*\# *.dvi *.log core) |
616 | 171 |
172 # For now, we comment these out, since I'm not changing them any. | |
992
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
173 #!! echo "Making links to \`cpp'." |
616 | 174 #!! (cd cpp |
175 #!! ln cccp.c cexp.y Makefile README ../${tempdir}/cpp) | |
176 #!! | |
992
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
177 #!! echo "Making links to \`info'." |
616 | 178 #!! # Don't distribute backups or autosaves. |
179 #!! (cd info | |
180 #!! ln [a-zA-Z]* ../${tempdir}/info | |
181 #!! cd ../${tempdir}/info | |
182 #!! # Avoid an error when expanding the wildcards later. | |
183 #!! ln emacs dummy~ ; ln emacs \#dummy\# | |
184 #!! rm -f *~ \#*\# core) | |
185 #!! | |
992
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
186 #!! echo "Making links to \`man'." |
616 | 187 #!! (cd man |
188 #!! ln *.tex *.texinfo *.texi *.aux *.cps *.fns *.kys *.vrs ../${tempdir}/man | |
189 #!! ln *.c ../${tempdir}/man | |
190 #!! ln ChangeLog Makefile README split-man ../${tempdir}/man) | |
191 | |
992
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
192 echo "Making links to \`shortnames'." |
616 | 193 (cd shortnames |
194 ln *.c ../${tempdir}/shortnames | |
195 ln Makefile reserved special ../${tempdir}/shortnames) | |
196 | |
992
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
197 echo "Making sure copying notices are all symlinks to \`etc/COPYING'." |
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
198 rm -f ${tempdir}/etc/COPYING |
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
199 cp etc/COPYING ${tempdir}/etc/COPYING |
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
200 for subdir in lisp external-lisp src lib-src info shortnames; do |
616 | 201 if [ -f ${tempdir}/${subdir}/COPYING ]; then |
202 rm ${tempdir}/${subdir}/COPYING | |
203 fi | |
204 ln -s ../etc/COPYING ${tempdir}/${subdir} | |
205 done | |
206 | |
992
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
207 if [ "${newer}" ]; then |
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
208 echo "Removing files older than $newer." |
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
209 # We remove .elc files unconditionally, on the theory that anyone picking |
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
210 # up an incremental distribution already has a running Emacs to byte-compile |
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
211 # them with. |
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
212 find ${tempparent} \( -name '*.elc' -o ! -newer ${newer} \) -exec rm -f {} \; |
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
213 fi |
144a9a018e7c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
214 |
621 | 215 if [ "${make_tar}" = yes ]; then |
216 echo "Creating tar file." | |
217 (cd ${tempparent}; tar cvf - ${emacsname}) | compress > ${emacsname}.tar.Z | |
218 fi | |
616 | 219 |
621 | 220 if [ "${clean_up}" = yes ]; then |
616 | 221 echo "Cleaning up the staging directory." |
222 rm -rf ${tempparent} | |
223 fi |