Re: configuring a script before it is installed

[email protected] ("Peter Michaux")
Newsgroups perl.makemaker
Message-ID <[email protected]>
On Wed, Aug 27, 2008 at 6:21 PM, Peter Michaux <[email protected]> wrote:
> Hi,
>
> I'm building a command line "to-do" CPAN module. The module will have
> some scripts that need to be installed in /usr/local/bin, for example.
> These scripts need to manipulate data files in /usr/local/etc and
> /usr/local/var, for example, which contain the application
> configuration and database of actual to-dos. I want the
> "/usr/local/etc" and "/usr/local/var" directories to be configurable
> during the "perl Makefile.pl; make" stage of installing the CPAN
> module.
>
> I think that "/usr/local/etc" and "/usr/local/var" strings need to be
> hard coded into my scripts somehow. Right now I'm using the GNU
> ./configure; make; make install system and am using m4 macros
> @sysconfdir@, @localstatedir@ to modify the scripts (i.e. hard code
> the string) before they are installed. I'd like to use the Perl system
> (not the GNU system) for building so that my module can be used on all
> systems with Perl.
>
> Is what I want to do possible with MakeMaker?

After a bunch of hunting around I discovered that PM_FILTER in
combination with sed seems like it will be able to do what I want

PM_FILTER => 'sed -e s%@localstatedir[@]%/usr/local/var%g | ' .
             'sed -e s%@sysconfdir[@]%/usr/local/etc%g';

If there is something better please let me know.

Thanks,
Peter
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.