From owner-freebsd-questions@FreeBSD.ORG Sat Sep 12 08:54:53 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3DCB01065679 for ; Sat, 12 Sep 2009 08:54:53 +0000 (UTC) (envelope-from m.seaman@infracaninophile.co.uk) Received: from smtp.infracaninophile.co.uk (gate6.infracaninophile.co.uk [IPv6:2001:8b0:151:1::1]) by mx1.freebsd.org (Postfix) with ESMTP id A60BF8FC13 for ; Sat, 12 Sep 2009 08:54:52 +0000 (UTC) Received: from happy-idiot-talk.infracaninophile.co.uk (localhost [IPv6:::1]) (authenticated bits=0) by smtp.infracaninophile.co.uk (8.14.3/8.14.3) with ESMTP id n8C8sdGT046361; Sat, 12 Sep 2009 09:54:45 +0100 (BST) (envelope-from m.seaman@infracaninophile.co.uk) X-DKIM: Sendmail DKIM Filter v2.8.3 smtp.infracaninophile.co.uk n8C8sdGT046361 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=infracaninophile.co.uk; s=200708; t=1252745686; bh=9MUtCdeC9+v+NAiHs4RRMnf7VgGd3y7/TRcrcohqAbw=; h=Message-ID:Date:From:MIME-Version:To:CC:Subject:References: In-Reply-To:Content-Type:Cc:Content-Type:Date:From:In-Reply-To: Message-ID:Mime-Version:References:To; z=Message-ID:=20<4AAB61C9.4030005@infracaninophile.co.uk>|Date:=20S at,=2012=20Sep=202009=2009:54:33=20+0100|From:=20Matthew=20Seaman= 20|Organization:=20Infracaninophi le|User-Agent:=20Thunderbird=202.0.0.23=20(X11/20090823)|MIME-Vers ion:=201.0|To:=20John=20W=20|CC:=20freebsd-ques tions=20|Subject:=20Re:=20ports:=20 how=20to=20handle=20'alternate'=20dependencies|References:=20|In-Reply- To:=20|X-Enigmail-Version:=200.95.6|Content-Type:=20multipart/signed=3B =20micalg=3Dpgp-sha256=3B=0D=0A=20protocol=3D"application/pgp-sign ature"=3B=0D=0A=20boundary=3D"------------enigA7B7EDDFDCB3FEF4ED39 C0EC"; b=p9coQN/2SWjp1E9KZmsa8KzrNJM99T4OgNr5o4qByewiwamyl9BclmB7i1mdHZXN5 /xsDWihhmIcftH/M91tFBpbq6e7IOWmRU9oshqZvE2CjD6mkZkIevjFRCcLAs2UqCK X0hkjuYWINKYeOb1hYsqR7uMrdRYgsm50DuaiTP0= X-Authentication-Warning: happy-idiot-talk.infracaninophile.co.uk: Host localhost [IPv6:::1] claimed to be happy-idiot-talk.infracaninophile.co.uk Message-ID: <4AAB61C9.4030005@infracaninophile.co.uk> Date: Sat, 12 Sep 2009 09:54:33 +0100 From: Matthew Seaman Organization: Infracaninophile User-Agent: Thunderbird 2.0.0.23 (X11/20090823) MIME-Version: 1.0 To: John W References: In-Reply-To: X-Enigmail-Version: 0.95.6 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enigA7B7EDDFDCB3FEF4ED39C0EC" X-Virus-Scanned: clamav-milter 0.95.2 at happy-idiot-talk.infracaninophile.co.uk X-Virus-Status: Clean X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VERIFIED,NO_RELAYS autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on happy-idiot-talk.infracaninophile.co.uk Cc: freebsd-questions Subject: Re: ports: how to handle 'alternate' dependencies X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Sep 2009 08:54:53 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigA7B7EDDFDCB3FEF4ED39C0EC Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable John W wrote: > I'm just learning the guts of how ports work, and wonder: >=20 > How do ports specify that "any one of X, Y, Z " would satisfy a depende= ncy. >=20 > For instance, when I build graphics/jalbum, it says it requires jdk16. > I would rather use diablo-jdk16, since I find it faster and it is > easier to install. >=20 > But how would I alter graphics/jalbum to say, essentially, "either > jdk16 or diablo-jdk16 is required" >=20 > Generally, how to handle the case when a port requires X, but there > are multiple implementations of X that can perform the job, and any > will suffice? > I feel like this issue must come up from time to time, what is the > right way to deal with it? > I didn't see any mention of this in the porters handbook... This is a quite tricky area. First thing to realise is that a dependency= line like this in a port: RUN_DEPENDS+=3D ${LOCALBASE}/sbin/suphp:${PORTSDIR}/www/suphp says that the port needs ${LOCALBASE}/sbin/suphp in order to run. The port will be satisfied if there is any executable file of that name in place -- there's no check that the file belongs to any particular port or even to any port at all. If the test file is not found, then the second part of the dependency line just indicates an example of a port that when installed will provide the dependency. Now, for most of the dependency lines shown explicitly in port makefiles,= there isn't any ambiguity here: there's only one port available that can fulfil the dependency. Job done. Where there are multiple choices, you see two different scenarios: * Ports with 'devel' variants or multiple release versions, but that only have a few dependents. In this case, if you want a non-standard version, simply install it first, before trying to install the dependent port. This will work just fine from the point of view of the software operating correctly, although it can confuse ports management tools, which have been known to continually try and substitute the listed dependency. * Foundation ports -- things like Apache, MySQL, OpenLDAP, autoconf, Java, perl, python. Here there are hundreds or thousands of possible dependents. In these cases, typically there will be a special mechan= ism for specifying what version(s) can be used with each port, possibly a= corresponding user settable flag for choosing what should be installe= d, and frequently a mechanism for feeding back into the ports system wha= t version /was/ installed. Lets take perl as an example. Currently there are two, pretty much f= reely interchangeable, versions of perl available in the ports: /usr/ports/lang/perl5.8 --- perl-5.8.9_3 /usr/ports/lang/perl5.10 --- perl-5.10.1 By default, you'll get perl5.8 -- that is, if you install anything wi= th a=20 dependency on perl and perl was not previously installed and you have= n't=20 made a deliberate choice to install one or the other. However, you c= an opt to use perl5.10 simply by installing it -- or more likely, as per= l is pretty fundamental to the system and tends to be installed just about= everywhere by replacing perl5.8 with it. eg: # portupgrade -o lang/perl5.10 -f perl-5.8.9_3 # portupgrade -x perl-5.10.1 -fr perl-5.10.1 After doing this, any perl-dependent ports you install will happily d= epend on perl5.10 and if you build your own INDEX, perl5.10 will appear eve= rywhere in the dependency listings. The reason is that perl adds text like t= he following to /etc/make.conf: # added by use.perl 2009-09-12 09:04:56 PERL_VERSION=3D5.10.1 In principle you could add this variable definition to /etc/make.conf= before ever installing perl in order to get the version you want straight aw= ay. This works because ports that depend on perl generally contain the magic i= nvocation like: USE_PERL=3D yes or PERL_CONFIGURE=3D yes which ultimately have the effect of causing /usr/ports/Mk/bsd.perl.m= k to be included and parsed during a make(1) invocation. The PERL_VERSIO= N variable is examined in there and used to modify various *_DEPENDS l= ines amongst other things. In fact, the majority of the files under /usr/ports/Mk exist to prov= ide this sort of alternate dependency capability for the sort of commonly use= d=20 software packages that the majority of everything else relies upon. Perl is slightly unusual in that at the moment either of the perl ve= rsions is compatible with any perl dependent ports in the tree. There's no= t much perl-5.10 specific code readily available anywhere. More frequently = ports will need a specific version or versions of a dependency, and the ty= pical mechanisms for specifying that work like the following. The port ma= intainer can indicate that a port depends on a popular software system and wh= at dependency versions are compatible with it by including a USE_FOO va= riable,=20 possibly with additional variables to control various behaviours: USE_MYSQL=3D yes IGNORE_WITH_MYSQL=3D 323 40 41 The user can frequently use a 'WITH_FOO' variable in /etc/make.conf,= or make a selection via an OPTIONS dialogue to choose their preference:= WITH_MYSQL_VER=3D 50 There are any number of variations on how all this sort of stuff wor= ks in detail, depending on the needs of individual ports. There's a l= ot of documentation in the Porter's Handbook and the various makefiles in = /usr/ports/Mk/ are extensively commented. Simply copying what anoth= er port does is a good starting point. =20 Cheers, Matthew --=20 Dr Matthew J Seaman MA, D.Phil. 7 Priory Courtyard Flat 3 PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate Kent, CT11 9PW --------------enigA7B7EDDFDCB3FEF4ED39C0EC Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.13 (FreeBSD) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEAREIAAYFAkqrYc8ACgkQ8Mjk52CukIxnRwCeJF2ydl+eRe8D9XAr8F/cbnuZ 76wAnRtszNGeVOUsfIlnMc6Mvc9gzdUj =xNbN -----END PGP SIGNATURE----- --------------enigA7B7EDDFDCB3FEF4ED39C0EC--