2 ### make-dist: create an Emacs distribution tar file from current srcdir
4 ## Copyright (C) 1995, 1997-1998, 2000-2013 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.
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.
105 ## Include the test/ directory.
106 ## This option is mainly for the hydra build server.
112 echo "Usage: ${progname} [options]"
114 echo " --bzip2 use bzip2 instead of gzip"
115 echo " --clean-up delete staging directories when done"
116 echo " --lzma use lzma instead of gzip"
117 echo " --xz use xz instead of gzip"
118 echo " --no-compress don't compress"
119 echo " --newer=TIME don't include files older than TIME"
120 echo " --no-check don't check for bad file names etc."
121 echo " --no-update don't recompile or do analogous things"
122 echo " --snapshot same as --clean-up --no-update --tar --no-check"
123 echo " --tar make a tar file"
124 echo " --tests include the test/ directory"
130 echo "${progname}: Unrecognized argument: $1" >&2
137 ### Make sure we're running in the right place.
138 if [ ! -d src
-o ! -f src
/lisp.h
-o ! -d lisp
-o ! -f lisp
/subr.el
]; then
139 echo "${progname}: Can't find \`src/lisp.h' and \`lisp/subr.el'." >&2
140 echo "${progname} must be run in the top directory of the Emacs" >&2
141 echo "distribution tree. cd to that directory and try again." >&2
145 ### Find where to run Emacs.
146 ### (Accept only absolute file names.)
147 if [ $update = yes ];
151 EMACS
=`pwd`/src
/emacs
156 if [ ! -f "$EMACS" ]; then
157 echo "$0: You must set the EMACS environment variable " \
158 "to an absolute file name." 2>&1
165 ### Find out which version of Emacs this is.
167 sed -n 's/^AC_INIT(emacs,[ ]*\([^ )]*\).*/\1/p' <configure.ac
169 if [ ! "${version}" ]; then
170 echo "${progname}: can't find current Emacs version in \`./src/emacs.c'" >&2
174 echo Version number is
$version
176 if [ $update = yes ]; then
177 if ! grep -q "@set EMACSVER *${version}" doc
/emacs
/emacsver.texi || \
178 ! grep -q "tree holds version *${version}" README
; then
179 echo "WARNING: README and/or emacsver.texi have the wrong version number"
180 echo "Consider running M-x set-version from admin/admin.el"
185 ### Make sure we don't already have a directory emacs-${version}.
187 emacsname
="emacs-${version}${new_extension}"
189 if [ -d ${emacsname} ]
191 echo Directory
"${emacsname}" already exists
>&2
195 ### Make sure the subdirectory is available.
196 tempparent
="make-dist.tmp.$$"
197 if [ -d ${tempparent} ]; then
198 echo "${progname}: staging directory \`${tempparent}' already exists.
199 Perhaps a previous invocation of \`${progname}' failed to clean up after
200 itself. Check that directories whose names are of the form
201 \`make-dist.tmp.NNNNN' don't contain any important information, remove
202 them, and try again." >&2
206 if [ $check = yes ]; then
207 ls -1 lisp
/[a-zA-Z
]*.el lisp
/[a-z
]*/[a-zA-Z0-9
]*.el \
208 lisp
/[a-z
]*/[a-z
]*/[a-zA-Z0-9
]*.el \
209 lisp
/[a-z
]*/[a-z
]*/[a-z
]*/[a-zA-Z0-9
]*.el \
210 leim
/[a-z
]*/[a-z
]*.el
> /tmp
/el
212 ls -1 lisp
/[a-zA-Z
]*.elc lisp
/[a-z
]*/[a-zA-Z0-9
]*.elc \
213 lisp
/[a-z
]*/[a-z
]*/[a-zA-Z0-9
]*.elc \
214 lisp
/[a-z
]*/[a-z
]*/[a-z
]*/[a-zA-Z0-9
]*.elc \
215 leim
/[a-z
]*/[a-z
]*.elc
> /tmp
/elc
217 ## Check for .elc files with no corresponding .el file.
218 sed 's/\.el$/.elc/' /tmp
/el
> /tmp
/elelc
220 bogosities
="`comm -13 /tmp/elelc /tmp/elc`"
221 if [ x
"${bogosities}" != x
"" ]; then
222 echo "The following .elc files have no corresponding .el files:"
226 ### Check for .el files with no corresponding .elc file.
227 sed 's/\.elc$/.el/' /tmp
/elc
> /tmp
/elcel
228 losers
="`comm -23 /tmp/el /tmp/elcel`"
230 rm -f /tmp
/el
/tmp
/elc
/tmp
/elcel
/tmp
/elelc
233 for file in $losers; do
234 grep -q "no-byte-compile: t" $file && continue
236 site-init.el | site-load.el | site-start.el | default.el
) continue ;;
239 bogosities
="$file $bogosities"
242 if [ x
"${bogosities}" != x
"" ]; then
243 echo "The following .el files have no corresponding .elc files:"
248 if [ $update = yes ]; then
250 ## Make sure configure is newer than configure.ac, etc.
251 ## It is better to let autoreconf do what is needed than
252 ## for us to try and duplicate all its checks.
253 echo "Running autoreconf"
254 autoreconf
-i -I m4 ||
{ x
=$?
; echo Autoreconf FAILED
! >&2; exit $x; }
256 ## Make sure src/stamp-h.in is newer than configure.ac.
258 echo timestamp
> src
/stamp-h.
in
260 echo "Updating Info files"
263 echo "Updating finder, custom and autoload data"
264 (cd lisp
&& make updates EMACS
="$EMACS")
266 echo "Updating leim-list.el"
267 (cd leim
&& make leim-list.el EMACS
="$EMACS")
269 echo "Recompiling Lisp files"
270 $EMACS -batch -f batch-byte-recompile-directory lisp leim
273 echo "Creating staging directory: \`${tempparent}'"
276 tempdir
="${tempparent}/${emacsname}"
278 ### This trap ensures that the staging directory will be cleaned up even
279 ### when the script is interrupted in mid-career.
280 if [ "${clean_up}" = yes ]; then
281 trap "echo 'Cleaning up the staging directory'; rm -rf ${tempparent}" EXIT
284 echo "Creating top directory: \`${tempdir}'"
287 ### We copy in the top-level files before creating the subdirectories in
288 ### hopes that this will make the top-level files appear first in the
289 ### tar file; this means that people can start reading the INSTALL and
290 ### README while the rest of the tar file is still unpacking. Whoopee.
291 echo "Making links to top-level files"
292 ln INSTALL README BUGS
${tempdir}
293 ln ChangeLog Makefile.
in autogen.sh configure configure.ac
${tempdir}
294 ln config.bat make-dist .dir-locals.el
${tempdir}
295 ln aclocal.
m4 ${tempdir}
297 echo "Creating subdirectories"
298 for subdir
in site-lisp \
299 leim leim
/CXTERM-DIC leim
/MISC-DIC \
300 leim
/SKK-DIC leim
/ja-dic leim
/quail \
301 build-aux build-aux
/snippet \
302 src src
/bitmaps lib lib-src oldXMenu lwlib \
303 nt nt
/inc nt
/inc
/sys nt
/inc
/arpa nt
/inc
/netinet nt
/icons \
304 `find etc lisp admin test -type d` \
305 doc
doc
/emacs
doc
/misc
doc
/man
doc
/lispref
doc
/lispintro \
307 nextstep nextstep
/templates \
308 nextstep
/Cocoa nextstep
/Cocoa
/Emacs.base \
309 nextstep
/Cocoa
/Emacs.base
/Contents \
310 nextstep
/Cocoa
/Emacs.base
/Contents
/Resources \
312 nextstep
/GNUstep
/Emacs.base \
313 nextstep
/GNUstep
/Emacs.base
/Resources
316 if [ "$with_tests" != "yes" ]; then
322 ## site-lisp for in-place installs (?).
323 [ "$subdir" = "site-lisp" ] ||
[ -d "$subdir" ] || \
324 echo "WARNING: $subdir not found, making anyway"
325 echo " ${tempdir}/${subdir}"
326 mkdir
${tempdir}/${subdir}
329 echo "Making links to \`lisp' and its subdirectories"
330 files
=`find lisp \( -name '*.el' -o -name '*.elc' -o -name 'ChangeLog*' \
331 -o -name 'README*' \)`
333 ### Don't distribute site-init.el, site-load.el, or default.el.
334 for file in lisp
/Makefile.
in lisp
/makefile.w32-in
$files; do
336 */site-init
*|
*/site-load
*|
*/default
*) continue ;;
338 ln $file $tempdir/$file
341 echo "Making links to \`leim' and its subdirectories"
343 ln makefile.w32-in ..
/${tempdir}/leim
344 ln ChangeLog README ..
/${tempdir}/leim
345 ln CXTERM-DIC
/README CXTERM-DIC
/*.tit ..
/${tempdir}/leim
/CXTERM-DIC
346 ln SKK-DIC
/README SKK-DIC
/SKK-JISYO.L ..
/${tempdir}/leim
/SKK-DIC
347 ln MISC-DIC
/README MISC-DIC
/*.
* ..
/${tempdir}/leim
/MISC-DIC
348 ln ja-dic
/*.el ja-dic
/*.elc ..
/${tempdir}/leim
/ja-dic
349 ln Makefile.
in ..
/${tempdir}/leim
/Makefile.
in
350 ln leim-ext.el ..
/${tempdir}/leim
/leim-ext.el
351 ## Lisp files that start with a capital (also 4Corner.el) are
352 ## generated from TIT dictionaries so we don't distribute them.
353 ln quail
/[a-z
]*.el quail
/[a-z
]*.elc ..
/${tempdir}/leim
/quail
354 rm -f ..
/${tempdir}/leim
/quail
/quick-b5.
*
355 rm -f ..
/${tempdir}/leim
/quail
/quick-cns.
*
356 rm -f ..
/${tempdir}/leim
/quail
/tsang-b5.
*
357 rm -f ..
/${tempdir}/leim
/quail
/tsang-cns.
*)
359 echo "Making links to \`build-aux'"
361 ln compile config.guess config.sub depcomp ..
/${tempdir}/build-aux
362 ln install-sh missing move-if-change update-subdirs ..
/${tempdir}/build-aux
)
364 echo "Making links to \`build-aux/snippet'"
365 (cd build-aux
/snippet
366 ln *.h ..
/..
/${tempdir}/build-aux
/snippet
)
368 echo "Making links to \`src'"
369 ### Don't distribute the configured versions of
370 ### config.in, paths.in, buildobj.h, or Makefile.in.
372 echo " (It is ok if ln fails in some cases.)"
373 ln [a-zA-Z
]*.
[chm
] ..
/${tempdir}/src
374 ln [a-zA-Z
]*.
in ..
/${tempdir}/src
375 ln [a-zA-Z
]*.mk ..
/${tempdir}/src
376 ln README ChangeLog ChangeLog.
*[0-9] ..
/${tempdir}/src
377 ln makefile.w32-in ..
/${tempdir}/src
378 ln .gdbinit .dbxinit ..
/${tempdir}/src
380 rm -f globals.h config.h epaths.h Makefile buildobj.h
)
382 echo "Making links to \`src/bitmaps'"
384 ln README
*.xbm ..
/..
/${tempdir}/src
/bitmaps
)
386 echo "Making links to \`lib'"
387 (snippet_h
=`(cd build-aux/snippet && ls *.h)`
389 ln [a-zA-Z
]*.
[ch
] ..
/${tempdir}/lib
390 ln gnulib.mk Makefile.am Makefile.
in makefile.w32-in ..
/${tempdir}/lib
392 script='/[*]/d; s/\.in\.h$/.h/'
393 rm -f `(echo "$snippet_h"; ls *.in.h) | sed "$script"`)
395 echo "Making links to \`lib-src'"
397 ln [a-zA-Z
]*.
[ch
] ..
/${tempdir}/lib-src
398 ln ChangeLog Makefile.
in README testfile ..
/${tempdir}/lib-src
399 ln grep-changelog rcs2log ..
/${tempdir}/lib-src
400 ln makefile.w32-in ..
/${tempdir}/lib-src
)
402 echo "Making links to \`m4'"
404 ln *.
m4 ..
/${tempdir}/m4)
406 echo "Making links to \`nt'"
408 ln emacs-x86.manifest emacs-x64.manifest emacs.rc ..
/${tempdir}/nt
409 ln config.nt emacsclient.rc emacs-src.tags ..
/${tempdir}/nt
410 ln nmake.defs gmake.defs subdirs.el
[a-z
]*.bat
[a-z
]*.
[ch
] ..
/${tempdir}/nt
411 ln ChangeLog INSTALL README README.W32 makefile.w32-in ..
/${tempdir}/nt
)
413 echo "Making links to \`nt/inc' and its subdirectories"
414 for f
in `find nt/inc -type f -name '[a-z]*.h'`; do
418 echo "Making links to \`nt/icons'"
420 ln README
[a-z
]*.ico ..
/..
/${tempdir}/nt
/icons
421 ln [a-z
]*.cur ..
/..
/${tempdir}/nt
/icons
)
423 echo "Making links to \`msdos'"
425 ln ChangeLog INSTALL README emacs.ico emacs.pif ..
/${tempdir}/msdos
426 ln depfiles.bat inttypes.h ..
/${tempdir}/msdos
427 ln is_exec.c sigaction.c mainmake.v2
sed*.inp ..
/${tempdir}/msdos
)
429 echo "Making links to \`nextstep'"
431 ln ChangeLog README INSTALL Makefile.
in ..
/${tempdir}/nextstep
)
433 echo "Making links to \`nextstep/templates'"
434 (cd nextstep
/templates
435 ln Emacs.desktop.
in Info-gnustep.plist.
in Info.plist.
in InfoPlist.
strings.
in ..
/..
/${tempdir}/nextstep
/templates
)
437 echo "Making links to \`nextstep/Cocoa/Emacs.base/Contents'"
438 (cd nextstep
/Cocoa
/Emacs.base
/Contents
439 ln PkgInfo ..
/..
/..
/..
/${tempdir}/nextstep
/Cocoa
/Emacs.base
/Contents
)
441 echo "Making links to \`nextstep/Cocoa/Emacs.base/Contents/Resources'"
442 (cd nextstep
/Cocoa
/Emacs.base
/Contents
/Resources
443 ln Credits.html
*.icns ..
/..
/..
/..
/..
/${tempdir}/nextstep
/Cocoa
/Emacs.base
/Contents
/Resources
)
445 echo "Making links to \`nextstep/GNUstep/Emacs.base/Resources'"
446 (cd nextstep
/GNUstep
/Emacs.base
/Resources
447 ln README emacs.tiff ..
/..
/..
/..
/${tempdir}/nextstep
/GNUstep
/Emacs.base
/Resources
)
449 echo "Making links to \`oldXMenu'"
451 ln *.
[ch
] *.
in ..
/${tempdir}/oldXMenu
452 ln README ChangeLog ..
/${tempdir}/oldXMenu
)
454 echo "Making links to \`lwlib'"
456 ln *.
[ch
] *.
in ..
/${tempdir}/lwlib
457 ln README ChangeLog ..
/${tempdir}/lwlib
)
459 echo "Making links to \`admin' and its subdirectories"
460 for f
in `find admin -type f`; do
464 if [ "$with_tests" = "yes" ]; then
465 echo "Making links to \`test' and its subdirectories"
466 for f
in `find test -type f`; do
468 test
/automated
/flymake
/warnpred
/a.out
) continue ;;
469 test
/automated
/Makefile
) continue ;;
475 echo "Making links to \`etc' and its subdirectories"
476 for f
in `find etc -type f`; do
478 etc
/DOC
*|etc
/*.pyc
) continue ;;
483 echo "Making links to \`info'"
484 ln `find info -type f -print` ${tempdir}/info
486 echo "Making links to \`doc/emacs'"
488 ln *.texi
*.
in makefile.w32-in ChangeLog
* ..
/..
/${tempdir}/doc
/emacs
)
490 echo "Making links to \`doc/misc'"
492 ln *.texi
*.tex
*.
in makefile.w32-in gnus-news.el ChangeLog
* ..
/..
/${tempdir}/doc
/misc
)
494 echo "Making links to \`doc/lispref'"
496 ln *.texi
*.
in makefile.w32-in README ChangeLog
* ..
/..
/${tempdir}/doc
/lispref
497 ln spellfile ..
/..
/${tempdir}/doc
/lispref
498 ln two-volume.
make two-volume-cross-refs.txt ..
/..
/${tempdir}/doc
/lispref
)
500 echo "Making links to \`doc/lispintro'"
502 ln *.texi
*.
in makefile.w32-in
*.eps
*.pdf ..
/..
/${tempdir}/doc
/lispintro
503 ln README ChangeLog
* ..
/..
/${tempdir}/doc
/lispintro
504 cd ..
/..
/${tempdir}/doc
/lispintro
)
506 echo "Making links to \`doc/man'"
508 ln ChangeLog
* *.1 ..
/..
/${tempdir}/doc
/man
509 cd ..
/..
/${tempdir}/doc
/man
)
511 ### It would be nice if they could all be symlinks to top-level copy, but
512 ### you're not supposed to have any symlinks in distribution tar files.
513 echo "Making sure copying notices are all copies of \`COPYING'"
514 for subdir
in . etc info leim lib lib-src lisp lwlib msdos nt src
; do
515 rm -f ${tempdir}/${subdir}/COPYING
516 cp COPYING
${tempdir}/${subdir}
519 if [ "${newer}" ]; then
520 echo "Removing files older than $newer"
521 ## We remove .elc files unconditionally, on the theory that anyone picking
522 ## up an incremental distribution already has a running Emacs to byte-compile
524 find ${tempparent} \( -name '*.elc' -o ! -newer ${newer} \) -exec rm -f {} \
;
527 ## Don't distribute backups, autosaves, etc.
528 echo "Removing unwanted files"
529 find ${tempparent} \
( -name '*~' -o -name '#*#' -o -name '.*ignore' -o -name '=*' -o -name 'TAGS' \
) -exec rm -f {} \
;
531 if [ "${make_tar}" = yes ]; then
532 echo "Looking for $default_gzip"
534 temppath
=`echo $PATH | sed -e 's/^:/.:/' -e 's/::/:.:/g' -e 's/:$/:./' \
536 for dir
in ${temppath}; do
537 [ -x ${dir}/$default_gzip ] ||
continue
540 if [ "$found" = "0" ]; then
541 echo "WARNING: \`$default_gzip' not found, will not compress" >&2
544 case "${default_gzip}" in
545 bzip2) gzip_extension
=.bz2
;;
546 lzma
) gzip_extension
=.lzma
;;
547 xz
) gzip_extension
=.xz
;;
548 gzip) gzip_extension
=.gz
; default_gzip
="gzip --best";;
549 *) gzip_extension
= ;;
551 echo "Creating tar file"
552 (cd ${tempparent} ; tar cvf
- ${emacsname} ) \
554 > ${emacsname}.
tar${gzip_extension}
557 if [ "${clean_up}" != yes ]; then
558 (cd ${tempparent}; mv ${emacsname} ..
)
562 ### make-dist ends here