On Mon, 3 Mar 2003 22:58:12 -0500 Ilya Goldberg <[EMAIL PROTECTED]> wrote:

> To answer my own question, the problem was a bug (feature?) in how 
> 'DIR' is processed.
  I think it is a (minor) bug.

> The Makefile.PLs in 'DIR' are passed INST_* with '../' prepended - no 
> mater how deep the subdir is.  It is always assumed to be only one 
> level down.  This results in a separate blib tree in the wrong place in 
> my case.  This in-turn results in a failure to install my compiled 
> XSUBs.
> 
> Looking at MakeMaker's code, apparently '../' is pre-pended only if 
> INST_* is a relative path.  So I passed INST_* to WriteMakefile as 
> absolute paths determined from the cwd where the top-level Makefile.PL 
> is run.  It works, but is obviously not ideal.
> 
> use Cwd qw(cwd abs_path);
> my $pwd = abs_path(cwd()) || die "Can't figure out your cwd!";
> ...
>      INST_BIN     => File::Spec->catdir($pwd,'blib','bin'),
>      INST_LIB     => File::Spec->catdir($pwd,'blib','lib'),
>      INST_ARCHLIB => File::Spec->catdir($pwd,'blib','arch'),
>      INST_SCRIPT  => File::Spec->catdir($pwd,'blib','script'),
>      INST_MAN1DIR => File::Spec->catdir($pwd,'blib','man1'),
>      INST_MAN3DIR => File::Spec->catdir($pwd,'blib','man3'),
> ...
> 
> 
> One pretty good solution would be to determine and set INST_* to 
> absolute paths in MakeMaker in the top-level make and pass absolute 
> paths to the lower-level makes.
  Another solution is to put a Makefile.PL in each directory between the
root and the directory with the other Makefile.PLs. Example: if current
layout is:

my_prj/Makefile.PL  # DIR lists 'foo/bar/baz/moo/boo', 'x/y/z'
my_pry/foo/bar/baz/moo/boo/Makefile.PL
my_prj/x/y/z/Makefile.PL

add/change

my_prj/Makefile.PL # DIR = 'foo', 'x'
my_prj/foo/Makefile.PL # DIR = 'bar'
my_prj/foo/bar/Makefile.PL # dir = 'baz'
...
my_prj/foo/bar/baz/moo/Makefile.PL # DIR = 'boo'
# same for x/Makefile.PL and x/y/Makefile.PL

  Of course it is suboptimal, but the bug doesn't annoy me that much, so I
won't try to fix it otherwise.

HTH
Mattia



Reply via email to