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.
11 # Exit if a command fails.
14 # Print out each line we read, for debugging's sake.
19 while [ $# -gt 0 ]; do
25 echo "${progname}: Unrecognized argument: $1" >&2
32 # Make sure we're running in the right place.
33 if [ ! -d src
-o ! -f src
/lisp.h
-o ! -d lisp
-o ! -f lisp
/version.el
]; then
34 echo "${progname}: must run in the top directory of the Emacs" >&2
35 echo "distribution tree. Cd to that directory and try again." >&2
39 # Find out which version of Emacs this is.
40 version
=`grep 'defconst[ ]*emacs-version' lisp/version.el \
41 | sed -e 's/^.*"\([0-9]+\.[0-9]+\)\..*$/\1/'`
42 if [ ! "${version}" ]; then
43 echo "${progname}: can't find current emacs version in ./lisp/version.el." >&2
47 # Make sure the subdirectory is available.
48 tempparent
="make-dist.$$"
49 if [ -d ${tempparent} ]; then
50 echo "${progname}: staging directory ${tempparent} already exists.
51 Perhaps a previous invocation of ${progname} failed to clean up
52 after itself. Check that directories whose names are of the form
53 make-dist.NNNNN don't contain any important information, remove them,
58 echo "Creating staging directory: ${tempparent}"
60 emacsname
="emacs-${version}"
61 tempdir
="${tempparent}/${emacsname}"
63 echo "Creating top directory: ${tempdir}"
66 # We copy in the top-level files before creating the subdirectories in
67 # hopes that this will make the top-level files appear first in the
69 echo "Copying top-level files."
70 ln INSTALL PROBLEMS README
${tempdir}
71 ln ChangeLog Makefile.
in build-install.
in configure make-dist
${tempdir}
73 echo "Creating subdirectories."
74 for subdir
in lisp lisp
/term src src
/m src
/s lib-src oldXMenu \
75 etc lock local-lisp arch-lib cpp info man shortnames
; do
76 mkdir
${tempdir}/${subdir}
80 # Don't distribute =*.el files, site-init.el, or site-load.el.
82 ln [a-zA-Z
]*.el ..
/${tempdir}/lisp
83 ln [a-zA-Z
]*.elc ..
/${tempdir}/lisp
84 ln [a-zA-Z
]*.defns ..
/${tempdir}/lisp
85 ln ChangeLog README ..
/${tempdir}/lisp
87 rm -f site-init site-init.el site-init.elc
88 rm -f site-load site-load.el site-load.elc
)
90 echo "Copying lisp/term."
91 # Don't distribute =*.el files.
93 ln [a-zA-Z
]*.el ..
/..
/${tempdir}/lisp
/term
94 ln [a-zA-Z
]*.elc ..
/..
/${tempdir}/lisp
/term
95 ln README ..
/..
/${tempdir}/lisp
/term
)
98 # Don't distribute =*.[ch] files, or the configured versions of
99 # config.h.in, paths.h.in, or Makefile.in.
101 ln [a-zA-Z
]*.c ..
/${tempdir}/src
102 ln [a-zA-Z
]*.h ..
/${tempdir}/src
103 ln [a-zA-Z
]*.s ..
/${tempdir}/src
104 ln README Makefile.
in ymakefile ChangeLog config.h.
in paths.h.
in \
106 ln .gdbinit .dbxinit ..
/${tempdir}/src
107 ln *.com
*.opt vms-pp.trans vmsbuild ..
/${tempdir}/src
109 etags
*.h
*.c ..
/lisp
/*.el
)
111 echo "Copying src/m."
113 ln README
*.h ..
/..
/${tempdir}/src
/m
)
115 echo "Copying src/s."
117 ln README
*.h ..
/..
/${tempdir}/src
/s
)
119 echo "Copying lib-src."
121 ln [a-zA-Z
]*.c
[a-zA-Z
]*.h
[a-zA-Z
]*.y
[a-zA-Z
]*.
lex ..
/${tempdir}/lib-src
122 ln ChangeLog Makefile.
in README testfile ..
/${tempdir}/lib-src
)
124 echo "Copying oldXMenu."
126 ln *.c
*.h ..
/${tempdir}/oldXMenu
127 ln README Makefile Imakefile ChangeLog ..
/${tempdir}/oldXMenu
)
130 # Don't distribute DOC files, backups, autosaves, or tex litter.
132 ln [0-9a-zA-Z]* ..
/${tempdir}/etc
134 # Avoid an error when expanding the wildcards later.
135 for dummy
in DOC-dummy dummy~ \
#dummy\# dummy.dvi dummy.log; do
138 rm -f DOC
* *~ \
#*\# *.dvi *.log core)
140 # For now, we comment these out, since I'm not changing them any.
141 #!! echo "Copying cpp."
143 #!! ln cccp.c cexp.y Makefile README ../${tempdir}/cpp)
145 #!! echo "Copying info."
146 #!! # Don't distribute backups or autosaves.
148 #!! ln [a-zA-Z]* ../${tempdir}/info
149 #!! cd ../${tempdir}/info
150 #!! # Avoid an error when expanding the wildcards later.
151 #!! ln emacs dummy~ ; ln emacs \#dummy\#
152 #!! rm -f *~ \#*\# core)
154 #!! echo "Copying man."
156 #!! ln *.tex *.texinfo *.texi *.aux *.cps *.fns *.kys *.vrs ../${tempdir}/man
157 #!! ln *.c ../${tempdir}/man
158 #!! ln ChangeLog Makefile README split-man ../${tempdir}/man)
160 echo "Copying shortnames."
162 ln *.c ..
/${tempdir}/shortnames
163 ln Makefile reserved special ..
/${tempdir}/shortnames
)
165 echo "Making sure copying notices are symlinks."
166 if [ -f ${tempdir}/etc
/COPYING
]; then
167 rm ${tempdir}/etc
/COPYING
168 ln etc
/COPYING
${tempdir}/etc
/COPYING
170 for subdir
in lisp src lib-src info shortnames
; do
171 if [ -f ${tempdir}/${subdir}/COPYING
]; then
172 rm ${tempdir}/${subdir}/COPYING
174 ln -s ..
/etc
/COPYING
${tempdir}/${subdir}
177 echo "Creating tar file."
178 (cd ${tempparent}; tar cvf - ${emacsname}) | compress > ${emacsname}.
tar.Z
180 if [ "${cleanup}" = yes ]; then
181 echo "Cleaning up the staging directory."