/[wait]/cvs-head/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

Contents of /cvs-head/Makefile.PL

Parent Directory Parent Directory | Revision Log Revision Log


Revision 10 - (show annotations)
Fri Apr 28 15:40:52 2000 UTC (24 years ago) by ulpfr
File MIME type: text/plain
File size: 5485 byte(s)
Initial revision

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

Properties

Name Value
cvs2svn:cvs-rev 1.1

  ViewVC Help
Powered by ViewVC 1.1.26