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.
55 while [ $# -gt 0 ]; do
57 ## This option tells make-dist to delete the staging directory
58 ## when done. It is useless to use this unless you make a tar file.
62 ## This option tells make-dist to make a tar file.
66 ## This option tells make-dist not to recompile or do analogous things.
70 ## This option says don't check for bad file names, etc.
74 ## This option tells make-dist to make the distribution normally, then
75 ## remove all files older than the given timestamp file. This is useful
76 ## for creating incremental or patch distributions.
82 ## This option tells make-dist to use `bzip2' instead of gzip.
99 echo "Usage: ${progname} [options]"
101 echo " --bzip2 use bzip2 instead of gzip"
102 echo " --clean-up delete staging directories when done"
103 echo " --lzma use lzma instead of gzip"
104 echo " --newer=TIME don't include files older than TIME"
105 echo " --no-check don't check for bad file names etc."
106 echo " --no-update don't recompile or do analogous things"
107 echo " --snapshot same as --clean-up --no-update --tar --no-check"
108 echo " --tar make a tar file"
114 echo "${progname}: Unrecognized argument: $1" >&2
121 ### Make sure we're running in the right place.
122 if [ ! -d src
-o ! -f src
/lisp.h
-o ! -d lisp
-o ! -f lisp
/subr.el
]; then
123 echo "${progname}: Can't find \`src/lisp.h' and \`lisp/subr.el'." >&2
124 echo "${progname} must be run in the top directory of the Emacs" >&2
125 echo "distribution tree. cd to that directory and try again." >&2
129 ### Find where to run Emacs.
130 ### (Accept only absolute file names.)
131 if [ $update = yes ];
135 EMACS
=`pwd`/src
/emacs
140 if [ ! -f "$EMACS" ]; then
141 echo "$0: You must set the EMACS environment variable " \
142 "to an absolute file name." 2>&1
149 ### Find out which version of Emacs this is.
150 version
=`sed -n '/char emacs_version/ s/^[^"]*"\([^"]*\)".*$/\1/p' src/emacs.c`
151 if [ ! "${version}" ]; then
152 echo "${progname}: can't find current Emacs version in \`./src/emacs.c'" >&2
156 echo Version number is
$version
158 if [ $update = yes ]; then
159 if ! grep -q "@set EMACSVER *${version}" doc
/emacs
/emacsver.texi || \
160 ! grep -q "tree holds version *${version}" README
; then
161 echo "WARNING: README and/or emacsver.texi have the wrong version number"
162 echo "Consider running M-x set-version from admin/admin.el"
167 ### Make sure we don't already have a directory emacs-${version}.
169 emacsname
="emacs-${version}${new_extension}"
171 if [ -d ${emacsname} ]
173 echo Directory
"${emacsname}" already exists
>&2
177 ### Make sure the subdirectory is available.
178 tempparent
="make-dist.tmp.$$"
179 if [ -d ${tempparent} ]; then
180 echo "${progname}: staging directory \`${tempparent}' already exists.
181 Perhaps a previous invocation of \`${progname}' failed to clean up after
182 itself. Check that directories whose names are of the form
183 \`make-dist.tmp.NNNNN' don't contain any important information, remove
184 them, and try again." >&2
188 if [ $check = yes ]; then
189 ls -1 lisp
/[a-zA-Z
]*.el lisp
/[a-z
]*/[a-zA-Z0-9
]*.el \
190 lisp
/[a-z
]*/[a-z
]*/[a-zA-Z0-9
]*.el \
191 lisp
/[a-z
]*/[a-z
]*/[a-z
]*/[a-zA-Z0-9
]*.el \
192 leim
/[a-z
]*/[a-z
]*.el
> /tmp
/el
194 ls -1 lisp
/[a-zA-Z
]*.elc lisp
/[a-z
]*/[a-zA-Z0-9
]*.elc \
195 lisp
/[a-z
]*/[a-z
]*/[a-zA-Z0-9
]*.elc \
196 lisp
/[a-z
]*/[a-z
]*/[a-z
]*/[a-zA-Z0-9
]*.elc \
197 leim
/[a-z
]*/[a-z
]*.elc
> /tmp
/elc
199 ## Check for .elc files with no corresponding .el file.
200 sed 's/\.el$/.elc/' /tmp
/el
> /tmp
/elelc
202 bogosities
="`comm -13 /tmp/elelc /tmp/elc`"
203 if [ x
"${bogosities}" != x
"" ]; then
204 echo "The following .elc files have no corresponding .el files:"
208 ### Check for .el files with no corresponding .elc file.
209 sed 's/\.elc$/.el/' /tmp
/elc
> /tmp
/elcel
210 losers
="`comm -23 /tmp/el /tmp/elcel`"
212 rm -f /tmp
/el
/tmp
/elc
/tmp
/elcel
/tmp
/elelc
215 for file in $losers; do
216 grep -q "no-byte-compile: t" $file && continue
218 site-init.el | site-load.el | site-start.el | default.el
) continue ;;
221 bogosities
="$file $bogosities"
224 if [ x
"${bogosities}" != x
"" ]; then
225 echo "The following .el files have no corresponding .elc files:"
230 if [ $update = yes ]; then
232 ## Make sure configure is newer than configure.in.
233 if [ "x`ls -t configure configure.in | sed q`" != "xconfigure" ]; then
234 echo "\`./configure.in' is newer than \`./configure'" >&2
235 echo "Running autoconf" >&2
236 autoconf ||
{ x
=$?
; echo Autoconf FAILED
! >&2; exit $x; }
239 ## Make sure src/stamp-h.in is newer than configure.in.
240 if [ "x`ls -t src/stamp-h.in configure.in | sed q`" != "xsrc/stamp-h.in" ]; then
241 echo "\`./configure.in' is newer than \`./src/stamp-h.in'" >&2
242 echo "Running autoheader" >&2
243 autoheader ||
{ x
=$?
; echo Autoheader FAILED
! >&2; exit $x; }
245 echo timestamp
> src
/stamp-h.
in
248 echo "Updating Info files"
249 (cd doc
/emacs
; make info
)
250 (cd doc
/misc
; make info
)
251 (cd doc
/lispref
; make info
)
252 (cd doc
/lispintro
; make info
)
254 echo "Updating finder, custom and autoload data"
255 (cd lisp
; make updates EMACS
="$EMACS")
257 if test -f leim
/leim-list.el
; then
258 echo "Updating leim-list.el"
259 (cd leim
; make leim-list.el EMACS
="$EMACS")
262 echo "Recompiling Lisp files"
263 $EMACS -batch -f batch-byte-recompile-directory lisp leim
266 echo "Creating staging directory: \`${tempparent}'"
269 tempdir
="${tempparent}/${emacsname}"
271 ### This trap ensures that the staging directory will be cleaned up even
272 ### when the script is interrupted in mid-career.
273 if [ "${clean_up}" = yes ]; then
274 trap "echo 'Cleaning up the staging directory'; rm -rf ${tempparent}" EXIT
277 echo "Creating top directory: \`${tempdir}'"
280 ### We copy in the top-level files before creating the subdirectories in
281 ### hopes that this will make the top-level files appear first in the
282 ### tar file; this means that people can start reading the INSTALL and
283 ### README while the rest of the tar file is still unpacking. Whoopee.
284 echo "Making links to top-level files"
285 ln INSTALL README BUGS move-if-change
${tempdir}
286 ln ChangeLog Makefile.
in configure configure.
in ${tempdir}
287 ln config.bat make-dist update-subdirs vpath.
sed .dir-locals.el
${tempdir}
288 ln mkinstalldirs config.sub config.guess install-sh
${tempdir}
289 ln aclocal.
m4 ${tempdir}
290 ln compile depcomp missing
${tempdir}
291 ln arg-nonnull.h c
++defs.h warn-on-use.h
${tempdir}
293 echo "Creating subdirectories"
294 for subdir
in site-lisp \
295 leim leim
/CXTERM-DIC leim
/MISC-DIC \
296 leim
/SKK-DIC leim
/ja-dic leim
/quail \
297 src src
/m src
/s src
/bitmaps lib lib-src oldXMenu lwlib \
298 nt nt
/inc nt
/inc
/sys nt
/inc
/arpa nt
/inc
/netinet nt
/icons \
299 `find etc lisp -type d` \
300 doc
doc
/emacs
doc
/misc
doc
/man
doc
/lispref
doc
/lispintro \
302 nextstep nextstep
/Cocoa nextstep
/Cocoa
/Emacs.base \
303 nextstep
/Cocoa
/Emacs.base
/Contents \
304 nextstep
/Cocoa
/Emacs.base
/Contents
/Resources \
305 nextstep
/Cocoa
/Emacs.base
/Contents
/Resources
/English.lproj \
306 nextstep
/Cocoa
/Emacs.xcodeproj \
308 nextstep
/GNUstep
/Emacs.base \
309 nextstep
/GNUstep
/Emacs.base
/Resources
311 ## site-lisp for in-place installs (?).
312 [ "$subdir" = "site-lisp" ] ||
[ -d "$subdir" ] || \
313 echo "WARNING: $subdir not found, making anyway"
314 echo " ${tempdir}/${subdir}"
315 mkdir
${tempdir}/${subdir}
318 echo "Making links to \`lisp' and its subdirectories"
319 files
=`find lisp \( -name '*.el' -o -name '*.elc' -o -name 'ChangeLog*' \
320 -o -name 'README*' \)`
322 ### Don't distribute site-init.el, site-load.el, or default.el.
323 for file in lisp
/Makefile.
in lisp
/makefile.w32-in
$files; do
325 */site-init
*|
*/site-load
*|
*/default
*) continue ;;
327 ln $file $tempdir/$file
330 echo "Making links to \`leim' and its subdirectories"
332 ln makefile.w32-in ..
/${tempdir}/leim
333 ln ChangeLog README ..
/${tempdir}/leim
334 ln CXTERM-DIC
/README CXTERM-DIC
/*.tit ..
/${tempdir}/leim
/CXTERM-DIC
335 ln SKK-DIC
/README SKK-DIC
/SKK-JISYO.L ..
/${tempdir}/leim
/SKK-DIC
336 ln MISC-DIC
/README MISC-DIC
/*.
* ..
/${tempdir}/leim
/MISC-DIC
337 ln ja-dic
/*.el ja-dic
/*.elc ..
/${tempdir}/leim
/ja-dic
338 ln Makefile.
in ..
/${tempdir}/leim
/Makefile.
in
339 ln leim-ext.el ..
/${tempdir}/leim
/leim-ext.el
340 ## Lisp files that start with a capital (also 4Corner.el) are
341 ## generated from TIT dictionaries so we don't distribute them.
342 ln quail
/[a-z
]*.el quail
/[a-z
]*.elc ..
/${tempdir}/leim
/quail
343 rm -f ..
/${tempdir}/leim
/quail
/quick-b5.
*
344 rm -f ..
/${tempdir}/leim
/quail
/quick-cns.
*
345 rm -f ..
/${tempdir}/leim
/quail
/tsang-b5.
*
346 rm -f ..
/${tempdir}/leim
/quail
/tsang-cns.
*)
348 echo "Making links to \`src'"
349 ### Don't distribute the configured versions of
350 ### config.in, paths.in, buildobj.h, or Makefile.in.
352 echo " (It is ok if ln fails in some cases.)"
353 ln [a-zA-Z
]*.
[chm
] ..
/${tempdir}/src
354 ln [a-zA-Z
]*.
in ..
/${tempdir}/src
355 ln [a-zA-Z
]*.mk ..
/${tempdir}/src
356 ln README ChangeLog ChangeLog.
*[0-9] ..
/${tempdir}/src
357 ln makefile.w32-in ..
/${tempdir}/src
358 ln .gdbinit .dbxinit ..
/${tempdir}/src
360 rm -f config.h epaths.h Makefile buildobj.h
)
362 echo "Making links to \`src/bitmaps'"
364 ln README
*.xbm ..
/..
/${tempdir}/src
/bitmaps
)
366 echo "Making links to \`src/m'"
368 ln README
[a-zA-Z0-9
]*.h ..
/..
/${tempdir}/src
/m
)
370 echo "Making links to \`src/s'"
372 ln README
[a-zA-Z0-9
]*.h ..
/..
/${tempdir}/src
/s
)
374 echo "Making links to \`lib'"
375 (build_aux_h
=`(ls *.h)`
377 ln [a-zA-Z
]*.
[ch
] ..
/${tempdir}/lib
378 ln gnulib.mk Makefile.am Makefile.
in ..
/${tempdir}/lib
380 rm -f `(echo "$build_aux_h"; ls *.in.h) | sed '/[*]/d; s/.in.h$/.h/'`)
382 echo "Making links to \`lib-src'"
384 ln [a-zA-Z
]*.
[ch
] ..
/${tempdir}/lib-src
385 ln ChangeLog Makefile.
in README testfile vcdiff ..
/${tempdir}/lib-src
386 ln grep-changelog rcs2log rcs-checkin ..
/${tempdir}/lib-src
387 ln makefile.w32-in ..
/${tempdir}/lib-src
)
389 echo "Making links to \`m4'"
391 ln *.
m4 ..
/${tempdir}/m4)
393 ## Exclude README.W32 because it is specific to pre-built binaries(?).
394 echo "Making links to \`nt'"
396 ln emacs.manifest emacs.rc emacsclient.rc config.nt ..
/${tempdir}/nt
397 ln emacs-src.tags nmake.defs gmake.defs subdirs.el ..
/${tempdir}/nt
398 ln [a-z
]*.bat
[a-z
]*.
[ch
] ..
/${tempdir}/nt
399 ln ChangeLog INSTALL README makefile.w32-in ..
/${tempdir}/nt
)
401 echo "Making links to \`nt/inc' and its subdirectories"
402 for f
in `find nt/inc -type f -name '[a-z]*.h'`; do
406 echo "Making links to \`nt/icons'"
408 ln README
[a-z
]*.ico ..
/..
/${tempdir}/nt
/icons
409 ln [a-z
]*.cur ..
/..
/${tempdir}/nt
/icons
)
411 echo "Making links to \`msdos'"
413 ln ChangeLog INSTALL README emacs.ico emacs.pif ..
/${tempdir}/msdos
414 ln is_exec.c sigaction.c mainmake.v2
sed*.inp ..
/${tempdir}/msdos
)
416 echo "Making links to \`nextstep'"
418 ln ChangeLog README INSTALL ..
/${tempdir}/nextstep
)
420 echo "Making links to \`nextstep/Cocoa/Emacs.base/Contents'"
421 (cd nextstep
/Cocoa
/Emacs.base
/Contents
422 ln Info.plist PkgInfo ..
/..
/..
/..
/${tempdir}/nextstep
/Cocoa
/Emacs.base
/Contents
)
424 echo "Making links to \`nextstep/Cocoa/Emacs.base/Contents/Resources'"
425 (cd nextstep
/Cocoa
/Emacs.base
/Contents
/Resources
426 ln Credits.html
*.icns ..
/..
/..
/..
/..
/${tempdir}/nextstep
/Cocoa
/Emacs.base
/Contents
/Resources
)
428 echo "Making links to \`nextstep/Cocoa/Emacs.base/Contents/Resources/English.lproj'"
429 (cd nextstep
/Cocoa
/Emacs.base
/Contents
/Resources
/English.lproj
430 ln InfoPlist.
strings ..
/..
/..
/..
/..
/..
/${tempdir}/nextstep
/Cocoa
/Emacs.base
/Contents
/Resources
/English.lproj
)
432 echo "Making links to \`nextstep/Cocoa/Emacs.xcodeproj'"
433 (cd nextstep
/Cocoa
/Emacs.xcodeproj
434 ln project.pbxproj ..
/..
/..
/${tempdir}/nextstep
/Cocoa
/Emacs.xcodeproj
)
436 echo "Making links to \`nextstep/GNUstep/Emacs.base/Resources'"
437 (cd nextstep
/GNUstep
/Emacs.base
/Resources
438 ln Emacs.desktop Info-gnustep.plist README emacs.tiff ..
/..
/..
/..
/${tempdir}/nextstep
/GNUstep
/Emacs.base
/Resources
)
440 echo "Making links to \`oldXMenu'"
442 ln *.
[ch
] *.
in ..
/${tempdir}/oldXMenu
443 ln README ChangeLog ..
/${tempdir}/oldXMenu
)
445 echo "Making links to \`lwlib'"
447 ln *.
[ch
] *.
in ..
/${tempdir}/lwlib
448 ln README ChangeLog ..
/${tempdir}/lwlib
)
450 echo "Making links to \`etc' and its subdirectories"
451 for f
in `find etc -type f`; do
453 etc
/DOC
*|etc
/*.pyc
) continue ;;
458 echo "Making links to \`info'"
459 ln `find info -type f -print` ${tempdir}/info
461 echo "Making links to \`doc/emacs'"
463 ln *.texi
*.
in makefile.w32-in ChangeLog
* ..
/..
/${tempdir}/doc
/emacs
)
465 echo "Making links to \`doc/misc'"
467 ln *.texi
*.tex
*.
in makefile.w32-in gnus-news.el ChangeLog
* ..
/..
/${tempdir}/doc
/misc
)
469 echo "Making links to \`doc/lispref'"
471 ln *.texi
*.
in makefile.w32-in README ChangeLog
* ..
/..
/${tempdir}/doc
/lispref
472 ln *.txt
*.el spellfile tindex.pl ..
/..
/${tempdir}/doc
/lispref
473 ln two-volume.
make ..
/..
/${tempdir}/doc
/lispref
)
475 echo "Making links to \`doc/lispintro'"
477 ln *.texi
*.
in makefile.w32-in
*.eps
*.pdf ..
/..
/${tempdir}/doc
/lispintro
478 ln README ChangeLog
* ..
/..
/${tempdir}/doc
/lispintro
479 cd ..
/..
/${tempdir}/doc
/lispintro
)
481 echo "Making links to \`doc/man'"
483 ln ChangeLog
* *.1 ..
/..
/${tempdir}/doc
/man
484 cd ..
/..
/${tempdir}/doc
/man
)
486 ### It would be nice if they could all be symlinks to top-level copy, but
487 ### you're not supposed to have any symlinks in distribution tar files.
488 echo "Making sure copying notices are all copies of \`COPYING'"
489 for subdir
in . etc info leim lib lib-src lisp lwlib msdos nt src
; do
490 rm -f ${tempdir}/${subdir}/COPYING
491 cp COPYING
${tempdir}/${subdir}
494 if [ "${newer}" ]; then
495 echo "Removing files older than $newer"
496 ## We remove .elc files unconditionally, on the theory that anyone picking
497 ## up an incremental distribution already has a running Emacs to byte-compile
499 find ${tempparent} \( -name '*.elc' -o ! -newer ${newer} \) -exec rm -f {} \
;
502 ## Don't distribute backups, autosaves, etc.
503 echo "Removing unwanted files"
504 find ${tempparent} \
( -name '*~' -o -name '#*#' -o -name '.*ignore' -o -name '=*' -o -name 'TAGS' \
) -exec rm -f {} \
;
506 if [ "${make_tar}" = yes ]; then
507 echo "Looking for $default_gzip"
509 temppath
=`echo $PATH | sed -e 's/^:/.:/' -e 's/::/:.:/g' -e 's/:$/:./' \
511 for dir
in ${temppath}; do
512 [ -x ${dir}/$default_gzip ] ||
continue
515 if [ "$found" = "0" ]; then
516 echo "WARNING: \`$default_gzip' not found, will not compress" >&2
519 case "${default_gzip}" in
520 bzip2) gzip_extension
=.bz2
;;
521 lzma
) gzip_extension
=.lzma
;;
522 gzip) gzip_extension
=.gz
; default_gzip
="gzip --best";;
523 *) gzip_extension
= ;;
525 echo "Creating tar file"
526 (cd ${tempparent} ; tar cvf
- ${emacsname} ) \
528 > ${emacsname}.
tar${gzip_extension}
531 if [ "${clean_up}" != yes ]; then
532 (cd ${tempparent}; mv ${emacsname} ..
)
536 ### make-dist ends here