make-dist 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653
  1. #!/bin/sh
  2. ### make-dist: create an Emacs distribution tar file from current srcdir
  3. ## Copyright (C) 1995, 1997-1998, 2000-2017 Free Software Foundation,
  4. ## Inc.
  5. ## This file is part of GNU Emacs.
  6. ## GNU Emacs is free software: you can redistribute it and/or modify
  7. ## it under the terms of the GNU General Public License as published by
  8. ## the Free Software Foundation, either version 3 of the License, or
  9. ## (at your option) any later version.
  10. ## GNU Emacs is distributed in the hope that it will be useful,
  11. ## but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ## GNU General Public License for more details.
  14. ## You should have received a copy of the GNU General Public License
  15. ## along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
  16. ### Commentary:
  17. ## This basically creates a duplicate directory structure, and then
  18. ## hard links into it only those files that should be distributed.
  19. ## This means that if you add a file with an odd name, you should make
  20. ## sure that this script will include it.
  21. ### Code:
  22. progname="$0"
  23. ### Exit if a command fails.
  24. #set -e
  25. ### Print out each line we read, for debugging's sake.
  26. #set -v
  27. LANGUAGE=C
  28. LC_ALL=C
  29. LC_MESSAGES=
  30. LANG=
  31. export LANGUAGE LC_ALL LC_MESSAGES LANG
  32. ## Remove unnecessary restrictions on file access.
  33. umask 022
  34. update=yes
  35. check=yes
  36. clean_up=no
  37. make_tar=no
  38. default_gzip=gzip
  39. newer=""
  40. with_tests=no
  41. changelog=yes
  42. verbose=no
  43. while [ $# -gt 0 ]; do
  44. case "$1" in
  45. ## This option tells make-dist to delete the staging directory
  46. ## when done. It is useless to use this unless you make a tar file.
  47. "--clean-up" )
  48. clean_up=yes
  49. ;;
  50. ## This option tells make-dist to make a tar file.
  51. "--tar" )
  52. make_tar=yes
  53. ;;
  54. ## This option tells make-dist not to recompile or do analogous things.
  55. "--no-update" )
  56. update=no
  57. ;;
  58. ## This option says don't check for bad file names, etc.
  59. "--no-check" )
  60. check=no
  61. ;;
  62. "--no-changelog" )
  63. changelog=no
  64. ;;
  65. ## This option tells make-dist to make the distribution normally, then
  66. ## remove all files older than the given timestamp file. This is useful
  67. ## for creating incremental or patch distributions.
  68. "--newer")
  69. newer="$2"
  70. new_extension=".new"
  71. shift
  72. ;;
  73. ## This option tells make-dist to use 'bzip2' instead of gzip.
  74. "--bzip2")
  75. default_gzip="bzip2"
  76. ;;
  77. ## Same with xz.
  78. "--xz")
  79. default_gzip="xz"
  80. ;;
  81. "--no-compress")
  82. default_gzip="cat"
  83. ;;
  84. "--snapshot")
  85. clean_up=yes
  86. make_tar=yes
  87. update=no
  88. ;;
  89. ## Include the test/ directory.
  90. ## This option is mainly for the hydra build server.
  91. "--tests")
  92. with_tests=yes
  93. ;;
  94. "--verbose")
  95. verbose=yes
  96. ;;
  97. "--help")
  98. printf '%s\n' "Usage: ${progname} [options]"
  99. echo ""
  100. echo " --bzip2 use bzip2 instead of gzip"
  101. echo " --clean-up delete staging directories when done"
  102. echo " --xz use xz instead of gzip"
  103. echo " --no-compress don't compress"
  104. echo " --newer=TIME don't include files older than TIME"
  105. echo " --no-check don't check for bad file names etc."
  106. echo " --no-update don't recompile or do analogous things"
  107. echo " --no-changelog don't generate the top-level ChangeLog"
  108. echo " --snapshot same as --clean-up --no-update --tar --no-check"
  109. echo " --tar make a tar file"
  110. echo " --tests include the test/ directory"
  111. echo " --verbose noisier output"
  112. echo ""
  113. exit 0
  114. ;;
  115. * )
  116. printf '%s\n' "${progname}: Unrecognized argument: $1" >&2
  117. exit 1
  118. ;;
  119. esac
  120. shift
  121. done
  122. ### Make sure we're running in the right place.
  123. if [ ! -d src -o ! -f src/lisp.h -o ! -d lisp -o ! -f lisp/subr.el ]; then
  124. printf '%s\n' "${progname}: Can't find 'src/lisp.h' and 'lisp/subr.el'." >&2
  125. printf '%s\n' "${progname} must be run in the top directory of the Emacs" >&2
  126. printf '%s\n' "distribution tree. cd to that directory and try again." >&2
  127. exit 1
  128. fi
  129. ### Find where to run Emacs.
  130. ### (Accept only absolute file names.)
  131. if [ $update = yes ];
  132. then
  133. if [ -f src/emacs ];
  134. then
  135. EMACS=`pwd`/src/emacs
  136. else
  137. case $EMACS in
  138. /*) ;;
  139. *)
  140. if [ ! -f "$EMACS" ]; then
  141. printf '%s\n' "$0: You must set the EMACS environment variable " \
  142. "to an absolute file name." 2>&1
  143. exit 1
  144. fi;;
  145. esac
  146. fi
  147. fi
  148. ### Find out which version of Emacs this is.
  149. version=`
  150. sed -n 's/^AC_INIT(GNU Emacs,[ ]*\([^ ,)]*\).*/\1/p' <configure.ac
  151. ` || version=
  152. if [ ! "${version}" ]; then
  153. printf '%s\n' \
  154. "${progname}: can't find current Emacs version in './src/emacs.c'" >&2
  155. exit 1
  156. fi
  157. echo Version number is $version
  158. if [ $update = yes ]; then
  159. if ! grep -q "tree holds version *${version}" README; then
  160. echo "WARNING: README has the wrong version number"
  161. echo "Consider running M-x set-version from admin/admin.el"
  162. sleep 5
  163. fi
  164. fi
  165. ### Make sure we don't already have a directory emacs-${version}.
  166. emacsname="emacs-${version}${new_extension}"
  167. if [ -d ${emacsname} ]
  168. then
  169. echo Directory "${emacsname}" already exists >&2
  170. exit 1
  171. fi
  172. ### Make sure the subdirectory is available.
  173. tempparent="make-dist.tmp.$$"
  174. if [ -d ${tempparent} ]; then
  175. printf '%s\n' "${progname}: staging directory '${tempparent}' already exists.
  176. Perhaps a previous invocation of '${progname}' failed to clean up after
  177. itself. Check that directories whose names are of the form
  178. 'make-dist.tmp.NNNNN' don't contain any important information, remove
  179. them, and try again." >&2
  180. exit 1
  181. fi
  182. if [ $check = yes ]; then
  183. echo "Sanity checking (use --no-check to disable this)..."
  184. error=no
  185. ls -1 lisp/[a-zA-Z]*.el lisp/[a-z]*/[a-zA-Z0-9]*.el \
  186. lisp/[a-z]*/[a-z]*/[a-zA-Z0-9]*.el \
  187. lisp/[a-z]*/[a-z]*/[a-z]*/[a-zA-Z0-9]*.el > /tmp/el
  188. ls -1 lisp/[a-zA-Z]*.elc lisp/[a-z]*/[a-zA-Z0-9]*.elc \
  189. lisp/[a-z]*/[a-z]*/[a-zA-Z0-9]*.elc \
  190. lisp/[a-z]*/[a-z]*/[a-z]*/[a-zA-Z0-9]*.elc > /tmp/elc
  191. ## Check for .elc files with no corresponding .el file.
  192. sed 's/\.el$/.elc/' /tmp/el > /tmp/elelc
  193. bogosities=`comm -13 /tmp/elelc /tmp/elc`
  194. if [ x"${bogosities}" != x"" ]; then
  195. error=yes
  196. echo "The following .elc files have no corresponding .el files:"
  197. echo "${bogosities}"
  198. fi
  199. ### Check for .el files with no corresponding .elc file.
  200. sed 's/\.elc$/.el/' /tmp/elc > /tmp/elcel
  201. losers=`comm -23 /tmp/el /tmp/elcel`
  202. bogosities=
  203. while read elc; do
  204. el=`echo $elc | sed 's/c$//'`
  205. [ -e $el ] || continue
  206. [ $elc -nt $el ] || bogosities="$bogosities $elc"
  207. done < /tmp/elc
  208. if [ x"${bogosities}" != x"" ]; then
  209. error=yes
  210. echo "The following .elc files are older than their .el files:"
  211. echo "${bogosities}"
  212. fi
  213. rm -f /tmp/el /tmp/elc /tmp/elcel /tmp/elelc
  214. bogosities=
  215. for file in $losers; do
  216. grep -q "no-byte-compile: t" $file && continue
  217. case $file in
  218. site-init.el | site-load.el | site-start.el | default.el) continue ;;
  219. esac
  220. bogosities="$file $bogosities"
  221. done
  222. if [ x"${bogosities}" != x"" ]; then
  223. error=yes
  224. echo "The following .el files have no corresponding .elc files:"
  225. echo "${bogosities}"
  226. fi
  227. ## This is only a crude check, eg it does not handle .info
  228. ## files with multiple .texi source files.
  229. find doc -name '*.texi' > /tmp/el
  230. bogosities=
  231. while read texi; do
  232. info=`sed -n 's/^@setfilename //p' $texi | sed 's|.*info/||'`
  233. [ x"${info}" != x"" ] || continue
  234. info=info/$info
  235. [ -e $info ] || continue
  236. [ $info -nt $texi ] || bogosities="$bogosities $info"
  237. done < /tmp/el
  238. rm -f /tmp/el
  239. if [ x"${bogosities}" != x"" ]; then
  240. error=yes
  241. echo "The following .info files are older than their .texi files:"
  242. echo "${bogosities}"
  243. fi
  244. ## This exits with non-zero status if any .info files need
  245. ## rebuilding.
  246. if [ -e Makefile ]; then
  247. echo "Checking to see if info files are up-to-date..."
  248. make --question info || error=yes
  249. fi
  250. if [ $error = yes ]; then
  251. echo "Failed checks" >&2
  252. exit 1
  253. fi
  254. fi
  255. if [ $update = yes ]; then
  256. ## Make sure configure is newer than configure.ac, etc.
  257. ## It is better to let autoreconf do what is needed than
  258. ## for us to try and duplicate all its checks.
  259. echo "Running autoreconf"
  260. autoreconf -i -I m4 || { x=$?; echo Autoreconf FAILED! >&2; exit $x; }
  261. ## Make sure src/stamp-h.in is newer than configure.ac.
  262. rm -f src/stamp-h.in
  263. echo timestamp > src/stamp-h.in
  264. echo "Updating Info files"
  265. make info
  266. echo "Updating finder, custom and autoload data"
  267. (cd lisp && make updates EMACS="$EMACS")
  268. echo "Updating leim-list.el"
  269. (cd leim && make leim-list.el EMACS="$EMACS")
  270. echo "Recompiling Lisp files"
  271. $EMACS -batch -f batch-byte-recompile-directory lisp
  272. fi # $update = yes
  273. echo "Creating staging directory: '${tempparent}'"
  274. mkdir ${tempparent}
  275. tempdir="${tempparent}/${emacsname}"
  276. ### This trap ensures that the staging directory will be cleaned up even
  277. ### when the script is interrupted in mid-career.
  278. if [ "${clean_up}" = yes ]; then
  279. trap "echo 'Cleaning up the staging directory'; rm -rf ${tempparent}" EXIT
  280. fi
  281. echo "Creating top directory: '${tempdir}'"
  282. mkdir ${tempdir}
  283. if [ "$changelog" = yes ]; then
  284. if test -e .git; then
  285. echo "Making top-level ChangeLog"
  286. make ChangeLog CHANGELOG=${tempdir}/ChangeLog || \
  287. { x=$?; echo "make ChangeLog FAILED (try --no-changelog?)" >&2; exit $x; }
  288. else
  289. echo "No repository, so omitting top-level ChangeLog"
  290. fi
  291. fi
  292. ### We copy in the top-level files before creating the subdirectories in
  293. ### hopes that this will make the top-level files appear first in the
  294. ### tar file; this means that people can start reading the INSTALL and
  295. ### README while the rest of the tar file is still unpacking. Whoopee.
  296. echo "Making links to top-level files"
  297. ln INSTALL README BUGS ${tempdir}
  298. ln ChangeLog.*[0-9] Makefile.in autogen.sh configure configure.ac ${tempdir}
  299. ln config.bat make-dist .dir-locals.el ${tempdir}
  300. ln aclocal.m4 CONTRIBUTE ${tempdir}
  301. echo "Creating subdirectories"
  302. for subdir in site-lisp \
  303. leim leim/CXTERM-DIC leim/MISC-DIC leim/SKK-DIC \
  304. build-aux build-aux/snippet \
  305. src src/bitmaps lib lib-src oldXMenu lwlib \
  306. nt nt/inc nt/inc/sys nt/inc/arpa nt/inc/netinet nt/icons \
  307. `find etc lisp admin test -type d` \
  308. doc doc/emacs doc/misc doc/man doc/lispref doc/lispintro \
  309. info m4 modules modules/mod-test msdos \
  310. nextstep nextstep/templates \
  311. nextstep/Cocoa nextstep/Cocoa/Emacs.base \
  312. nextstep/Cocoa/Emacs.base/Contents \
  313. nextstep/Cocoa/Emacs.base/Contents/Resources \
  314. nextstep/GNUstep \
  315. nextstep/GNUstep/Emacs.base \
  316. nextstep/GNUstep/Emacs.base/Resources
  317. do
  318. if [ "$with_tests" != "yes" ]; then
  319. case $subdir in
  320. test*|*/mod-test*) continue ;;
  321. esac
  322. fi
  323. ## site-lisp for in-place installs (?).
  324. [ "$subdir" = "site-lisp" ] || [ -d "$subdir" ] || \
  325. echo "WARNING: $subdir not found, making anyway"
  326. [ "$verbose" = "yes" ] && echo " ${tempdir}/${subdir}"
  327. mkdir ${tempdir}/${subdir}
  328. done
  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' \)`
  332. ### Don't distribute site-init.el, site-load.el, or default.el.
  333. for file in lisp/Makefile.in $files; do
  334. case $file in
  335. */site-init*|*/site-load*|*/default*) continue ;;
  336. esac
  337. ln $file $tempdir/$file
  338. done
  339. echo "Making links to 'leim' and its subdirectories"
  340. (cd leim
  341. ln ChangeLog.*[0-9] README ../${tempdir}/leim
  342. ln CXTERM-DIC/README CXTERM-DIC/*.tit ../${tempdir}/leim/CXTERM-DIC
  343. ln SKK-DIC/README SKK-DIC/SKK-JISYO.L ../${tempdir}/leim/SKK-DIC
  344. ln MISC-DIC/README MISC-DIC/*.* ../${tempdir}/leim/MISC-DIC
  345. ln Makefile.in ../${tempdir}/leim/Makefile.in
  346. ln leim-ext.el ../${tempdir}/leim/leim-ext.el)
  347. ## FIXME Can we not just use the "find -type f" method for this one?
  348. echo "Making links to 'build-aux'"
  349. (cd build-aux
  350. ln compile config.guess config.sub depcomp msys-to-w32 ../${tempdir}/build-aux
  351. ln gitlog-to-changelog gitlog-to-emacslog ../${tempdir}/build-aux
  352. ln install-sh missing move-if-change ../${tempdir}/build-aux
  353. ln update-copyright update-subdirs ../${tempdir}/build-aux
  354. ln dir_top make-info-dir ar-lib ../${tempdir}/build-aux)
  355. echo "Making links to 'build-aux/snippet'"
  356. (cd build-aux/snippet
  357. ln *.h ../../${tempdir}/build-aux/snippet)
  358. echo "Making links to 'src'"
  359. ### Don't distribute the configured versions of
  360. ### config.in, paths.in, buildobj.h, or Makefile.in.
  361. (cd src
  362. echo " (It is ok if ln fails in some cases.)"
  363. ln [a-zA-Z]*.[chm] ../${tempdir}/src
  364. ln [a-zA-Z]*.in ../${tempdir}/src
  365. ln deps.mk ../${tempdir}/src
  366. ln README ChangeLog.*[0-9] ../${tempdir}/src
  367. ln .gdbinit .dbxinit ../${tempdir}/src
  368. cd ../${tempdir}/src
  369. rm -f globals.h config.h epaths.h Makefile buildobj.h)
  370. echo "Making links to 'src/bitmaps'"
  371. (cd src/bitmaps
  372. ln README *.xbm ../../${tempdir}/src/bitmaps)
  373. echo "Making links to 'lib'"
  374. (snippet_h=`(cd build-aux/snippet && ls *.h)`
  375. cd lib
  376. ln [a-zA-Z]*.[ch] ../${tempdir}/lib
  377. ln gnulib.mk Makefile.am Makefile.in ../${tempdir}/lib
  378. cd ../${tempdir}/lib
  379. script='/[*]/d; s/\.in\.h$/.h/'
  380. rm -f `(echo "$snippet_h"; ls *.in.h) | sed "$script"`)
  381. echo "Making links to 'lib-src'"
  382. (cd lib-src
  383. ln [a-zA-Z]*.[ch] ../${tempdir}/lib-src
  384. ln ChangeLog.*[0-9] Makefile.in README ../${tempdir}/lib-src
  385. ln rcs2log ../${tempdir}/lib-src
  386. ln update-game-score.exe.manifest ../${tempdir}/lib-src)
  387. echo "Making links to 'm4'"
  388. (cd m4
  389. ln *.m4 ../${tempdir}/m4)
  390. echo "Making links to 'modules'"
  391. (cd modules
  392. ln *.py ../${tempdir}/modules
  393. if [ "$with_tests" = "yes" ]; then
  394. for f in `find mod-test -type f`; do
  395. case $f in
  396. *.log|*.o|*.so) continue ;;
  397. esac
  398. ln $f ../$tempdir/modules/$f
  399. done
  400. fi
  401. )
  402. echo "Making links to 'nt'"
  403. (cd nt
  404. ln emacs-x86.manifest emacs-x64.manifest ../${tempdir}/nt
  405. ln [a-z]*.bat [a-z]*.[ch] ../${tempdir}/nt
  406. ln *.in gnulib.mk gnulib-modules-to-delete.cfg ../${tempdir}/nt
  407. ln mingw-cfg.site epaths.nt INSTALL.W64 ../${tempdir}/nt
  408. ln ChangeLog.*[0-9] INSTALL README README.W32 ../${tempdir}/nt)
  409. echo "Making links to 'nt/inc' and its subdirectories"
  410. for f in `find nt/inc -type f -name '[a-z]*.h'`; do
  411. ln $f $tempdir/$f
  412. done
  413. echo "Making links to 'nt/icons'"
  414. (cd nt/icons
  415. ln README [a-z]*.ico ../../${tempdir}/nt/icons
  416. ln [a-z]*.cur ../../${tempdir}/nt/icons)
  417. echo "Making links to 'msdos'"
  418. (cd msdos
  419. ln ChangeLog.*[0-9] INSTALL README emacs.ico emacs.pif ../${tempdir}/msdos
  420. ln depfiles.bat inttypes.h ../${tempdir}/msdos
  421. ln mainmake.v2 sed*.inp ../${tempdir}/msdos)
  422. echo "Making links to 'nextstep'"
  423. (cd nextstep
  424. ln ChangeLog.*[0-9] README INSTALL Makefile.in ../${tempdir}/nextstep)
  425. echo "Making links to 'nextstep/templates'"
  426. (cd nextstep/templates
  427. ln Emacs.desktop.in Info-gnustep.plist.in Info.plist.in InfoPlist.strings.in ../../${tempdir}/nextstep/templates)
  428. echo "Making links to 'nextstep/Cocoa/Emacs.base/Contents'"
  429. (cd nextstep/Cocoa/Emacs.base/Contents
  430. ln PkgInfo ../../../../${tempdir}/nextstep/Cocoa/Emacs.base/Contents)
  431. echo "Making links to 'nextstep/Cocoa/Emacs.base/Contents/Resources'"
  432. (cd nextstep/Cocoa/Emacs.base/Contents/Resources
  433. 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 )
  437. echo "Making links to 'oldXMenu'"
  438. (cd oldXMenu
  439. ln *.[ch] *.in *.mk ../${tempdir}/oldXMenu
  440. ln README ChangeLog.*[0-9] ../${tempdir}/oldXMenu)
  441. echo "Making links to 'lwlib'"
  442. (cd lwlib
  443. ln *.[ch] *.in *.mk ../${tempdir}/lwlib
  444. ln README ChangeLog.*[0-9] ../${tempdir}/lwlib)
  445. ## It is important to distribute admin/ because it contains sources
  446. ## for generated lisp/international/uni-*.el files.
  447. echo "Making links to 'admin' and its subdirectories"
  448. for f in `find admin -type f`; do
  449. case $f in
  450. */Makefile) [ -f $f.in ] && continue ;;
  451. esac
  452. ln $f $tempdir/$f
  453. done
  454. if [ "$with_tests" = "yes" ]; then
  455. echo "Making links to 'test' and its subdirectories"
  456. for f in `find test -type f`; do
  457. case $f in
  458. test/automated/*.log) continue ;;
  459. test/automated/flymake/warnpred/a.out) continue ;;
  460. test/automated/Makefile) continue ;;
  461. esac
  462. ln $f $tempdir/$f
  463. done
  464. fi
  465. echo "Making links to 'etc' and its subdirectories"
  466. for f in `find etc -type f`; do
  467. case $f in
  468. etc/DOC*|etc/*.pyc) continue ;;
  469. ## Arguably we should not exclude *.ps.
  470. etc/refcards/*.aux|etc/refcards/*.dvi|etc/refcards/*.log|etc/refcards/*.ps)
  471. continue ;;
  472. esac
  473. ln $f $tempdir/$f
  474. done
  475. echo "Making links to 'info'"
  476. ln `find info -type f -print` ${tempdir}/info
  477. echo "Making links to 'doc/emacs'"
  478. (cd doc/emacs
  479. ln *.texi *.in ChangeLog.*[0-9] ../../${tempdir}/doc/emacs)
  480. echo "Making links to 'doc/misc'"
  481. (cd doc/misc
  482. ln *.texi *.tex *.in gnus-news.el ChangeLog.*[0-9] \
  483. ../../${tempdir}/doc/misc)
  484. echo "Making links to 'doc/lispref'"
  485. (cd doc/lispref
  486. ln *.texi *.in README ChangeLog.*[0-9] ../../${tempdir}/doc/lispref
  487. ln spellfile ../../${tempdir}/doc/lispref
  488. ln two-volume.make two-volume-cross-refs.txt ../../${tempdir}/doc/lispref)
  489. echo "Making links to 'doc/lispintro'"
  490. (cd doc/lispintro
  491. ln *.texi *.in *.eps *.pdf ../../${tempdir}/doc/lispintro
  492. ln README ChangeLog.*[0-9] ../../${tempdir}/doc/lispintro
  493. cd ../../${tempdir}/doc/lispintro)
  494. echo "Making links to 'doc/man'"
  495. (cd doc/man
  496. ln *.*[0-9] *.in ../../${tempdir}/doc/man
  497. cd ../../${tempdir}/doc/man
  498. rm -f emacs.1)
  499. ### It would be nice if they could all be symlinks to top-level copy, but
  500. ### you're not supposed to have any symlinks in distribution tar files.
  501. echo "Making sure copying notices are all copies of 'COPYING'"
  502. for subdir in . etc leim lib lib-src lisp lwlib msdos nt src; do
  503. rm -f ${tempdir}/${subdir}/COPYING
  504. cp COPYING ${tempdir}/${subdir}
  505. done
  506. if [ "${newer}" ]; then
  507. printf '%s\n' "Removing files older than $newer"
  508. ## We remove .elc files unconditionally, on the theory that anyone picking
  509. ## up an incremental distribution already has a running Emacs to byte-compile
  510. ## them with.
  511. find ${tempparent} \( -name '*.elc' -o ! -newer ${newer} \) -exec rm -f {} \;
  512. fi
  513. ## Don't distribute backups, autosaves, etc.
  514. echo "Removing unwanted files"
  515. find ${tempparent} \( -name '*~' -o -name '#*#' -o -name '.*ignore' -o -name '=*' -o -name 'TAGS' \) -exec rm -f {} \;
  516. if [ "${make_tar}" = yes ]; then
  517. echo "Looking for $default_gzip"
  518. found=0
  519. temppath=`printf '%s\n' "$PATH" |
  520. sed -e 's/^:/.:/' -e 's/::/:.:/g' -e 's/:$/:./' -e 's/:/ /g'
  521. `
  522. for dir in ${temppath}; do
  523. [ -x ${dir}/$default_gzip ] || continue
  524. found=1; break
  525. done
  526. if [ "$found" = "0" ]; then
  527. echo "WARNING: '$default_gzip' not found, will not compress" >&2
  528. default_gzip=cat
  529. fi
  530. case "${default_gzip}" in
  531. bzip2) gzip_extension=.bz2 ;;
  532. xz) gzip_extension=.xz ;;
  533. gzip) gzip_extension=.gz ; default_gzip="gzip --best";;
  534. *) gzip_extension= ;;
  535. esac
  536. echo "Creating tar file"
  537. taropt=
  538. [ "$verbose" = "yes" ] && taropt=v
  539. (cd ${tempparent} ; tar c${taropt}f - ${emacsname} ) \
  540. | ${default_gzip} \
  541. > ${emacsname}.tar${gzip_extension}
  542. fi
  543. if [ "${clean_up}" != yes ]; then
  544. (cd ${tempparent}; mv ${emacsname} ..)
  545. rm -rf ${tempparent}
  546. fi
  547. ### make-dist ends here