Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 4 Feb 2001 03:23:02 +0100
From:      Anton Berezin <tobez@tobez.org>
To:        freebsd-ports@freebsd.org
Cc:        Josef Karthauser <joe@tao.org.uk>, Will Andrews <will@FreeBSD.org>, Mike Meyer <mwm@mired.org>, Dmitry Sivachenko <dima@Chg.RU>, Mark Murray <mark@grondar.za>
Subject:   Request for comments: BSDPAN, p5-ports polisher (and more)
Message-ID:  <20010204032302.C49456@heechee.tobez.org>

next in thread | raw e-mail | index | archive | help
I present to your attention the initial version of BSDPAN, a tool, which
currently does two things:

1. Makes p5- FreeBSD ports PREFIX-clean.

2. Makes Perl modules installed in a classical Perl way (by use of
   CPAN.pm, or by manual downloading and perl Makefile.PL && make &&
   make test && make install sequence) register themselves with FreeBSD
   PKG_DB (commonly found in /var/db/pkg).

Contrary to the popular belief shared by many FreeBSD developers, p5-
ports as they are now are not PREFIX-clean, not a single one.  This is
mainly due to the fact that Perl's MakeMaker uses several variables to
control the placement of the files it installs.  Only some of them are
governed by PREFIX, and even those that are have some quirks (namely,
directory names become different if PREFIX contains the `perl'
substring).

The obvious solution to this problem is to define these variables in BSD
port makefile system when PERL_CONFIGURE is detected, and to pass them
to perl.

This is not the solution I present here.  There are two reasons:  it is
impossible to implement (2), and it is not general enough.

Another possible solution is to patch FreeBSD system perl distribution
to account for MakeMaker's (mis)features.

This is also not the solution I present.  Though it is possible to solve
both (1) and (2) with this approach it has a major drawback:
maintainability.  The constellation of modules known collectively as
`MakeMaker' is large and complicated;  it's quite laborious to rework
such patches every time we import newer Perl into FreeBSD system.

Instead, I decided to go the third route.  The patching is done
dynamically by overriding (and extending) MakeMaker's functionality on
the fly.

The code is located at
        http://www.tobez.org/download/bsdpan-2001020401.tgz

It currently consists of four Perl modules, two of which override
corresponding MakeMaker modules, and the rest provide useful utility
functions.

BSDPAN.pm is a utility module providing following functions:

path            returns it's own path
perl_version    returns the string identical to bsd.port.mk's
                PERL_VERSION
perl_ver        returns the string identical to bsd.port.mk's PERL_VER
perl_arch       returns the string identical to bsd.port.mk's PERL_ARCH
builds_port     returns true if called as a part of p5- port building
                process
builds_standalone       returns !builds_port()

BSDPAN/Override.pm is a utility module which provides one function:

override(sub_name, sub_ref)     overrides a given Perl function (or
                                a method) with the user-supplied sub
                                reference

ExtUtils/MM_Unix.pm overrides everything necessary to solve (1), and
some parts necessary to solve (2).

ExtUtils/Packlist.pm overrides the rest necessary to solve (2).

The only thing necessary to start using this new functionality is to
have Perl to search this modules before it searches its own system
modules (in particular, ExtUtils::MM_Unix and ExtUtils::Packlist).

In case this solution will be incorporated into FreeBSD, the system perl
compilation process has to be slightly changed to include the path to
these modules into the perl binary.  I think the good path might be
/usr/libdata/perl/%%PERL_VER%%/BSDPAN, or just /usr/libdata/perl/BSDPAN.

For now, in order to test BSDPAN, you will only need to set the
environment variable PERL5LIB to point to a directory you unpacked the
tarball to (including the first BSDPAN subdirectory).

I would like to thank Josef Karthauser for discussing these things with
me.

Please let me know what you think,
%Anton.
-- 
May the tuna salad be with you.


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




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