Subject: | Gantry 3.53 Build.PL does not honour destdir |
G'day folk,
When using something like dh-make-perl (which takes a Perl distribution
and turns it into a Debian package: .deb) the build destination
directory may not be the installation directory. This is particularly
important as it may be desirable to build a package once, and then push
it out and install it on several machines (or make it available for
people to install via apt-get). Of course, I usually use dh-make-perl
just so that I have one easy place to monitor my installed packages
from, and to give me an easy uninstall path.
When the install_base is created on line 151, it refers to the
install_destination, not the destination directory. This can be kludged
to work with the following patch:
diff -u -r Gantry-3.53/Build.PL kludged-Gantry/Build.PL
--- Gantry-3.53/Build.PL 2008-07-07 04:58:49.000000000 +1000
+++ kludged-Gantry/Build.PL 2008-09-25 18:36:07.000000000 +1000
@@ -150,6 +150,8 @@
my $install_base = $self->install_destination('lib')
|| $p->{install_sets}{site}{lib};
+
+ $install_base = "$p->{destdir}/$install_base";
my $initf = "$install_base/$p->{dist_name}/Init.pm";
but clearly this is not ideal. Without this kludge the attempt to write
Init.pm fails due to Init.pm not being found in the appropriate
location. Of course if $p->{destdir} is undefined, then you get
//$install_base and you probably don't want that. You'd probably want
to say something more like:
if(defined $p->{destdir}) {
$install_base = "$p->{destdir}/$install_base";
}
but at least I could build my .deb with that kludge. ;)
Also, the Gantry templates also do not honour the destdir and are
instead placed on the build machine, not below destdir as they should
be. This means that they are not available in the .deb that gets
created and thus will go missing from deployed distributions. :(
To work with dh-make-perl (and I'm sure many other similar tools),
ideally one would treat destdir as the equivalent of /, as in fact all
the rest of the Module::Build code does. Using the package manager
would then take care of creating and populating the appropriate
directories as requested. Certainly it should not require root access
to build a distribution, even if it requires root access to then install it.
Thanks,
Jacinta