From owner-freebsd-ports Sat Feb 3 18:23:27 2001 Delivered-To: freebsd-ports@freebsd.org Received: from heechee.tobez.org (254.adsl0.ryv.worldonline.dk [213.237.10.254]) by hub.freebsd.org (Postfix) with ESMTP id 1478837B4EC; Sat, 3 Feb 2001 18:23:08 -0800 (PST) Received: by heechee.tobez.org (Postfix, from userid 1001) id AAB3554EB; Sun, 4 Feb 2001 03:23:02 +0100 (CET) Date: Sun, 4 Feb 2001 03:23:02 +0100 From: Anton Berezin To: freebsd-ports@freebsd.org Cc: Josef Karthauser , Will Andrews , Mike Meyer , Dmitry Sivachenko , Mark Murray Subject: Request for comments: BSDPAN, p5-ports polisher (and more) Message-ID: <20010204032302.C49456@heechee.tobez.org> Mail-Followup-To: Anton Berezin , freebsd-ports@freebsd.org, Josef Karthauser , Will Andrews , Mike Meyer , Dmitry Sivachenko , Mark Murray Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i Sender: owner-freebsd-ports@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org 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