Re: Detecting where files will be placed

Michael G Schwern <[email protected]> Thu, 11 Feb 2010 14:07:43 -0800
Newsgroups gmane.comp.lang.perl.modules.extutils-makemaker.devel
Message-ID <[email protected]>
Alberto Simões wrote:
> I am trying o prepare an installation script that needs to install some
> data files and some private binaries. For that it would be great to
> substitute on public binaries the base path where the private binaries
> will be placed.
> 
> With all this site, vendor and perl paths I never know where it will be
> placed.
> 
> Is there any easy way to find it out during installation step?

So, if I understand you, if programs were going into /usr/local/bin you might 
want to go into /usr/local/bin/private?


> Other than messing with INSTALL_$(INSTALLDIRS)... rules?

There's a double whammy.  First, you have to look at $mm->{INSTALLDIRS} to 
figure out what set of install directories you're going to.  Then you need to 
figure out what set of install variables this maps to (for example, "perl" 
maps to INSTALLPRIVLIB and INSTALLBIN but "site" maps to INSTALLSITELIB and 
INSTALLSITEBIN).  And for the final insult, you have to expand any make 
variables inside $mm->{INSTALLBIN} yourself.  For example, if a PREFIX is set, 
$mm->{INSTALLBIN} might be '$(PERLPREFIX)/bin'.  MM_Any has a private 
_expand_macros() method you can crib from.

Once you have that, you can modify it to your liking and add a postamble() 
which extends pure_install.

Or maybe Module::Install has something to handle this.

In Module::Build you follow these instructions to add a new install type.
http://search.cpan.org/~dagolden/Module-Build-0.3603/lib/Module/Build/Cookbook.pm#Adding_new_elements_to_the_install_process

Then you call $builder->install_destination("bin") to get the install location 
and modify it to your liking.


> (please, do not answer to switch to MB. I have too much things ready to
> go over the hedge).

I'm sorry, I cannot delete the above MB recommendation in strict compliance 
with Sarbanes-Oxley data archiving regulations.


-- 
"I went to college, which is a lot like being in the Army, except when
  stupid people yell at me for stupid things, I can hit them."
     -- Jonathan Schwarz