/[wait]/trunk/Makefile.PL
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /trunk/Makefile.PL

Parent Directory Parent Directory | Revision Log Revision Log


Revision 19 - (hide annotations)
Tue May 9 11:29:45 2000 UTC (24 years ago) by ulpfr
Original Path: branches/CPAN/Makefile.PL
File MIME type: text/plain
File size: 5520 byte(s)
Import of WAIT-1.800

1 ulpfr 10 ######################### -*- Mode: Perl -*- #########################
2     ##
3     ## $Basename: Makefile.PL $
4 ulpfr 19 ## $Revision: 1.13 $
5 ulpfr 10 ##
6     ## Author : Ulrich Pfeifer
7     ## Created On : Tue Aug 20 12:15:44 1996
8     ##
9     ## Last Modified By : Ulrich Pfeifer
10 ulpfr 19 ## Last Modified On : Sun Apr 9 14:08:50 2000
11 ulpfr 10 ##
12     ## Copyright (c) 1996-1997, Ulrich Pfeifer
13     ##
14     ######################################################################
15    
16     use strict;
17    
18     use Config;
19     use ExtUtils::MakeMaker qw(:DEFAULT neatvalue);
20     use File::Path;
21     use Getopt::Long;
22    
23     &check_perl(5.00307); # need pack 'w', ...
24    
25     my %OPT = (default => 0);
26     GetOptions(\%OPT, 'default!');
27    
28     &init($OPT{default});
29    
30 ulpfr 13 my @pl_files = glob('script/*');
31 ulpfr 10
32     my %seen;
33     my @objects = grep { s![^.]+$!o!; !$seen{$_}++ } glob('*.[cx]*');
34    
35 ulpfr 19 WriteMakefile(
36     'PREREQ_PM' => {'Term::ReadLine' => 0,
37     'DB_File' => 1.03,
38     'Data::Dumper' => 2.02,
39     'Pod::Text' => 1.02,
40     'HTML::Entities' => 0,
41     'LockFile::Simple' => 0,
42 ulpfr 10 },
43     'NAME' => 'WAIT',
44     'OBJECT' => join(' ', @objects),
45 ulpfr 19 # $Format: " 'VERSION' => sprintf('%5.3f', ($ProjectMajorVersion$ * 100 + ( $ProjectMinorVersion$-1))/1000),"$
46     'VERSION' => sprintf('%5.3f', (18 * 100 + ( 1-1))/1000),
47 ulpfr 10 'EXE_FILES' => \@pl_files,
48     'dist' => {
49 ulpfr 19 PREOP => 'cp README.header README && pod2text lib/WAIT.pm >> README',
50 ulpfr 10 SUFFIX => 'gz',
51     COMPRESS => 'gzip -9f',
52     },
53     );
54    
55    
56     ## ###################################################################
57     ## subs
58     ## ###################################################################
59    
60     sub MY::postamble
61     {
62     q[
63     lib/WAIT/Query/Wais.pm: waisquery.y
64     byacc -P -l waisquery.y;
65     sed -n '2,$$ p' y.tab.pl | ]. "$Config{cpp} $Config{cppminus}" .
66 ulpfr 19 q[ | sed -e '/^# [0-9]/ d' > $@ && rm -f y.tab.pl
67 ulpfr 10
68     TAGS: MANIFEST
69     etags `].$^X.q[ -ane 'print "$$F[0]\n"' MANIFEST`
70     ]
71     }
72    
73    
74     sub init
75     {
76     my $use_defaults = shift;
77    
78     $WAIT::Config = {};
79     eval { require WAIT::Config; };
80    
81     my $answer;
82    
83    
84     ## WAIT database directory
85     print <<"EOF";
86     The WAIT module needs a directory of its own to store the databases.
87     This may be a site-wide directory or a personal directory.
88     EOF
89     ;
90    
91     $answer = $WAIT::Config->{WAIT_home};
92     $answer = '' unless $answer && -d $answer;
93     $answer = prompt("WAIT database directory?", $answer) unless $use_defaults;
94    
95     mkpath($answer) unless $answer && -d $answer; # dies if it can't
96     $WAIT::Config->{WAIT_home} = $answer;
97    
98    
99     ## get manual pages
100     my $help = q{
101    
102     Now you need to tell me which manual directories you want to index.
103     If you want to enter a path, just type it in. To select a path type
104     '+' an the number. To deselect type '-' an the number. Enter 'q' if
105     you are finished.
106    
107     };
108     my %seen;
109     my @manpath = @{$WAIT::Config->{manpath} ||
110     [grep (-d $_, split(':', $ENV{MANPATH}),
111     '/usr/man',
112     '/usr/local/man')]};
113    
114     @manpath = grep !$seen{$_}++, @manpath;
115     my %select; @select{0 .. @manpath} = ('+') x @manpath;
116    
117     for (split(':', $ENV{MANPATH}), '/usr/man', '/usr/local/man') {
118     next unless -d $_;
119     next if $seen{$_};
120     $select{@manpath} = '-';
121     push @manpath, $_;
122     }
123    
124     print $help;
125     while (! $use_defaults) {
126     my $i;
127     for $i (0 .. $#manpath) {
128     printf "%2d %c %s\n", $i, ord($select{$i}), $manpath[$i];
129     }
130     $answer = prompt("path|[+-]number|q>");
131     if ($answer eq 'q') {
132     last;
133     } elsif ($answer =~ /^(\+|\-)\s*(\d+)?$/) {
134     if (defined $2) {
135     if (0 <= $2 and $2 <= $#manpath) {
136     $select{$2} = $1;
137     }
138     else {
139     print $help;
140     }
141     } else {
142     for (keys %select) {
143     $select{$_} = $1;
144     }
145     }
146     } elsif (-d $answer) {
147     push @manpath, $answer;
148     $select{$#manpath} = '+';
149     } else {
150     print "Directory '$answer' does not seem to exists?\n";
151     print $help;
152     }
153     }
154     $WAIT::Config->{manpath} = [];
155     my $i;
156     foreach $i (0 .. $#manpath) {
157     if ($select{$i} eq '+') {
158     push @{$WAIT::Config->{manpath}}, $manpath[$i];
159     }
160     }
161    
162    
163     ## pager
164     print "\nWhat pager do you want to use?\n";
165     print "Your perl administrator recommends '$Config{pager}'\n";
166     print "We would prefer 'less', if you have that installed\n"
167     unless $Config{pager} =~ /less/;
168    
169     $answer = $WAIT::Config->{pager} || $Config{pager} || 'less';
170     $answer = prompt("pager?", $answer) unless $use_defaults;
171     $WAIT::Config->{pager} = $answer;
172    
173    
174     ## write config
175 ulpfr 13 my $configpmdir = MM->catdir('lib', 'WAIT');
176 ulpfr 10 mkpath $configpmdir;
177 ulpfr 13 my $configpm = MM->catfile('lib', 'WAIT', 'Config.pm/' );
178 ulpfr 10
179     open FH, "> $configpm" or die "Couldn't write open $configpm: $!\n";
180     print FH qq[\$WAIT::Config = \{\n];
181     foreach (sort keys %$WAIT::Config) {
182     print FH " '$_' => ", neatvalue($WAIT::Config->{$_}), ",\n";
183     }
184    
185     print FH "};\n1;\n";
186     }
187    
188    
189     sub check_perl
190     {
191     my $perlversion = shift;
192    
193     if ($] < $perlversion) {
194     print <<"EOF";
195     Your Perl version is less than $perlversion. Please install a Perl with version
196     $perlversion or higher. Get it from CPAN: http://www.perl.org/CPAN/
197     EOF
198     ;
199     die "\n";
200     }
201     else {
202     print "Your perl has version $] (higher than $perlversion). Ok!\n";
203     }
204     }
205    

Properties

Name Value
cvs2svn:cvs-rev 1.1.1.3

  ViewVC Help
Powered by ViewVC 1.1.26