make TARGET optional
[p5sagit/local-lib.git] / eg / scripted_install.pl
1 #!/usr/bin/perl\r
2 # contributed by hdp@cpan.org\r
3 \r
4 use strict;\r
5 use warnings;\r
6 use CPAN;\r
7 use Cwd;\r
8 use File::Spec;\r
9 my $target = $ENV{TARGET} ? Cwd::abs_path($ENV{TARGET}) : undef;
10 \r
11 my $mod = CPAN::Shell->expand(Module => "local::lib");\r
12 $mod->get;\r
13 my $dir = CPAN::Shell->expand(Distribution => $mod->cpan_file)->dir;\r
14 chdir($dir);\r
15 my $make = $CPAN::Config->{make};\r
16 my $bootstrap = $target ? "--bootstrap=$target" : "--bootstrap"
17 system($^X, 'Makefile.PL', $bootstrap) && exit 1;
18 system($make, 'test') && exit 1;\r
19 system($make, 'install') && exit 1;\r