Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Jul 2007 18:16:16 +0200
From:      Anton Berezin <tobez@tobez.org>
To:        Paul Schmehl <pauls@utdallas.edu>
Cc:        FreeBSD Ports <freebsd-ports@freebsd.org>
Subject:   Re: How to include new dirs in @INC
Message-ID:  <20070724161616.GA42493@heechee.tobez.org>
In-Reply-To: <69DD0E3AC68E2AEC7C876B4C@utd59514.utdallas.edu>
References:  <A28004F61E056F5279E996F7@utd59514.utdallas.edu> <20070724095718.GB68140@heechee.tobez.org> <1B50EA71ECD75693D12CE9D3@utd59514.utdallas.edu> <20070724142514.GA4315@heechee.tobez.org> <69DD0E3AC68E2AEC7C876B4C@utd59514.utdallas.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
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@tobez.org> 
> 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
> >>PREFIX?
> >
> >Hmmm.  I assume you are using %%SITE_PERL%% as the prefix in the
> >pkg-plist?
> >
> Yes, that's correct.
> 
> >bsd.port.mk 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/IP4.pm
> 
> Then I installed the port and confirmed that the module was installed:
> ls /usr/local/lib/perl5/site_perl/5.8.8/mach/IP4.pm
> /usr/local/lib/perl5/site_perl/5.8.8/mach/IP4.pm
> 
> 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/IP4.pm' 
> 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 bsd.port.mk 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 bsd.port.mk, 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 bsd.port.mk:

.if defined(PERL_CONFIGURE)
CONFIGURE_ARGS+= CC="${CC}" CCFLAGS="${CFLAGS}" PREFIX="${TARGETDIR}" \
    INSTALLPRIVLIB="${TARGETDIR}/lib" INSTALLARCHLIB="${TARGETDIR}/lib"
.....

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
bsd.port.mk yourself.

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070724161616.GA42493>