From owner-freebsd-ports@FreeBSD.ORG Fri Nov 30 18:46:12 2012 Return-Path: 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 0FB804CB; Fri, 30 Nov 2012 18:46:12 +0000 (UTC) (envelope-from prvs=6745961d0=pschmehl_lists@tx.rr.com) Received: from ip-002.utdallas.edu (ip-002.utdallas.edu [129.110.20.108]) by mx1.freebsd.org (Postfix) with ESMTP id 6C2098FC13; Fri, 30 Nov 2012 18:46:11 +0000 (UTC) X-Group: None X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AnAHALL+uFCBbgogOmdsb2JhbABEwBUDAQEBARkIS4IeAQEEATgCRAsLDgouQxQGARKICgbAEoxAg2BhA4hdjj+SOQ X-IronPort-AV: E=Sophos;i="4.84,192,1355119200"; d="scan'208";a="104840321" Received: from zxtm01.utdallas.edu (HELO utd71538.utdallas.edu) ([129.110.10.32]) by ip-002.utdallas.edu with ESMTP/TLS/DHE-RSA-AES256-SHA; 30 Nov 2012 12:46:09 -0600 Date: Fri, 30 Nov 2012 12:46:08 -0600 From: Paul Schmehl To: Alberto Villa , FreeBSD Ports List Subject: Re: Dealing with options in dependent ports Message-ID: <601F44F1995485BC7DB3BCF1@utd71538.campus.ad.utdallas.edu> In-Reply-To: References: <20121130154740.GA16360@graf.pompo.net> X-Mailer: Mulberry/4.1.0a1 (Mac OS X) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline; size=2099 X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: Paul Schmehl List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Nov 2012 18:46:12 -0000 --On November 30, 2012 7:07:20 PM +0100 Alberto Villa wrote: > On Fri, Nov 30, 2012 at 4:47 PM, Thierry Thomas > wrote: >> However, to enforce the right dependency, this option have to produce a >> different plist. > > Really? Isn't enough to depend on the package name instead of a file? No. The dependency installs files that are not otherwise installed, so the pkg-plist has to reflect that. Here's how I did it in the port I just created a slave for. Created this section in the main port's Makefile: .if defined(SLAVE) OPTIONS_DEFINE+= BROCCOLI OPTIONS_DEFAULT+= BROCCOLI BROCCOLI_DESC= Build support for libbroccoli communications .endif This adds the option and enforces it being selected if you install the slave port. Then created this section in the main port's Makefile: .if ${PORT_OPTIONS:MBROCCOLI} PLIST_SUB+= BROCCOLI="" pre-configure: (cd ${WRKSRC}/aux/broccoli && ./configure) pre-build: (cd ${WRKSRC}/aux/broccoli && ${MAKE}) post-build: patch ${BUILD_WRKSRC}/cmake_install.cmake ${FILESDIR}/broccoli.patch .else PLIST_SUB+= BROCCOLI="@comment " .endif The PLIST_SUB section allows you to add files to the pkg-plist that are provisional, based on the install of the slave port. Then the pkg_plist sub has the files included with the macro: %%BROCCOLI%%include/broccoli.h %%BROCCOLI%%lib/libbinpac.a %%BROCCOLI%%lib/libbroccoli.a %%BROCCOLI%%lib/libbroccoli.so %%BROCCOLI%%lib/libbroccoli.so.5 %%BROCCOLI%%lib/libbroccoli.so.5.1.0 Those only get removed if the option was selected, so deinstall won't throw errors if you install the main port without that option. -- Paul Schmehl, Senior Infosec Analyst As if it wasn't already obvious, my opinions are my own and not those of my employer. ******************************************* "It is as useless to argue with those who have renounced the use of reason as to administer medication to the dead." Thomas Jefferson "There are some ideas so wrong that only a very intelligent person could believe in them." George Orwell