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
|
use ExtUtils::MakeMaker;
use ExtUtils::Embed;
use Config;
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
my %config;
foreach my $arg (@ARGV) {
my ($k,$v) = split(/=/, $arg, 2);
$config{$k} = $v;
}
my $hacking = $config{HACKING} ? 'DEFINE += -Wall' : '';
my $perl_path;
if ($config{PERL_PATH}) {
$perl_path = $config{PERL_PATH};
}
elsif ($^X =~ m|^/|) {
$perl_path = $^X;
}
else {
$perl_path = $Config{perlpath};
$perl_path =~ s|/[^/]*$|/$^X|;
}
print "Checking $perl_path is the same version as this one...";
chomp(my $V = `$perl_path -MConfig -le 'print Config->myconfig'`);
if ($V eq Config->myconfig) {
print "ok\n";
}
else {
print "not ok\n";
print <<EOT;
The perl at $perl_path and the one currently executing this Makefile.PL do
not appear to be the same.
Please specify a full path to a perl interpreter on the command line, e.g:
perl Makefile.PL PERL_PATH=/usr/bin/perl_custom
EOT
exit;
}
my $variant = "44BSD";
$variant = "43BSD" if $^O eq 'solaris';
WriteMakefile(
'NAME' => 'PPerl',
'VERSION_FROM' => 'PPerl.pm', # finds $VERSION
'EXE_FILES' => [ qw( pperl ) ],
'realclean' => {FILES => 'pperl'},
($] >= 5.005 ? ## Add these new keywords supported since 5.005
(ABSTRACT_FROM => 'PPerl.pm', # retrieve abstract from module
AUTHOR => 'Matt Sergeant, matt@sergeant.org') : ()),
DEFINE => "-DVARIANT_$variant -DPERL_INTERP='\"$perl_path\"' -I.",
MAN1PODS => { "PPerl.pm" => 'pperl.1p' },
MAN3PODS => { },
);
sub MY::postamble {
my $ccopts = ccopts;
chomp $ccopts;
my $ldopts = ldopts;
chomp $ldopts;
"
# just hacking around
$hacking
pperl.h: pperl.h.header PPerl.pm
\t$^X write_pperl_h
main.o: Makefile main.c pperl.h
pperl: main.o pass_fd.o
\t\$(CC) \$(DEFINE) -o pperl main.o pass_fd.o $ldopts
pass_fd.c: pass_fd.h
PPerl.xs: pass_fd.c
";
}
|