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