]> code.delx.au - gnu-emacs/blob - make-dist
* make-dist: Update and simplify.
[gnu-emacs] / make-dist
1 #!/bin/sh
2 ### make-dist: create an Emacs distribution tar file from current srcdir
3
4 ## Copyright (C) 1995, 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005,
5 ## 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
6
7 ## This file is part of GNU Emacs.
8
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.
13
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.
18
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/>.
21
22 ### Commentary:
23
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.
28
29 ### Code:
30
31 progname="$0"
32
33 ### Exit if a command fails.
34 #set -e
35
36 ### Print out each line we read, for debugging's sake.
37 #set -v
38
39 LANGUAGE=C
40 LC_ALL=C
41 LC_MESSAGES=
42 LANG=
43 export LANGUAGE LC_ALL LC_MESSAGES LANG
44
45 ## Don't restrict access to any files.
46 umask 0
47
48 update=yes
49 check=yes
50 clean_up=no
51 make_tar=no
52 newer=""
53
54 while [ $# -gt 0 ]; do
55 case "$1" in
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.
58 "--clean-up" )
59 clean_up=yes
60 ;;
61 ## This option tells make-dist to make a tar file.
62 "--tar" )
63 make_tar=yes
64 ;;
65 ## This option tells make-dist not to recompile or do analogous things.
66 "--no-update" )
67 update=no
68 ;;
69 ## This option says don't check for bad file names, etc.
70 "--no-check" )
71 check=no
72 ;;
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.
76 "--newer")
77 newer="$2"
78 new_extension=".new"
79 shift
80 ;;
81 ## This option tells make-dist to use `compress' instead of gzip.
82 ## Normally, make-dist uses gzip whenever it is present.
83 "--compress")
84 default_gzip="compress"
85 ;;
86 ## Same with bzip2.
87 "--bzip2")
88 default_gzip="bzip2"
89 ;;
90 ## Same with lzma.
91 "--lzma")
92 default_gzip="lzma"
93 ;;
94
95 "--snapshot")
96 clean_up=yes
97 make_tar=yes
98 update=no
99 check=no
100 ;;
101
102 "--help")
103 echo "Usage: ${progname} [options]"
104 echo ""
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"
114 echo ""
115 exit 0
116 ;;
117
118 * )
119 echo "${progname}: Unrecognized argument: $1" >&2
120 exit 1
121 ;;
122 esac
123 shift
124 done
125
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
131 exit 1
132 fi
133
134 ### Find where to run Emacs.
135 ### (Accept only absolute file names.)
136 if [ $update = yes ];
137 then
138 unset EMACS_UNIBYTE
139 if [ -f src/emacs ];
140 then
141 EMACS=`pwd`/src/emacs
142 else
143 case $EMACS in
144 /*) ;;
145 *)
146 if [ ! -f "$EMACS" ]; then
147 echo "$0: You must set the EMACS environment variable " \
148 "to an absolute file name." 2>&1
149 exit 1
150 fi;;
151 esac
152 fi
153 fi
154
155 ### Find out which version of Emacs this is.
156 shortversion=`grep 'char emacs_version' src/emacs.c \
157 | sed -e 's/^.*"\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/'`
158 version=`grep 'char emacs_version' src/emacs.c \
159 | sed -e 's/^[^"]*"\([^"]*\)".*$/\1/'`
160 if [ ! "${version}" ]; then
161 echo "${progname}: can't find current Emacs version in \`./src/emacs.c'" >&2
162 exit 1
163 fi
164
165 echo Version numbers are $version and $shortversion
166
167 if [ $update = yes ];
168 then
169 if grep -s "@set EMACSVER *${shortversion}" ./doc/emacs/emacsver.texi > /dev/null; then
170 true
171 else
172 echo "You must update the version number in \`./doc/emacs/emacsver.texi'"
173 sleep 5
174 fi
175 fi
176
177 ### Make sure we don't already have a directory emacs-${version}.
178
179 emacsname="emacs-${version}${new_extension}"
180
181 if [ -d ${emacsname} ]
182 then
183 echo Directory "${emacsname}" already exists >&2
184 exit 1
185 fi
186
187 ### Make sure the subdirectory is available.
188 tempparent="make-dist.tmp.$$"
189 if [ -d ${tempparent} ]; then
190 echo "${progname}: staging directory \`${tempparent}' already exists.
191 Perhaps a previous invocation of \`${progname}' failed to clean up after
192 itself. Check that directories whose names are of the form
193 \`make-dist.tmp.NNNNN' don't contain any important information, remove
194 them, and try again." >&2
195 exit 1
196 fi
197
198 ### Find where to run Emacs.
199 if [ $check = yes ];
200 then
201 ### Check for .elc files with no corresponding .el file.
202 ls -1 lisp/[a-zA-Z]*.el lisp/[a-z]*/[a-zA-Z0-9]*.el \
203 lisp/[a-z]*/[a-z]*/[a-zA-Z0-9]*.el \
204 lisp/[a-z]*/[a-z]*/[a-z]*/[a-zA-Z0-9]*.el \
205 leim/[a-z]*/[a-z]*.el | sed 's/\.el$/.elc/' > /tmp/el
206 ls -1 lisp/[a-zA-Z]*.elc lisp/[a-z]*/[a-zA-Z0-9]*.elc \
207 lisp/[a-z]*/[a-z]*/[a-zA-Z0-9]*.elc \
208 lisp/[a-z]*/[a-z]*/[a-z]*/[a-zA-Z0-9]*.elc \
209 leim/[a-z]*/[a-z]*.elc > /tmp/elc
210 bogosities="`comm -13 /tmp/el /tmp/elc`"
211 if [ "${bogosities}" != "" ]; then
212 echo "The following .elc files have no corresponding .el files:"
213 echo "${bogosities}"
214 fi
215 rm -f /tmp/el /tmp/elc
216
217 ### Check for .el files with no corresponding .elc file.
218 ls -1 lisp/[a-zA-Z]*.el lisp/[a-z]*/[a-zA-Z0-9]*.el \
219 lisp/[a-z]*/[a-z]*/[a-zA-Z0-9]*.el \
220 lisp/[a-z]*/[a-z]*/[a-z]*/[a-zA-Z0-9]*.el \
221 leim/[a-z]*/[a-z]*.el > /tmp/el
222 ls -1 lisp/[a-zA-Z]*.elc lisp/[a-z]*/[a-zA-Z0-9]*.elc \
223 lisp/[a-z]*/[a-z]*/[a-zA-Z0-9]*.el \
224 lisp/[a-z]*/[a-z]*/[a-z]*/[a-zA-Z0-9]*.el \
225 leim/[a-z]*/[a-z]*.elc | sed 's/\.elc$/.el/' > /tmp/elc
226 losers="`comm -23 /tmp/el /tmp/elc`"
227 bogosities=
228 for file in $losers; do
229 if ! grep -q "no-byte-compile: t" $file; then
230 case $file in
231 site-init.el | site-load.el | site-start.el | default.el)
232 ;;
233 *)
234 bogosities="$file $bogosities"
235 ;;
236 esac
237 fi
238 done
239 if [ x"${bogosities}" != x"" ]; then
240 echo "The following .el files have no corresponding .elc files:"
241 echo "${bogosities}"
242 fi
243 rm -f /tmp/el /tmp/elc
244 fi
245
246 ### Make sure configure is newer than configure.in.
247 if [ "x`ls -t configure configure.in | sed q`" != "xconfigure" ]; then
248 echo "\`./configure.in' is newer than \`./configure'" >&2
249 echo "Running autoconf" >&2
250 autoconf || { x=$?; echo Autoconf FAILED! >&2; exit $x; }
251 fi
252
253 ### Make sure src/stamp-h.in is newer than configure.in.
254 if [ "x`ls -t src/stamp-h.in configure.in | sed q`" != "xsrc/stamp-h.in" ]; then
255 echo "\`./configure.in' is newer than \`./src/stamp-h.in'" >&2
256 echo "Running autoheader" >&2
257 autoheader || { x=$?; echo Autoheader FAILED! >&2; exit $x; }
258 rm -f src/stamp-h.in
259 echo timestamp > src/stamp-h.in
260 fi
261
262 if [ $update = yes ];
263 then
264 echo "Updating Info files"
265 (cd doc/emacs; make info)
266 (cd doc/misc; make info)
267 (cd doc/lispref; make info)
268 (cd doc/lispintro; make info)
269
270 echo "Updating finder, custom and autoload data"
271 (cd lisp; make updates EMACS="$EMACS")
272
273 if test -f leim/leim-list.el; then
274 echo "Updating leim-list.el"
275 (cd leim; make leim-list.el EMACS="$EMACS")
276 fi
277
278 echo "Recompiling Lisp files"
279 $EMACS -batch -f batch-byte-recompile-directory lisp leim
280 fi
281
282 echo "Making lisp/MANIFEST"
283
284 (cd lisp;
285 files=`echo [!=]*.el | sed -e 's/ subdirs.el / /' -e 's/ default.el / /'`
286 for dir in [!=]*; do
287 if [ -d $dir ] && [ $dir != term ]
288 then
289 echo $dir
290 thisdir=`echo $dir/[!=]*.el | sed -e 's/ subdirs.el / /'`
291 files="$files $thisdir"
292 fi
293 done
294 for file in $files
295 do sed -n 's/^;;; //p; q' $file
296 done | sort > MANIFEST)
297
298 echo "Creating staging directory: \`${tempparent}'"
299
300 mkdir ${tempparent}
301 tempdir="${tempparent}/${emacsname}"
302
303 ### This trap ensures that the staging directory will be cleaned up even
304 ### when the script is interrupted in mid-career.
305 if [ "${clean_up}" = yes ]; then
306 trap "echo 'Interrupted...cleaning up the staging directory'; rm -rf ${tempparent}; exit 1" 1 2 15
307 fi
308
309 echo "Creating top directory: \`${tempdir}'"
310 mkdir ${tempdir}
311
312 ### We copy in the top-level files before creating the subdirectories in
313 ### hopes that this will make the top-level files appear first in the
314 ### tar file; this means that people can start reading the INSTALL and
315 ### README while the rest of the tar file is still unpacking. Whoopee.
316 echo "Making links to top-level files"
317 ln INSTALL README BUGS move-if-change ${tempdir}
318 ln ChangeLog Makefile.in configure configure.in ${tempdir}
319 ln config.bat make-dist update-subdirs vpath.sed .dir-locals.el ${tempdir}
320 ln mkinstalldirs config.sub config.guess install-sh ${tempdir}
321
322 echo "Updating version number in README"
323 (cd ${tempdir}
324 awk \
325 '$1 " " $2 " " $3 " " $4 " " $5 == "This directory tree holds version" { $6 = version; print $0 }
326 $1 " " $2 " " $3 " " $4 " " $5 != "This directory tree holds version"' \
327 version=${version} README > tmp.README
328 mv -f tmp.README README)
329
330
331 echo "Creating subdirectories"
332 for subdir in lisp site-lisp \
333 leim leim/CXTERM-DIC leim/MISC-DIC \
334 leim/SKK-DIC leim/ja-dic leim/quail \
335 src src/m src/s src/bitmaps lib-src oldXMenu lwlib \
336 nt nt/inc nt/inc/sys nt/inc/arpa nt/inc/netinet nt/icons \
337 etc etc/charsets etc/e etc/gnus etc/nxml \
338 etc/images etc/images/custom etc/images/ezimage etc/images/gnus \
339 etc/images/gud etc/images/icons etc/images/icons/hicolor \
340 etc/images/icons/hicolor/*x* etc/images/icons/hicolor/scalable \
341 etc/images/icons/hicolor/*/apps etc/images/icons/hicolor/*/mimetypes \
342 etc/images/low-color etc/images/mail etc/images/mpc \
343 etc/images/smilies etc/images/smilies/grayscale \
344 etc/images/smilies/medium etc/images/tree-widget \
345 etc/images/tree-widget/default etc/images/tree-widget/folder \
346 etc/refcards etc/schema etc/srecode etc/tutorials info doc doc/emacs \
347 doc/misc doc/man doc/lispref doc/lispintro m4 msdos \
348 nextstep nextstep/Cocoa nextstep/Cocoa/Emacs.base \
349 nextstep/Cocoa/Emacs.base/Contents \
350 nextstep/Cocoa/Emacs.base/Contents/Resources \
351 nextstep/Cocoa/Emacs.base/Contents/Resources/English.lproj \
352 nextstep/Cocoa/Emacs.xcodeproj \
353 nextstep/GNUstep \
354 nextstep/GNUstep/Emacs.base \
355 nextstep/GNUstep/Emacs.base/Resources
356 do
357 ## site-lisp for in-place installs (?).
358 [ "$subdir" = "site-lisp" ] || [ -d "$subdir" ] || \
359 echo "WARNING: $subdir not found, making anyway"
360 echo " ${tempdir}/${subdir}"
361 mkdir ${tempdir}/${subdir}
362 done
363
364 echo "Making links to \`lisp' and its subdirectories"
365 ### Don't distribute site-init.el, site-load.el, or default.el.
366 (cd lisp
367 ln [a-zA-Z]*.el ../${tempdir}/lisp
368 ln [a-zA-Z]*.elc ../${tempdir}/lisp
369 ln ChangeLog ChangeLog.*[0-9] ../${tempdir}/lisp
370 ln Makefile.in makefile.w32-in ../${tempdir}/lisp
371 ln README ../${tempdir}/lisp
372 (cd ../${tempdir}/lisp
373 rm -f site-init site-init.el site-init.elc
374 rm -f site-load site-load.el site-load.elc
375 rm -f site-start site-start.el site-start.elc
376 rm -f default default.el default.elc
377 )
378
379 ## Find all subdirs of lisp dir
380 for file in `find . -type d -print`; do
381 case $file in
382 . | .. | */=*)
383 ;;
384 *)
385 if [ -d $file ]; then
386 subdirs="$file $subdirs"
387 fi
388 ;;
389 esac
390 done
391
392 for file in $subdirs; do
393 echo " lisp/$file"
394 mkdir -p ../${tempdir}/lisp/$file
395 ln $file/[a-zA-Z0-9]*.el ../${tempdir}/lisp/$file
396 ln $file/[a-zA-Z0-9]*.elc ../${tempdir}/lisp/$file
397 ## calc/README.prev
398 for f in $file/README $file/ChangeLog $file/ChangeLog.*[0-9] \
399 $file/README.prev; do
400 [ -f $f ] || continue
401 ln $f ../${tempdir}/lisp/$file
402 done
403 done )
404
405 echo "Making links to \`leim' and its subdirectories"
406 (cd leim
407 ln makefile.w32-in ../${tempdir}/leim
408 ln ChangeLog README ../${tempdir}/leim
409 ln CXTERM-DIC/README CXTERM-DIC/*.tit ../${tempdir}/leim/CXTERM-DIC
410 ln SKK-DIC/README SKK-DIC/SKK-JISYO.L ../${tempdir}/leim/SKK-DIC
411 ln MISC-DIC/README MISC-DIC/*.* ../${tempdir}/leim/MISC-DIC
412 ln ja-dic/*.el ja-dic/*.elc ../${tempdir}/leim/ja-dic
413 ln Makefile.in ../${tempdir}/leim/Makefile.in
414 ln leim-ext.el ../${tempdir}/leim/leim-ext.el
415 ## Lisp files that start with a capital (also 4Corner.el) are
416 ## generated from TIT dictionaries so we don't distribute them.
417 ln quail/[a-z]*.el quail/[a-z]*.elc ../${tempdir}/leim/quail
418 rm -f ../${tempdir}/leim/quail/quick-b5.*
419 rm -f ../${tempdir}/leim/quail/quick-cns.*
420 rm -f ../${tempdir}/leim/quail/tsang-b5.*
421 rm -f ../${tempdir}/leim/quail/tsang-cns.*)
422
423 echo "Making links to \`src'"
424 ### Don't distribute =*.[ch] files, or the configured versions of
425 ### config.in, paths.in, or Makefile.in, or TAGS.
426 (cd src
427 echo " (It is ok if ln fails in some cases.)"
428 ln [a-zA-Z]*.[chm] ../${tempdir}/src
429 ln [a-zA-Z]*.in ../${tempdir}/src
430 ln [a-zA-Z]*.mk ../${tempdir}/src
431 ln README ChangeLog ChangeLog.*[0-9] ../${tempdir}/src
432 ln makefile.w32-in ../${tempdir}/src
433 ln .gdbinit .dbxinit ../${tempdir}/src
434 cd ../${tempdir}/src
435 rm -f config.h epaths.h Makefile buildobj.h)
436
437 echo "Making links to \`src/bitmaps'"
438 (cd src/bitmaps
439 ln README *.xbm ../../${tempdir}/src/bitmaps)
440
441 echo "Making links to \`src/m'"
442 (cd src/m
443 ln README [a-zA-Z0-9]*.h ../../${tempdir}/src/m)
444
445 echo "Making links to \`src/s'"
446 (cd src/s
447 ln README [a-zA-Z0-9]*.h ../../${tempdir}/src/s)
448
449 echo "Making links to \`lib-src'"
450 (cd lib-src
451 ln [a-zA-Z]*.[chmy] ../${tempdir}/lib-src
452 ln ChangeLog Makefile.in README testfile vcdiff ../${tempdir}/lib-src
453 ln grep-changelog rcs2log rcs-checkin ../${tempdir}/lib-src
454 ln makefile.w32-in ../${tempdir}/lib-src
455 cd ../${tempdir}/lib-src
456 rm -f getopt.h)
457
458 echo "Making links to \`m4'"
459 (cd m4
460 ln *.m4 ../${tempdir}/m4)
461
462 echo "Making links to \`nt'"
463 (cd nt
464 ln emacs.manifest emacs.rc emacsclient.rc config.nt ../${tempdir}/nt
465 ln emacs-src.tags nmake.defs gmake.defs subdirs.el ../${tempdir}/nt
466 ln [a-z]*.bat [a-z]*.[ch] ../${tempdir}/nt
467 ln ChangeLog INSTALL README README.W32 makefile.w32-in ../${tempdir}/nt)
468
469 echo "Making links to \`nt/inc'"
470 (cd nt/inc
471 ln [a-z]*.h ../../${tempdir}/nt/inc)
472
473 echo "Making links to \`nt/inc/sys'"
474 (cd nt/inc/sys
475 ln [a-z]*.h ../../../${tempdir}/nt/inc/sys)
476
477 echo "Making links to \`nt/inc/arpa'"
478 (cd nt/inc/arpa
479 ln [a-z]*.h ../../../${tempdir}/nt/inc/arpa)
480
481 echo "Making links to \`nt/inc/netinet'"
482 (cd nt/inc/netinet
483 ln [a-z]*.h ../../../${tempdir}/nt/inc/netinet)
484
485 echo "Making links to \`nt/icons'"
486 (cd nt/icons
487 ln README [a-z]*.ico ../../${tempdir}/nt/icons
488 ln [a-z]*.cur ../../${tempdir}/nt/icons)
489
490 echo "Making links to \`msdos'"
491 (cd msdos
492 ln ChangeLog INSTALL README emacs.ico emacs.pif ../${tempdir}/msdos
493 ln is_exec.c sigaction.c mainmake.v2 sed*.inp ../${tempdir}/msdos)
494
495 ## FIXME are DEV-NOTES and FOR-RELEASE appropriate?
496 echo "Making links to \`nextstep'"
497 (cd nextstep
498 ln AUTHORS ChangeLog README INSTALL ../${tempdir}/nextstep)
499
500 echo "Making links to \`nextstep/Cocoa/Emacs.base/Contents'"
501 (cd nextstep/Cocoa/Emacs.base/Contents
502 ln Info.plist PkgInfo ../../../../${tempdir}/nextstep/Cocoa/Emacs.base/Contents)
503
504 echo "Making links to \`nextstep/Cocoa/Emacs.base/Contents/Resources'"
505 (cd nextstep/Cocoa/Emacs.base/Contents/Resources
506 ln Credits.html *.icns ../../../../../${tempdir}/nextstep/Cocoa/Emacs.base/Contents/Resources)
507
508 echo "Making links to \`nextstep/Cocoa/Emacs.base/Contents/Resources/English.lproj'"
509 (cd nextstep/Cocoa/Emacs.base/Contents/Resources/English.lproj
510 ln InfoPlist.strings ../../../../../../${tempdir}/nextstep/Cocoa/Emacs.base/Contents/Resources/English.lproj)
511
512 echo "Making links to \`nextstep/Cocoa/Emacs.xcodeproj'"
513 (cd nextstep/Cocoa/Emacs.xcodeproj
514 ln project.pbxproj ../../../${tempdir}/nextstep/Cocoa/Emacs.xcodeproj)
515
516 echo "Making links to \`nextstep/GNUstep/Emacs.base/Resources'"
517 (cd nextstep/GNUstep/Emacs.base/Resources
518 ln Emacs.desktop Info-gnustep.plist README emacs.tiff ../../../../${tempdir}/nextstep/GNUstep/Emacs.base/Resources )
519
520 echo "Making links to \`oldXMenu'"
521 (cd oldXMenu
522 ln *.[ch] *.in ../${tempdir}/oldXMenu
523 ln README ChangeLog ../${tempdir}/oldXMenu)
524
525 echo "Making links to \`lwlib'"
526 (cd lwlib
527 ln *.[ch] *.in ../${tempdir}/lwlib
528 ln README ChangeLog ../${tempdir}/lwlib)
529
530 echo "Making links to \`etc'"
531 (cd etc
532 for f in *; do
533 [ -f "$f" ] || continue
534 case "$f" in
535 DOC*) continue ;;
536 esac
537 ln $f ../${tempdir}/etc
538 done)
539
540 for dir in etc/*/; do
541 case "$dir" in
542 etc/images/) continue ;;
543 esac
544 echo "Making links to \`${dir}'"
545 (cd ${dir}
546 ln * ../../${tempdir}/${dir})
547 done
548
549 echo "Making links to \`etc/images'"
550 (cd etc/images
551 for f in *; do
552 [ -f "$f" ] || continue
553 ln $f ../../${tempdir}/etc/images
554 done)
555
556 for dir in etc/images/*/; do
557 echo "Making links to \`${dir}'"
558 (cd ${dir}
559 for f in *; do
560 [ -f "$f" ] || continue
561 ln $f ../../../${tempdir}/${dir}
562 done
563 )
564 done
565
566 for dir in etc/images/*/*/; do
567 case "$dir" in
568 etc/images/icons/hicolor/) continue ;;
569 esac
570 echo "Making links to \`${dir}'"
571 (cd ${dir}
572 ln `ls -d *` ../../../../${tempdir}/${dir})
573 done
574
575 for dir in etc/images/icons/hicolor/*/apps \
576 etc/images/icons/hicolor/*/mimetypes; do
577 echo "Making links to \`${dir}'"
578 (cd ${dir}
579 ln `ls -d *` ../../../../../../${tempdir}/${dir}
580 cd ../../../../../../${tempdir}/${dir})
581 done
582
583 echo "Making links to \`info'"
584 (cd info
585 ln `find . -type f -print` ../${tempdir}/info)
586
587 echo "Making links to \`doc/emacs'"
588 (cd doc/emacs
589 ln *.texi *.in makefile.w32-in ChangeLog* ../../${tempdir}/doc/emacs)
590
591 echo "Making links to \`doc/misc'"
592 (cd doc/misc
593 ln *.texi *.tex *.in makefile.w32-in gnus-news.el ChangeLog* ../../${tempdir}/doc/misc)
594
595 echo "Making links to \`doc/lispref'"
596 (cd doc/lispref
597 ln *.texi *.in makefile.w32-in README ChangeLog* ../../${tempdir}/doc/lispref
598 ln *.txt *.el spellfile tindex.pl ../../${tempdir}/doc/lispref
599 ln two-volume.make ../../${tempdir}/doc/lispref)
600
601 echo "Making links to \`doc/lispintro'"
602 (cd doc/lispintro
603 ln *.texi *.in makefile.w32-in *.eps *.pdf ../../${tempdir}/doc/lispintro
604 ln README ChangeLog* ../../${tempdir}/doc/lispintro
605 cd ../../${tempdir}/doc/lispintro)
606
607 echo "Making links to \`doc/man'"
608 (cd doc/man
609 ln ChangeLog* *.1 ../../${tempdir}/doc/man
610 cd ../../${tempdir}/doc/man)
611
612 ### It would be nice if they could all be symlinks to top-level copy, but
613 ### you're not supposed to have any symlinks in distribution tar files.
614 echo "Making sure copying notices are all copies of \`COPYING'"
615 for subdir in . etc info leim lib-src lisp lwlib msdos nt src; do
616 rm -f ${tempdir}/${subdir}/COPYING
617 cp COPYING ${tempdir}/${subdir}
618 done
619
620 if [ "${newer}" ]; then
621 echo "Removing files older than $newer"
622 ## We remove .elc files unconditionally, on the theory that anyone picking
623 ## up an incremental distribution already has a running Emacs to byte-compile
624 ## them with.
625 find ${tempparent} \( -name '*.elc' -o ! -newer ${newer} \) -exec rm -f {} \;
626 fi
627
628 ## Don't distribute backups, autosaves, etc.
629 echo "Removing unwanted files"
630 find ${tempparent} \( -name '*~' -o -name '#*#' -o -name '.*ignore' -o -name '=*' -o -name 'TAGS' \) -exec rm -f {} \;
631
632 if [ "${make_tar}" = yes ]; then
633 if [ "${default_gzip}" = "" ]; then
634 echo "Looking for gzip"
635 temppath=`echo $PATH | sed 's/^:/.:/
636 s/::/:.:/g
637 s/:$/:./
638 s/:/ /g'`
639 default_gzip=`(
640 for dir in ${temppath}; do
641 if [ -f ${dir}/gzip ]; then echo 'gzip --best'; exit 0; fi
642 done
643 echo compress
644 )`
645 fi
646 case "${default_gzip}" in
647 bzip2) gzip_extension=.bz2 ;;
648 compress* ) gzip_extension=.Z ;;
649 lzma) gzip_extension=.lzma ;;
650 * ) gzip_extension=.gz ;;
651 esac
652 echo "Creating tar file"
653 (cd ${tempparent} ; tar cvf - ${emacsname} ) \
654 | ${default_gzip} \
655 > ${emacsname}.tar${gzip_extension}
656 fi
657
658 if [ "${clean_up}" = yes ]; then
659 echo "Cleaning up the staging directory"
660 rm -rf ${tempparent}
661 else
662 (cd ${tempparent}; mv ${emacsname} ..)
663 rm -rf ${tempparent}
664 fi
665
666 ### make-dist ends here