On Fri, Apr 1, 2011 at 7:15 PM, Simon Ruderich <si...@ruderich.org> wrote:
> I'm trying to install custom files to a specific location which
> should be relative to the given prefix/install_base/.. In this
> case into share/locale. So e.g. if --prefix=/usr/local then it
> should install into /usr/local/share/locale/.

How do you call your Build/Build.PL exactly? Do you call your example
with --install_base?

> I'm using Module::Build 0.340201 on Debian Squeeze.

You might want to upgrade to a more recent version of Module::Build.
«apt-get install libmodule-build-perl» should upgrade it to 0.3607.
CPAN will upgrade it to 0.38. It might solve your problems.

>    $build->add_build_element('locale');
>    $build->install_base_relpaths(locale => 'locale');

The general solution looks something like this:

  use File::Spec 'catdir';
  …
  $build->add_build_element('locale');
  $build->install_base_relpaths(locale => catdir('share', 'locale'));
  $build->prefix_relpaths($_, locale => catdir('share', 'locale')) for
qw/core vendor site/;
  $build->install_sets($_, 'locale',
catdir($build->original_prefix($_)), 'share', 'locale')) for qw/core
vendor site/;

Yeah, you need all of that for all options to work as you expect them
to. Also, you then have to figure out a way for your program to know
where to find the files, but that's a different discussion.

A much simpler solution in your case would be to use the sharedir
functionality of Module::Build (available since 0.36). It doesn't
sound like you need something sharedir can't provide.

> It seems to work, but doesn't look like a good solution. Is there
> a variable which returns the absolute installation prefix? I
> couldn't find any in the documentation.

No, that's not how it works on the inside: an absolute installation
prefix is only well-defined in a limited set of circumstances (when
using --prefix and --install_base).

Leon

Reply via email to