-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathMakefile.PL
104 lines (87 loc) · 2.16 KB
/
Makefile.PL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
use ExtUtils::MakeMaker;
my $pms= {};
my $pods= {};
my $sb_depends='';
my $sb_files='';
my $sb_winfiles='';
my @sb_winfiles=();
foreach (qw(bang perl brace built_in perlfunc executable eval)) {
my $ucase= ucfirst($_);
my $tmp='lib/Psh/Strategy/'.$ucase.'.pm';
$sb_depends.=$tmp." \\\n\t";
$sb_files.=$tmp.' ';
push @sb_winfiles, "lib\\Psh\\Strategy\\$ucase.pm";
}
$sb_winfiles= join(' +',@sb_winfiles);
$sb_depends= substr($sb_depends,0,-4);
sub MY::postamble {
# to copy share files after installation
my $tmp="
install ::
\$(PERL) postinstall.pl \$(SITEPREFIX) \$(PREFIX)
lib/Psh/StrategyBunch.pm : $sb_depends
";
if ($^O eq 'MSWin32') {
$tmp.=" copy $sb_winfiles lib\\Psh\\StrategyBunch.pm
";
} else {
$tmp.=" echo \"## do not modify - autogenerated ##\" > lib/Psh/StrategyBunch.pm
cat $sb_files >> lib/Psh/StrategyBunch.pm
";
}
return $tmp;
}
open( FILE, "< MANIFEST");
while( <FILE>)
{
chomp;
next if $_ !~ /.pm$/;
my $dest= $_;
$dest=~ s/^lib/\$(INST_LIBDIR)/;
$pms->{$_}=$dest;
}
$pms->{'lib/Psh/StrategyBunch.pm'}='$(INST_LIBDIR)/Psh/StrategyBunch.pm';
close(FILE);
chdir 'doc';
my @tmp= glob('*.pod');
foreach (@tmp) {
my $source= 'doc/'.$_;
s/\.pod$//;
my $dest= '$(INST_MAN1DIR)/'.$_.'.$(MAN1EXT)';
$pods->{$source}=$dest;
}
chdir '..';
WriteMakefile (
NAME => 'psh',
VERSION_FROM => 'lib/Psh.pm',
AUTHOR => 'Gregor N. Purdy, Sr. ([email protected])',
ABSTRACT => 'Perl Shell',
EXE_FILES => [ qw(psh) ],
PREREQ_PM => {
'Cwd' => '0',
'File::Spec' => '0',
},
MAN1PODS => $pods,
PM => $pms,
# PM_FILTER => 'grep -v \\"^\\#\\"', # remove comments on install
dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz' },
clean => { FILES => "psh-*.tar.gz lib/Psh/StrategyBunch.pm" },
);
eval {
require Term::ReadLine;
require Term::ReadLine::Gnu;
};
if ($@) {
eval {
require Term::ReadLine::Perl;
};
if ($@) {
print "We suggest you install Term::ReadLine::Gnu or Term::ReadLine::Perl to make psh more useful!\n";
}
}
eval {
require BSD::Resource;
};
if ($@) {
print "The 'ulimit' command in psh will not work, unless you install BSD::Resource.\n";
}