Commit | Line | Data |
---|---|---|
d8875586 MBT |
1 | ?RCS: $Id: Extract.U 1 2006-08-24 12:32:52Z rmanfredi $ |
2 | ?RCS: | |
3 | ?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi | |
4 | ?RCS: | |
5 | ?RCS: You may redistribute only under the terms of the Artistic Licence, | |
6 | ?RCS: as specified in the README file that comes with the distribution. | |
7 | ?RCS: You may reuse parts of this distribution only within the terms of | |
8 | ?RCS: that same Artistic Licence; a copy of which may be found at the root | |
9 | ?RCS: of the source tree for dist 4.0. | |
10 | ?RCS: | |
11 | ?RCS: $Log: Extract.U,v $ | |
12 | ?RCS: Revision 3.0.1.2 1997/02/28 14:58:52 ram | |
13 | ?RCS: patch61: added support for src.U | |
14 | ?RCS: | |
15 | ?RCS: Revision 3.0.1.1 1994/10/29 15:51:46 ram | |
16 | ?RCS: patch36: added ?F: line for metalint file checking | |
17 | ?RCS: | |
18 | ?RCS: Revision 3.0 1993/08/18 12:04:52 ram | |
19 | ?RCS: Baseline for dist 3.0 netwide release. | |
20 | ?RCS: | |
21 | ?X: | |
22 | ?X: This unit produces a shell script which can be doted in order to extract | |
23 | ?X: .SH files with variable substitutions. | |
24 | ?X: | |
25 | ?X: When running Configure from a remote directory ($src is not '.'), | |
26 | ?X: then the files will be created in that directory, so beware! | |
27 | ?X: | |
28 | ?MAKE:Extract: Mkdirp src | |
29 | ?MAKE: -pick add $@ %< | |
30 | ?F:./extract | |
31 | ?T:CONFIG SRC dir file | |
32 | : script used to extract .SH files with variable substitutions | |
33 | cat >extract <<EOS | |
34 | CONFIG=true | |
35 | SRC="$src" | |
36 | EOS | |
37 | cat >>extract <<'EOS' | |
38 | echo "Doing variable substitutions on .SH files..." | |
39 | if test -f "$SRC/MANIFEST"; then | |
40 | set x `awk '{print $1}' <$SRC/MANIFEST | grep '\.SH'` | |
41 | else | |
42 | echo "(Looking for .SH files under the source directory.)" | |
43 | set x `(cd "$SRC"; find . -name "*.SH" -print)` | |
44 | fi | |
45 | shift | |
46 | case $# in | |
47 | 0) set x `(cd "$SRC"; echo *.SH)`; shift;; | |
48 | esac | |
49 | if test ! -f "$SRC/$1"; then | |
50 | shift | |
51 | fi | |
52 | for file in $*; do | |
53 | case "$SRC" in | |
54 | ".") | |
55 | case "$file" in | |
56 | */*) | |
57 | dir=`expr X$file : 'X\(.*\)/'` | |
58 | file=`expr X$file : 'X.*/\(.*\)'` | |
59 | (cd $dir && . ./$file) | |
60 | ;; | |
61 | *) | |
62 | . ./$file | |
63 | ;; | |
64 | esac | |
65 | ;; | |
66 | *) | |
67 | ?X: | |
68 | ?X: When running Configure remotely ($src is not '.'), we cannot source | |
69 | ?X: the files directly, since that would wrongly cause the extraction | |
70 | ?X: where the source lie instead of withing the current directory. Therefore, | |
71 | ?X: we need to 'sh <file' then, which is okay since they will source the | |
72 | ?X: existing config.sh file. It's not possible to use: | |
73 | ?X: ../src/Configure -S -O -Dsomething | |
74 | ?X: unfortunately since no new config.sh with the -Dsomething override | |
75 | ?X: will be created before running the .SH files. A minor buglet. | |
76 | ?X: | |
77 | ?X: Note that we must create the directory hierarchy ourselves if it does | |
78 | ?X: not exist already, and that is done through a shell emulation of the | |
79 | ?X: 'mkdir -p' command. We don't want to use the $installdir metaconfig | |
80 | ?X: symbol here since that would require too much to be configured for | |
81 | ?X: this simple extraction task that may happen quickly with 'Configure -S'. | |
82 | ?X: -- RAM, 18/03/96 | |
83 | ?X: | |
84 | case "$file" in | |
85 | */*) | |
86 | dir=`expr X$file : 'X\(.*\)/'` | |
87 | file=`expr X$file : 'X.*/\(.*\)'` | |
88 | ./mkdirp $dir | |
89 | sh <"$SRC/$dir/$file" | |
90 | ;; | |
91 | *) | |
92 | sh <"$SRC/$file" | |
93 | ;; | |
94 | esac | |
95 | ;; | |
96 | esac | |
97 | done | |
98 | if test -f "$SRC/config_h.SH"; then | |
99 | if test ! -f config.h; then | |
100 | ?X: oops, they left it out of MANIFEST, probably, so do it anyway. | |
101 | sh <"$SRC/config_h.SH" | |
102 | fi | |
103 | fi | |
104 | EOS | |
105 |