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
|
616
|
19
|
|
20 while [ $# -gt 0 ]; do
|
|
21 case "$1" in
|
621
|
22 "--no-clean_up" )
|
|
23 clean_up=no
|
|
24 ;;
|
|
25 "--no-tar" )
|
|
26 make_tar=no
|
|
27 clean_up=no
|
616
|
28 ;;
|
|
29 * )
|
|
30 echo "${progname}: Unrecognized argument: $1" >&2
|
|
31 exit 1
|
|
32 ;;
|
|
33 esac
|
|
34 shift
|
|
35 done
|
|
36
|
|
37 # Make sure we're running in the right place.
|
|
38 if [ ! -d src -o ! -f src/lisp.h -o ! -d lisp -o ! -f lisp/version.el ]; then
|
|
39 echo "${progname}: must run in the top directory of the Emacs" >&2
|
|
40 echo "distribution tree. Cd to that directory and try again." >&2
|
|
41 exit 1
|
|
42 fi
|
|
43
|
|
44 # Find out which version of Emacs this is.
|
|
45 version=`grep 'defconst[ ]*emacs-version' lisp/version.el \
|
|
46 | sed -e 's/^.*"\([0-9]+\.[0-9]+\)\..*$/\1/'`
|
|
47 if [ ! "${version}" ]; then
|
|
48 echo "${progname}: can't find current emacs version in ./lisp/version.el." >&2
|
|
49 exit 1
|
|
50 fi
|
|
51
|
|
52 # Make sure the subdirectory is available.
|
|
53 tempparent="make-dist.$$"
|
|
54 if [ -d ${tempparent} ]; then
|
|
55 echo "${progname}: staging directory ${tempparent} already exists.
|
|
56 Perhaps a previous invocation of ${progname} failed to clean up
|
|
57 after itself. Check that directories whose names are of the form
|
|
58 make-dist.NNNNN don't contain any important information, remove them,
|
|
59 and try again." >&2
|
|
60 exit 1
|
|
61 fi
|
|
62
|
|
63 echo "Creating staging directory: ${tempparent}"
|
|
64 mkdir ${tempparent}
|
|
65 emacsname="emacs-${version}"
|
|
66 tempdir="${tempparent}/${emacsname}"
|
|
67
|
|
68 echo "Creating top directory: ${tempdir}"
|
|
69 mkdir ${tempdir}
|
|
70
|
|
71 # We copy in the top-level files before creating the subdirectories in
|
|
72 # hopes that this will make the top-level files appear first in the
|
621
|
73 # tar file; this means that people can start reading the INSTALL and
|
|
74 # README while the rest of the tar file is still unpacking. Whoopee.
|
616
|
75 echo "Copying top-level files."
|
621
|
76 ln GETTING.GNU.SOFTWARE INSTALL PROBLEMS README ${tempdir}
|
616
|
77 ln ChangeLog Makefile.in build-install.in configure make-dist ${tempdir}
|
|
78
|
|
79 echo "Creating subdirectories."
|
|
80 for subdir in lisp lisp/term src src/m src/s lib-src oldXMenu \
|
|
81 etc lock local-lisp arch-lib cpp info man shortnames; do
|
|
82 mkdir ${tempdir}/${subdir}
|
|
83 done
|
|
84
|
|
85 echo "Copying lisp."
|
|
86 # Don't distribute =*.el files, site-init.el, or site-load.el.
|
|
87 (cd lisp
|
|
88 ln [a-zA-Z]*.el ../${tempdir}/lisp
|
|
89 ln [a-zA-Z]*.elc ../${tempdir}/lisp
|
|
90 ln [a-zA-Z]*.defns ../${tempdir}/lisp
|
|
91 ln ChangeLog README ../${tempdir}/lisp
|
|
92 cd ../${tempdir}/lisp
|
|
93 rm -f site-init site-init.el site-init.elc
|
|
94 rm -f site-load site-load.el site-load.elc)
|
|
95
|
|
96 echo "Copying lisp/term."
|
|
97 # Don't distribute =*.el files.
|
|
98 (cd lisp/term
|
|
99 ln [a-zA-Z]*.el ../../${tempdir}/lisp/term
|
|
100 ln [a-zA-Z]*.elc ../../${tempdir}/lisp/term
|
|
101 ln README ../../${tempdir}/lisp/term)
|
|
102
|
|
103 echo "Copying src."
|
|
104 # Don't distribute =*.[ch] files, or the configured versions of
|
|
105 # config.h.in, paths.h.in, or Makefile.in.
|
|
106 (cd src
|
|
107 ln [a-zA-Z]*.c ../${tempdir}/src
|
|
108 ln [a-zA-Z]*.h ../${tempdir}/src
|
|
109 ln [a-zA-Z]*.s ../${tempdir}/src
|
|
110 ln README Makefile.in ymakefile ChangeLog config.h.in paths.h.in \
|
|
111 ../${tempdir}/src
|
|
112 ln .gdbinit .dbxinit ../${tempdir}/src
|
|
113 ln *.com *.opt vms-pp.trans vmsbuild ../${tempdir}/src
|
|
114 cd ../${tempdir}/src
|
|
115 etags *.h *.c ../lisp/*.el)
|
|
116
|
|
117 echo "Copying src/m."
|
|
118 (cd src/m
|
|
119 ln README *.h ../../${tempdir}/src/m)
|
|
120
|
|
121 echo "Copying src/s."
|
|
122 (cd src/s
|
|
123 ln README *.h ../../${tempdir}/src/s)
|
|
124
|
|
125 echo "Copying lib-src."
|
|
126 (cd lib-src
|
|
127 ln [a-zA-Z]*.c [a-zA-Z]*.h [a-zA-Z]*.y [a-zA-Z]*.lex ../${tempdir}/lib-src
|
|
128 ln ChangeLog Makefile.in README testfile ../${tempdir}/lib-src)
|
|
129
|
|
130 echo "Copying oldXMenu."
|
|
131 (cd oldXMenu
|
|
132 ln *.c *.h ../${tempdir}/oldXMenu
|
|
133 ln README Makefile Imakefile ChangeLog ../${tempdir}/oldXMenu)
|
|
134
|
|
135 echo "Copying etc."
|
|
136 # Don't distribute DOC files, backups, autosaves, or tex litter.
|
|
137 (cd etc
|
|
138 ln [0-9a-zA-Z]* ../${tempdir}/etc
|
|
139 cd ../${tempdir}/etc
|
|
140 # Avoid an error when expanding the wildcards later.
|
|
141 for dummy in DOC-dummy dummy~ \#dummy\# dummy.dvi dummy.log; do
|
|
142 ln MACHINES ${dummy}
|
|
143 done
|
|
144 rm -f DOC* *~ \#*\# *.dvi *.log core)
|
|
145
|
|
146 # For now, we comment these out, since I'm not changing them any.
|
|
147 #!! echo "Copying cpp."
|
|
148 #!! (cd cpp
|
|
149 #!! ln cccp.c cexp.y Makefile README ../${tempdir}/cpp)
|
|
150 #!!
|
|
151 #!! echo "Copying info."
|
|
152 #!! # Don't distribute backups or autosaves.
|
|
153 #!! (cd info
|
|
154 #!! ln [a-zA-Z]* ../${tempdir}/info
|
|
155 #!! cd ../${tempdir}/info
|
|
156 #!! # Avoid an error when expanding the wildcards later.
|
|
157 #!! ln emacs dummy~ ; ln emacs \#dummy\#
|
|
158 #!! rm -f *~ \#*\# core)
|
|
159 #!!
|
|
160 #!! echo "Copying man."
|
|
161 #!! (cd man
|
|
162 #!! ln *.tex *.texinfo *.texi *.aux *.cps *.fns *.kys *.vrs ../${tempdir}/man
|
|
163 #!! ln *.c ../${tempdir}/man
|
|
164 #!! ln ChangeLog Makefile README split-man ../${tempdir}/man)
|
|
165
|
|
166 echo "Copying shortnames."
|
|
167 (cd shortnames
|
|
168 ln *.c ../${tempdir}/shortnames
|
|
169 ln Makefile reserved special ../${tempdir}/shortnames)
|
|
170
|
|
171 echo "Making sure copying notices are symlinks."
|
|
172 if [ -f ${tempdir}/etc/COPYING ]; then
|
|
173 rm ${tempdir}/etc/COPYING
|
|
174 ln etc/COPYING ${tempdir}/etc/COPYING
|
|
175 fi
|
|
176 for subdir in lisp src lib-src info shortnames; do
|
|
177 if [ -f ${tempdir}/${subdir}/COPYING ]; then
|
|
178 rm ${tempdir}/${subdir}/COPYING
|
|
179 fi
|
|
180 ln -s ../etc/COPYING ${tempdir}/${subdir}
|
|
181 done
|
|
182
|
621
|
183 if [ "${make_tar}" = yes ]; then
|
|
184 echo "Creating tar file."
|
|
185 (cd ${tempparent}; tar cvf - ${emacsname}) | compress > ${emacsname}.tar.Z
|
|
186 fi
|
616
|
187
|
621
|
188 if [ "${clean_up}" = yes ]; then
|
616
|
189 echo "Cleaning up the staging directory."
|
|
190 rm -rf ${tempparent}
|
|
191 fi
|