This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Populate metaconfig branch.
[metaconfig.git] / dist-3.0at70b / mcon / mlint.SH
1 case $CONFIG in
2 '')
3         if test -f config.sh; then TOP=.;
4         elif test -f ../config.sh; then TOP=..;
5         elif test -f ../../config.sh; then TOP=../..;
6         elif test -f ../../../config.sh; then TOP=../../..;
7         elif test -f ../../../../config.sh; then TOP=../../../..;
8         else
9                 echo "Can't find config.sh."; exit 1
10         fi
11         . $TOP/config.sh
12         ;;
13 esac
14 case "$0" in
15 */*) cd `expr X$0 : 'X\(.*\)/'` ;;
16 esac
17 echo "Extracting mcon/mlint (with variable substitutions)"
18 cat >mlint <<!GROK!THIS!
19 $startperl
20         eval "exec perl -S \$0 \$*"
21                 if \$running_under_some_shell;
22
23 # $Id: mlint.SH,v 3.0.1.3 1994/05/06 15:20:42 ram Exp $
24 #
25 #  Copyright (c) 1991-1993, Raphael Manfredi
26 #  
27 #  You may redistribute only under the terms of the Artistic Licence,
28 #  as specified in the README file that comes with the distribution.
29 #  You may reuse parts of this distribution only within the terms of
30 #  that same Artistic Licence; a copy of which may be found at the root
31 #  of the source tree for dist 3.0.
32 #
33 # Original Author: Harlan Stenn <harlan@mumps.pfcs.com>
34 #
35 # $Log: mlint.SH,v $
36 # Revision 3.0.1.3  1994/05/06  15:20:42  ram
37 # patch23: added -L switch to override public unit repository path
38 #
39 # Revision 3.0.1.2  1994/01/24  14:21:00  ram
40 # patch16: added ~/.dist_profile awareness
41 #
42 # Revision 3.0.1.1  1993/08/19  06:42:27  ram
43 # patch1: leading config.sh searching was not aborting properly
44 #
45 # Revision 3.0  1993/08/18  12:10:17  ram
46 # Baseline for dist 3.0 netwide release.
47 #
48
49 # Perload ON
50
51 \$MC = '$privlib';
52 \$version = '$VERSION';
53 \$patchlevel = '$PATCHLEVEL';
54 \$grep = '$grep';
55 !GROK!THIS!
56
57 $spitshell >>mlint <<'!NO!SUBS!'
58 &profile;                                               # Read ~/.dist_profile
59 require 'getopts.pl';
60 &usage unless &Getopts("hklVL:");
61
62 if ($opt_V) {
63         print STDERR "metalint $version PL$patchlevel\n";
64         exit 0;
65 } elsif ($opt_h) {
66         &usage;
67 }
68
69 chop($date = `date`);
70 $MC = $opt_L if $opt_L;                 # May override library path
71 $MC = &tilda_expand($MC);               # ~name expansion
72 chop($WD = `pwd`);                              # Working directory
73 chdir $MC || die "Can't chdir to $MC: $!\n";
74 chop($MC = `pwd`);                              # Real metalint lib path (no symbolic links)
75 chdir $WD || die "Can't chdir back to $WD: $!\n";
76
77 &init;                                                                  # Various initializations
78 `mkdir .MT 2>&1` unless -d '.MT';               # For private temporary files
79
80 &locate_units;                          # Fill in @ARGV with a unit list
81 &extract_dependencies;          # Extract dependencies from units
82 &sanity_checks;                         # Perform sanity checks
83
84 if ($opt_k) {
85         print "Leaving subdirectory .MT unremoved so you can peruse it.\n"
86                 unless $opt_s;
87 } else {
88         `rm -rf .MT 2>&1`;
89 }
90 print "Done.\n" unless $opt_s;
91
92 # General initializations
93 sub init {
94         &init_except;                   # Token which have upper-cased letters
95         &init_depend;                   # The %Depend array records control line handling
96 }
97
98 # Record the exceptions -- all symbols but these are lower case
99 sub init_except {
100         $Except{'Mcc'}++;
101         $Except{'Author'}++;
102         $Except{'Date'}++;
103         $Except{'Header'}++;
104         $Except{'Id'}++;
105         $Except{'Locker'}++;
106         $Except{'Log'}++;
107         $Except{'RCSfile'}++;
108         $Except{'Revision'}++;
109         $Except{'Source'}++;
110         $Except{'State'}++;
111 }
112
113 # Print out metalint's usage and exits
114 sub usage {
115         print STDERR <<EOM;
116 Usage: metalint [-hklsV] [-L dir]
117   -h : print this help message and exits.
118   -k : keep temporary directory.
119   -l : also report problems from library units.
120   -s : silent mode.
121   -L : specify main units repository.
122   -V : print version number and exits.
123 EOM
124         exit 1;
125 }
126
127 !NO!SUBS!
128 $grep -v '^;#' pl/locate.pl >>mlint 
129 $grep -v '^;#' pl/lint.pl >>mlint 
130 $grep -v '^;#' pl/init.pl >>mlint 
131 $grep -v '^;#' pl/extract.pl >>mlint 
132 $grep -v '^;#' pl/obsolete.pl >>mlint 
133 $grep -v '^;#' pl/tsort.pl >>mlint 
134 $grep -v '^;#' ../pl/tilde.pl >>mlint 
135 $grep -v '^;#' ../pl/profile.pl >>mlint
136 chmod +x mlint
137 $eunicefix mlint