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