2 ### make-dist: create an Emacs distribution tar file from current srcdir
4 ## Copyright (C) 1995, 1997-1998, 2000-2014 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 ## Remove unnecessary restrictions on file access.
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.
101 ## Include the test/ directory.
102 ## This option is mainly for the hydra build server.
108 echo "Usage: ${progname} [options]"
110 echo " --bzip2 use bzip2 instead of gzip"
111 echo " --clean-up delete staging directories when done"
112 echo " --xz use xz instead of gzip"
113 echo " --no-compress don't compress"
114 echo " --newer=TIME don't include files older than TIME"
115 echo " --no-check don't check for bad file names etc."
116 echo " --no-update don't recompile or do analogous things"
117 echo " --snapshot same as --clean-up --no-update --tar --no-check"
118 echo " --tar make a tar file"
119 echo " --tests include the test/ directory"
125 echo "${progname}: Unrecognized argument: $1" >&2
132 ### Make sure we're running in the right place.
133 if [ ! -d src
-o ! -f src
/lisp.h
-o ! -d lisp
-o ! -f lisp
/subr.el
]; then
134 echo "${progname}: Can't find \`src/lisp.h' and \`lisp/subr.el'." >&2
135 echo "${progname} must be run in the top directory of the Emacs" >&2
136 echo "distribution tree. cd to that directory and try again." >&2
140 ### Find where to run Emacs.
141 ### (Accept only absolute file names.)
142 if [ $update = yes ];
146 EMACS
=`pwd`/src
/emacs
151 if [ ! -f "$EMACS" ]; then
152 echo "$0: You must set the EMACS environment variable " \
153 "to an absolute file name." 2>&1
160 ### Find out which version of Emacs this is.
162 sed -n 's/^AC_INIT(GNU Emacs,[ ]*\([^ ,)]*\).*/\1/p' <configure.ac
164 if [ ! "${version}" ]; then
165 echo "${progname}: can't find current Emacs version in \`./src/emacs.c'" >&2
169 echo Version number is
$version
171 if [ $update = yes ]; then
172 if ! grep -q "tree holds version *${version}" README
; then
173 echo "WARNING: README has the wrong version number"
174 echo "Consider running M-x set-version from admin/admin.el"
179 ### Make sure we don't already have a directory emacs-${version}.
181 emacsname
="emacs-${version}${new_extension}"
183 if [ -d ${emacsname} ]
185 echo Directory
"${emacsname}" already exists
>&2
189 ### Make sure the subdirectory is available.
190 tempparent
="make-dist.tmp.$$"
191 if [ -d ${tempparent} ]; then
192 echo "${progname}: staging directory \`${tempparent}' already exists.
193 Perhaps a previous invocation of \`${progname}' failed to clean up after
194 itself. Check that directories whose names are of the form
195 \`make-dist.tmp.NNNNN' don't contain any important information, remove
196 them, and try again." >&2
200 if [ $check = yes ]; then
201 ls -1 lisp
/[a-zA-Z
]*.el lisp
/[a-z
]*/[a-zA-Z0-9
]*.el \
202 lisp
/[a-z
]*/[a-z
]*/[a-zA-Z0-9
]*.el \
203 lisp
/[a-z
]*/[a-z
]*/[a-z
]*/[a-zA-Z0-9
]*.el
> /tmp
/el
205 ls -1 lisp
/[a-zA-Z
]*.elc lisp
/[a-z
]*/[a-zA-Z0-9
]*.elc \
206 lisp
/[a-z
]*/[a-z
]*/[a-zA-Z0-9
]*.elc \
207 lisp
/[a-z
]*/[a-z
]*/[a-z
]*/[a-zA-Z0-9
]*.elc
> /tmp
/elc
209 ## Check for .elc files with no corresponding .el file.
210 sed 's/\.el$/.elc/' /tmp
/el
> /tmp
/elelc
212 bogosities
="`comm -13 /tmp/elelc /tmp/elc`"
213 if [ x
"${bogosities}" != x
"" ]; then
214 echo "The following .elc files have no corresponding .el files:"
218 ### Check for .el files with no corresponding .elc file.
219 sed 's/\.elc$/.el/' /tmp
/elc
> /tmp
/elcel
220 losers
="`comm -23 /tmp/el /tmp/elcel`"
222 rm -f /tmp
/el
/tmp
/elc
/tmp
/elcel
/tmp
/elelc
225 for file in $losers; do
226 grep -q "no-byte-compile: t" $file && continue
228 site-init.el | site-load.el | site-start.el | default.el
) continue ;;
231 bogosities
="$file $bogosities"
234 if [ x
"${bogosities}" != x
"" ]; then
235 echo "The following .el files have no corresponding .elc files:"
240 if [ $update = yes ]; then
242 ## Make sure configure is newer than configure.ac, etc.
243 ## It is better to let autoreconf do what is needed than
244 ## for us to try and duplicate all its checks.
245 echo "Running autoreconf"
246 autoreconf
-i -I m4 ||
{ x
=$?
; echo Autoreconf FAILED
! >&2; exit $x; }
248 ## Make sure src/stamp-h.in is newer than configure.ac.
250 echo timestamp
> src
/stamp-h.
in
252 echo "Updating Info files"
255 echo "Updating finder, custom and autoload data"
256 (cd lisp
&& make updates EMACS
="$EMACS")
258 echo "Updating leim-list.el"
259 (cd leim
&& make leim-list.el EMACS
="$EMACS")
261 echo "Recompiling Lisp files"
262 $EMACS -batch -f batch-byte-recompile-directory lisp
265 echo "Creating staging directory: \`${tempparent}'"
268 tempdir
="${tempparent}/${emacsname}"
270 ### This trap ensures that the staging directory will be cleaned up even
271 ### when the script is interrupted in mid-career.
272 if [ "${clean_up}" = yes ]; then
273 trap "echo 'Cleaning up the staging directory'; rm -rf ${tempparent}" EXIT
276 echo "Creating top directory: \`${tempdir}'"
279 ### We copy in the top-level files before creating the subdirectories in
280 ### hopes that this will make the top-level files appear first in the
281 ### tar file; this means that people can start reading the INSTALL and
282 ### README while the rest of the tar file is still unpacking. Whoopee.
283 echo "Making links to top-level files"
284 ln INSTALL README BUGS
${tempdir}
285 ln ChangeLog Makefile.
in autogen.sh configure configure.ac
${tempdir}
286 ln config.bat make-dist .dir-locals.el
${tempdir}
287 ln aclocal.
m4 ${tempdir}
289 echo "Creating subdirectories"
290 for subdir
in site-lisp \
291 leim leim
/CXTERM-DIC leim
/MISC-DIC leim
/SKK-DIC \
292 build-aux build-aux
/snippet \
293 src src
/bitmaps lib lib-src oldXMenu lwlib \
294 nt nt
/inc nt
/inc
/sys nt
/inc
/arpa nt
/inc
/netinet nt
/icons \
295 `find etc lisp admin test -type d` \
296 doc
doc
/emacs
doc
/misc
doc
/man
doc
/lispref
doc
/lispintro \
298 nextstep nextstep
/templates \
299 nextstep
/Cocoa nextstep
/Cocoa
/Emacs.base \
300 nextstep
/Cocoa
/Emacs.base
/Contents \
301 nextstep
/Cocoa
/Emacs.base
/Contents
/Resources \
303 nextstep
/GNUstep
/Emacs.base \
304 nextstep
/GNUstep
/Emacs.base
/Resources
307 if [ "$with_tests" != "yes" ]; then
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 Makefile.
in ..
/${tempdir}/leim
/Makefile.
in
340 ln leim-ext.el ..
/${tempdir}/leim
/leim-ext.el
)
342 ## FIXME Can we not just use the "find -type f" method for this one?
343 echo "Making links to \`build-aux'"
345 ln compile config.guess config.sub depcomp msys-to-w32 ..
/${tempdir}/build-aux
346 ln install-sh missing move-if-change ..
/${tempdir}/build-aux
347 ln update-copyright update-subdirs ..
/${tempdir}/build-aux
348 ln dir_top make-info-dir ..
/${tempdir}/build-aux
)
350 echo "Making links to \`build-aux/snippet'"
351 (cd build-aux
/snippet
352 ln *.h ..
/..
/${tempdir}/build-aux
/snippet
)
354 echo "Making links to \`src'"
355 ### Don't distribute the configured versions of
356 ### config.in, paths.in, buildobj.h, or Makefile.in.
358 echo " (It is ok if ln fails in some cases.)"
359 ln [a-zA-Z
]*.
[chm
] ..
/${tempdir}/src
360 ln [a-zA-Z
]*.
in ..
/${tempdir}/src
361 ln [a-zA-Z
]*.mk ..
/${tempdir}/src
362 ln README ChangeLog ChangeLog.
*[0-9] ..
/${tempdir}/src
363 ln makefile.w32-in ..
/${tempdir}/src
364 ln .gdbinit .dbxinit ..
/${tempdir}/src
366 rm -f globals.h config.h epaths.h Makefile buildobj.h
)
368 echo "Making links to \`src/bitmaps'"
370 ln README
*.xbm ..
/..
/${tempdir}/src
/bitmaps
)
372 echo "Making links to \`lib'"
373 (snippet_h
=`(cd build-aux/snippet && ls *.h)`
375 ln [a-zA-Z
]*.
[ch
] ..
/${tempdir}/lib
376 ln gnulib.mk Makefile.am Makefile.
in makefile.w32-in ..
/${tempdir}/lib
378 script='/[*]/d; s/\.in\.h$/.h/'
379 rm -f `(echo "$snippet_h"; ls *.in.h) | sed "$script"`)
381 echo "Making links to \`lib-src'"
383 ln [a-zA-Z
]*.
[ch
] ..
/${tempdir}/lib-src
384 ln ChangeLog Makefile.
in README ..
/${tempdir}/lib-src
385 ln rcs2log ..
/${tempdir}/lib-src
386 ln makefile.w32-in ..
/${tempdir}/lib-src
387 ln update-game-score.exe.manifest ..
/${tempdir}/lib-src
)
389 echo "Making links to \`m4'"
391 ln *.
m4 ..
/${tempdir}/m4)
393 echo "Making links to \`nt'"
395 ln emacs-x86.manifest emacs-x64.manifest ..
/${tempdir}/nt
396 ln config.nt emacs-src.tags ..
/${tempdir}/nt
397 ln nmake.defs gmake.defs subdirs.el
[a-z
]*.bat
[a-z
]*.
[ch
] ..
/${tempdir}/nt
398 ln *.
in gnulib.mk ..
/${tempdir}/nt
399 ln mingw-cfg.site epaths.nt INSTALL.OLD ..
/${tempdir}/nt
400 ln ChangeLog INSTALL README README.W32 makefile.w32-in ..
/${tempdir}/nt
)
402 echo "Making links to \`nt/inc' and its subdirectories"
403 for f
in `find nt/inc -type f -name '[a-z]*.h'`; do
407 echo "Making links to \`nt/icons'"
409 ln README
[a-z
]*.ico ..
/..
/${tempdir}/nt
/icons
410 ln [a-z
]*.cur ..
/..
/${tempdir}/nt
/icons
)
412 echo "Making links to \`msdos'"
414 ln ChangeLog INSTALL README emacs.ico emacs.pif ..
/${tempdir}/msdos
415 ln depfiles.bat inttypes.h ..
/${tempdir}/msdos
416 ln mainmake.v2
sed*.inp ..
/${tempdir}/msdos
)
418 echo "Making links to \`nextstep'"
420 ln ChangeLog README INSTALL Makefile.
in ..
/${tempdir}/nextstep
)
422 echo "Making links to \`nextstep/templates'"
423 (cd nextstep
/templates
424 ln Emacs.desktop.
in Info-gnustep.plist.
in Info.plist.
in InfoPlist.
strings.
in ..
/..
/${tempdir}/nextstep
/templates
)
426 echo "Making links to \`nextstep/Cocoa/Emacs.base/Contents'"
427 (cd nextstep
/Cocoa
/Emacs.base
/Contents
428 ln PkgInfo ..
/..
/..
/..
/${tempdir}/nextstep
/Cocoa
/Emacs.base
/Contents
)
430 echo "Making links to \`nextstep/Cocoa/Emacs.base/Contents/Resources'"
431 (cd nextstep
/Cocoa
/Emacs.base
/Contents
/Resources
432 ln Credits.html
*.icns ..
/..
/..
/..
/..
/${tempdir}/nextstep
/Cocoa
/Emacs.base
/Contents
/Resources
)
434 echo "Making links to \`nextstep/GNUstep/Emacs.base/Resources'"
435 (cd nextstep
/GNUstep
/Emacs.base
/Resources
436 ln README emacs.tiff ..
/..
/..
/..
/${tempdir}/nextstep
/GNUstep
/Emacs.base
/Resources
)
438 echo "Making links to \`oldXMenu'"
440 ln *.
[ch
] *.
in *.mk ..
/${tempdir}/oldXMenu
441 ln README ChangeLog ..
/${tempdir}/oldXMenu
)
443 echo "Making links to \`lwlib'"
445 ln *.
[ch
] *.
in *.mk ..
/${tempdir}/lwlib
446 ln README ChangeLog ..
/${tempdir}/lwlib
)
448 ## It is important to distribute admin/ because it contains sources
449 ## for generated lisp/international/uni-*.el files.
450 echo "Making links to \`admin' and its subdirectories"
451 for f
in `find admin -type f`; do
453 */Makefile
) [ -f $f.
in ] && continue ;;
458 if [ "$with_tests" = "yes" ]; then
459 echo "Making links to \`test' and its subdirectories"
460 for f
in `find test -type f`; do
462 test
/automated
/*.log
) continue ;;
463 test
/automated
/flymake
/warnpred
/a.out
) continue ;;
464 test
/automated
/Makefile
) continue ;;
470 echo "Making links to \`etc' and its subdirectories"
471 for f
in `find etc -type f`; do
473 etc
/DOC
*|etc
/*.pyc
) continue ;;
474 ## Arguably we should not exclude *.ps.
475 etc
/refcards
/*.aux|etc
/refcards
/*.dvi|etc
/refcards
/*.log|etc
/refcards
/*.ps
)
481 echo "Making links to \`info'"
482 ln `find info -type f -print` ${tempdir}/info
484 echo "Making links to \`doc/emacs'"
486 ln *.texi
*.
in makefile.w32-in ChangeLog
* ..
/..
/${tempdir}/doc
/emacs
)
488 echo "Making links to \`doc/misc'"
490 ln *.texi
*.tex
*.
in makefile.w32-in gnus-news.el ChangeLog
* ..
/..
/${tempdir}/doc
/misc
)
492 echo "Making links to \`doc/lispref'"
494 ln *.texi
*.
in makefile.w32-in README ChangeLog
* ..
/..
/${tempdir}/doc
/lispref
495 ln spellfile ..
/..
/${tempdir}/doc
/lispref
496 ln two-volume.
make two-volume-cross-refs.txt ..
/..
/${tempdir}/doc
/lispref
)
498 echo "Making links to \`doc/lispintro'"
500 ln *.texi
*.
in makefile.w32-in
*.eps
*.pdf ..
/..
/${tempdir}/doc
/lispintro
501 ln README ChangeLog
* ..
/..
/${tempdir}/doc
/lispintro
502 cd ..
/..
/${tempdir}/doc
/lispintro
)
504 echo "Making links to \`doc/man'"
506 ln ChangeLog
* *.1 *.
in ..
/..
/${tempdir}/doc
/man
507 cd ..
/..
/${tempdir}/doc
/man
510 ### It would be nice if they could all be symlinks to top-level copy, but
511 ### you're not supposed to have any symlinks in distribution tar files.
512 echo "Making sure copying notices are all copies of \`COPYING'"
513 for subdir
in . etc leim lib lib-src lisp lwlib msdos nt src
; do
514 rm -f ${tempdir}/${subdir}/COPYING
515 cp COPYING
${tempdir}/${subdir}
518 if [ "${newer}" ]; then
519 echo "Removing files older than $newer"
520 ## We remove .elc files unconditionally, on the theory that anyone picking
521 ## up an incremental distribution already has a running Emacs to byte-compile
523 find ${tempparent} \( -name '*.elc' -o ! -newer ${newer} \) -exec rm -f {} \
;
526 ## Don't distribute backups, autosaves, etc.
527 echo "Removing unwanted files"
528 find ${tempparent} \
( -name '*~' -o -name '#*#' -o -name '.*ignore' -o -name '=*' -o -name 'TAGS' \
) -exec rm -f {} \
;
530 if [ "${make_tar}" = yes ]; then
531 echo "Looking for $default_gzip"
533 temppath
=`echo $PATH | sed -e 's/^:/.:/' -e 's/::/:.:/g' -e 's/:$/:./' \
535 for dir
in ${temppath}; do
536 [ -x ${dir}/$default_gzip ] ||
continue
539 if [ "$found" = "0" ]; then
540 echo "WARNING: \`$default_gzip' not found, will not compress" >&2
543 case "${default_gzip}" in
544 bzip2) gzip_extension
=.bz2
;;
545 xz
) gzip_extension
=.xz
;;
546 gzip) gzip_extension
=.gz
; default_gzip
="gzip --best";;
547 *) gzip_extension
= ;;
549 echo "Creating tar file"
550 (cd ${tempparent} ; tar cvf
- ${emacsname} ) \
552 > ${emacsname}.
tar${gzip_extension}
555 if [ "${clean_up}" != yes ]; then
556 (cd ${tempparent}; mv ${emacsname} ..
)
560 ### make-dist ends here