From owner-freebsd-questions@FreeBSD.ORG Sat Sep 12 07:06:57 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 8D3CD1065670 for ; Sat, 12 Sep 2009 07:06:57 +0000 (UTC) (envelope-from dan@dan.emsphone.com) Received: from email2.allantgroup.com (email2.emsphone.com [199.67.51.116]) by mx1.freebsd.org (Postfix) with ESMTP id 527A58FC12 for ; Sat, 12 Sep 2009 07:06:57 +0000 (UTC) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by email2.allantgroup.com (8.14.0/8.14.0) with ESMTP id n8C76uIA002503 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sat, 12 Sep 2009 02:06:56 -0500 (CDT) (envelope-from dan@dan.emsphone.com) Received: from dan.emsphone.com (smmsp@localhost [127.0.0.1]) by dan.emsphone.com (8.14.3/8.14.3) with ESMTP id n8C76tj5087464 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sat, 12 Sep 2009 02:06:56 -0500 (CDT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.14.3/8.14.3/Submit) id n8C76tpp087462; Sat, 12 Sep 2009 02:06:55 -0500 (CDT) (envelope-from dan) Date: Sat, 12 Sep 2009 02:06:55 -0500 From: Dan Nelson To: John W Message-ID: <20090912070655.GC54762@dan.emsphone.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-OS: FreeBSD 7.2-STABLE User-Agent: Mutt/1.5.20 (2009-06-14) X-Virus-Scanned: ClamAV version 0.94.2, clamav-milter version 0.94.2 on email2.allantgroup.com X-Virus-Status: Clean X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0.2 (email2.allantgroup.com [199.67.51.78]); Sat, 12 Sep 2009 02:06:56 -0500 (CDT) X-Scanned-By: MIMEDefang 2.45 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 07:06:57 -0000 In the last episode (Sep 11), John W said: > I'm just learning the guts of how ports work, and wonder: > > How do ports specify that "any one of X, Y, Z " would satisfy a dependency. > > 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. > > But how would I alter graphics/jalbum to say, essentially, "either > jdk16 or diablo-jdk16 is required" > > 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 question might be better asked on the freebsd-ports mailing list... In your specific case, since you're looking at a java port, you have to follow the rules in /usr/ports/Mk/bsd.java.mk , which let you specify things like: USE_JAVA=YES JAVA_VERSION=1.6 JAVA_VENDOR="freebsd bsdjava" , to force the use of only Java 1.6 (not 1.5 or 1.7), and only the source-built or diablo-binary variants. Many port groups that provide multiple versions of an application either have special code in bsd.port.mk or have their own bsd.xxx.mk, and they usually let the port maintainer set WANT_XXX or WITH_XXX variables to prefer a particular version. See bsd.gecko.mk and bsd.database.mk for some complex examples. For the completely general case of two independant ports providing the same feature your port needs, you can roll your own checks. To prefer the playmusic port, but use the playwav port if it's already installed: .if exists(${LOCALBASE}/bin/playwavfile) RUN_DEPENDS+=playwav:${PORTSDIR}/audio/playwav .else RUN_DEPENDS+=playmusic:${PORTSDIR}/audio/playmusic .endif You can also get fancy and use OPTIONS to allow the user to pick their preferred alternative ports, using ".if exists" checks to pre-select any already-installed ones. -- Dan Nelson dnelson@allantgroup.com