Commit | Line | Data |
---|---|---|
f7dbcf3c | 1 | #!/bin/sh |
76fb0a58 JB |
2 | |
3 | #### make-dist: create an Emacs distribution tar file from the current | |
1d650ff1 | 4 | #### source tree. This basically creates a duplicate directory |
76fb0a58 JB |
5 | #### structure, and then hard links into it only those files that should |
6 | #### be distributed. This means that if you add a file with an odd name, | |
7 | #### you should make sure that this script will include it. | |
f7dbcf3c | 8 | |
e91081eb | 9 | # Copyright (C) 1995, 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005, |
37d6e313 | 10 | # 2006, 2007, 2008 Free Software Foundation, Inc. |
4c9c1174 KH |
11 | # |
12 | # This file is part of GNU Emacs. | |
13 | # | |
14 | # GNU Emacs is free software; you can redistribute it and/or modify | |
15 | # it under the terms of the GNU General Public License as published by | |
e5086daf | 16 | # the Free Software Foundation; either version 3, or (at your option) |
4c9c1174 KH |
17 | # any later version. |
18 | # | |
19 | # GNU Emacs is distributed in the hope that it will be useful, | |
20 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
21 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
22 | # GNU General Public License for more details. | |
23 | # | |
24 | # You should have received a copy of the GNU General Public License | |
1fb87c77 | 25 | # along with GNU Emacs; see the file COPYING. If not, write to the |
0d07bc90 LK |
26 | # Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
27 | # Boston, MA 02110-1301, USA. | |
4c9c1174 | 28 | |
f7dbcf3c JB |
29 | progname="$0" |
30 | ||
76fb0a58 | 31 | ### Exit if a command fails. |
8c28d444 | 32 | #set -e |
f7dbcf3c | 33 | |
76fb0a58 | 34 | ### Print out each line we read, for debugging's sake. |
8c28d444 | 35 | #set -v |
f7dbcf3c | 36 | |
8df317a6 GM |
37 | LANGUAGE=C |
38 | LC_ALL=C | |
39 | LC_MESSAGES= | |
40 | LANG= | |
41 | export LANGUAGE LC_ALL LC_MESSAGES LANG | |
42 | ||
ccd57f4d | 43 | ## Don't restrict access to any files. |
67ffab69 RS |
44 | umask 0 |
45 | ||
c75cfabd | 46 | update=yes |
e4e1c623 | 47 | check=yes |
f22edcea RS |
48 | clean_up=no |
49 | make_tar=no | |
1260d6ba | 50 | newer="" |
f7dbcf3c JB |
51 | |
52 | while [ $# -gt 0 ]; do | |
53 | case "$1" in | |
f22edcea RS |
54 | ## This option tells make-dist to delete the staging directory |
55 | ## when done. It is useless to use this unless you make a tar file. | |
56 | "--clean-up" ) | |
57 | clean_up=yes | |
4746118a | 58 | ;; |
f22edcea RS |
59 | ## This option tells make-dist to make a tar file. |
60 | "--tar" ) | |
61 | make_tar=yes | |
f7dbcf3c | 62 | ;; |
c75cfabd RS |
63 | ## This option tells make-dist not to recompile or do analogous things. |
64 | "--no-update" ) | |
65 | update=no | |
66 | ;; | |
e4e1c623 RS |
67 | ## This option says don't check for bad file names, etc. |
68 | "--no-check" ) | |
69 | check=no | |
70 | ;; | |
76fb0a58 | 71 | ## This option tells make-dist to make the distribution normally, then |
7b9cd64c ER |
72 | ## remove all files older than the given timestamp file. This is useful |
73 | ## for creating incremental or patch distributions. | |
1260d6ba | 74 | "--newer") |
ef15f270 JB |
75 | newer="$2" |
76 | new_extension=".new" | |
1260d6ba ER |
77 | shift |
78 | ;; | |
922ac4c5 JB |
79 | ## This option tells make-dist to use `compress' instead of gzip. |
80 | ## Normally, make-dist uses gzip whenever it is present. | |
81 | "--compress") | |
82 | default_gzip="compress" | |
83 | ;; | |
37d6e313 RF |
84 | ## Same with bzip2. |
85 | "--bzip2") | |
86 | default_gzip="bzip2" | |
87 | ;; | |
2a714d4e GM |
88 | |
89 | "--snapshot") | |
90 | clean_up=yes | |
91 | make_tar=yes | |
92 | update=no | |
93 | check=no | |
94 | ;; | |
95 | ||
96 | "--help") | |
97 | echo "Usage: ${progname} [options]" | |
98 | echo "" | |
37d6e313 | 99 | echo " --bzip2 use bzip2 instead of gzip" |
2a714d4e GM |
100 | echo " --clean-up delete staging directories when done" |
101 | echo " --compress use compress instead of gzip" | |
102 | echo " --newer=TIME don't include files older than TIME" | |
103 | echo " --no-check don't check for bad file names etc." | |
104 | echo " --no-update don't recompile or do analogous things" | |
105 | echo " --snapshot same as --clean-up --no-update --tar --no-check" | |
106 | echo " --tar make a tar file" | |
107 | echo "" | |
108 | exit 0 | |
109 | ;; | |
110 | ||
f7dbcf3c JB |
111 | * ) |
112 | echo "${progname}: Unrecognized argument: $1" >&2 | |
113 | exit 1 | |
114 | ;; | |
115 | esac | |
116 | shift | |
117 | done | |
118 | ||
76fb0a58 | 119 | ### Make sure we're running in the right place. |
f7dbcf3c | 120 | if [ ! -d src -o ! -f src/lisp.h -o ! -d lisp -o ! -f lisp/version.el ]; then |
1260d6ba ER |
121 | echo "${progname}: Can't find \`src/lisp.h' and \`lisp/version.el'." >&2 |
122 | echo "${progname} must be run in the top directory of the Emacs" >&2 | |
0d122844 | 123 | echo "distribution tree. cd to that directory and try again." >&2 |
f7dbcf3c JB |
124 | exit 1 |
125 | fi | |
126 | ||
c75cfabd | 127 | ### Find where to run Emacs. |
4b1aaa8b | 128 | ### (Accept only absolute file names.) |
c75cfabd RS |
129 | if [ $update = yes ]; |
130 | then | |
59d05d2d | 131 | unset EMACS_UNIBYTE |
c75cfabd RS |
132 | if [ -f src/emacs ]; |
133 | then | |
134 | EMACS=`pwd`/src/emacs | |
135 | else | |
4b1aaa8b PE |
136 | case $EMACS in |
137 | /*) ;; | |
138 | *) | |
139 | if [ ! -f "$EMACS" ]; then | |
140 | echo "$0: You must specify the EMACS environment variable " \ | |
141 | "to an absolute file name." 2>&1 | |
142 | exit 1 | |
143 | fi;; | |
144 | esac | |
c75cfabd RS |
145 | fi |
146 | fi | |
147 | ||
76fb0a58 | 148 | ### Find out which version of Emacs this is. |
0e0186f1 | 149 | shortversion=`grep 'defconst[ ]*emacs-version' lisp/version.el \ |
47d105b0 | 150 | | sed -e 's/^.*"\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/'` |
0e0186f1 RS |
151 | version=`grep 'defconst[ ]*emacs-version' lisp/version.el \ |
152 | | sed -e 's/^[^"]*"\([^"]*\)".*$/\1/'` | |
f7dbcf3c | 153 | if [ ! "${version}" ]; then |
21764d60 | 154 | echo "${progname}: can't find current Emacs version in \`./lisp/version.el'" >&2 |
f7dbcf3c JB |
155 | exit 1 |
156 | fi | |
157 | ||
21764d60 | 158 | echo Version numbers are $version and $shortversion |
47d105b0 | 159 | |
c75cfabd RS |
160 | if [ $update = yes ]; |
161 | then | |
d175b0ae | 162 | if grep -s "@set EMACSVER *${shortversion}" ./doc/emacs/emacs.texi > /dev/null; then |
c75cfabd RS |
163 | true |
164 | else | |
d175b0ae | 165 | echo "You must update the version number in \`./doc/emacs/emacs.texi'" |
c75cfabd RS |
166 | sleep 5 |
167 | fi | |
f753e9aa JB |
168 | fi |
169 | ||
bb160193 RS |
170 | ### Make sure we don't already have a directory emacs-${version}. |
171 | ||
172 | emacsname="emacs-${version}${new_extension}" | |
173 | ||
174 | if [ -d ${emacsname} ] | |
175 | then | |
176 | echo Directory "${emacsname}" already exists >&2 | |
177 | exit 1 | |
178 | fi | |
179 | ||
76fb0a58 | 180 | ### Make sure the subdirectory is available. |
1260d6ba | 181 | tempparent="make-dist.tmp.$$" |
f7dbcf3c | 182 | if [ -d ${tempparent} ]; then |
1260d6ba ER |
183 | echo "${progname}: staging directory \`${tempparent}' already exists. |
184 | Perhaps a previous invocation of \`${progname}' failed to clean up after | |
185 | itself. Check that directories whose names are of the form | |
186 | \`make-dist.tmp.NNNNN' don't contain any important information, remove | |
187 | them, and try again." >&2 | |
f7dbcf3c JB |
188 | exit 1 |
189 | fi | |
190 | ||
e4e1c623 RS |
191 | ### Find where to run Emacs. |
192 | if [ $check = yes ]; | |
193 | then | |
194 | ### Check for .elc files with no corresponding .el file. | |
fb0797ca | 195 | ls -1 lisp/[a-zA-Z]*.el lisp/[a-z]*/[a-zA-Z0-9]*.el \ |
5eea385d | 196 | leim/[a-z]*/[a-z]*.el | sed 's/\.el$/.elc/' > /tmp/el |
fb0797ca | 197 | ls -1 lisp/[a-zA-Z]*.elc lisp/[a-z]*/[a-zA-Z0-9]*.elc \ |
5eea385d | 198 | leim/[a-z]*/[a-z]*.elc > /tmp/elc |
e4e1c623 RS |
199 | bogosities="`comm -13 /tmp/el /tmp/elc`" |
200 | if [ "${bogosities}" != "" ]; then | |
201 | echo "The following .elc files have no corresponding .el files:" | |
202 | echo "${bogosities}" | |
8615e792 | 203 | fi |
e4e1c623 RS |
204 | rm -f /tmp/el /tmp/elc |
205 | ||
206 | ### Check for .el files with no corresponding .elc file. | |
fb0797ca | 207 | ls -1 lisp/[a-zA-Z]*.el lisp/[a-z]*/[a-zA-Z0-9]*.el \ |
33740d04 | 208 | leim/[a-z]*/[a-z]*.el > /tmp/el |
fb0797ca | 209 | ls -1 lisp/[a-zA-Z]*.elc lisp/[a-z]*/[a-zA-Z0-9]*.elc \ |
33740d04 | 210 | leim/[a-z]*/[a-z]*.elc | sed 's/\.elc$/.el/' > /tmp/elc |
e4e1c623 RS |
211 | losers="`comm -23 /tmp/el /tmp/elc`" |
212 | bogosities= | |
213 | for file in $losers; do | |
33740d04 | 214 | if ! grep -q "no-byte-compile: t" $file; then |
e4e1c623 RS |
215 | case $file in |
216 | site-init.el | site-load.el | site-start.el | default.el) | |
217 | ;; | |
e4e1c623 RS |
218 | *) |
219 | bogosities="$file $bogosities" | |
220 | ;; | |
221 | esac | |
222 | fi | |
223 | done | |
224 | if [ x"${bogosities}" != x"" ]; then | |
225 | echo "The following .el files have no corresponding .elc files:" | |
226 | echo "${bogosities}" | |
227 | fi | |
228 | rm -f /tmp/el /tmp/elc | |
f5674423 KH |
229 | fi |
230 | ||
b4e84d5d | 231 | ### Make sure configure is newer than configure.in. |
a8a8fcfa | 232 | if [ "x`ls -t configure configure.in | sed q`" != "xconfigure" ]; then |
21764d60 KH |
233 | echo "\`./configure.in' is newer than \`./configure'" >&2 |
234 | echo "Running autoconf" >&2 | |
28335560 | 235 | autoconf || { x=$?; echo Autoconf FAILED! >&2; exit $x; } |
b4e84d5d JB |
236 | fi |
237 | ||
a49eb675 AS |
238 | ### Make sure src/config-in.stamp is newer than configure.in. |
239 | if [ "x`ls -t src/stamp-h.in configure.in | sed q`" != "xsrc/stamp-h.in" ]; then | |
240 | echo "\`./configure.in' is newer than \`./src/stamp-h.in'" >&2 | |
241 | echo "Running autoheader" >&2 | |
242 | autoheader || { x=$?; echo Autoheader FAILED! >&2; exit $x; } | |
243 | rm -f src/stamp-h.in | |
244 | echo timestamp > src/stamp-h.in | |
245 | fi | |
246 | ||
c75cfabd RS |
247 | if [ $update = yes ]; |
248 | then | |
249 | echo "Updating Info files" | |
d175b0ae RF |
250 | (cd doc/emacs; make -f Makefile.in srcdir=. info) |
251 | (cd doc/misc; make -f Makefile.in srcdir=. info) | |
252 | (cd doc/lispref; make -f Makefile.in srcdir=. info) | |
253 | (cd doc/lispintro; make -f Makefile.in SHELL=/bin/sh srcdir=. info VPATH=.) | |
980ab937 | 254 | |
e888d449 | 255 | echo "Updating finder, custom and autoload data" |
59d05d2d | 256 | (cd lisp; make updates EMACS="$EMACS") |
7cf45b04 | 257 | |
5eea385d GM |
258 | if test -f leim/leim-list.el; then |
259 | echo "Updating leim-list.el" | |
260 | (cd leim; make leim-list.el EMACS="$EMACS") | |
261 | fi | |
29c98ed3 RS |
262 | |
263 | echo "Recompiling Lisp files" | |
29c98ed3 | 264 | $EMACS -batch -f batch-byte-recompile-directory lisp leim |
c75cfabd | 265 | fi |
0588a761 | 266 | |
f07eebe0 KH |
267 | echo "Making lisp/MANIFEST" |
268 | ||
73494596 RS |
269 | (cd lisp; |
270 | files=`echo [!=]*.el | sed -e 's/ subdirs.el / /' -e 's/ default.el / /'` | |
271 | for dir in [!=]*; do | |
5eea385d GM |
272 | if [ -d $dir ] && [ $dir != term ] && [ $dir != CVS ] && [ $dir != RCS ] |
273 | then | |
73494596 RS |
274 | echo $dir |
275 | thisdir=`echo $dir/[!=]*.el | sed -e 's/ subdirs.el / /'` | |
276 | files="$files $thisdir" | |
277 | fi | |
278 | done | |
a8a8fcfa PE |
279 | for file in $files |
280 | do sed -n 's/^;;; //p; q' $file | |
281 | done | sort > MANIFEST) | |
f07eebe0 | 282 | |
1260d6ba | 283 | echo "Creating staging directory: \`${tempparent}'" |
bb160193 | 284 | |
f7dbcf3c | 285 | mkdir ${tempparent} |
f7dbcf3c JB |
286 | tempdir="${tempparent}/${emacsname}" |
287 | ||
76fb0a58 JB |
288 | ### This trap ensures that the staging directory will be cleaned up even |
289 | ### when the script is interrupted in mid-career. | |
00c00348 | 290 | if [ "${clean_up}" = yes ]; then |
21764d60 | 291 | trap "echo 'Interrupted...cleaning up the staging directory'; rm -rf ${tempparent}; exit 1" 1 2 15 |
00c00348 ER |
292 | fi |
293 | ||
1260d6ba | 294 | echo "Creating top directory: \`${tempdir}'" |
f7dbcf3c JB |
295 | mkdir ${tempdir} |
296 | ||
76fb0a58 JB |
297 | ### We copy in the top-level files before creating the subdirectories in |
298 | ### hopes that this will make the top-level files appear first in the | |
299 | ### tar file; this means that people can start reading the INSTALL and | |
300 | ### README while the rest of the tar file is still unpacking. Whoopee. | |
21764d60 | 301 | echo "Making links to top-level files" |
3ada8b66 | 302 | ln INSTALL README BUGS move-if-change ${tempdir} |
bcea38a3 | 303 | ln ChangeLog Makefile.in configure configure.in ${tempdir} |
6f8b09f3 | 304 | ln config.bat make-dist update-subdirs vpath.sed ${tempdir} |
bb160193 | 305 | ### Copy these files; they're cross-filesystem symlinks. |
a4888c88 | 306 | cp mkinstalldirs ${tempdir} |
76fb0a58 | 307 | cp config.sub ${tempdir} |
2ed56345 | 308 | cp config.guess ${tempdir} |
dc7717ab | 309 | cp install-sh ${tempdir} |
f7dbcf3c | 310 | |
21764d60 | 311 | echo "Updating version number in README" |
f753e9aa JB |
312 | (cd ${tempdir} |
313 | awk \ | |
314 | '$1 " " $2 " " $3 " " $4 " " $5 == "This directory tree holds version" { $6 = version; print $0 } | |
315 | $1 " " $2 " " $3 " " $4 " " $5 != "This directory tree holds version"' \ | |
316 | version=${version} README > tmp.README | |
af559a4e | 317 | mv -f tmp.README README) |
f753e9aa JB |
318 | |
319 | ||
21764d60 | 320 | echo "Creating subdirectories" |
d175b0ae | 321 | for subdir in lisp site-lisp \ |
05494c29 | 322 | leim leim/CXTERM-DIC leim/MISC-DIC \ |
ca111811 | 323 | leim/SKK-DIC leim/ja-dic leim/quail \ |
c660c0a7 | 324 | src src/m src/s src/bitmaps lib-src oldXMenu lwlib \ |
5ec8424f | 325 | nt nt/inc nt/inc/sys nt/inc/arpa nt/inc/netinet nt/icons \ |
5c902eb5 | 326 | etc etc/e etc/gnus etc/nxml \ |
ffda926c | 327 | etc/images etc/images/ezimage etc/images/gnus etc/images/gud \ |
d8981daf GM |
328 | etc/images/icons etc/images/icons/hicolor \ |
329 | etc/images/icons/hicolor/*x* etc/images/icons/hicolor/*x*/apps \ | |
330 | etc/images/low-color etc/images/mail \ | |
56bcdb80 GM |
331 | etc/images/smilies etc/images/smilies/grayscale \ |
332 | etc/images/smilies/medium etc/images/tree-widget \ | |
333 | etc/images/tree-widget/default etc/images/tree-widget/folder \ | |
3ada8b66 RF |
334 | etc/refcards etc/schema etc/tutorials info doc doc/emacs \ |
335 | doc/misc doc/man doc/lispref doc/lispintro m4 msdos vms mac \ | |
336 | mac/inc mac/inc/sys mac/src mac/Emacs.app mac/Emacs.app/Contents \ | |
e0f712ba AC |
337 | mac/Emacs.app/Contents/MacOS mac/Emacs.app/Contents/Resources \ |
338 | mac/Emacs.app/Contents/Resources/English.lproj | |
b3635775 GM |
339 | do |
340 | echo " ${tempdir}/${subdir}" | |
f7dbcf3c JB |
341 | mkdir ${tempdir}/${subdir} |
342 | done | |
343 | ||
67ffab69 | 344 | echo "Making links to \`lisp' and its subdirectories" |
7b9cd64c | 345 | ### Don't distribute TAGS, =*.el files, site-init.el, site-load.el, or default.el. |
f7dbcf3c JB |
346 | (cd lisp |
347 | ln [a-zA-Z]*.el ../${tempdir}/lisp | |
348 | ln [a-zA-Z]*.elc ../${tempdir}/lisp | |
8d2197ac | 349 | ln [a-zA-Z]*.dat ../${tempdir}/lisp |
a1363c1d | 350 | for img in [a-zA-Z]*.xpm [a-zA-Z]*.xbm [a-zA-Z]*.pbm; do |
365949b7 GM |
351 | # If there are no images, the shell won't expand the pattern. |
352 | if [ -f $img ]; then | |
353 | ln $img ../${tempdir}/lisp | |
354 | fi | |
355 | done | |
76fb0a58 JB |
356 | ## simula.el doesn't keep abbreviations in simula.defns any more. |
357 | ## ln [a-zA-Z]*.defns ../${tempdir}/lisp | |
fb0797ca LK |
358 | ln ChangeLog ChangeLog.*[0-9] ../${tempdir}/lisp |
359 | ln Makefile.in makefile.w32-in ../${tempdir}/lisp | |
5eea385d | 360 | test -f README && ln README ../${tempdir}/lisp |
67ffab69 RS |
361 | (cd ../${tempdir}/lisp |
362 | rm -f TAGS =* | |
363 | rm -f site-init site-init.el site-init.elc | |
364 | rm -f site-load site-load.el site-load.elc | |
365 | rm -f site-start site-start.el site-start.elc | |
366 | rm -f default default.el default.elc | |
367 | ) | |
368 | ||
369 | ## Find all subdirs of lisp dir | |
370 | for file in `find . -type d -print`; do | |
371 | case $file in | |
5eea385d | 372 | . | .. | */Old | */CVS | */RCS | */=*) |
177c0ea7 | 373 | ;; |
67ffab69 RS |
374 | *) |
375 | if [ -d $file ]; then | |
376 | subdirs="$file $subdirs" | |
377 | fi | |
378 | ;; | |
379 | esac | |
380 | done | |
381 | ||
382 | for file in $subdirs; do | |
383 | echo " lisp/$file" | |
3ada8b66 | 384 | mkdir -p ../${tempdir}/lisp/$file |
b3635775 GM |
385 | ln $file/[a-zA-Z0-9]*.el ../${tempdir}/lisp/$file |
386 | ln $file/[a-zA-Z0-9]*.elc ../${tempdir}/lisp/$file | |
387 | for img in $file/[a-zA-Z]*.xpm $file/[a-zA-Z]*.xbm $file/[a-zA-Z]*.pbm; do | |
365949b7 GM |
388 | if [ -f $img ]; then |
389 | ln $img ../${tempdir}/lisp/$file | |
390 | fi | |
391 | done | |
67ffab69 RS |
392 | if [ -f $file/README ]; then |
393 | ln $file/README ../${tempdir}/lisp/$file | |
394 | fi | |
b3635775 | 395 | |
dcf3ff7f RS |
396 | if [ -f $file/ChangeLog ]; then |
397 | ln $file/ChangeLog ../${tempdir}/lisp/$file | |
fb0797ca | 398 | for f in $file/ChangeLog.*[0-9]; do |
b3635775 GM |
399 | if [ -f $f ]; then |
400 | ln $f ../${tempdir}/lisp/$file | |
401 | fi | |
402 | done | |
dcf3ff7f | 403 | fi |
67ffab69 | 404 | done ) |
a78c106d | 405 | |
ca111811 | 406 | echo "Making links to \`leim' and its subdirectories" |
91741841 RS |
407 | ### Don't distribute TAGS, or =*.el files. |
408 | (cd leim | |
561bd1a1 | 409 | ln makefile.w32-in ../${tempdir}/leim |
ca111811 EZ |
410 | ln ChangeLog README ../${tempdir}/leim |
411 | ||
412 | ln CXTERM-DIC/*.tit ../${tempdir}/leim/CXTERM-DIC | |
413 | ln SKK-DIC/README SKK-DIC/SKK-JISYO.L ../${tempdir}/leim/SKK-DIC | |
414 | ln MISC-DIC/*.* ../${tempdir}/leim/MISC-DIC | |
415 | ln ja-dic/*.el ja-dic/*.elc ../${tempdir}/leim/ja-dic | |
416 | ln Makefile.in ../${tempdir}/leim/Makefile.in | |
1d390bd8 | 417 | ln leim-ext.el ../${tempdir}/leim/leim-ext.el |
fb0797ca LK |
418 | ## Lisp files that start with a capital are generated from TIT |
419 | ## dictionaries so we don't distribute them. | |
ca111811 EZ |
420 | ln quail/[a-z]*.el quail/[a-z]*.elc ../${tempdir}/leim/quail |
421 | rm -f ../${tempdir}/leim/quail/quick-b5.* | |
422 | rm -f ../${tempdir}/leim/quail/quick-cns.* | |
423 | rm -f ../${tempdir}/leim/quail/tsang-b5.* | |
424 | rm -f ../${tempdir}/leim/quail/tsang-cns.* | |
425 | ||
426 | cd ../${tempdir}/leim | |
91741841 RS |
427 | rm -f TAGS =* */=*) |
428 | ||
21764d60 | 429 | echo "Making links to \`src'" |
76fb0a58 | 430 | ### Don't distribute =*.[ch] files, or the configured versions of |
c3f1e1a9 | 431 | ### config.in, paths.in, or Makefile.in, or TAGS. |
f7dbcf3c | 432 | (cd src |
c75cfabd | 433 | echo " (It is ok if ln fails in some cases.)" |
f7dbcf3c JB |
434 | ln [a-zA-Z]*.c ../${tempdir}/src |
435 | ln [a-zA-Z]*.h ../${tempdir}/src | |
436 | ln [a-zA-Z]*.s ../${tempdir}/src | |
c75cfabd RS |
437 | ln [a-zA-Z]*.in ../${tempdir}/src |
438 | ln [a-zA-Z]*.opt ../${tempdir}/src | |
439 | ## If we ended up with a symlink, or if we did not get anything | |
440 | ## due to a cross-device symlink, copy the file. | |
441 | for file in [a-zA-Z]*.[hcs] [a-zA-Z]*.in [a-zA-Z]*.opt; do | |
442 | if test -f ../${tempdir}/src/$file; then | |
443 | # test -f appears to succeed for a symlink | |
444 | if test -L ../${tempdir}/src/$file; then | |
445 | rm ../${tempdir}/src/$file | |
62dfdaf0 | 446 | cp -p $file ../${tempdir}/src |
c75cfabd RS |
447 | chmod a-w ../${tempdir}/src/$file |
448 | fi | |
449 | else | |
450 | rm ../${tempdir}/src/$file | |
62dfdaf0 | 451 | cp -p $file ../${tempdir}/src |
c75cfabd RS |
452 | chmod a-w ../${tempdir}/src/$file |
453 | fi | |
454 | done | |
455 | ln README ChangeLog ChangeLog.*[0-9] ../${tempdir}/src | |
561bd1a1 | 456 | ln makefile.w32-in ../${tempdir}/src |
990ee059 | 457 | ln .gdbinit .dbxinit ../${tempdir}/src |
f7dbcf3c | 458 | cd ../${tempdir}/src |
8c28d444 | 459 | rm -f config.h epaths.h Makefile Makefile.c |
7b9cd64c | 460 | rm -f =* TAGS) |
f7dbcf3c | 461 | |
21764d60 | 462 | echo "Making links to \`src/bitmaps'" |
690eca32 JB |
463 | (cd src/bitmaps |
464 | ln README *.xbm ../../${tempdir}/src/bitmaps) | |
465 | ||
21764d60 | 466 | echo "Making links to \`src/m'" |
f7dbcf3c | 467 | (cd src/m |
facbb78e RS |
468 | # We call files for miscellaneous input (to linker etc) .inp. |
469 | ln README [a-zA-Z0-9]*.h *.inp ../../${tempdir}/src/m) | |
f7dbcf3c | 470 | |
21764d60 | 471 | echo "Making links to \`src/s'" |
f7dbcf3c | 472 | (cd src/s |
77427171 | 473 | ln README [a-zA-Z0-9]*.h ../../${tempdir}/src/s) |
f7dbcf3c | 474 | |
21764d60 | 475 | echo "Making links to \`lib-src'" |
f7dbcf3c | 476 | (cd lib-src |
375f1bd7 | 477 | ln [a-zA-Z]*.[chy] ../${tempdir}/lib-src |
c3f1e1a9 | 478 | ln ChangeLog Makefile.in README testfile vcdiff ../${tempdir}/lib-src |
561bd1a1 | 479 | ln grep-changelog rcs2log rcs-checkin ../${tempdir}/lib-src |
b3635775 | 480 | ln makefile.w32-in ../${tempdir}/lib-src |
c75cfabd RS |
481 | ## If we ended up with a symlink, or if we did not get anything |
482 | ## due to a cross-device symlink, copy the file. | |
483 | for file in [a-zA-Z]*.[chy]; do | |
484 | if test -f ../${tempdir}/lib-src/$file; then | |
485 | # test -f appears to succeed for a symlink | |
486 | if test -L ../${tempdir}/lib-src/$file; then | |
487 | rm ../${tempdir}/lib-src/$file | |
488 | cp $file ../${tempdir}/lib-src | |
489 | chmod a-w ../${tempdir}/lib-src/$file | |
490 | fi | |
491 | else | |
492 | rm ../${tempdir}/lib-src/$file | |
493 | cp $file ../${tempdir}/lib-src | |
494 | chmod a-w ../${tempdir}/lib-src/$file | |
495 | fi | |
496 | done | |
1260d6ba | 497 | cd ../${tempdir}/lib-src |
c75cfabd | 498 | rm -f Makefile.c |
9eff9fe3 | 499 | rm -f getopt.h |
7b9cd64c | 500 | rm -f =* TAGS) |
f7dbcf3c | 501 | |
9eff9fe3 PE |
502 | echo "Making links to \`m4'" |
503 | (cd m4 | |
504 | ln *.m4 ../${tempdir}/m4) | |
505 | ||
21764d60 | 506 | echo "Making links to \`nt'" |
391b3748 | 507 | (cd nt |
bcea38a3 PJ |
508 | ln emacs.rc config.nt [a-z]*.c ../${tempdir}/nt |
509 | ln nmake.defs gmake.defs subdirs.el ../${tempdir}/nt | |
561bd1a1 | 510 | ln [a-z]*.bat [a-z]*.h ../${tempdir}/nt |
bcea38a3 | 511 | ln ChangeLog INSTALL README makefile.w32-in ../${tempdir}/nt) |
391b3748 | 512 | |
21764d60 | 513 | echo "Making links to \`nt/inc'" |
391b3748 | 514 | (cd nt/inc |
77427171 | 515 | ln [a-z]*.h ../../${tempdir}/nt/inc) |
391b3748 | 516 | |
21764d60 | 517 | echo "Making links to \`nt/inc/sys'" |
391b3748 | 518 | (cd nt/inc/sys |
77427171 | 519 | ln [a-z]*.h ../../../${tempdir}/nt/inc/sys) |
391b3748 | 520 | |
e827bc37 RS |
521 | echo "Making links to \`nt/inc/arpa'" |
522 | (cd nt/inc/arpa | |
523 | ln [a-z]*.h ../../../${tempdir}/nt/inc/arpa) | |
524 | ||
525 | echo "Making links to \`nt/inc/netinet'" | |
526 | (cd nt/inc/netinet | |
527 | ln [a-z]*.h ../../../${tempdir}/nt/inc/netinet) | |
528 | ||
5ec8424f GV |
529 | echo "Making links to \`nt/icons'" |
530 | (cd nt/icons | |
d6dc647f JR |
531 | ln [a-z]*.ico ../../${tempdir}/nt/icons |
532 | ln [a-z]*.cur ../../${tempdir}/nt/icons) | |
5ec8424f | 533 | |
b3635775 GM |
534 | echo "Making links to \`mac'" |
535 | (cd mac | |
e278f0fe | 536 | ln ChangeLog INSTALL README make-package *.xml *.MPW ../${tempdir}/mac) |
b3635775 GM |
537 | |
538 | echo "Making links to \`mac/inc'" | |
539 | (cd mac/inc | |
540 | ln [a-z]*.h ../../${tempdir}/mac/inc) | |
541 | ||
542 | echo "Making links to \`mac/inc/sys'" | |
543 | (cd mac/inc/sys | |
544 | ln [a-z]*.h ../../../${tempdir}/mac/inc/sys) | |
545 | ||
546 | echo "Making links to \`mac/src'" | |
547 | (cd mac/src | |
548 | ln [a-z]*.c *.r ../../${tempdir}/mac/src) | |
549 | ||
e0f712ba AC |
550 | echo "Making links to \`mac/Emacs.app/Contents'" |
551 | (cd mac/Emacs.app/Contents | |
552 | ln Info.plist PkgInfo ../../../${tempdir}/mac/Emacs.app/Contents) | |
553 | ||
e278f0fe YM |
554 | echo "Making links to \`mac/Emacs.app/Contents/Resources'" |
555 | (cd mac/Emacs.app/Contents/Resources | |
556 | ln Emacs.icns ../../../../${tempdir}/mac/Emacs.app/Contents/Resources) | |
557 | ||
e0f712ba AC |
558 | echo "Making links to \`mac/Emacs.app/Contents/Resources/English.lproj'" |
559 | (cd mac/Emacs.app/Contents/Resources/English.lproj | |
560 | ln InfoPlist.strings ../../../../../${tempdir}/mac/Emacs.app/Contents/Resources/English.lproj) | |
177c0ea7 | 561 | |
21764d60 | 562 | echo "Making links to \`msdos'" |
52d7b2e5 RS |
563 | (cd msdos |
564 | ln ChangeLog emacs.ico emacs.pif ../${tempdir}/msdos | |
7fd85d56 | 565 | ln is_exec.c sigaction.c mainmake mainmake.v2 sed*.inp ../${tempdir}/msdos |
52d7b2e5 RS |
566 | cd ../${tempdir}/msdos |
567 | rm -f =*) | |
568 | ||
21764d60 | 569 | echo "Making links to \`oldXMenu'" |
f7dbcf3c | 570 | (cd oldXMenu |
8bdbf9ed | 571 | ln *.c *.h *.in ../${tempdir}/oldXMenu |
10b9fe32 | 572 | ln README ChangeLog ../${tempdir}/oldXMenu |
f395c83a | 573 | ln compile.com descrip.mms ../${tempdir}/oldXMenu) |
f7dbcf3c | 574 | |
21764d60 | 575 | echo "Making links to \`lwlib'" |
c660c0a7 RS |
576 | (cd lwlib |
577 | ln *.c *.h *.in ../${tempdir}/lwlib | |
ebb81677 | 578 | ln README ChangeLog ../${tempdir}/lwlib) |
c660c0a7 | 579 | |
21764d60 | 580 | echo "Making links to \`etc'" |
f395c83a JB |
581 | ### Don't distribute = files, TAGS, DOC files, backups, autosaves, or |
582 | ### tex litter. | |
f7dbcf3c | 583 | (cd etc |
561bd1a1 | 584 | files=`ls -d * | grep -v CVS | grep -v RCS | grep -v 'Old' | grep -v '^e$' \ |
916447e4 RF |
585 | | grep -v '^gnus$' | grep -v '^images$' | grep -v '^nxml$' \ |
586 | | grep -v '^refcards$' | grep -v '^tutorials$'| grep -v '^schema$'` | |
7a6ee7ae | 587 | ln $files ../${tempdir}/etc |
98d4c1d0 RS |
588 | ## If we ended up with a symlink, or if we did not get anything |
589 | ## due to a cross-device symlink, copy the file. | |
7a6ee7ae | 590 | for file in $files; do |
98d4c1d0 RS |
591 | if test -f ../${tempdir}/etc/$file; then |
592 | # test -f appears to succeed for a symlink | |
593 | if test -L ../${tempdir}/etc/$file; then | |
594 | rm ../${tempdir}/etc/$file | |
595 | cp $file ../${tempdir}/etc | |
596 | chmod a-w ../${tempdir}/etc/$file | |
597 | fi | |
598 | else | |
599 | rm ../${tempdir}/etc/$file | |
600 | cp $file ../${tempdir}/etc | |
601 | chmod a-w ../${tempdir}/etc/$file | |
602 | fi | |
603 | done | |
f7dbcf3c | 604 | cd ../${tempdir}/etc |
d175b0ae | 605 | rm -f fns*.el |
23a58692 | 606 | rm -f DOC* *~ \#*\# *.dvi *.log *.orig *.rej *,v =* core |
f395c83a | 607 | rm -f TAGS) |
f7dbcf3c | 608 | |
5c902eb5 | 609 | for dir in etc/e etc/gnus etc/nxml etc/tutorials etc/refcards etc/schema ; do |
561c44e8 RF |
610 | echo "Making links to \`${dir}'" |
611 | (cd ${dir} | |
612 | ln `ls -d * | grep -v CVS | grep -v RCS` ../../${tempdir}/${dir} | |
613 | cd ../../${tempdir}/${dir} | |
614 | rm -f *~ \#*\# *,v =* core) | |
615 | done | |
f08ad882 | 616 | |
36eaa68f RF |
617 | echo "Making links to \`etc/images'" |
618 | (cd etc/images | |
10b9fe32 | 619 | for img in README [a-zA-Z]*.xpm [a-zA-Z]*.xbm [a-zA-Z]*.pbm; do |
36eaa68f RF |
620 | if [ -f $img ]; then |
621 | ln $img ../../${tempdir}/etc/images | |
622 | fi | |
623 | done) | |
624 | ||
ad7a98ae | 625 | for dir in etc/images/ezimage etc/images/gnus etc/images/gud etc/images/icons \ |
561c44e8 | 626 | etc/images/low-color etc/images/mail etc/images/smilies ; do |
561bd1a1 EZ |
627 | echo "Making links to \`${dir}'" |
628 | (cd ${dir} | |
629 | ln `ls -d * | grep -v CVS | grep -v RCS` ../../../${tempdir}/${dir} | |
630 | cd ../../../${tempdir}/${dir} | |
631 | rm -f *~ \#*\# *,v =* core) | |
632 | done | |
633 | ||
56bcdb80 | 634 | for dir in etc/images/tree-widget/default etc/images/tree-widget/folder \ |
d8981daf | 635 | etc/images/smilies/grayscale etc/images/smilies/medium; do |
561c44e8 RF |
636 | echo "Making links to \`${dir}'" |
637 | (cd ${dir} | |
638 | ln `ls -d * | grep -v CVS | grep -v RCS` ../../../../${tempdir}/${dir} | |
639 | cd ../../../../${tempdir}/${dir} | |
640 | rm -f *~ \#*\# *,v =* core) | |
641 | done | |
642 | ||
d8981daf GM |
643 | for dir in etc/images/icons/hicolor/*x*/apps ; do |
644 | echo "Making links to \`${dir}'" | |
645 | (cd ${dir} | |
646 | ln `ls -d * | grep -v CVS | grep -v RCS` ../../../../../../${tempdir}/${dir} | |
647 | cd ../../../../../../${tempdir}/${dir} | |
648 | rm -f *~ \#*\# *,v =* core) | |
649 | done | |
650 | ||
21764d60 | 651 | echo "Making links to \`info'" |
66afa119 RS |
652 | # Don't distribute backups or autosaves. |
653 | (cd info | |
b3635775 | 654 | ln `find . -type f -print | grep -v CVS | grep -v RCS | grep -v cvsignore` ../${tempdir}/info |
5eea385d | 655 | #ln [a-zA-Z]* ../${tempdir}/info |
66afa119 RS |
656 | cd ../${tempdir}/info |
657 | # Avoid an error when expanding the wildcards later. | |
658 | ln emacs dummy~ ; ln emacs \#dummy\# | |
659 | rm -f *~ \#*\# core) | |
fda4e8f6 | 660 | |
d175b0ae RF |
661 | echo "Making links to \`doc/emacs'" |
662 | (cd doc/emacs | |
663 | ln *.texi *.aux *.cps *.fns *.kys *.vrs ../../${tempdir}/doc/emacs | |
664 | ln makefile.w32-in ../../${tempdir}/doc/emacs | |
665 | test -f README && ln README ../../${tempdir}/doc/emacs | |
666 | test -f Makefile.in && ln Makefile.in ../../${tempdir}/doc/emacs | |
667 | ln ChangeLog ../../${tempdir}/doc/emacs | |
668 | cp texinfo.tex ../../${tempdir}/doc/emacs | |
669 | cd ../../${tempdir}/doc/emacs | |
56c31c87 RS |
670 | rm -f \#*\# =* *~ core emacs-index* *.Z *.z xmail |
671 | rm -f emacs.?? termcap.?? gdb.?? *.log *.toc *.dvi *.oaux) | |
f7dbcf3c | 672 | |
d175b0ae RF |
673 | echo "Making links to \`doc/misc'" |
674 | (cd doc/misc | |
675 | ln *.texi *.aux *.cps *.fns *.kys *.vrs ../../${tempdir}/doc/misc | |
676 | ln makefile.w32-in ../../${tempdir}/doc/misc | |
677 | test -f README && ln README ../../${tempdir}/doc/misc | |
678 | test -f Makefile.in && ln Makefile.in ../../${tempdir}/doc/misc | |
679 | ln ChangeLog ../../${tempdir}/doc/misc | |
680 | cp texinfo.tex ../../${tempdir}/doc/misc | |
681 | cd ../../${tempdir}/doc/misc | |
682 | rm -f \#*\# =* *~ core emacs-index* *.Z *.z xmail | |
683 | rm -f emacs.?? termcap.?? gdb.?? *.log *.toc *.dvi *.oaux) | |
684 | ||
685 | echo "Making links to \`doc/lispref'" | |
686 | (cd doc/lispref | |
687 | ln `ls -1 *.texi` ../../${tempdir}/doc/lispref | |
688 | ln *.aux *.cps *.fns *.kys *.vrs ../../${tempdir}/doc/lispref | |
689 | ln *.txt *.el spellfile tindex.pl ../../${tempdir}/doc/lispref | |
690 | ln makefile.w32-in ../../${tempdir}/doc/lispref | |
691 | test -f README && ln README ../../${tempdir}/doc/lispref | |
692 | test -f Makefile.in && ln Makefile.in ../../${tempdir}/doc/lispref | |
693 | ln ChangeLog ../../${tempdir}/doc/lispref | |
694 | cd ../../${tempdir}/doc/lispref | |
1d951084 EZ |
695 | rm -f \#*\# =* *~ core elisp-index* *.Z *.z xmail |
696 | rm -f elisp.?? *.log *.toc *.dvi *.oaux) | |
697 | ||
d175b0ae RF |
698 | echo "Making links to \`doc/lispintro'" |
699 | (cd doc/lispintro | |
700 | ln *.texi *.aux *.cps *.fns *.kys *.vrs *.eps ../../${tempdir}/doc/lispintro | |
701 | ln makefile.w32-in ../../${tempdir}/doc/lispintro | |
702 | test -f texinfo.tex && ln texinfo.tex ../../${tempdir}/doc/lispintro | |
703 | test -f README && ln README ../../${tempdir}/doc/lispintro | |
704 | test -f Makefile.in && ln Makefile.in ../../${tempdir}/doc/lispintro | |
705 | ln ChangeLog ../../${tempdir}/doc/lispintro | |
706 | cd ../../${tempdir}/doc/lispintro | |
3716a206 EZ |
707 | rm -f \#*\# =* *~ core *.Z *.z xmail |
708 | rm -f emacs-lisp-intro.?? *.log *.toc *.dvi *.oaux) | |
709 | ||
d175b0ae RF |
710 | echo "Making links to \`doc/man'" |
711 | (cd doc/man | |
31d0fa8c | 712 | ln *.1 ../../${tempdir}/doc/man) |
d175b0ae | 713 | |
21764d60 | 714 | echo "Making links to \`vms'" |
40eef465 | 715 | (cd vms |
5eea385d | 716 | test -f README && ln README ../${tempdir}/vms |
40eef465 JB |
717 | cd ../${tempdir}/vms |
718 | rm -f *~) | |
719 | ||
6ab508db | 720 | ### It would be nice if they could all be symlinks to top-level copy, but |
c87b230f | 721 | ### you're not supposed to have any symlinks in distribution tar files. |
fd4bc580 | 722 | echo "Making sure copying notices are all copies of \`COPYING'" |
860484dd | 723 | for subdir in . etc info leim lib-src lisp lwlib mac msdos nt src; do |
b37017c6 | 724 | rm -f ${tempdir}/${subdir}/COPYING |
fd4bc580 | 725 | cp COPYING ${tempdir}/${subdir} |
f7dbcf3c JB |
726 | done |
727 | ||
1260d6ba | 728 | if [ "${newer}" ]; then |
21764d60 | 729 | echo "Removing files older than $newer" |
76fb0a58 JB |
730 | ## We remove .elc files unconditionally, on the theory that anyone picking |
731 | ## up an incremental distribution already has a running Emacs to byte-compile | |
732 | ## them with. | |
1260d6ba ER |
733 | find ${tempparent} \( -name '*.elc' -o ! -newer ${newer} \) -exec rm -f {} \; |
734 | fi | |
735 | ||
4746118a | 736 | if [ "${make_tar}" = yes ]; then |
922ac4c5 | 737 | if [ "${default_gzip}" = "" ]; then |
21764d60 | 738 | echo "Looking for gzip" |
922ac4c5 JB |
739 | temppath=`echo $PATH | sed 's/^:/.:/ |
740 | s/::/:.:/g | |
741 | s/:$/:./ | |
742 | s/:/ /g'` | |
743 | default_gzip=`( | |
744 | for dir in ${temppath}; do | |
745 | if [ -f ${dir}/gzip ]; then echo 'gzip --best'; exit 0; fi | |
746 | done | |
747 | echo compress | |
748 | )` | |
749 | fi | |
f395c83a | 750 | case "${default_gzip}" in |
37d6e313 | 751 | bzip2) gzip_extension=.bz2 ;; |
f395c83a | 752 | compress* ) gzip_extension=.Z ;; |
0dc610dd | 753 | * ) gzip_extension=.gz ;; |
f395c83a | 754 | esac |
ca111811 | 755 | echo "Creating tar file" |
f395c83a JB |
756 | (cd ${tempparent} ; tar cvf - ${emacsname} ) \ |
757 | | ${default_gzip} \ | |
758 | > ${emacsname}.tar${gzip_extension} | |
4746118a | 759 | fi |
f7dbcf3c | 760 | |
4746118a | 761 | if [ "${clean_up}" = yes ]; then |
21764d60 | 762 | echo "Cleaning up the staging directory" |
f395c83a | 763 | rm -rf ${tempparent} |
bb160193 | 764 | else |
ca111811 | 765 | (cd ${tempparent}; mv ${emacsname} ..) |
bb160193 | 766 | rm -rf ${tempparent} |
f7dbcf3c | 767 | fi |
00c00348 | 768 | |
ab5796a9 | 769 | # arch-tag: 26e3eb50-a394-4ab2-82b2-d8e5af500de7 |
76fb0a58 | 770 | ### make-dist ends here |