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