How to include new dirs in @INC

Anton Berezin tobez at
Tue Jul 24 16:16:18 UTC 2007

On Tue, Jul 24, 2007 at 10:17:53AM -0500, Paul Schmehl wrote:
> --On Tuesday, July 24, 2007 16:25:14 +0200 Anton Berezin <tobez at> 
> wrote:
> >On Tue, Jul 24, 2007 at 09:18:17AM -0500, Paul Schmehl wrote:
> >
> >>BTW, maybe you know the answer to this.  I can't remove the perl modules
> >>in  pkg-plist because it prepends PREFIX to SITE_PERL, making the
> >>location  /usr/local/usr/local/lib/perl5/site_perl/5.8.8.  This seems to
> >>me to be a  bug.  Shouldn't pkg-plist honor SITE_PERL and not prepend
> >
> >Hmmm.  I assume you are using %%SITE_PERL%% as the prefix in the
> >pkg-plist?
> >
> Yes, that's correct.
> > defines ${SITE_PERL} as ${PREFIX}${SITE_PERL_REL}, and it
> >defines a plist substitution %%SITE_PERL%% to be the same as
> >${SITE_PERL_REL}, so in most circumstances it "just works".
> >
> I tried both %%SITE_PERL%% and %%SITE_PERL_REL%% and both failed.
> >Maybe a snippet of your pkg-plist together with *-install Makefile targets
> >(if any) would help to see what's wrong?
> >
> The %%SITE_PERL%% stuff is no longer in pkg-plist.  I moved it to the 
> pkg-deinstall script.  I could do some more testing, I suppose.....
> OK, commented out one of the modules in the pkg-deinstall script and added 
> it to pkg-plist like this:
> %%SITE_PERL%%/mach/
> Then I installed the port and confirmed that the module was installed:
> ls /usr/local/lib/perl5/site_perl/5.8.8/mach/
> /usr/local/lib/perl5/site_perl/5.8.8/mach/
> Then I deinstalled the port and got this error:
> make deinstall PREFIX=/var/tmp/$(make -V PORTNAME)
> ===>  Deinstalling for security/bro
> ===>   Deinstalling bro-1.2
> pkg_delete: file '/var/tmp/bro/lib/perl5/site_perl/5.8.8/mach/' 
> doesn't exist
> pkg_delete: couldn't entirely delete package (perhaps the packing list is
> incorrectly specified?)
> As you can see, SITE_PERL is prepending PREFIX to SITE_PERL_REL (as you 
> said), but perl modules are *always* installed in 
> /usr/local/lib/perl5/site_perl/blah, are they not?
> IOW, this will work fine in pkg-plist *if* (and only if) PREFIX is the 
> default.  If the installer changes PREFIX to anything else, the perl 
> modules will not be uninstalled and the deinstall will generate an error. 
> (Installing the perl modules in non-standard-PREFIX/lib/blah makes no sense 
> because the scripts won't work because @INC doesn't include non-standard 
> locations by default.)
> Perhaps the correct way to resolve this is to change to define 
> ${SITE_PERL} in pkg-plist as ${LOCALBASE}/${SITE_PERL_REL} instead of 
> ${PREFIX}/${SITE_PERL_REL}?  No matter what PREFIX an installer chooses, 
> perl modules should always be in LOCALBASE, right?

Right.  I assume that the port you are creating uses "normal" Makefile.PL
for a part of the configuration process, while not being the main
configuration mechanism (that is, the port does not define PERL_CONFIGURE in
its skeleton).

In, there is a special handling of the ports that do define
PERL_CONFIGURE to make them PREFIX-clean.  Unfortunately, this handling is
not kicking in for special cases such as yours.

The relevant lines from

.if defined(PERL_CONFIGURE)

So, if you can duplicate the setting of INSTALLPRIVLIB and INSTALLARCHLIB
wherever "perl Makefile.PL" is run during configuration process of your
port, this should make Perl modules installed by the port PREFIX-clean.

If Build.PL is used instead, there is a similar way which you can look up in yourself.

Hope this helps.
We're going for 'working' here. 'clean' is for people with skills...
-- Flemming Jacobsen

More information about the freebsd-ports mailing list