From owner-freebsd-ports@FreeBSD.ORG Sat Feb 24 16:30:38 2007 Return-Path: X-Original-To: ports@FreeBSD.org Delivered-To: freebsd-ports@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 33D8416A400 for ; Sat, 24 Feb 2007 16:30:38 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from server.t-hosting.hu (server.t-hosting.hu [217.20.133.7]) by mx1.freebsd.org (Postfix) with ESMTP id E2CCA13C428 for ; Sat, 24 Feb 2007 16:30:37 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from localhost (localhost [127.0.0.1]) by server.t-hosting.hu (Postfix) with ESMTP id 8C4D59EF143; Sat, 24 Feb 2007 17:30:36 +0100 (CET) X-Virus-Scanned: amavisd-new at t-hosting.hu Received: from server.t-hosting.hu ([127.0.0.1]) by localhost (server.t-hosting.hu [127.0.0.1]) (amavisd-new, port 10024) with LMTP id C5y6VGOa-WA3; Sat, 24 Feb 2007 17:30:10 +0100 (CET) Received: from [192.168.2.186] (catv-50635cb6.catv.broadband.hu [80.99.92.182]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by server.t-hosting.hu (Postfix) with ESMTP id C2E6A9EF13D; Sat, 24 Feb 2007 17:30:10 +0100 (CET) Message-ID: <45E06810.1070704@FreeBSD.org> Date: Sat, 24 Feb 2007 17:30:08 +0100 From: Gabor Kovesdan User-Agent: Thunderbird 1.5.0.9 (Windows/20061207) MIME-Version: 1.0 To: Fabian Keil References: <20070222141301.007fee4f@localhost> <45DDA117.3050508@FreeBSD.org> <20070224163229.062bd234@localhost> In-Reply-To: <20070224163229.062bd234@localhost> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: ports@FreeBSD.org Subject: Re: Optionally depending on one of two ports (or none of them) 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: Sat, 24 Feb 2007 16:30:38 -0000 Fabian Keil schrieb: > Gabor Kovesdan wrote: > > >> What about grepping in the output of pkg_info? Or even better just >> grepping in ls ${PKG_DBDIR} to determine which one is installed and >> adding the appropriate dependency. >> > > Are you aware of ports that already do that? > > I grepped around a bit but didn't find any, > and as my make knowledge is rather limited > it sounds like too much work to be worth it. > > No, but I made an example for you, you can use this: HAVE_TOR_DEVEL!= if ls /var/db/pkg | grep tor-devel-\* >/dev/null 2>&1 ; then echo YES; fi; You should decide which one to use as a default. Let's say it is tor. .if defined(HAVE_TOR_DEVEL) RUN_DEPENDS+= ${LOCALBASE}/bin/tor:${PORTSDIR}/security/tor-devel .else RUN_DEPENDS+= ${LOCALBASE}/bin/tor:${PORTSDIR}/security/tor .endif Or if you want to make tor-devel the default one: .if !defined(HAVE_TOR_DEVEL) RUN_DEPENDS+= ${LOCALBASE}/bin/tor:${PORTSDIR}/security/tor .else RUN_DEPENDS+= ${LOCALBASE}/bin/tor:${PORTSDIR}/security/tor-devel .endif Or you can make it better by giving a knob for selecting the default. The only problem is with my example, it does not respect PKG_DBDIR, but I think it is better then just adding a pkg-message for the user to make decision. I could not use ${PKG_DBDIR} in the evaluation somehow, it did not work. This is not a big deal, though, people don't often override that I think. Regards, Gabor