make-dist 18 KB
Newer Older
Jim Blandy's avatar
Jim Blandy committed
1
#!/bin/sh
2
### make-dist: create an Emacs distribution tar file from current srcdir
3

4 5
## Copyright (C) 1995, 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005,
##   2006, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
Jim Blandy's avatar
Jim Blandy committed
6

7
## This file is part of GNU Emacs.
8

9 10 11 12
## GNU Emacs is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
13

14 15 16 17
## GNU Emacs is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.
18

19 20
## You should have received a copy of the GNU General Public License
## along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
21

22 23 24 25 26 27 28 29
### Commentary:

## This basically creates a duplicate directory structure, and then
## hard links into it only those files that should be distributed.
## This means that if you add a file with an odd name, you should make
## sure that this script will include it.

### Code:
Karl Heuer's avatar
Karl Heuer committed
30

Jim Blandy's avatar
Jim Blandy committed
31 32
progname="$0"

33
### Exit if a command fails.
34
#set -e
Jim Blandy's avatar
Jim Blandy committed
35

36
### Print out each line we read, for debugging's sake.
37
#set -v
Jim Blandy's avatar
Jim Blandy committed
38

39 40 41 42 43 44
LANGUAGE=C
LC_ALL=C
LC_MESSAGES=
LANG=
export LANGUAGE LC_ALL LC_MESSAGES LANG

45
## Don't restrict access to any files.
46 47
umask 0

48
update=yes
Richard M. Stallman's avatar
Richard M. Stallman committed
49
check=yes
50 51
clean_up=no
make_tar=no
Eric S. Raymond's avatar
Eric S. Raymond committed
52
newer=""
Jim Blandy's avatar
Jim Blandy committed
53 54 55

while [ $# -gt 0 ]; do
  case "$1" in
56 57 58 59
    ## This option tells make-dist to delete the staging directory
    ## when done.  It is useless to use this unless you make a tar file.
    "--clean-up" )
      clean_up=yes
Jim Blandy's avatar
Jim Blandy committed
60
    ;;
61 62 63
    ## This option tells make-dist to make a tar file.
    "--tar" )
      make_tar=yes
Jim Blandy's avatar
Jim Blandy committed
64
    ;;
65 66 67 68
    ## This option tells make-dist not to recompile or do analogous things.
    "--no-update" )
      update=no
    ;;
Richard M. Stallman's avatar
Richard M. Stallman committed
69 70 71 72
    ## This option says don't check for bad file names, etc.
    "--no-check" )
      check=no
    ;;
73
    ## This option tells make-dist to make the distribution normally, then
74 75
    ## remove all files older than the given timestamp file.  This is useful
    ## for creating incremental or patch distributions.
Eric S. Raymond's avatar
Eric S. Raymond committed
76
    "--newer")
Jim Blandy's avatar
Jim Blandy committed
77 78
      newer="$2"
      new_extension=".new"
Eric S. Raymond's avatar
Eric S. Raymond committed
79 80
      shift
    ;;
81 82 83 84 85
    ## This option tells make-dist to use `compress' instead of gzip.
    ## Normally, make-dist uses gzip whenever it is present.
    "--compress")
      default_gzip="compress"
    ;;
86 87 88 89
    ## Same with bzip2.
    "--bzip2")
      default_gzip="bzip2"
    ;;
90 91 92 93
    ## Same with lzma.
    "--lzma")
      default_gzip="lzma"
    ;;
94 95 96 97 98 99 100 101 102 103 104

    "--snapshot")
      clean_up=yes
      make_tar=yes
      update=no
      check=no
     ;;

    "--help")
      echo "Usage: ${progname} [options]"
      echo ""
105
      echo "  --bzip2	use bzip2 instead of gzip"
106 107
      echo "  --clean-up	delete staging directories when done"
      echo "  --compress	use compress instead of gzip"
108
      echo "  --lzma	use lzma instead of gzip"
109 110 111 112 113 114 115 116 117
      echo "  --newer=TIME	don't include files older than TIME"
      echo "  --no-check	don't check for bad file names etc."
      echo "  --no-update	don't recompile or do analogous things"
      echo "  --snapshot	same as --clean-up --no-update --tar --no-check"
      echo "  --tar		make a tar file"
      echo ""
      exit 0
    ;;

Jim Blandy's avatar
Jim Blandy committed
118 119 120 121 122 123 124 125
    * )
      echo "${progname}: Unrecognized argument: $1" >&2
      exit 1
    ;;
  esac
  shift
done

126
### Make sure we're running in the right place.
127 128
if [ ! -d src -o ! -f src/lisp.h -o ! -d lisp -o ! -f lisp/subr.el ]; then
  echo "${progname}: Can't find \`src/lisp.h' and \`lisp/subr.el'." >&2
Eric S. Raymond's avatar
Eric S. Raymond committed
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
Jim Blandy's avatar
Jim Blandy committed
131 132 133
  exit 1
fi

134
### Find where to run Emacs.
135
### (Accept only absolute file names.)
136 137
if [ $update = yes ];
then
138
  unset EMACS_UNIBYTE
139 140 141 142
  if [ -f src/emacs ];
  then
    EMACS=`pwd`/src/emacs
  else
143 144 145 146
    case $EMACS in
      /*) ;;
      *)
	if [ ! -f "$EMACS" ]; then
Glenn Morris's avatar
Glenn Morris committed
147
	  echo "$0: You must set the EMACS environment variable " \
148 149 150 151
	       "to an absolute file name." 2>&1
	  exit 1
	fi;;
    esac
152 153 154
  fi
fi

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 \
Richard M. Stallman's avatar
Richard M. Stallman committed
159
	 | sed -e 's/^[^"]*"\([^"]*\)".*$/\1/'`
Jim Blandy's avatar
Jim Blandy committed
160
if [ ! "${version}" ]; then
161
  echo "${progname}: can't find current Emacs version in \`./src/emacs.c'" >&2
Jim Blandy's avatar
Jim Blandy committed
162 163 164
  exit 1
fi

165
echo Version numbers are $version and $shortversion
166

167 168
if [ $update = yes ];
then
169
  if grep -s "@set EMACSVER  *${shortversion}" ./doc/emacs/emacsver.texi > /dev/null; then
170 171
    true
  else
172
    echo "You must update the version number in \`./doc/emacs/emacsver.texi'"
173 174
    sleep 5
  fi
175 176
fi

177 178 179 180 181 182 183 184 185 186
### Make sure we don't already have a directory  emacs-${version}.

emacsname="emacs-${version}${new_extension}"

if [ -d ${emacsname} ]
then
  echo Directory "${emacsname}" already exists >&2
  exit 1
fi

187
### Make sure the subdirectory is available.
Eric S. Raymond's avatar
Eric S. Raymond committed
188
tempparent="make-dist.tmp.$$"
Jim Blandy's avatar
Jim Blandy committed
189
if [ -d ${tempparent} ]; then
Eric S. Raymond's avatar
Eric S. Raymond committed
190 191 192 193 194
  echo "${progname}: staging directory \`${tempparent}' already exists.
Perhaps a previous invocation of \`${progname}' failed to clean up after
itself.  Check that directories whose names are of the form
\`make-dist.tmp.NNNNN' don't contain any important information, remove
them, and try again." >&2
Jim Blandy's avatar
Jim Blandy committed
195 196 197
  exit 1
fi

Richard M. Stallman's avatar
Richard M. Stallman committed
198 199 200 201
### Find where to run Emacs.
if [ $check = yes ];
then
  ### 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 204
	lisp/[a-z]*/[a-z]*/[a-zA-Z0-9]*.el \
	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 208
	lisp/[a-z]*/[a-z]*/[a-zA-Z0-9]*.elc \
	lisp/[a-z]*/[a-z]*/[a-z]*/[a-zA-Z0-9]*.elc \
209
	leim/[a-z]*/[a-z]*.elc > /tmp/elc
Richard M. Stallman's avatar
Richard M. Stallman committed
210 211 212 213
  bogosities="`comm -13 /tmp/el /tmp/elc`"
  if [ "${bogosities}" != "" ]; then
    echo "The following .elc files have no corresponding .el files:"
    echo "${bogosities}"
214
  fi
Richard M. Stallman's avatar
Richard M. Stallman committed
215 216 217
  rm -f /tmp/el /tmp/elc

  ### 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 220
	lisp/[a-z]*/[a-z]*/[a-zA-Z0-9]*.el \
	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 224
	lisp/[a-z]*/[a-z]*/[a-zA-Z0-9]*.el \
	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
Richard M. Stallman's avatar
Richard M. Stallman committed
226 227 228
  losers="`comm -23 /tmp/el /tmp/elc`"
  bogosities=
  for file in $losers; do
229
    if ! grep -q "no-byte-compile: t" $file; then
Richard M. Stallman's avatar
Richard M. Stallman committed
230 231 232 233 234 235 236 237 238 239 240 241 242 243
      case $file in
	site-init.el | site-load.el | site-start.el | default.el)
	  ;;
	*)
	  bogosities="$file $bogosities"
	  ;;
      esac
    fi
  done
  if [ x"${bogosities}" != x"" ]; then
    echo "The following .el files have no corresponding .elc files:"
    echo "${bogosities}"
  fi
  rm -f /tmp/el /tmp/elc
Karl Heuer's avatar
Karl Heuer committed
244 245
fi

246
### Make sure configure is newer than configure.in.
247
if [ "x`ls -t configure configure.in | sed q`" != "xconfigure" ]; then
248 249
  echo "\`./configure.in' is newer than \`./configure'" >&2
  echo "Running autoconf" >&2
250
  autoconf || { x=$?; echo Autoconf FAILED! >&2; exit $x; }
251 252
fi

253
### Make sure src/stamp-h.in is newer than configure.in.
Andreas Schwab's avatar
Andreas Schwab committed
254 255 256 257 258 259 260 261
if [ "x`ls -t src/stamp-h.in configure.in | sed q`" != "xsrc/stamp-h.in" ]; then
  echo "\`./configure.in' is newer than \`./src/stamp-h.in'" >&2
  echo "Running autoheader" >&2
  autoheader || { x=$?; echo Autoheader FAILED! >&2; exit $x; }
  rm -f src/stamp-h.in
  echo timestamp > src/stamp-h.in
fi

262 263 264
if [ $update = yes ];
then
  echo "Updating Info files"
265 266 267 268
  (cd doc/emacs; make info)
  (cd doc/misc; make info)
  (cd doc/lispref; make info)
  (cd doc/lispintro; make info)
Richard M. Stallman's avatar
Richard M. Stallman committed
269

270
  echo "Updating finder, custom and autoload data"
271
  (cd lisp; make updates EMACS="$EMACS")
272

273 274 275 276
  if test -f leim/leim-list.el; then
    echo "Updating leim-list.el"
    (cd leim; make leim-list.el EMACS="$EMACS")
  fi
277 278 279

  echo "Recompiling Lisp files"
  $EMACS -batch -f batch-byte-recompile-directory lisp leim
280
fi
Richard M. Stallman's avatar
Richard M. Stallman committed
281

282 283
## What is this file for?  It goes in srcdir, not the tarfile.
## Why does it exclude term/ ?
Karl Heuer's avatar
Karl Heuer committed
284 285
echo "Making lisp/MANIFEST"

286 287 288 289 290 291 292
files=`find lisp -type f -name '*.el'`
for file in $files; do
   case "$file" in
     */subdirs.el|*/default.el|*/loaddefs.el|*/term/*) continue ;;
   esac
   sed -n 's/^;;; //p; q' $file
done | sort > lisp/MANIFEST
Karl Heuer's avatar
Karl Heuer committed
293

Eric S. Raymond's avatar
Eric S. Raymond committed
294
echo "Creating staging directory: \`${tempparent}'"
295

Jim Blandy's avatar
Jim Blandy committed
296 297 298
mkdir ${tempparent}
tempdir="${tempparent}/${emacsname}"

299 300
### This trap ensures that the staging directory will be cleaned up even
### when the script is interrupted in mid-career.
Eric S. Raymond's avatar
Eric S. Raymond committed
301
if [ "${clean_up}" = yes ]; then
302
  trap "echo 'Cleaning up the staging directory'; rm -rf ${tempparent}" EXIT
Eric S. Raymond's avatar
Eric S. Raymond committed
303 304
fi

Eric S. Raymond's avatar
Eric S. Raymond committed
305
echo "Creating top directory: \`${tempdir}'"
Jim Blandy's avatar
Jim Blandy committed
306 307
mkdir ${tempdir}

308 309 310 311
### We copy in the top-level files before creating the subdirectories in
### hopes that this will make the top-level files appear first in the
### tar file; this means that people can start reading the INSTALL and
### README while the rest of the tar file is still unpacking.  Whoopee.
312
echo "Making links to top-level files"
313
ln INSTALL README BUGS move-if-change ${tempdir}
314
ln ChangeLog Makefile.in configure configure.in ${tempdir}
315
ln config.bat make-dist update-subdirs vpath.sed .dir-locals.el ${tempdir}
316
ln mkinstalldirs config.sub config.guess install-sh ${tempdir}
Jim Blandy's avatar
Jim Blandy committed
317

318 319
## FIXME why do we bother doing this? set-version in admin/admin.el
## does this, and more besides.
320
echo "Updating version number in README"
321 322 323 324 325
(cd ${tempdir}
 awk \
   '$1 " " $2 " " $3 " " $4 " " $5 == "This directory tree holds version" { $6 = version; print $0 }
    $1 " " $2 " " $3 " " $4 " " $5 != "This directory tree holds version"' \
   version=${version} README > tmp.README
326
 mv -f tmp.README README)
327 328


329
echo "Creating subdirectories"
330
for subdir in site-lisp \
Pavel Janík's avatar
Pavel Janík committed
331
	      leim leim/CXTERM-DIC leim/MISC-DIC \
332
	      leim/SKK-DIC leim/ja-dic leim/quail \
333
	      src src/m src/s src/bitmaps lib-src oldXMenu lwlib \
334
	      nt nt/inc nt/inc/sys nt/inc/arpa nt/inc/netinet nt/icons \
335 336 337
	      `find etc lisp -type d` \
	      doc doc/emacs doc/misc doc/man doc/lispref doc/lispintro \
	      info m4 msdos \
Glenn Morris's avatar
Glenn Morris committed
338 339 340 341 342 343 344
	      nextstep nextstep/Cocoa nextstep/Cocoa/Emacs.base \
	      nextstep/Cocoa/Emacs.base/Contents \
	      nextstep/Cocoa/Emacs.base/Contents/Resources \
	      nextstep/Cocoa/Emacs.base/Contents/Resources/English.lproj \
	      nextstep/Cocoa/Emacs.xcodeproj \
	      nextstep/GNUstep \
	      nextstep/GNUstep/Emacs.base \
345
	      nextstep/GNUstep/Emacs.base/Resources
346
do
347 348 349
  ## site-lisp for in-place installs (?).
  [ "$subdir" = "site-lisp" ] || [ -d "$subdir" ] || \
      echo "WARNING: $subdir not found, making anyway"
350
  echo "  ${tempdir}/${subdir}"
Jim Blandy's avatar
Jim Blandy committed
351 352 353
  mkdir ${tempdir}/${subdir}
done

354
echo "Making links to \`lisp' and its subdirectories"
355 356 357
files=`find lisp \( -name '*.el' -o -name '*.elc' -o -name 'ChangeLog*' \
 -o -name 'README*' \)`

358
### Don't distribute site-init.el, site-load.el, or default.el.
359 360 361 362 363 364
for file in lisp/Makefile.in lisp/makefile.w32-in $files; do
  case $file in
    */site-init*|*/site-load*|*/default*) continue ;;
  esac
  ln $file $tempdir/$file
done
365

366
echo "Making links to \`leim' and its subdirectories"
367
(cd leim
368
 ln makefile.w32-in ../${tempdir}/leim
369
 ln ChangeLog README ../${tempdir}/leim
370
 ln CXTERM-DIC/README CXTERM-DIC/*.tit ../${tempdir}/leim/CXTERM-DIC
371
 ln SKK-DIC/README SKK-DIC/SKK-JISYO.L ../${tempdir}/leim/SKK-DIC
372
 ln MISC-DIC/README MISC-DIC/*.* ../${tempdir}/leim/MISC-DIC
373 374
 ln ja-dic/*.el ja-dic/*.elc ../${tempdir}/leim/ja-dic
 ln Makefile.in ../${tempdir}/leim/Makefile.in
Kenichi Handa's avatar
Kenichi Handa committed
375
 ln leim-ext.el ../${tempdir}/leim/leim-ext.el
376 377
 ## Lisp files that start with a capital (also 4Corner.el) are
 ## generated from TIT dictionaries so we don't distribute them.
378 379 380 381
 ln quail/[a-z]*.el quail/[a-z]*.elc ../${tempdir}/leim/quail
 rm -f ../${tempdir}/leim/quail/quick-b5.*
 rm -f ../${tempdir}/leim/quail/quick-cns.*
 rm -f ../${tempdir}/leim/quail/tsang-b5.*
382
 rm -f ../${tempdir}/leim/quail/tsang-cns.*)
383

384
echo "Making links to \`src'"
385 386
### Don't distribute the configured versions of
### config.in, paths.in, buildobj.h, or Makefile.in.
Jim Blandy's avatar
Jim Blandy committed
387
(cd src
388
 echo "  (It is ok if ln fails in some cases.)"
389
 ln [a-zA-Z]*.[chm] ../${tempdir}/src
390
 ln [a-zA-Z]*.in ../${tempdir}/src
391
 ln [a-zA-Z]*.mk ../${tempdir}/src
392
 ln README ChangeLog ChangeLog.*[0-9] ../${tempdir}/src
393
 ln makefile.w32-in ../${tempdir}/src
394
 ln .gdbinit .dbxinit ../${tempdir}/src
Jim Blandy's avatar
Jim Blandy committed
395
 cd ../${tempdir}/src
396
 rm -f config.h epaths.h Makefile buildobj.h)
Jim Blandy's avatar
Jim Blandy committed
397

398
echo "Making links to \`src/bitmaps'"
399 400 401
(cd src/bitmaps
 ln README *.xbm ../../${tempdir}/src/bitmaps)

402
echo "Making links to \`src/m'"
Jim Blandy's avatar
Jim Blandy committed
403
(cd src/m
404
 ln README [a-zA-Z0-9]*.h ../../${tempdir}/src/m)
Jim Blandy's avatar
Jim Blandy committed
405

406
echo "Making links to \`src/s'"
Jim Blandy's avatar
Jim Blandy committed
407
(cd src/s
408
 ln README [a-zA-Z0-9]*.h ../../${tempdir}/src/s)
Jim Blandy's avatar
Jim Blandy committed
409

410
echo "Making links to \`lib-src'"
Jim Blandy's avatar
Jim Blandy committed
411
(cd lib-src
412
 ln [a-zA-Z]*.[ch] ../${tempdir}/lib-src
413
 ln ChangeLog Makefile.in README testfile vcdiff ../${tempdir}/lib-src
414
 ln grep-changelog rcs2log rcs-checkin ../${tempdir}/lib-src
415
 ln makefile.w32-in ../${tempdir}/lib-src
Eric S. Raymond's avatar
Eric S. Raymond committed
416
 cd ../${tempdir}/lib-src
417
 rm -f getopt.h)
Jim Blandy's avatar
Jim Blandy committed
418

419 420 421 422
echo "Making links to \`m4'"
(cd m4
 ln *.m4 ../${tempdir}/m4)

423
echo "Making links to \`nt'"
424
(cd nt
425 426 427 428
 ln emacs.manifest emacs.rc emacsclient.rc config.nt ../${tempdir}/nt
 ln emacs-src.tags nmake.defs gmake.defs subdirs.el ../${tempdir}/nt
 ln [a-z]*.bat [a-z]*.[ch] ../${tempdir}/nt
 ln ChangeLog INSTALL README README.W32 makefile.w32-in ../${tempdir}/nt)
429

430
echo "Making links to \`nt/inc'"
431
(cd nt/inc
432
 ln [a-z]*.h ../../${tempdir}/nt/inc)
433

434
echo "Making links to \`nt/inc/sys'"
435
(cd nt/inc/sys
436
 ln [a-z]*.h ../../../${tempdir}/nt/inc/sys)
437

438 439 440 441 442 443 444 445
echo "Making links to \`nt/inc/arpa'"
(cd nt/inc/arpa
 ln [a-z]*.h ../../../${tempdir}/nt/inc/arpa)

echo "Making links to \`nt/inc/netinet'"
(cd nt/inc/netinet
 ln [a-z]*.h ../../../${tempdir}/nt/inc/netinet)

446 447
echo "Making links to \`nt/icons'"
(cd nt/icons
448
 ln README [a-z]*.ico ../../${tempdir}/nt/icons
449
 ln [a-z]*.cur ../../${tempdir}/nt/icons)
450

451
echo "Making links to \`msdos'"
452
(cd msdos
453
 ln ChangeLog INSTALL README emacs.ico emacs.pif ../${tempdir}/msdos
454
 ln is_exec.c sigaction.c mainmake.v2 sed*.inp ../${tempdir}/msdos)
455

Glenn Morris's avatar
Glenn Morris committed
456 457
echo "Making links to \`nextstep'"
(cd nextstep
458
 ln AUTHORS ChangeLog README INSTALL ../${tempdir}/nextstep)
Glenn Morris's avatar
Glenn Morris committed
459 460 461 462 463 464 465

echo "Making links to \`nextstep/Cocoa/Emacs.base/Contents'"
(cd nextstep/Cocoa/Emacs.base/Contents
 ln Info.plist PkgInfo ../../../../${tempdir}/nextstep/Cocoa/Emacs.base/Contents)

echo "Making links to \`nextstep/Cocoa/Emacs.base/Contents/Resources'"
(cd nextstep/Cocoa/Emacs.base/Contents/Resources
Glenn Morris's avatar
Glenn Morris committed
466
 ln Credits.html *.icns ../../../../../${tempdir}/nextstep/Cocoa/Emacs.base/Contents/Resources)
Glenn Morris's avatar
Glenn Morris committed
467 468 469 470 471 472 473 474 475 476 477

echo "Making links to \`nextstep/Cocoa/Emacs.base/Contents/Resources/English.lproj'"
(cd nextstep/Cocoa/Emacs.base/Contents/Resources/English.lproj
 ln InfoPlist.strings ../../../../../../${tempdir}/nextstep/Cocoa/Emacs.base/Contents/Resources/English.lproj)

echo "Making links to \`nextstep/Cocoa/Emacs.xcodeproj'"
(cd nextstep/Cocoa/Emacs.xcodeproj
 ln project.pbxproj ../../../${tempdir}/nextstep/Cocoa/Emacs.xcodeproj)

echo "Making links to \`nextstep/GNUstep/Emacs.base/Resources'"
(cd nextstep/GNUstep/Emacs.base/Resources
Glenn Morris's avatar
Glenn Morris committed
478
 ln Emacs.desktop Info-gnustep.plist README emacs.tiff ../../../../${tempdir}/nextstep/GNUstep/Emacs.base/Resources )
Glenn Morris's avatar
Glenn Morris committed
479

480
echo "Making links to \`oldXMenu'"
Jim Blandy's avatar
Jim Blandy committed
481
(cd oldXMenu
482
 ln *.[ch] *.in ../${tempdir}/oldXMenu
Dan Nicolaescu's avatar
Dan Nicolaescu committed
483
 ln README ChangeLog ../${tempdir}/oldXMenu)
Jim Blandy's avatar
Jim Blandy committed
484

485
echo "Making links to \`lwlib'"
486
(cd lwlib
487
 ln *.[ch] *.in ../${tempdir}/lwlib
Pavel Janík's avatar
Pavel Janík committed
488
 ln README ChangeLog ../${tempdir}/lwlib)
489

490 491 492 493 494
echo "Making links to \`etc' and its subdirectories"
for f in `find etc -type f`; do
  case $f in
    etc/DOC*) continue ;;
  esac
495
  ln $f $tempdir/$f
496 497
done

498
echo "Making links to \`info'"
499
(cd info
500 501
 ln `find . -type f -print` ../${tempdir}/info)

502 503
echo "Making links to \`doc/emacs'"
(cd doc/emacs
504
 ln *.texi *.in makefile.w32-in ChangeLog* ../../${tempdir}/doc/emacs)
Jim Blandy's avatar
Jim Blandy committed
505

506 507
echo "Making links to \`doc/misc'"
(cd doc/misc
508 509
 ln *.texi *.tex *.in makefile.w32-in gnus-news.el ChangeLog* ../../${tempdir}/doc/misc)

510 511
echo "Making links to \`doc/lispref'"
(cd doc/lispref
512
 ln *.texi *.in makefile.w32-in README ChangeLog* ../../${tempdir}/doc/lispref
513
 ln *.txt *.el spellfile tindex.pl ../../${tempdir}/doc/lispref
514
 ln two-volume.make ../../${tempdir}/doc/lispref)
515

516 517
echo "Making links to \`doc/lispintro'"
(cd doc/lispintro
518 519 520
 ln *.texi *.in makefile.w32-in *.eps *.pdf ../../${tempdir}/doc/lispintro
 ln README ChangeLog* ../../${tempdir}/doc/lispintro
 cd ../../${tempdir}/doc/lispintro)
521

522 523
echo "Making links to \`doc/man'"
(cd doc/man
524 525
 ln ChangeLog* *.1 ../../${tempdir}/doc/man
 cd ../../${tempdir}/doc/man)
526

Pavel Janík's avatar
Pavel Janík committed
527
### It would be nice if they could all be symlinks to top-level copy, but
528
### you're not supposed to have any symlinks in distribution tar files.
529
echo "Making sure copying notices are all copies of \`COPYING'"
530
for subdir in . etc info leim lib-src lisp lwlib msdos nt src; do
531
  rm -f ${tempdir}/${subdir}/COPYING
532
  cp COPYING ${tempdir}/${subdir}
Jim Blandy's avatar
Jim Blandy committed
533 534
done

Eric S. Raymond's avatar
Eric S. Raymond committed
535
if [ "${newer}" ]; then
536
  echo "Removing files older than $newer"
537 538 539
  ## We remove .elc files unconditionally, on the theory that anyone picking
  ## up an incremental distribution already has a running Emacs to byte-compile
  ## them with.
Eric S. Raymond's avatar
Eric S. Raymond committed
540 541 542
  find ${tempparent} \( -name '*.elc' -o ! -newer ${newer} \) -exec rm -f {} \;
fi

543 544 545 546
## Don't distribute backups, autosaves, etc.
echo "Removing unwanted files"
find ${tempparent} \( -name '*~' -o -name '#*#' -o -name '.*ignore' -o -name '=*' -o -name 'TAGS' \) -exec rm -f {} \;

Jim Blandy's avatar
Jim Blandy committed
547
if [ "${make_tar}" = yes ]; then
548
  if [ "${default_gzip}" = "" ]; then
549
    echo "Looking for gzip"
550 551 552 553 554 555 556 557 558 559 560
    temppath=`echo $PATH | sed 's/^:/.:/
				s/::/:.:/g
				s/:$/:./
				s/:/ /g'`
    default_gzip=`(
      for dir in ${temppath}; do
	if [ -f ${dir}/gzip ]; then echo 'gzip --best'; exit 0; fi
      done
      echo compress
    )`
  fi
561
  case "${default_gzip}" in
562
    bzip2)      gzip_extension=.bz2 ;;
563
    compress* ) gzip_extension=.Z ;;
564
    lzma)       gzip_extension=.lzma ;;
565
    * )         gzip_extension=.gz ;;
566
  esac
567
  echo "Creating tar file"
568 569 570
  (cd ${tempparent} ; tar cvf - ${emacsname} ) \
    | ${default_gzip} \
    > ${emacsname}.tar${gzip_extension}
Jim Blandy's avatar
Jim Blandy committed
571
fi
Jim Blandy's avatar
Jim Blandy committed
572

573
if [ "${clean_up}" != yes ]; then
574
  (cd ${tempparent}; mv ${emacsname} ..)
575
  rm -rf ${tempparent}
Jim Blandy's avatar
Jim Blandy committed
576
fi
Eric S. Raymond's avatar
Eric S. Raymond committed
577

578
### make-dist ends here