From owner-freebsd-ports@FreeBSD.ORG Tue Mar 3 15:38:21 2009 Return-Path: Delivered-To: freebsd-ports@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6A4591065675 for ; Tue, 3 Mar 2009 15:38:21 +0000 (UTC) (envelope-from amdmi3@amdmi3.ru) Received: from smtp.timeweb.ru (smtp.timeweb.ru [217.170.79.85]) by mx1.freebsd.org (Postfix) with ESMTP id ECF128FC1F for ; Tue, 3 Mar 2009 15:38:20 +0000 (UTC) (envelope-from amdmi3@amdmi3.ru) Received: from [213.148.20.85] (helo=hive.panopticon) by smtp.timeweb.ru with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.69) (envelope-from ) id 1LeWhK-0004Ch-Fx for freebsd-ports@freebsd.org; Tue, 03 Mar 2009 18:38:22 +0300 Received: from hades.panopticon (hades.panopticon [192.168.0.32]) by hive.panopticon (Postfix) with ESMTP id C72381ADA for ; Tue, 3 Mar 2009 18:37:29 +0300 (MSK) Received: by hades.panopticon (Postfix, from userid 1000) id 06875108839; Tue, 3 Mar 2009 18:37:40 +0300 (MSK) Date: Tue, 3 Mar 2009 18:37:39 +0300 From: Dmitry Marakasov To: freebsd-ports@freebsd.org Message-ID: <20090303153739.GC55713@hades.panopticon> References: <20090303072936.0e154820@scorpio> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20090303072936.0e154820@scorpio> User-Agent: Mutt/1.5.19 (2009-01-05) Subject: Re: Configuring 'RUN_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: Tue, 03 Mar 2009 15:38:22 -0000 * Jerry (gesbbb@yahoo.com) wrote: > A port I am creating has a RUN_DEPENDS of either 'curl' or 'wget'. I > have tried several times to write some sort of test in the make file to > determine if one or the other were installed, and if neither then to > install 'curl'. I suppose I could create an OPTIONS to install one or > the other; however, I have not gotten that to work correctly either. You'll need something like this: --- .include .if exists(${LOCALBASE}/bin/wget) && !exists(${LOCALBASE}/bin/curl) RUN_DEPENDS+= wget:${PORTSDIR}/ftp/wget .else RUN_DEPENDS+= curl:${PORTSDIR}/ftp/curl .endif --- You should be careful though to match this with your program's logic. I.e. `what does it do if both wget and curl are installed?' The above case is for `it uses curl then' answer. > The port will also require Clamav, either the standard port or the > devel one. Therefore I have two run dependencies to adjust. No, you don't. clamav and clamav-devel are conflicting ports that install the same files, so should you depend on clamav as RUN_DEPENDS= clamscan:${PORTSDIR}/security/clamav or LIB_DEPENDS= clamav:${PORTSDIR}/security/clamav if clamav-devel is installed instead, dependency will still match it and it'll be used. Note `clamav', not `clamav.5' in LIB_DEPENDS. > I tried Googling and the Porters Handbook, but I cannot find what I am > looking for. Is it possible? I assume it must be. A regular 'if' or > 'case' statement I would normally use does not work in a make file. >From my experience, the best source for digging examples of such nontrivial cases are Makefiles for other ports. grep'ping portstree is too slow, so it's better to create an index like that: find -L /usr/ports -name Makefile -maxdepth 3 -mindepth 3 -exec grep -H '' {} \; > MAKEFILES.INDEX -- Dmitry Marakasov . 55B5 0596 FF1E 8D84 5F56 9510 D35A 80DD F9D2 F77D amdmi3@amdmi3.ru ..: jabber: amdmi3@jabber.ru http://www.amdmi3.ru