2 ### make-dist: create an Emacs distribution tar file from current srcdir
4 ## Copyright (C) 1995, 1997-1998, 2000-2011 Free Software Foundation, Inc.
6 ## This file is part of GNU Emacs.
8 ## GNU Emacs is free software: you can redistribute it and/or modify
9 ## it under the terms of the GNU General Public License as published by
10 ## the Free Software Foundation, either version 3 of the License, or
11 ## (at your option) any later version.
13 ## GNU Emacs is distributed in the hope that it will be useful,
14 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ## GNU General Public License for more details.
18 ## You should have received a copy of the GNU General Public License
19 ## along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
23 ## This basically creates a duplicate directory structure, and then
24 ## hard links into it only those files that should be distributed.
25 ## This means that if you add a file with an odd name, you should make
26 ## sure that this script will include it.
32 ### Exit if a command fails.
35 ### Print out each line we read, for debugging's sake.
42 export LANGUAGE LC_ALL LC_MESSAGES LANG
44 ## Don't restrict access to any files.
54 while [ $# -gt 0 ]; do
56 ## This option tells make-dist to delete the staging directory
57 ## when done. It is useless to use this unless you make a tar file.
61 ## This option tells make-dist to make a tar file.
65 ## This option tells make-dist not to recompile or do analogous things.
69 ## This option says don't check for bad file names, etc.
73 ## This option tells make-dist to make the distribution normally, then
74 ## remove all files older than the given timestamp file. This is useful
75 ## for creating incremental or patch distributions.
81 ## This option tells make-dist to use `bzip2' instead of gzip.
98 echo "Usage: ${progname} [options]"
100 echo " --bzip2 use bzip2 instead of gzip"
101 echo " --clean-up delete staging directories when done"
102 echo " --lzma use lzma instead of gzip"
103 echo " --newer=TIME don't include files older than TIME"
104 echo " --no-check don't check for bad file names etc."
105 echo " --no-update don't recompile or do analogous things"
106 echo " --snapshot same as --clean-up --no-update --tar --no-check"
107 echo " --tar make a tar file"
113 echo "${progname}: Unrecognized argument: $1" >&2
120 ### Make sure we're running in the right place.
121 if [ ! -d src
-o ! -f src
/lisp.h
-o ! -d lisp
-o ! -f lisp
/subr.el
]; then
122 echo "${progname}: Can't find \`src/lisp.h' and \`lisp/subr.el'." >&2
123 echo "${progname} must be run in the top directory of the Emacs" >&2
124 echo "distribution tree. cd to that directory and try again." >&2
128 ### Find where to run Emacs.
129 ### (Accept only absolute file names.)
130 if [ $update = yes ];
134 EMACS
=`pwd`/src
/emacs
139 if [ ! -f "$EMACS" ]; then
140 echo "$0: You must set the EMACS environment variable " \
141 "to an absolute file name." 2>&1
148 ### Find out which version of Emacs this is.
150 sed -n 's/^AC_INIT(emacs,[ ]*\([^ )]*\).*/\1/p' <configure.in
152 if [ ! "${version}" ]; then
153 echo "${progname}: can't find current Emacs version in \`./src/emacs.c'" >&2
157 echo Version number is
$version
159 if [ $update = yes ]; then
160 if ! grep -q "@set EMACSVER *${version}" doc
/emacs
/emacsver.texi || \
161 ! grep -q "tree holds version *${version}" README
; then
162 echo "WARNING: README and/or emacsver.texi have the wrong version number"
163 echo "Consider running M-x set-version from admin/admin.el"
168 ### Make sure we don't already have a directory emacs-${version}.
170 emacsname
="emacs-${version}${new_extension}"
172 if [ -d ${emacsname} ]
174 echo Directory
"${emacsname}" already exists
>&2
178 ### Make sure the subdirectory is available.
179 tempparent
="make-dist.tmp.$$"
180 if [ -d ${tempparent} ]; then
181 echo "${progname}: staging directory \`${tempparent}' already exists.
182 Perhaps a previous invocation of \`${progname}' failed to clean up after
183 itself. Check that directories whose names are of the form
184 \`make-dist.tmp.NNNNN' don't contain any important information, remove
185 them, and try again." >&2
189 if [ $check = yes ]; then
190 ls -1 lisp
/[a-zA-Z
]*.el lisp
/[a-z
]*/[a-zA-Z0-9
]*.el \
191 lisp
/[a-z
]*/[a-z
]*/[a-zA-Z0-9
]*.el \
192 lisp
/[a-z
]*/[a-z
]*/[a-z
]*/[a-zA-Z0-9
]*.el \
193 leim
/[a-z
]*/[a-z
]*.el
> /tmp
/el
195 ls -1 lisp
/[a-zA-Z
]*.elc lisp
/[a-z
]*/[a-zA-Z0-9
]*.elc \
196 lisp
/[a-z
]*/[a-z
]*/[a-zA-Z0-9
]*.elc \
197 lisp
/[a-z
]*/[a-z
]*/[a-z
]*/[a-zA-Z0-9
]*.elc \
198 leim
/[a-z
]*/[a-z
]*.elc
> /tmp
/elc
200 ## Check for .elc files with no corresponding .el file.
201 sed 's/\.el$/.elc/' /tmp
/el
> /tmp
/elelc
203 bogosities
="`comm -13 /tmp/elelc /tmp/elc`"
204 if [ x
"${bogosities}" != x
"" ]; then
205 echo "The following .elc files have no corresponding .el files:"
209 ### Check for .el files with no corresponding .elc file.
210 sed 's/\.elc$/.el/' /tmp
/elc
> /tmp
/elcel
211 losers
="`comm -23 /tmp/el /tmp/elcel`"
213 rm -f /tmp
/el
/tmp
/elc
/tmp
/elcel
/tmp
/elelc
216 for file in $losers; do
217 grep -q "no-byte-compile: t" $file && continue
219 site-init.el | site-load.el | site-start.el | default.el
) continue ;;
222 bogosities
="$file $bogosities"
225 if [ x
"${bogosities}" != x
"" ]; then
226 echo "The following .el files have no corresponding .elc files:"
231 if [ $update = yes ]; then
233 ## Make sure configure is newer than configure.in.
234 if [ "x`ls -t configure configure.in | sed q`" != "xconfigure" ]; then
235 echo "\`./configure.in' is newer than \`./configure'" >&2
236 echo "Running autoconf" >&2
237 autoconf ||
{ x
=$?
; echo Autoconf FAILED
! >&2; exit $x; }
240 ## Make sure src/stamp-h.in is newer than configure.in.
241 if [ "x`ls -t src/stamp-h.in configure.in | sed q`" != "xsrc/stamp-h.in" ]; then
242 echo "\`./configure.in' is newer than \`./src/stamp-h.in'" >&2
243 echo "Running autoheader" >&2
244 autoheader ||
{ x
=$?
; echo Autoheader FAILED
! >&2; exit $x; }
246 echo timestamp
> src
/stamp-h.
in
249 echo "Updating Info files"
250 (cd doc
/emacs
; make info
)
251 (cd doc
/misc
; make info
)
252 (cd doc
/lispref
; make info
)
253 (cd doc
/lispintro
; make info
)
255 echo "Updating finder, custom and autoload data"
256 (cd lisp
; make updates EMACS
="$EMACS")
258 if test -f leim
/leim-list.el
; then
259 echo "Updating leim-list.el"
260 (cd leim
; make leim-list.el EMACS
="$EMACS")
263 echo "Recompiling Lisp files"
264 $EMACS -batch -f batch-byte-recompile-directory lisp leim
267 echo "Creating staging directory: \`${tempparent}'"
270 tempdir
="${tempparent}/${emacsname}"
272 ### This trap ensures that the staging directory will be cleaned up even
273 ### when the script is interrupted in mid-career.
274 if [ "${clean_up}" = yes ]; then
275 trap "echo 'Cleaning up the staging directory'; rm -rf ${tempparent}" EXIT
278 echo "Creating top directory: \`${tempdir}'"
281 ### We copy in the top-level files before creating the subdirectories in
282 ### hopes that this will make the top-level files appear first in the
283 ### tar file; this means that people can start reading the INSTALL and
284 ### README while the rest of the tar file is still unpacking. Whoopee.
285 echo "Making links to top-level files"
286 ln INSTALL README BUGS move-if-change
${tempdir}
287 ln ChangeLog Makefile.
in configure configure.
in ${tempdir}
288 ln config.bat make-dist update-subdirs vpath.
sed .dir-locals.el
${tempdir}
289 ln mkinstalldirs config.sub config.guess install-sh
${tempdir}
290 ln aclocal.
m4 ${tempdir}
291 ln compile depcomp missing
${tempdir}
292 ln arg-nonnull.h c
++defs.h warn-on-use.h
${tempdir}
294 echo "Creating subdirectories"
295 for subdir
in site-lisp \
296 leim leim
/CXTERM-DIC leim
/MISC-DIC \
297 leim
/SKK-DIC leim
/ja-dic leim
/quail \
298 src src
/m src
/s src
/bitmaps lib lib-src oldXMenu lwlib \
299 nt nt
/inc nt
/inc
/sys nt
/inc
/arpa nt
/inc
/netinet nt
/icons \
300 `find etc lisp -type d` \
301 doc
doc
/emacs
doc
/misc
doc
/man
doc
/lispref
doc
/lispintro \
302 test test
/automated test
/cedet test
/cedet
/tests test
/indent \
304 nextstep nextstep
/Cocoa nextstep
/Cocoa
/Emacs.base \
305 nextstep
/Cocoa
/Emacs.base
/Contents \
306 nextstep
/Cocoa
/Emacs.base
/Contents
/Resources \
307 nextstep
/Cocoa
/Emacs.base
/Contents
/Resources
/English.lproj \
308 nextstep
/Cocoa
/Emacs.xcodeproj \
310 nextstep
/GNUstep
/Emacs.base \
311 nextstep
/GNUstep
/Emacs.base
/Resources
313 ## site-lisp for in-place installs (?).
314 [ "$subdir" = "site-lisp" ] ||
[ -d "$subdir" ] || \
315 echo "WARNING: $subdir not found, making anyway"
316 echo " ${tempdir}/${subdir}"
317 mkdir
${tempdir}/${subdir}
320 echo "Making links to \`lisp' and its subdirectories"
321 files
=`find lisp \( -name '*.el' -o -name '*.elc' -o -name 'ChangeLog*' \
322 -o -name 'README*' \)`
324 ### Don't distribute site-init.el, site-load.el, or default.el.
325 for file in lisp
/Makefile.
in lisp
/makefile.w32-in
$files; do
327 */site-init
*|
*/site-load
*|
*/default
*) continue ;;
329 ln $file $tempdir/$file
332 echo "Making links to \`leim' and its subdirectories"
334 ln makefile.w32-in ..
/${tempdir}/leim
335 ln ChangeLog README ..
/${tempdir}/leim
336 ln CXTERM-DIC
/README CXTERM-DIC
/*.tit ..
/${tempdir}/leim
/CXTERM-DIC
337 ln SKK-DIC
/README SKK-DIC
/SKK-JISYO.L ..
/${tempdir}/leim
/SKK-DIC
338 ln MISC-DIC
/README MISC-DIC
/*.
* ..
/${tempdir}/leim
/MISC-DIC
339 ln ja-dic
/*.el ja-dic
/*.elc ..
/${tempdir}/leim
/ja-dic
340 ln Makefile.
in ..
/${tempdir}/leim
/Makefile.
in
341 ln leim-ext.el ..
/${tempdir}/leim
/leim-ext.el
342 ## Lisp files that start with a capital (also 4Corner.el) are
343 ## generated from TIT dictionaries so we don't distribute them.
344 ln quail
/[a-z
]*.el quail
/[a-z
]*.elc ..
/${tempdir}/leim
/quail
345 rm -f ..
/${tempdir}/leim
/quail
/quick-b5.
*
346 rm -f ..
/${tempdir}/leim
/quail
/quick-cns.
*
347 rm -f ..
/${tempdir}/leim
/quail
/tsang-b5.
*
348 rm -f ..
/${tempdir}/leim
/quail
/tsang-cns.
*)
350 echo "Making links to \`src'"
351 ### Don't distribute the configured versions of
352 ### config.in, paths.in, buildobj.h, or Makefile.in.
354 echo " (It is ok if ln fails in some cases.)"
355 ln [a-zA-Z
]*.
[chm
] ..
/${tempdir}/src
356 ln [a-zA-Z
]*.
in ..
/${tempdir}/src
357 ln [a-zA-Z
]*.mk ..
/${tempdir}/src
358 ln README ChangeLog ChangeLog.
*[0-9] ..
/${tempdir}/src
359 ln makefile.w32-in ..
/${tempdir}/src
360 ln .gdbinit .dbxinit ..
/${tempdir}/src
362 rm -f globals.h config.h epaths.h Makefile buildobj.h
)
364 echo "Making links to \`src/bitmaps'"
366 ln README
*.xbm ..
/..
/${tempdir}/src
/bitmaps
)
368 echo "Making links to \`src/m'"
370 ln README
[a-zA-Z0-9
]*.h ..
/..
/${tempdir}/src
/m
)
372 echo "Making links to \`src/s'"
374 ln README
[a-zA-Z0-9
]*.h ..
/..
/${tempdir}/src
/s
)
376 echo "Making links to \`lib'"
377 (build_aux_h
=`(ls *.h)`
379 ln [a-zA-Z
]*.
[ch
] ..
/${tempdir}/lib
380 ln gnulib.mk Makefile.am Makefile.
in ..
/${tempdir}/lib
382 rm -f `(echo "$build_aux_h"; ls *.in.h) | sed '/[*]/d; s/.in.h$/.h/'`)
384 echo "Making links to \`lib-src'"
386 ln [a-zA-Z
]*.
[ch
] ..
/${tempdir}/lib-src
387 ln ChangeLog Makefile.
in README testfile vcdiff ..
/${tempdir}/lib-src
388 ln grep-changelog rcs2log rcs-checkin ..
/${tempdir}/lib-src
389 ln makefile.w32-in ..
/${tempdir}/lib-src
)
391 echo "Making links to \`m4'"
393 ln *.
m4 ..
/${tempdir}/m4)
395 ## Exclude README.W32 because it is specific to pre-built binaries(?).
396 echo "Making links to \`nt'"
398 ln emacs.manifest emacs.rc emacsclient.rc config.nt ..
/${tempdir}/nt
399 ln emacs-src.tags nmake.defs gmake.defs subdirs.el ..
/${tempdir}/nt
400 ln [a-z
]*.bat
[a-z
]*.
[ch
] ..
/${tempdir}/nt
401 ln ChangeLog INSTALL README makefile.w32-in ..
/${tempdir}/nt
)
403 echo "Making links to \`nt/inc' and its subdirectories"
404 for f
in `find nt/inc -type f -name '[a-z]*.h'`; do
408 echo "Making links to \`nt/icons'"
410 ln README
[a-z
]*.ico ..
/..
/${tempdir}/nt
/icons
411 ln [a-z
]*.cur ..
/..
/${tempdir}/nt
/icons
)
413 echo "Making links to \`msdos'"
415 ln ChangeLog INSTALL README emacs.ico emacs.pif ..
/${tempdir}/msdos
416 ln is_exec.c sigaction.c mainmake.v2
sed*.inp ..
/${tempdir}/msdos
)
418 echo "Making links to \`nextstep'"
420 ln ChangeLog README INSTALL ..
/${tempdir}/nextstep
)
422 echo "Making links to \`nextstep/Cocoa/Emacs.base/Contents'"
423 (cd nextstep
/Cocoa
/Emacs.base
/Contents
424 ln Info.plist PkgInfo ..
/..
/..
/..
/${tempdir}/nextstep
/Cocoa
/Emacs.base
/Contents
)
426 echo "Making links to \`nextstep/Cocoa/Emacs.base/Contents/Resources'"
427 (cd nextstep
/Cocoa
/Emacs.base
/Contents
/Resources
428 ln Credits.html
*.icns ..
/..
/..
/..
/..
/${tempdir}/nextstep
/Cocoa
/Emacs.base
/Contents
/Resources
)
430 echo "Making links to \`nextstep/Cocoa/Emacs.base/Contents/Resources/English.lproj'"
431 (cd nextstep
/Cocoa
/Emacs.base
/Contents
/Resources
/English.lproj
432 ln InfoPlist.
strings ..
/..
/..
/..
/..
/..
/${tempdir}/nextstep
/Cocoa
/Emacs.base
/Contents
/Resources
/English.lproj
)
434 echo "Making links to \`nextstep/Cocoa/Emacs.xcodeproj'"
435 (cd nextstep
/Cocoa
/Emacs.xcodeproj
436 ln project.pbxproj ..
/..
/..
/${tempdir}/nextstep
/Cocoa
/Emacs.xcodeproj
)
438 echo "Making links to \`nextstep/GNUstep/Emacs.base/Resources'"
439 (cd nextstep
/GNUstep
/Emacs.base
/Resources
440 ln Emacs.desktop Info-gnustep.plist README emacs.tiff ..
/..
/..
/..
/${tempdir}/nextstep
/GNUstep
/Emacs.base
/Resources
)
442 echo "Making links to \`oldXMenu'"
444 ln *.
[ch
] *.
in ..
/${tempdir}/oldXMenu
445 ln README ChangeLog ..
/${tempdir}/oldXMenu
)
447 echo "Making links to \`lwlib'"
449 ln *.
[ch
] *.
in ..
/${tempdir}/lwlib
450 ln README ChangeLog ..
/${tempdir}/lwlib
)
452 echo "Making links to \`etc' and its subdirectories"
453 for f
in `find etc -type f`; do
455 etc
/DOC
*|etc
/*.pyc
) continue ;;
460 echo "Making links to \`info'"
461 ln `find info -type f -print` ${tempdir}/info
463 echo "Making links to \`doc/emacs'"
465 ln *.texi
*.
in makefile.w32-in ChangeLog
* ..
/..
/${tempdir}/doc
/emacs
)
467 echo "Making links to \`doc/misc'"
469 ln *.texi
*.tex
*.
in makefile.w32-in gnus-news.el ChangeLog
* ..
/..
/${tempdir}/doc
/misc
)
471 echo "Making links to \`doc/lispref'"
473 ln *.texi
*.
in makefile.w32-in README ChangeLog
* ..
/..
/${tempdir}/doc
/lispref
474 ln *.txt
*.el spellfile tindex.pl ..
/..
/${tempdir}/doc
/lispref
475 ln two-volume.
make ..
/..
/${tempdir}/doc
/lispref
)
477 echo "Making links to \`doc/lispintro'"
479 ln *.texi
*.
in makefile.w32-in
*.eps
*.pdf ..
/..
/${tempdir}/doc
/lispintro
480 ln README ChangeLog
* ..
/..
/${tempdir}/doc
/lispintro
481 cd ..
/..
/${tempdir}/doc
/lispintro
)
483 echo "Making links to \`doc/man'"
485 ln ChangeLog
* *.1 ..
/..
/${tempdir}/doc
/man
486 cd ..
/..
/${tempdir}/doc
/man
)
488 echo "Making links to \`test'"
490 ln *.el ChangeLog README ..
/${tempdir}/test)
492 echo "Making links to \`test/automated'"
494 ln *.el Makefile.
in ..
/..
/${tempdir}/test
/automated
)
496 echo "Making links to \`test/cedet'"
498 ln *.el ..
/..
/${tempdir}/test
/cedet
)
500 echo "Making links to \`test/cedet/tests'"
502 ln *.c
*.
[ch
]pp
*.el
*.hh
*.java
*.
make ..
/..
/..
/${tempdir}/test
/cedet
/tests
)
504 echo "Making links to \`test/indent'"
506 ln *.m
*.mod
*.prolog Makefile ..
/..
/${tempdir}/test
/indent
)
508 ### It would be nice if they could all be symlinks to top-level copy, but
509 ### you're not supposed to have any symlinks in distribution tar files.
510 echo "Making sure copying notices are all copies of \`COPYING'"
511 for subdir
in . etc info leim lib lib-src lisp lwlib msdos nt src
; do
512 rm -f ${tempdir}/${subdir}/COPYING
513 cp COPYING
${tempdir}/${subdir}
516 if [ "${newer}" ]; then
517 echo "Removing files older than $newer"
518 ## We remove .elc files unconditionally, on the theory that anyone picking
519 ## up an incremental distribution already has a running Emacs to byte-compile
521 find ${tempparent} \( -name '*.elc' -o ! -newer ${newer} \) -exec rm -f {} \
;
524 ## Don't distribute backups, autosaves, etc.
525 echo "Removing unwanted files"
526 find ${tempparent} \
( -name '*~' -o -name '#*#' -o -name '.*ignore' -o -name '=*' -o -name 'TAGS' \
) -exec rm -f {} \
;
528 if [ "${make_tar}" = yes ]; then
529 echo "Looking for $default_gzip"
531 temppath
=`echo $PATH | sed -e 's/^:/.:/' -e 's/::/:.:/g' -e 's/:$/:./' \
533 for dir
in ${temppath}; do
534 [ -x ${dir}/$default_gzip ] ||
continue
537 if [ "$found" = "0" ]; then
538 echo "WARNING: \`$default_gzip' not found, will not compress" >&2
541 case "${default_gzip}" in
542 bzip2) gzip_extension
=.bz2
;;
543 lzma
) gzip_extension
=.lzma
;;
544 gzip) gzip_extension
=.gz
; default_gzip
="gzip --best";;
545 *) gzip_extension
= ;;
547 echo "Creating tar file"
548 (cd ${tempparent} ; tar cvf
- ${emacsname} ) \
550 > ${emacsname}.
tar${gzip_extension}
553 if [ "${clean_up}" != yes ]; then
554 (cd ${tempparent}; mv ${emacsname} ..
)
558 ### make-dist ends here