make-dist 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660
  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. [ -r $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. [ -r $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 [ -r Makefile ]; then
  247. echo "Checking to see if info files are up-to-date..."
  248. make --question info || error=yes
  249. fi
  250. ## Is this a release?
  251. case $version in
  252. [1-9][0-9].[0-9])
  253. if [ -r ChangeLog ]; then
  254. if ! grep -q "Version $version released" ChangeLog; then
  255. echo "No release notice in ChangeLog"
  256. error=yes
  257. fi
  258. else
  259. echo "A release must have a ChangeLog"
  260. error=yes
  261. fi
  262. ;;
  263. esac
  264. if [ $error = yes ]; then
  265. echo "Failed checks" >&2
  266. exit 1
  267. fi
  268. fi
  269. if [ $update = yes ]; then
  270. ## Make sure configure is newer than configure.ac, etc.
  271. ## It is better to let autoreconf do what is needed than
  272. ## for us to try and duplicate all its checks.
  273. echo "Running autoreconf"
  274. autoreconf -i -I m4 || { x=$?; echo Autoreconf FAILED! >&2; exit $x; }
  275. ## Make sure src/stamp-h.in is newer than configure.ac.
  276. rm -f src/stamp-h.in
  277. echo timestamp > src/stamp-h.in
  278. echo "Updating Info files"
  279. make info
  280. echo "Updating finder, custom and autoload data"
  281. (cd lisp && make updates EMACS="$EMACS")
  282. echo "Updating leim-list.el"
  283. (cd leim && make leim-list.el EMACS="$EMACS")
  284. echo "Recompiling Lisp files"
  285. $EMACS -batch -f batch-byte-recompile-directory lisp
  286. fi # $update = yes
  287. echo "Creating staging directory: '${tempparent}'"
  288. mkdir ${tempparent}
  289. tempdir="${tempparent}/${emacsname}"
  290. ### This trap ensures that the staging directory will be cleaned up even
  291. ### when the script is interrupted in mid-career.
  292. if [ "${clean_up}" = yes ]; then
  293. trap "echo 'Cleaning up the staging directory'; rm -rf ${tempparent}" EXIT
  294. fi
  295. echo "Creating top directory: '${tempdir}'"
  296. mkdir ${tempdir}
  297. if [ "$changelog" = yes ]; then
  298. if test -r .git; then
  299. ## When making a release or pretest the ChangeLog should already
  300. ## have been created and edited as needed. Don't ignore it.
  301. if test -r ChangeLog; then
  302. echo "Using existing top-level ChangeLog"
  303. else
  304. echo "Making top-level ChangeLog"
  305. make ChangeLog CHANGELOG=${tempdir}/ChangeLog || \
  306. { x=$?; echo "make ChangeLog FAILED (try --no-changelog?)" >&2; exit $x; }
  307. fi
  308. else
  309. echo "No repository, so omitting top-level ChangeLog"
  310. fi
  311. fi
  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 ${tempdir}
  318. ln ChangeLog.*[0-9] Makefile.in autogen.sh configure configure.ac ${tempdir}
  319. ln config.bat make-dist .dir-locals.el ${tempdir}
  320. ln aclocal.m4 CONTRIBUTE ChangeLog ${tempdir}
  321. echo "Creating subdirectories"
  322. for subdir in site-lisp \
  323. leim leim/CXTERM-DIC leim/MISC-DIC leim/SKK-DIC \
  324. build-aux \
  325. src src/bitmaps lib lib-src oldXMenu lwlib \
  326. nt nt/inc nt/inc/sys nt/inc/arpa nt/inc/netinet nt/icons \
  327. `find etc lisp admin test -type d` \
  328. doc doc/emacs doc/misc doc/man doc/lispref doc/lispintro \
  329. info m4 modules msdos \
  330. nextstep nextstep/templates \
  331. nextstep/Cocoa nextstep/Cocoa/Emacs.base \
  332. nextstep/Cocoa/Emacs.base/Contents \
  333. nextstep/Cocoa/Emacs.base/Contents/Resources \
  334. nextstep/GNUstep \
  335. nextstep/GNUstep/Emacs.base \
  336. nextstep/GNUstep/Emacs.base/Resources
  337. do
  338. if [ "$with_tests" != "yes" ]; then
  339. case $subdir in
  340. test*) continue ;;
  341. esac
  342. fi
  343. ## site-lisp for in-place installs (?).
  344. [ "$subdir" = "site-lisp" ] || [ -d "$subdir" ] || \
  345. echo "WARNING: $subdir not found, making anyway"
  346. [ "$verbose" = "yes" ] && echo " ${tempdir}/${subdir}"
  347. mkdir ${tempdir}/${subdir}
  348. done
  349. echo "Making links to 'lisp' and its subdirectories"
  350. files=`find lisp \( -name '*.el' -o -name '*.elc' -o -name 'ChangeLog*' \
  351. -o -name 'README' \)`
  352. ### Don't distribute site-init.el, site-load.el, or default.el.
  353. for file in lisp/Makefile.in $files; do
  354. case $file in
  355. */site-init*|*/site-load*|*/default*) continue ;;
  356. esac
  357. ln $file $tempdir/$file
  358. done
  359. echo "Making links to 'leim' and its subdirectories"
  360. (cd leim
  361. ln ChangeLog.*[0-9] README ../${tempdir}/leim
  362. ln CXTERM-DIC/README CXTERM-DIC/*.tit ../${tempdir}/leim/CXTERM-DIC
  363. ln SKK-DIC/README SKK-DIC/SKK-JISYO.L ../${tempdir}/leim/SKK-DIC
  364. ln MISC-DIC/README MISC-DIC/*.* ../${tempdir}/leim/MISC-DIC
  365. ln Makefile.in ../${tempdir}/leim/Makefile.in
  366. ln leim-ext.el ../${tempdir}/leim/leim-ext.el)
  367. ## FIXME Can we not just use the "find -type f" method for this one?
  368. echo "Making links to 'build-aux'"
  369. (cd build-aux
  370. ln config.guess config.sub msys-to-w32 ../${tempdir}/build-aux
  371. ln gitlog-to-changelog gitlog-to-emacslog ../${tempdir}/build-aux
  372. ln install-sh move-if-change ../${tempdir}/build-aux
  373. ln update-copyright update-subdirs ../${tempdir}/build-aux
  374. ln dir_top make-info-dir ../${tempdir}/build-aux)
  375. echo "Making links to 'src'"
  376. ### Don't distribute the configured versions of
  377. ### config.in, paths.in, buildobj.h, or Makefile.in.
  378. (cd src
  379. echo " (It is ok if ln fails in some cases.)"
  380. ln [a-zA-Z]*.[chm] ../${tempdir}/src
  381. ln [a-zA-Z]*.in ../${tempdir}/src
  382. ln deps.mk ../${tempdir}/src
  383. ln README ChangeLog.*[0-9] ../${tempdir}/src
  384. ln .gdbinit .dbxinit ../${tempdir}/src
  385. cd ../${tempdir}/src
  386. rm -f globals.h config.h epaths.h Makefile buildobj.h)
  387. echo "Making links to 'src/bitmaps'"
  388. (cd src/bitmaps
  389. ln README *.xbm ../../${tempdir}/src/bitmaps)
  390. echo "Making links to 'lib'"
  391. (cd lib
  392. ln [a-zA-Z_]*.[ch] ../${tempdir}/lib
  393. ln gnulib.mk.in Makefile.in ../${tempdir}/lib
  394. cd ../${tempdir}/lib
  395. script='/[*]/d; s/\.in\.h$/.h/'
  396. rm -f `ls *.in.h | sed "$script"`)
  397. echo "Making links to 'lib-src'"
  398. (cd lib-src
  399. ln [a-zA-Z]*.[ch] ../${tempdir}/lib-src
  400. ln ChangeLog.*[0-9] Makefile.in README ../${tempdir}/lib-src
  401. ln rcs2log ../${tempdir}/lib-src)
  402. echo "Making links to 'm4'"
  403. (cd m4
  404. ln *.m4 ../${tempdir}/m4)
  405. echo "Making links to 'modules'"
  406. (cd modules
  407. ln *.py ../${tempdir}/modules
  408. )
  409. echo "Making links to 'nt'"
  410. (cd nt
  411. ln emacs-x86.manifest emacs-x64.manifest ../${tempdir}/nt
  412. ln [a-z]*.bat [a-z]*.[ch] ../${tempdir}/nt
  413. ln *.in gnulib-cfg.mk ../${tempdir}/nt
  414. ln mingw-cfg.site epaths.nt INSTALL.W64 ../${tempdir}/nt
  415. ln ChangeLog.*[0-9] INSTALL README README.W32 ../${tempdir}/nt)
  416. echo "Making links to 'nt/inc' and its subdirectories"
  417. for f in `find nt/inc -type f -name '[a-z]*.h'`; do
  418. ln $f $tempdir/$f
  419. done
  420. echo "Making links to 'nt/icons'"
  421. (cd nt/icons
  422. ln README [a-z]*.ico ../../${tempdir}/nt/icons
  423. ln [a-z]*.cur ../../${tempdir}/nt/icons)
  424. echo "Making links to 'msdos'"
  425. (cd msdos
  426. ln ChangeLog.*[0-9] INSTALL README emacs.ico emacs.pif ../${tempdir}/msdos
  427. ln depfiles.bat inttypes.h ../${tempdir}/msdos
  428. ln mainmake.v2 sed*.inp ../${tempdir}/msdos)
  429. echo "Making links to 'nextstep'"
  430. (cd nextstep
  431. ln ChangeLog.*[0-9] README INSTALL Makefile.in ../${tempdir}/nextstep)
  432. echo "Making links to 'nextstep/templates'"
  433. (cd nextstep/templates
  434. ln Emacs.desktop.in Info-gnustep.plist.in Info.plist.in InfoPlist.strings.in ../../${tempdir}/nextstep/templates)
  435. echo "Making links to 'nextstep/Cocoa/Emacs.base/Contents'"
  436. (cd nextstep/Cocoa/Emacs.base/Contents
  437. ln PkgInfo ../../../../${tempdir}/nextstep/Cocoa/Emacs.base/Contents)
  438. echo "Making links to 'nextstep/Cocoa/Emacs.base/Contents/Resources'"
  439. (cd nextstep/Cocoa/Emacs.base/Contents/Resources
  440. ln Credits.html *.icns ../../../../../${tempdir}/nextstep/Cocoa/Emacs.base/Contents/Resources)
  441. echo "Making links to 'nextstep/GNUstep/Emacs.base/Resources'"
  442. (cd nextstep/GNUstep/Emacs.base/Resources
  443. ln README emacs.tiff ../../../../${tempdir}/nextstep/GNUstep/Emacs.base/Resources )
  444. echo "Making links to 'oldXMenu'"
  445. (cd oldXMenu
  446. ln *.[ch] *.in *.mk ../${tempdir}/oldXMenu
  447. ln README ChangeLog.*[0-9] ../${tempdir}/oldXMenu)
  448. echo "Making links to 'lwlib'"
  449. (cd lwlib
  450. ln *.[ch] *.in *.mk ../${tempdir}/lwlib
  451. ln README ChangeLog.*[0-9] ../${tempdir}/lwlib)
  452. ## It is important to distribute admin/ because it contains sources
  453. ## for generated lisp/international/uni-*.el files.
  454. echo "Making links to 'admin' and its subdirectories"
  455. for f in `find admin -type f`; do
  456. case $f in
  457. */Makefile) [ -f $f.in ] && continue ;;
  458. esac
  459. ln $f $tempdir/$f
  460. done
  461. if [ "$with_tests" = "yes" ]; then
  462. echo "Making links to 'test' and its subdirectories"
  463. for f in `find test -type f ! -name '*.log' ! -name a.out \
  464. ! -name '*.so' ! -name '*.dll' ! -name '*.o'
  465. `; do
  466. case $f in
  467. */Makefile) [ -f $f.in ] && continue ;;
  468. esac
  469. ln $f $tempdir/$f
  470. done
  471. fi
  472. echo "Making links to 'etc' and its subdirectories"
  473. for f in `find etc -type f`; do
  474. case $f in
  475. etc/DOC*|etc/*.pyc) continue ;;
  476. ## Arguably we should not exclude *.ps.
  477. etc/refcards/*.aux|etc/refcards/*.dvi|etc/refcards/*.log|etc/refcards/*.ps)
  478. continue ;;
  479. esac
  480. ln $f $tempdir/$f
  481. done
  482. echo "Making links to 'info'"
  483. ln `find info -type f -print` ${tempdir}/info
  484. echo "Making links to 'doc/emacs'"
  485. (cd doc/emacs
  486. ln *.texi *.in ChangeLog.*[0-9] ../../${tempdir}/doc/emacs)
  487. echo "Making links to 'doc/misc'"
  488. (cd doc/misc
  489. ln *.texi *.tex *.in gnus-news.el ChangeLog.*[0-9] \
  490. ../../${tempdir}/doc/misc)
  491. echo "Making links to 'doc/lispref'"
  492. (cd doc/lispref
  493. ln *.texi *.in README ChangeLog.*[0-9] ../../${tempdir}/doc/lispref
  494. ln spellfile ../../${tempdir}/doc/lispref
  495. ln two-volume.make two-volume-cross-refs.txt ../../${tempdir}/doc/lispref)
  496. echo "Making links to 'doc/lispintro'"
  497. (cd doc/lispintro
  498. ln *.texi *.in *.eps *.pdf ../../${tempdir}/doc/lispintro
  499. ln README ChangeLog.*[0-9] ../../${tempdir}/doc/lispintro
  500. cd ../../${tempdir}/doc/lispintro)
  501. echo "Making links to 'doc/man'"
  502. (cd doc/man
  503. ln *.*[0-9] *.in ../../${tempdir}/doc/man
  504. cd ../../${tempdir}/doc/man
  505. rm -f emacs.1)
  506. ### It would be nice if they could all be symlinks to top-level copy, but
  507. ### you're not supposed to have any symlinks in distribution tar files.
  508. echo "Making sure copying notices are all copies of 'COPYING'"
  509. for subdir in . etc leim lib lib-src lisp lwlib msdos nt src; do
  510. rm -f ${tempdir}/${subdir}/COPYING
  511. cp COPYING ${tempdir}/${subdir}
  512. done
  513. if [ "${newer}" ]; then
  514. printf '%s\n' "Removing files older than $newer"
  515. ## We remove .elc files unconditionally, on the theory that anyone picking
  516. ## up an incremental distribution already has a running Emacs to byte-compile
  517. ## them with.
  518. find ${tempparent} \( -name '*.elc' -o ! -newer ${newer} \) -exec rm -f {} \;
  519. fi
  520. ## Don't distribute backups, autosaves, etc.
  521. echo "Removing unwanted files"
  522. find ${tempparent} \( -name '*~' -o -name '#*#' -o -name '.*ignore' -o -name '=*' -o -name 'TAGS' \) -exec rm -f {} \;
  523. if [ "${make_tar}" = yes ]; then
  524. echo "Looking for $default_gzip"
  525. found=0
  526. temppath=`printf '%s\n' "$PATH" |
  527. sed -e 's/^:/.:/' -e 's/::/:.:/g' -e 's/:$/:./' -e 's/:/ /g'
  528. `
  529. for dir in ${temppath}; do
  530. [ -x ${dir}/$default_gzip ] || continue
  531. found=1; break
  532. done
  533. if [ "$found" = "0" ]; then
  534. echo "WARNING: '$default_gzip' not found, will not compress" >&2
  535. default_gzip=cat
  536. fi
  537. case "${default_gzip}" in
  538. bzip2) gzip_extension=.bz2 ;;
  539. xz) gzip_extension=.xz ;;
  540. gzip) gzip_extension=.gz ; default_gzip="gzip --best";;
  541. *) gzip_extension= ;;
  542. esac
  543. echo "Creating tar file"
  544. taropt=
  545. [ "$verbose" = "yes" ] && taropt=v
  546. (cd ${tempparent} ; tar c${taropt}f - ${emacsname} ) \
  547. | ${default_gzip} \
  548. > ${emacsname}.tar${gzip_extension}
  549. fi
  550. if [ "${clean_up}" != yes ]; then
  551. (cd ${tempparent}; mv ${emacsname} ..)
  552. rm -rf ${tempparent}
  553. fi
  554. ### make-dist ends here