make-dist 20.5 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 'Interrupted...cleaning up the staging directory'; rm -rf ${tempparent}; exit 1" 1 2 15
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 lisp 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 \
Miles Bader's avatar
Miles Bader committed
335
	      etc etc/charsets etc/e etc/gnus etc/nxml \
336 337
	      etc/images etc/images/custom etc/images/ezimage etc/images/gnus \
	      etc/images/gud etc/images/icons etc/images/icons/hicolor \
338
	      etc/images/icons/hicolor/*x* etc/images/icons/hicolor/scalable \
339
	      etc/images/icons/hicolor/*/apps etc/images/icons/hicolor/*/mimetypes \
Glenn Morris's avatar
Glenn Morris committed
340
	      etc/images/low-color etc/images/mail etc/images/mpc \
341 342 343
	      etc/images/smilies etc/images/smilies/grayscale \
	      etc/images/smilies/medium etc/images/tree-widget \
	      etc/images/tree-widget/default etc/images/tree-widget/folder \
344
	      etc/refcards etc/schema etc/srecode etc/tutorials info doc doc/emacs \
Dan Nicolaescu's avatar
Dan Nicolaescu committed
345
	      doc/misc doc/man doc/lispref doc/lispintro m4 msdos \
Glenn Morris's avatar
Glenn Morris committed
346 347 348 349 350 351 352
	      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 \
353
	      nextstep/GNUstep/Emacs.base/Resources
354
do
355 356 357
  ## site-lisp for in-place installs (?).
  [ "$subdir" = "site-lisp" ] || [ -d "$subdir" ] || \
      echo "WARNING: $subdir not found, making anyway"
358
  echo "  ${tempdir}/${subdir}"
Jim Blandy's avatar
Jim Blandy committed
359 360 361
  mkdir ${tempdir}/${subdir}
done

362
echo "Making links to \`lisp' and its subdirectories"
363
### Don't distribute site-init.el, site-load.el, or default.el.
Jim Blandy's avatar
Jim Blandy committed
364 365 366
(cd lisp
 ln [a-zA-Z]*.el ../${tempdir}/lisp
 ln [a-zA-Z]*.elc ../${tempdir}/lisp
367 368
 ln ChangeLog ChangeLog.*[0-9] ../${tempdir}/lisp
 ln Makefile.in makefile.w32-in ../${tempdir}/lisp
369
 ln README ../${tempdir}/lisp
370 371 372 373 374 375 376 377 378 379
 (cd ../${tempdir}/lisp
  rm -f site-init site-init.el site-init.elc
  rm -f site-load site-load.el site-load.elc
  rm -f site-start site-start.el site-start.elc
  rm -f default default.el default.elc
  )

 ## Find all subdirs of lisp dir
 for file in `find . -type d -print`; do
   case $file in
380
     . | .. | */=*)
381
       ;;
382 383 384 385 386 387 388 389 390 391
     *)
       if [ -d $file ]; then
	 subdirs="$file $subdirs"
       fi
       ;;
   esac
 done

 for file in $subdirs; do
   echo "  lisp/$file"
392
   mkdir -p ../${tempdir}/lisp/$file
393 394
   ln $file/[a-zA-Z0-9]*.el ../${tempdir}/lisp/$file
   ln $file/[a-zA-Z0-9]*.elc ../${tempdir}/lisp/$file
395 396
   ## calc/README.prev
   for f in $file/README $file/ChangeLog $file/ChangeLog.*[0-9] \
397
       $file/README.prev; do
398 399
     [ -f $f ] || continue
     ln $f ../${tempdir}/lisp/$file
400
   done
401
 done )
402

403
echo "Making links to \`leim' and its subdirectories"
404
(cd leim
405
 ln makefile.w32-in ../${tempdir}/leim
406
 ln ChangeLog README ../${tempdir}/leim
407
 ln CXTERM-DIC/README CXTERM-DIC/*.tit ../${tempdir}/leim/CXTERM-DIC
408
 ln SKK-DIC/README SKK-DIC/SKK-JISYO.L ../${tempdir}/leim/SKK-DIC
409
 ln MISC-DIC/README MISC-DIC/*.* ../${tempdir}/leim/MISC-DIC
410 411
 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
412
 ln leim-ext.el ../${tempdir}/leim/leim-ext.el
413 414
 ## Lisp files that start with a capital (also 4Corner.el) are
 ## generated from TIT dictionaries so we don't distribute them.
415 416 417 418
 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.*
419
 rm -f ../${tempdir}/leim/quail/tsang-cns.*)
420

421
echo "Making links to \`src'"
422
### Don't distribute =*.[ch] files, or the configured versions of
423
### config.in, paths.in, or Makefile.in, or TAGS.
Jim Blandy's avatar
Jim Blandy committed
424
(cd src
425
 echo "  (It is ok if ln fails in some cases.)"
426
 ln [a-zA-Z]*.[chm] ../${tempdir}/src
427
 ln [a-zA-Z]*.in ../${tempdir}/src
428
 ln [a-zA-Z]*.mk ../${tempdir}/src
429
 ln README ChangeLog ChangeLog.*[0-9] ../${tempdir}/src
430
 ln makefile.w32-in ../${tempdir}/src
431
 ln .gdbinit .dbxinit ../${tempdir}/src
Jim Blandy's avatar
Jim Blandy committed
432
 cd ../${tempdir}/src
433
 rm -f config.h epaths.h Makefile buildobj.h)
Jim Blandy's avatar
Jim Blandy committed
434

435
echo "Making links to \`src/bitmaps'"
436 437 438
(cd src/bitmaps
 ln README *.xbm ../../${tempdir}/src/bitmaps)

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

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

447
echo "Making links to \`lib-src'"
Jim Blandy's avatar
Jim Blandy committed
448
(cd lib-src
449
 ln [a-zA-Z]*.[ch] ../${tempdir}/lib-src
450
 ln ChangeLog Makefile.in README testfile vcdiff ../${tempdir}/lib-src
451
 ln grep-changelog rcs2log rcs-checkin ../${tempdir}/lib-src
452
 ln makefile.w32-in ../${tempdir}/lib-src
Eric S. Raymond's avatar
Eric S. Raymond committed
453
 cd ../${tempdir}/lib-src
454
 rm -f getopt.h)
Jim Blandy's avatar
Jim Blandy committed
455

456 457 458 459
echo "Making links to \`m4'"
(cd m4
 ln *.m4 ../${tempdir}/m4)

460
echo "Making links to \`nt'"
461
(cd nt
462 463 464 465
 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)
466

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

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

475 476 477 478 479 480 481 482
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)

483 484
echo "Making links to \`nt/icons'"
(cd nt/icons
485
 ln README [a-z]*.ico ../../${tempdir}/nt/icons
486
 ln [a-z]*.cur ../../${tempdir}/nt/icons)
487

488
echo "Making links to \`msdos'"
489
(cd msdos
490
 ln ChangeLog INSTALL README emacs.ico emacs.pif ../${tempdir}/msdos
491
 ln is_exec.c sigaction.c mainmake.v2 sed*.inp ../${tempdir}/msdos)
492

493
## FIXME are DEV-NOTES and FOR-RELEASE appropriate?
Glenn Morris's avatar
Glenn Morris committed
494 495
echo "Making links to \`nextstep'"
(cd nextstep
496
 ln AUTHORS ChangeLog README INSTALL ../${tempdir}/nextstep)
Glenn Morris's avatar
Glenn Morris committed
497 498 499 500 501 502 503

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
504
 ln Credits.html *.icns ../../../../../${tempdir}/nextstep/Cocoa/Emacs.base/Contents/Resources)
Glenn Morris's avatar
Glenn Morris committed
505 506 507 508 509 510 511 512 513 514 515

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
516
 ln Emacs.desktop Info-gnustep.plist README emacs.tiff ../../../../${tempdir}/nextstep/GNUstep/Emacs.base/Resources )
Glenn Morris's avatar
Glenn Morris committed
517

518
echo "Making links to \`oldXMenu'"
Jim Blandy's avatar
Jim Blandy committed
519
(cd oldXMenu
520
 ln *.[ch] *.in ../${tempdir}/oldXMenu
Dan Nicolaescu's avatar
Dan Nicolaescu committed
521
 ln README ChangeLog ../${tempdir}/oldXMenu)
Jim Blandy's avatar
Jim Blandy committed
522

523
echo "Making links to \`lwlib'"
524
(cd lwlib
525
 ln *.[ch] *.in ../${tempdir}/lwlib
Pavel Janík's avatar
Pavel Janík committed
526
 ln README ChangeLog ../${tempdir}/lwlib)
527

528
echo "Making links to \`etc'"
Jim Blandy's avatar
Jim Blandy committed
529
(cd etc
530 531 532 533 534 535 536
 for f in *; do
   [ -f "$f" ] || continue
   case "$f" in
    DOC*) continue ;;
   esac
   ln $f ../${tempdir}/etc
 done)
Jim Blandy's avatar
Jim Blandy committed
537

538 539 540 541
for dir in etc/*/; do
    case "$dir" in
        etc/images/) continue ;;
    esac
542 543
    echo "Making links to \`${dir}'"
    (cd ${dir}
544
     ln * ../../${tempdir}/${dir})
545
done
546

547 548
echo "Making links to \`etc/images'"
(cd etc/images
Glenn Morris's avatar
Glenn Morris committed
549 550 551
 for f in *; do
     [ -f "$f" ] || continue
     ln $f ../../${tempdir}/etc/images
552 553
 done)

554
for dir in etc/images/*/; do
555 556
    echo "Making links to \`${dir}'"
    (cd ${dir}
Glenn Morris's avatar
Glenn Morris committed
557 558 559 560 561
     for f in *; do
         [ -f "$f" ] || continue
         ln $f ../../../${tempdir}/${dir}
     done
     )
562 563
done

564 565 566 567
for dir in etc/images/*/*/; do
    case "$dir" in
        etc/images/icons/hicolor/) continue ;;
    esac
568 569
    echo "Making links to \`${dir}'"
    (cd ${dir}
570
     ln `ls -d *` ../../../../${tempdir}/${dir})
571 572
done

573 574
for dir in etc/images/icons/hicolor/*/apps \
    etc/images/icons/hicolor/*/mimetypes; do
575 576
    echo "Making links to \`${dir}'"
    (cd ${dir}
577
     ln `ls -d *` ../../../../../../${tempdir}/${dir}
578
     cd ../../../../../../${tempdir}/${dir})
579 580
done

581
echo "Making links to \`info'"
582
(cd info
583 584
 ln `find . -type f -print` ../${tempdir}/info)

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

589 590
echo "Making links to \`doc/misc'"
(cd doc/misc
591 592
 ln *.texi *.tex *.in makefile.w32-in gnus-news.el ChangeLog* ../../${tempdir}/doc/misc)

593 594
echo "Making links to \`doc/lispref'"
(cd doc/lispref
595
 ln *.texi *.in makefile.w32-in README ChangeLog* ../../${tempdir}/doc/lispref
596
 ln *.txt *.el spellfile tindex.pl ../../${tempdir}/doc/lispref
597
 ln two-volume.make ../../${tempdir}/doc/lispref)
598

599 600
echo "Making links to \`doc/lispintro'"
(cd doc/lispintro
601 602 603
 ln *.texi *.in makefile.w32-in *.eps *.pdf ../../${tempdir}/doc/lispintro
 ln README ChangeLog* ../../${tempdir}/doc/lispintro
 cd ../../${tempdir}/doc/lispintro)
604

605 606
echo "Making links to \`doc/man'"
(cd doc/man
607 608
 ln ChangeLog* *.1 ../../${tempdir}/doc/man
 cd ../../${tempdir}/doc/man)
609

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

Eric S. Raymond's avatar
Eric S. Raymond committed
618
if [ "${newer}" ]; then
619
  echo "Removing files older than $newer"
620 621 622
  ## 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
623 624 625
  find ${tempparent} \( -name '*.elc' -o ! -newer ${newer} \) -exec rm -f {} \;
fi

626 627 628 629
## 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
630
if [ "${make_tar}" = yes ]; then
631
  if [ "${default_gzip}" = "" ]; then
632
    echo "Looking for gzip"
633 634 635 636 637 638 639 640 641 642 643
    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
644
  case "${default_gzip}" in
645
    bzip2)      gzip_extension=.bz2 ;;
646
    compress* ) gzip_extension=.Z ;;
647
    lzma)       gzip_extension=.lzma ;;
648
    * )         gzip_extension=.gz ;;
649
  esac
650
  echo "Creating tar file"
651 652 653
  (cd ${tempparent} ; tar cvf - ${emacsname} ) \
    | ${default_gzip} \
    > ${emacsname}.tar${gzip_extension}
Jim Blandy's avatar
Jim Blandy committed
654
fi
Jim Blandy's avatar
Jim Blandy committed
655

Jim Blandy's avatar
Jim Blandy committed
656
if [ "${clean_up}" = yes ]; then
657
  echo "Cleaning up the staging directory"
658
  rm -rf ${tempparent}
659
else
660
  (cd ${tempparent}; mv ${emacsname} ..)
661
  rm -rf ${tempparent}
Jim Blandy's avatar
Jim Blandy committed
662
fi
Eric S. Raymond's avatar
Eric S. Raymond committed
663

664
### make-dist ends here