This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Remove spurious LINT: directives
[metaconfig.git] / U / modified / Extract.U
CommitLineData
959f3c4c
JH
1?RCS: $Id: Extract.U,v 3.0.1.2 1997/02/28 14:58:52 ram Exp $
2?RCS:
3?RCS: Copyright (c) 1991-1993, Raphael Manfredi
4c42341b 4?RCS:
959f3c4c
JH
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 3.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:
4c42341b 21?X:
959f3c4c
JH
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!
4c42341b 27?X:
959f3c4c
JH
28?MAKE:Extract: src
29?MAKE: -pick add $@ %<
30?F:./extract
ff429c2d 31?T:PERL_CONFIG_SH dir file name create mkdir_p
959f3c4c
JH
32: script used to extract .SH files with variable substitutions
33cat >extract <<'EOS'
ff429c2d 34PERL_CONFIG_SH=true
959f3c4c 35echo "Doing variable substitutions on .SH files..."
78daaa51
JH
36if test -f MANIFEST; then
37 set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
959f3c4c
JH
38else
39 echo "(Looking for .SH files under the source directory.)"
3720fc47 40 set x `(cd "$src"; find . -name "*.SH" -print)`
959f3c4c
JH
41fi
42shift
43case $# in
3720fc47 440) set x `(cd "$src"; echo *.SH)`; shift;;
959f3c4c 45esac
3720fc47 46if test ! -f "$src/$1"; then
959f3c4c
JH
47 shift
48fi
49?X: script to emulate mkdir -p
50mkdir_p='
51name=$1;
52create="";
53while test $name; do
54 if test ! -d "$name"; then
55 create="$name $create";
56 name=`echo $name | sed -e "s|^[^/]*$||"`;
57 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
58 else
59 name="";
60 fi;
61done;
62for file in $create; do
63 mkdir $file;
64done
65'
66for file in $*; do
67 case "$src" in
68 ".")
69 case "$file" in
70 */*)
71 dir=`expr X$file : 'X\(.*\)/'`
72 file=`expr X$file : 'X.*/\(.*\)'`
3720fc47 73 (cd "$dir" && . ./$file)
959f3c4c
JH
74 ;;
75 *)
76 . ./$file
77 ;;
78 esac
79 ;;
80 *)
81?X:
82?X: When running Configure remotely ($src is not '.'), we cannot source
83?X: the files directly, since that would wrongly cause the extraction
84?X: where the source lie instead of withing the current directory. Therefore,
85?X: we need to 'sh <file' then, which is okay since they will source the
86?X: existing config.sh file. It's not possible to use:
87?X: ../src/Configure -S -O -Dsomething
88?X: unfortunately since no new config.sh with the -Dsomething override
89?X: will be created before running the .SH files. A minor buglet.
90?X:
91?X: Note that we must create the directory hierarchy ourselves if it does
92?X: not exist already, and that is done through a shell emulation of the
93?X: 'mkdir -p' command. We don't want to use the $installdir metaconfig
94?X: symbol here since that would require too much to be configured for
95?X: this simple extraction task that may happen quickly with 'Configure -S'.
96?X: -- RAM, 18/03/96
97?X:
98 case "$file" in
99 */*)
100 dir=`expr X$file : 'X\(.*\)/'`
101 file=`expr X$file : 'X.*/\(.*\)'`
102 (set x $dir; shift; eval $mkdir_p)
3720fc47 103 sh <"$src/$dir/$file"
959f3c4c
JH
104 ;;
105 *)
3720fc47 106 sh <"$src/$file"
959f3c4c
JH
107 ;;
108 esac
109 ;;
110 esac
111done
3720fc47 112if test -f "$src/config_h.SH"; then
959f3c4c
JH
113 if test ! -f config.h; then
114 : oops, they left it out of MANIFEST, probably, so do it anyway.
3720fc47 115 . "$src/config_h.SH"
959f3c4c
JH
116 fi
117fi
118EOS
119