2 ### make-dist: create an Emacs distribution tar file from current srcdir
4 ## Copyright (C) 1995, 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005,
5 ## 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
7 ## This file is part of GNU Emacs.
9 ## GNU Emacs is free software: you can redistribute it and/or modify
10 ## it under the terms of the GNU General Public License as published by
11 ## the Free Software Foundation, either version 3 of the License, or
12 ## (at your option) any later version.
14 ## GNU Emacs is distributed in the hope that it will be useful,
15 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ## GNU General Public License for more details.
19 ## You should have received a copy of the GNU General Public License
20 ## along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
24 ## This basically creates a duplicate directory structure, and then
25 ## hard links into it only those files that should be distributed.
26 ## This means that if you add a file with an odd name, you should make
27 ## sure that this script will include it.
33 ### Exit if a command fails.
36 ### Print out each line we read, for debugging's sake.
43 export LANGUAGE LC_ALL LC_MESSAGES LANG
45 ## 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 `compress' instead of gzip.
82 ## Normally, make-dist uses gzip whenever it is present.
84 default_gzip
="compress"
103 echo "Usage: ${progname} [options]"
105 echo " --bzip2 use bzip2 instead of gzip"
106 echo " --clean-up delete staging directories when done"
107 echo " --compress use compress instead of gzip"
108 echo " --lzma use lzma instead of gzip"
109 echo " --newer=TIME don't include files older than TIME"
110 echo " --no-check don't check for bad file names etc."
111 echo " --no-update don't recompile or do analogous things"
112 echo " --snapshot same as --clean-up --no-update --tar --no-check"
113 echo " --tar make a tar file"
119 echo "${progname}: Unrecognized argument: $1" >&2
126 ### Make sure we're running in the right place.
127 if [ ! -d src
-o ! -f src
/lisp.h
-o ! -d lisp
-o ! -f lisp
/subr.el
]; then
128 echo "${progname}: Can't find \`src/lisp.h' and \`lisp/subr.el'." >&2
129 echo "${progname} must be run in the top directory of the Emacs" >&2
130 echo "distribution tree. cd to that directory and try again." >&2
134 ### Find where to run Emacs.
135 ### (Accept only absolute file names.)
136 if [ $update = yes ];
141 EMACS
=`pwd`/src
/emacs
146 if [ ! -f "$EMACS" ]; then
147 echo "$0: You must set the EMACS environment variable " \
148 "to an absolute file name." 2>&1
155 ### Find out which version of Emacs this is.
156 version
=`sed -n '/char emacs_version/ s/^[^"]*"\([^"]*\)".*$/\1/p' src/emacs.c`
157 if [ ! "${version}" ]; then
158 echo "${progname}: can't find current Emacs version in \`./src/emacs.c'" >&2
162 echo Version number is
$version
164 if [ $update = yes ];
166 if grep -s "@set EMACSVER *${version}" .
/doc
/emacs
/emacsver.texi
> /dev
/null
; then
169 echo "You must update the version number in \`./doc/emacs/emacsver.texi'"
174 ### Make sure we don't already have a directory emacs-${version}.
176 emacsname
="emacs-${version}${new_extension}"
178 if [ -d ${emacsname} ]
180 echo Directory
"${emacsname}" already exists
>&2
184 ### Make sure the subdirectory is available.
185 tempparent
="make-dist.tmp.$$"
186 if [ -d ${tempparent} ]; then
187 echo "${progname}: staging directory \`${tempparent}' already exists.
188 Perhaps a previous invocation of \`${progname}' failed to clean up after
189 itself. Check that directories whose names are of the form
190 \`make-dist.tmp.NNNNN' don't contain any important information, remove
191 them, and try again." >&2
195 ### Find where to run Emacs.
198 ### Check for .elc files with no corresponding .el file.
199 ls -1 lisp
/[a-zA-Z
]*.el lisp
/[a-z
]*/[a-zA-Z0-9
]*.el \
200 lisp
/[a-z
]*/[a-z
]*/[a-zA-Z0-9
]*.el \
201 lisp
/[a-z
]*/[a-z
]*/[a-z
]*/[a-zA-Z0-9
]*.el \
202 leim
/[a-z
]*/[a-z
]*.el |
sed 's/\.el$/.elc/' > /tmp
/el
203 ls -1 lisp
/[a-zA-Z
]*.elc lisp
/[a-z
]*/[a-zA-Z0-9
]*.elc \
204 lisp
/[a-z
]*/[a-z
]*/[a-zA-Z0-9
]*.elc \
205 lisp
/[a-z
]*/[a-z
]*/[a-z
]*/[a-zA-Z0-9
]*.elc \
206 leim
/[a-z
]*/[a-z
]*.elc
> /tmp
/elc
207 bogosities
="`comm -13 /tmp/el /tmp/elc`"
208 if [ "${bogosities}" != "" ]; then
209 echo "The following .elc files have no corresponding .el files:"
212 rm -f /tmp
/el
/tmp
/elc
214 ### Check for .el files with no corresponding .elc file.
215 ls -1 lisp
/[a-zA-Z
]*.el lisp
/[a-z
]*/[a-zA-Z0-9
]*.el \
216 lisp
/[a-z
]*/[a-z
]*/[a-zA-Z0-9
]*.el \
217 lisp
/[a-z
]*/[a-z
]*/[a-z
]*/[a-zA-Z0-9
]*.el \
218 leim
/[a-z
]*/[a-z
]*.el
> /tmp
/el
219 ls -1 lisp
/[a-zA-Z
]*.elc lisp
/[a-z
]*/[a-zA-Z0-9
]*.elc \
220 lisp
/[a-z
]*/[a-z
]*/[a-zA-Z0-9
]*.el \
221 lisp
/[a-z
]*/[a-z
]*/[a-z
]*/[a-zA-Z0-9
]*.el \
222 leim
/[a-z
]*/[a-z
]*.elc |
sed 's/\.elc$/.el/' > /tmp
/elc
223 losers
="`comm -23 /tmp/el /tmp/elc`"
225 for file in $losers; do
226 if ! grep -q "no-byte-compile: t" $file; then
228 site-init.el | site-load.el | site-start.el | default.el
)
231 bogosities
="$file $bogosities"
236 if [ x
"${bogosities}" != x
"" ]; then
237 echo "The following .el files have no corresponding .elc files:"
240 rm -f /tmp
/el
/tmp
/elc
243 ### Make sure configure is newer than configure.in.
244 if [ "x`ls -t configure configure.in | sed q`" != "xconfigure" ]; then
245 echo "\`./configure.in' is newer than \`./configure'" >&2
246 echo "Running autoconf" >&2
247 autoconf ||
{ x
=$?
; echo Autoconf FAILED
! >&2; exit $x; }
250 ### Make sure src/stamp-h.in is newer than configure.in.
251 if [ "x`ls -t src/stamp-h.in configure.in | sed q`" != "xsrc/stamp-h.in" ]; then
252 echo "\`./configure.in' is newer than \`./src/stamp-h.in'" >&2
253 echo "Running autoheader" >&2
254 autoheader ||
{ x
=$?
; echo Autoheader FAILED
! >&2; exit $x; }
256 echo timestamp
> src
/stamp-h.
in
259 if [ $update = yes ];
261 echo "Updating Info files"
262 (cd doc
/emacs
; make info
)
263 (cd doc
/misc
; make info
)
264 (cd doc
/lispref
; make info
)
265 (cd doc
/lispintro
; make info
)
267 echo "Updating finder, custom and autoload data"
268 (cd lisp
; make updates EMACS
="$EMACS")
270 if test -f leim
/leim-list.el
; then
271 echo "Updating leim-list.el"
272 (cd leim
; make leim-list.el EMACS
="$EMACS")
275 echo "Recompiling Lisp files"
276 $EMACS -batch -f batch-byte-recompile-directory lisp leim
279 ## What is this file for? It goes in srcdir, not the tarfile.
280 ## Why does it exclude term/ ?
281 echo "Making lisp/MANIFEST"
283 files
=`find lisp -type f -name '*.el'`
284 for file in $files; do
286 */subdirs.el|
*/default.el|
*/loaddefs.el|
*/term
/*) continue ;;
288 sed -n 's/^;;; //p; q' $file
289 done |
sort > lisp
/MANIFEST
291 echo "Creating staging directory: \`${tempparent}'"
294 tempdir
="${tempparent}/${emacsname}"
296 ### This trap ensures that the staging directory will be cleaned up even
297 ### when the script is interrupted in mid-career.
298 if [ "${clean_up}" = yes ]; then
299 trap "echo 'Cleaning up the staging directory'; rm -rf ${tempparent}" EXIT
302 echo "Creating top directory: \`${tempdir}'"
305 ### We copy in the top-level files before creating the subdirectories in
306 ### hopes that this will make the top-level files appear first in the
307 ### tar file; this means that people can start reading the INSTALL and
308 ### README while the rest of the tar file is still unpacking. Whoopee.
309 echo "Making links to top-level files"
310 ln INSTALL README BUGS move-if-change
${tempdir}
311 ln ChangeLog Makefile.
in configure configure.
in ${tempdir}
312 ln config.bat make-dist update-subdirs vpath.
sed .dir-locals.el
${tempdir}
313 ln mkinstalldirs config.sub config.guess install-sh
${tempdir}
315 ## FIXME why do we bother doing this? set-version in admin/admin.el
316 ## does this, and more besides.
317 echo "Updating version number in README"
320 '$1 " " $2 " " $3 " " $4 " " $5 == "This directory tree holds version" { $6 = version; print $0 }
321 $1 " " $2 " " $3 " " $4 " " $5 != "This directory tree holds version"' \
322 version
=${version} README
> tmp.README
323 mv -f tmp.README README
)
326 echo "Creating subdirectories"
327 for subdir
in site-lisp \
328 leim leim
/CXTERM-DIC leim
/MISC-DIC \
329 leim
/SKK-DIC leim
/ja-dic leim
/quail \
330 src src
/m src
/s src
/bitmaps lib-src oldXMenu lwlib \
331 nt nt
/inc nt
/inc
/sys nt
/inc
/arpa nt
/inc
/netinet nt
/icons \
332 `find etc lisp -type d` \
333 doc
doc
/emacs
doc
/misc
doc
/man
doc
/lispref
doc
/lispintro \
335 nextstep nextstep
/Cocoa nextstep
/Cocoa
/Emacs.base \
336 nextstep
/Cocoa
/Emacs.base
/Contents \
337 nextstep
/Cocoa
/Emacs.base
/Contents
/Resources \
338 nextstep
/Cocoa
/Emacs.base
/Contents
/Resources
/English.lproj \
339 nextstep
/Cocoa
/Emacs.xcodeproj \
341 nextstep
/GNUstep
/Emacs.base \
342 nextstep
/GNUstep
/Emacs.base
/Resources
344 ## site-lisp for in-place installs (?).
345 [ "$subdir" = "site-lisp" ] ||
[ -d "$subdir" ] || \
346 echo "WARNING: $subdir not found, making anyway"
347 echo " ${tempdir}/${subdir}"
348 mkdir
${tempdir}/${subdir}
351 echo "Making links to \`lisp' and its subdirectories"
352 files
=`find lisp \( -name '*.el' -o -name '*.elc' -o -name 'ChangeLog*' \
353 -o -name 'README*' \)`
355 ### Don't distribute site-init.el, site-load.el, or default.el.
356 for file in lisp
/Makefile.
in lisp
/makefile.w32-in
$files; do
358 */site-init
*|
*/site-load
*|
*/default
*) continue ;;
360 ln $file $tempdir/$file
363 echo "Making links to \`leim' and its subdirectories"
365 ln makefile.w32-in ..
/${tempdir}/leim
366 ln ChangeLog README ..
/${tempdir}/leim
367 ln CXTERM-DIC
/README CXTERM-DIC
/*.tit ..
/${tempdir}/leim
/CXTERM-DIC
368 ln SKK-DIC
/README SKK-DIC
/SKK-JISYO.L ..
/${tempdir}/leim
/SKK-DIC
369 ln MISC-DIC
/README MISC-DIC
/*.
* ..
/${tempdir}/leim
/MISC-DIC
370 ln ja-dic
/*.el ja-dic
/*.elc ..
/${tempdir}/leim
/ja-dic
371 ln Makefile.
in ..
/${tempdir}/leim
/Makefile.
in
372 ln leim-ext.el ..
/${tempdir}/leim
/leim-ext.el
373 ## Lisp files that start with a capital (also 4Corner.el) are
374 ## generated from TIT dictionaries so we don't distribute them.
375 ln quail
/[a-z
]*.el quail
/[a-z
]*.elc ..
/${tempdir}/leim
/quail
376 rm -f ..
/${tempdir}/leim
/quail
/quick-b5.
*
377 rm -f ..
/${tempdir}/leim
/quail
/quick-cns.
*
378 rm -f ..
/${tempdir}/leim
/quail
/tsang-b5.
*
379 rm -f ..
/${tempdir}/leim
/quail
/tsang-cns.
*)
381 echo "Making links to \`src'"
382 ### Don't distribute the configured versions of
383 ### config.in, paths.in, buildobj.h, or Makefile.in.
385 echo " (It is ok if ln fails in some cases.)"
386 ln [a-zA-Z
]*.
[chm
] ..
/${tempdir}/src
387 ln [a-zA-Z
]*.
in ..
/${tempdir}/src
388 ln [a-zA-Z
]*.mk ..
/${tempdir}/src
389 ln README ChangeLog ChangeLog.
*[0-9] ..
/${tempdir}/src
390 ln makefile.w32-in ..
/${tempdir}/src
391 ln .gdbinit .dbxinit ..
/${tempdir}/src
393 rm -f config.h epaths.h Makefile buildobj.h
)
395 echo "Making links to \`src/bitmaps'"
397 ln README
*.xbm ..
/..
/${tempdir}/src
/bitmaps
)
399 echo "Making links to \`src/m'"
401 ln README
[a-zA-Z0-9
]*.h ..
/..
/${tempdir}/src
/m
)
403 echo "Making links to \`src/s'"
405 ln README
[a-zA-Z0-9
]*.h ..
/..
/${tempdir}/src
/s
)
407 echo "Making links to \`lib-src'"
409 ln [a-zA-Z
]*.
[ch
] ..
/${tempdir}/lib-src
410 ln ChangeLog Makefile.
in README testfile vcdiff ..
/${tempdir}/lib-src
411 ln grep-changelog rcs2log rcs-checkin ..
/${tempdir}/lib-src
412 ln makefile.w32-in ..
/${tempdir}/lib-src
413 cd ..
/${tempdir}/lib-src
416 echo "Making links to \`m4'"
418 ln *.
m4 ..
/${tempdir}/m4)
420 echo "Making links to \`nt'"
422 ln emacs.manifest emacs.rc emacsclient.rc config.nt ..
/${tempdir}/nt
423 ln emacs-src.tags nmake.defs gmake.defs subdirs.el ..
/${tempdir}/nt
424 ln [a-z
]*.bat
[a-z
]*.
[ch
] ..
/${tempdir}/nt
425 ln ChangeLog INSTALL README README.W32 makefile.w32-in ..
/${tempdir}/nt
)
427 echo "Making links to \`nt/inc'"
429 ln [a-z
]*.h ..
/..
/${tempdir}/nt
/inc
)
431 echo "Making links to \`nt/inc/sys'"
433 ln [a-z
]*.h ..
/..
/..
/${tempdir}/nt
/inc
/sys
)
435 echo "Making links to \`nt/inc/arpa'"
437 ln [a-z
]*.h ..
/..
/..
/${tempdir}/nt
/inc
/arpa
)
439 echo "Making links to \`nt/inc/netinet'"
441 ln [a-z
]*.h ..
/..
/..
/${tempdir}/nt
/inc
/netinet
)
443 echo "Making links to \`nt/icons'"
445 ln README
[a-z
]*.ico ..
/..
/${tempdir}/nt
/icons
446 ln [a-z
]*.cur ..
/..
/${tempdir}/nt
/icons
)
448 echo "Making links to \`msdos'"
450 ln ChangeLog INSTALL README emacs.ico emacs.pif ..
/${tempdir}/msdos
451 ln is_exec.c sigaction.c mainmake.v2
sed*.inp ..
/${tempdir}/msdos
)
453 echo "Making links to \`nextstep'"
455 ln AUTHORS ChangeLog README INSTALL ..
/${tempdir}/nextstep
)
457 echo "Making links to \`nextstep/Cocoa/Emacs.base/Contents'"
458 (cd nextstep
/Cocoa
/Emacs.base
/Contents
459 ln Info.plist PkgInfo ..
/..
/..
/..
/${tempdir}/nextstep
/Cocoa
/Emacs.base
/Contents
)
461 echo "Making links to \`nextstep/Cocoa/Emacs.base/Contents/Resources'"
462 (cd nextstep
/Cocoa
/Emacs.base
/Contents
/Resources
463 ln Credits.html
*.icns ..
/..
/..
/..
/..
/${tempdir}/nextstep
/Cocoa
/Emacs.base
/Contents
/Resources
)
465 echo "Making links to \`nextstep/Cocoa/Emacs.base/Contents/Resources/English.lproj'"
466 (cd nextstep
/Cocoa
/Emacs.base
/Contents
/Resources
/English.lproj
467 ln InfoPlist.
strings ..
/..
/..
/..
/..
/..
/${tempdir}/nextstep
/Cocoa
/Emacs.base
/Contents
/Resources
/English.lproj
)
469 echo "Making links to \`nextstep/Cocoa/Emacs.xcodeproj'"
470 (cd nextstep
/Cocoa
/Emacs.xcodeproj
471 ln project.pbxproj ..
/..
/..
/${tempdir}/nextstep
/Cocoa
/Emacs.xcodeproj
)
473 echo "Making links to \`nextstep/GNUstep/Emacs.base/Resources'"
474 (cd nextstep
/GNUstep
/Emacs.base
/Resources
475 ln Emacs.desktop Info-gnustep.plist README emacs.tiff ..
/..
/..
/..
/${tempdir}/nextstep
/GNUstep
/Emacs.base
/Resources
)
477 echo "Making links to \`oldXMenu'"
479 ln *.
[ch
] *.
in ..
/${tempdir}/oldXMenu
480 ln README ChangeLog ..
/${tempdir}/oldXMenu
)
482 echo "Making links to \`lwlib'"
484 ln *.
[ch
] *.
in ..
/${tempdir}/lwlib
485 ln README ChangeLog ..
/${tempdir}/lwlib
)
487 echo "Making links to \`etc' and its subdirectories"
488 for f
in `find etc -type f`; do
490 etc
/DOC
*) continue ;;
495 echo "Making links to \`info'"
497 ln `find . -type f -print` ..
/${tempdir}/info
)
499 echo "Making links to \`doc/emacs'"
501 ln *.texi
*.
in makefile.w32-in ChangeLog
* ..
/..
/${tempdir}/doc
/emacs
)
503 echo "Making links to \`doc/misc'"
505 ln *.texi
*.tex
*.
in makefile.w32-in gnus-news.el ChangeLog
* ..
/..
/${tempdir}/doc
/misc
)
507 echo "Making links to \`doc/lispref'"
509 ln *.texi
*.
in makefile.w32-in README ChangeLog
* ..
/..
/${tempdir}/doc
/lispref
510 ln *.txt
*.el spellfile tindex.pl ..
/..
/${tempdir}/doc
/lispref
511 ln two-volume.
make ..
/..
/${tempdir}/doc
/lispref
)
513 echo "Making links to \`doc/lispintro'"
515 ln *.texi
*.
in makefile.w32-in
*.eps
*.pdf ..
/..
/${tempdir}/doc
/lispintro
516 ln README ChangeLog
* ..
/..
/${tempdir}/doc
/lispintro
517 cd ..
/..
/${tempdir}/doc
/lispintro
)
519 echo "Making links to \`doc/man'"
521 ln ChangeLog
* *.1 ..
/..
/${tempdir}/doc
/man
522 cd ..
/..
/${tempdir}/doc
/man
)
524 ### It would be nice if they could all be symlinks to top-level copy, but
525 ### you're not supposed to have any symlinks in distribution tar files.
526 echo "Making sure copying notices are all copies of \`COPYING'"
527 for subdir
in . etc info leim lib-src lisp lwlib msdos nt src
; do
528 rm -f ${tempdir}/${subdir}/COPYING
529 cp COPYING
${tempdir}/${subdir}
532 if [ "${newer}" ]; then
533 echo "Removing files older than $newer"
534 ## We remove .elc files unconditionally, on the theory that anyone picking
535 ## up an incremental distribution already has a running Emacs to byte-compile
537 find ${tempparent} \( -name '*.elc' -o ! -newer ${newer} \) -exec rm -f {} \
;
540 ## Don't distribute backups, autosaves, etc.
541 echo "Removing unwanted files"
542 find ${tempparent} \
( -name '*~' -o -name '#*#' -o -name '.*ignore' -o -name '=*' -o -name 'TAGS' \
) -exec rm -f {} \
;
544 if [ "${make_tar}" = yes ]; then
545 if [ "${default_gzip}" = "" ]; then
546 echo "Looking for gzip"
547 temppath
=`echo $PATH | sed 's/^:/.:/
552 for dir in ${temppath}; do
553 if [ -f ${dir}/gzip ]; then echo 'gzip --best'; exit 0; fi
558 case "${default_gzip}" in
559 bzip2) gzip_extension
=.bz2
;;
560 compress* ) gzip_extension
=.Z
;;
561 lzma
) gzip_extension
=.lzma
;;
562 * ) gzip_extension
=.gz
;;
564 echo "Creating tar file"
565 (cd ${tempparent} ; tar cvf
- ${emacsname} ) \
567 > ${emacsname}.
tar${gzip_extension}
570 if [ "${clean_up}" != yes ]; then
571 (cd ${tempparent}; mv ${emacsname} ..
)
575 ### make-dist ends here