On Sun, Feb 16, 2003 at 11:34:48AM -0600, Ken Williams wrote:
> Last week I did some poking around in the PREFIX-like areas of
> Module::Build and discovered that some parts of it are totally broken,
> and have been for several version releases. Ick. This really needs to
> be addressed. And it needs to be simpler than it is in MakeMaker, for
> sure.
>
> One way to make installation happen in another directory is like this:
>
> perl Build.PL config='sitelib=/tmp sitearch=/tmp/debian'
>
> Obviously not ideal, but it should work for the time being.
When building a package, one should build the software with the paths
from which it will ultimately run, not where it will initially be installed.
So doing the above might cause some problems down the road.
MakeMaker 6.06 added a DESTDIR macro, inspired by the GNU make standard
targets (http://www.gnu.org/manual/make/html_node/make_127.html). This
allows a package builder to build a package normally, but install it
into a different directory root for packaging.
Translated to Module::Build, it might look something like this:
perl Build.PL
./Build
./Build test
./Build install --destdir=/tmp/debian-pkg-root
Which would be added as $self->{properties}{destdir}.
Internally, install_map would do something like:
sub install_map {
my ($self, $blib) = @_;
my $lib = File::Spec->catfile($blib,'lib');
my $arch = File::Spec->catfile($blib,'arch');
my $inst_lib = $self->{config}{sitelib};
my $inst_arch = $self->{config}{sitearch};
my $destdir = $self->{properties}{destdir} || '';
if( length $destdir ) {
$inst_lib = File::Spec->catfile($destdir, $inst_lib);
$inst_arch = File::Spec->catfile($destdir, $inst_arch);
}
return {$lib => $inst_lib,
$arch => $inst_arch,
read => ''}; # To keep ExtUtils::Install quiet
}
Its simple for both Module::Build and the packager, and its the Correct
way to handle packaging modules.
|