From owner-freebsd-ports@FreeBSD.ORG Fri Oct 14 02:17:09 2005 Return-Path: X-Original-To: ports@freebsd.org Delivered-To: freebsd-ports@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 515B716A41F for ; Fri, 14 Oct 2005 02:17:09 +0000 (GMT) (envelope-from edwin@mavetju.org) Received: from mail3out.barnet.com.au (mail3out.barnet.com.au [202.83.176.17]) by mx1.FreeBSD.org (Postfix) with ESMTP id B446D43D49 for ; Fri, 14 Oct 2005 02:17:07 +0000 (GMT) (envelope-from edwin@mavetju.org) Received: by mail3out.barnet.com.au (Postfix, from userid 27) id 3D76F877CDA; Fri, 14 Oct 2005 12:17:06 +1000 (EST) X-Viruscan-Id: <434F15220000D7699739E3@BarNet> Received: from mail3-auth.barnet.com.au (mail3.barnet.com.au [202.83.176.16]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "*.barnet.com.au", Issuer "BarNet Root Certificate Authority" (verified OK)) by mail3.barnet.com.au (Postfix) with ESMTP id F2404877CA4; Fri, 14 Oct 2005 12:17:05 +1000 (EST) Received: from k7.mavetju (edwin-3.int.barnet.com.au [10.10.12.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "edwin.adsl.barnet.com.au", Issuer "BarNet Root Certificate Authority" (not verified)) by mail3-auth.barnet.com.au (Postfix) with ESMTP id 6120B877C95; Fri, 14 Oct 2005 12:17:05 +1000 (EST) Received: by k7.mavetju (Postfix, from userid 1001) id 095FF61A4; Fri, 14 Oct 2005 12:17:03 +1000 (EST) Date: Fri, 14 Oct 2005 12:17:03 +1000 From: Edwin Groothuis To: Sergey Skvortsov Message-ID: <20051014021703.GG1278@k7.mavetju> References: <20051012114222.GD1278@k7.mavetju> <434D0CFE.9090007@protey.ru> <20051012211228.GE1278@k7.mavetju> <434E55B3.7020501@protey.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <434E55B3.7020501@protey.ru> User-Agent: Mutt/1.5.9i Cc: ports@freebsd.org Subject: Re: PERL_RUN_DEPENDS and PERL_BUILD_DEPENDS X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Oct 2005 02:17:09 -0000 On Thu, Oct 13, 2005 at 04:40:19PM +0400, Sergey Skvortsov wrote: > Edwin Groothuis wrote: > >>>The syntax is: > >>> PERL_BUILD_DEPENDS= MIME-Lite:${PORTSDIR}/mail/p5-MIME-Lite > >>>It checks the for the existence of MIME::Lite with the "perl -e > >>>'use MIME::Lite'" command. > >>Obviously this approach will cause great performance degrade. > >>stat(2) is much more faster than loading perl. > > > >Minimal compared with the time it takes to fetch distfiles and to > >build. That's the only time it is checked. > > Loading some module (via "use") can take even more time than simply > detecting corresponding .pm file because all code is compiled into > bytecode-tree. PERL_BUILD_DEPEND is an useless syntax sugar. To extend the abilities for individual users: - RUN_DEPENDS=foo:${PORTSDIR}/bar/foo If foo isn't in LOCALBASE or X11PREFIX, you can add the directory to the PATH variable and the executable is found. - LIB_DEPENDS=foo.1:${PORTSDIR}/bar/foo If libfoo.so.1 isn't in LOCALBASE/lib or X11PREFIX/lib, you can use the ldconfig tool to add the path and the library is found. Now what if I'm a user who doesn't have root-priveleges on a machine and still need one or two perl modules which the administrator doesn't want or isn't able to add new modules. I could setup a private PREFIX with all the modules there, but the whole ports building system will choke when checking for dependencies: Image a port depending on MIME::Lite and Net::DNS. MIME::Lite is in the /usr/local/, Net::DNS is in /home/edwin. RUN_DEPENDS=${SITE_PERL}/MIME/Lite.pm \ ${SITE_PERL}/Net/DNS.pm And SITE_PERL is ${LOCALBASE}/lib/perl5/... Running with PREFIX=LOCALBASE=/usr/local, the first gets detected properly but the second not and the installation of it will fail. Running with PREFIX=/home/edwin, LOCALBASE=/usr/local, the first one will be detected and the second one will be installed in /home/edwin. Everybody looks happy. Except the next time you build this port because it can't find Net::DNS and it will attempt to install it again. Running with PREFIX=LOCALBASE=/home/edwin, all the modules will be installed /home/edwin. That while we only needed one module. Perl has a environment variable called PERL5LIB which can be used to override the standard locations modules are being searched for. Using this variable, the user can just set this variable and only the missing modules get installed: PERL_RUN_DEPENDS= MIME::Lite \ Net::DNS Running with PREFIX=/home/edwin, the first one gets detected because it is in /usr/local/lib/perl5, the second one gets detected because it's in the /home/edwin. And next installation attempt everything gets properly detected again. And everybody was happy. > FYI: "perl -MMIME::Lite -e 0" is right way to check module. Thank you for that. Edwin -- Edwin Groothuis | Personal website: http://www.mavetju.org edwin@mavetju.org | Weblog: http://weblog.barnet.com.au/edwin/