Re: [Module::Build] Document install_base_relpaths
Status: Beta
Brought to you by:
kwilliams
|
From: Randy W. S. <ml...@th...> - 2006-03-04 21:41:09
|
David Wheeler wrote:
> On Mar 4, 2006, at 09:11, Ken Williams wrote:
>
>> In general, with custom stuff in a distro, you first specify how it
>> gets mapped to blib/, then how it gets mapped to installation
>> directories.
>
>
> Yes, but I think that a reasonable default would be "copy all of the
> files from the distribution directory named for the element to the same
> named directory under the install base." That's what I'm running into
> when, for example, I want to install Mason components. They don't need
> to be processed at all, just copied from comp to blib/comp during
> ./Build, and from blib/comp to install_base/comp during ./ Build install.
>
> That's why I was suggesting a separate method, so that it could be
> independent. But ultimately what's happening for me is that I want to
> make sure that the contents of the comp directory are installed in comp
> relative to the install base, even if it should change during the build
> process.
>
> So I'm thinking something like this:
>
> sub add_build_dir {
> my ($self, $dir) = @_;
> die "What the?" unless -d $dir;
> $self->add_build_element($dir);
> $self->install_base_relpaths->{$elem} ||= [$elem];
> no strict 'refs';
> *{ref $self . "::process_$dir\_files"} = sub {
> my self = shift;
> my $files = $self->find_files_in_dir($dir);
> while (my ($file, $dest) = each %$files) {
> $self->copy_if_modified(
> from => $file,
> to => File::Spec->catfile($self->blib, $dest)
> );
> }
> };
> }
>
> Only perhaps less magical. Do you see what I'm getting at?
Does this work with 0.27x ?
IIUC, the desired behavior is that by saying:
my $build = Module::Build->new(
...
conf_files => { 'conf/myconf' => 'conf/myconf' },
};
$build->add_build_dir('conf');
The 'conf' files will be automatically installed when an 'install_base'
is supplied? Eg.
./Build install --install-base ~
rather than requiring an explicit install-path
.Build install --install-base ~ --install-path conf=~/conf
But the supplied patches don't do anything because ->install_types()
still don't know about 'conf' files.
Also, would something similar be done for 'prefix'? Where would the
default location be? Somewhere like:
"$prefix/share/$dist_name/$elem"
Or did I miss the intent?
Randy.
|