Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 30 Nov 2012 12:46:08 -0600
From:      Paul Schmehl <pschmehl_lists@tx.rr.com>
To:        Alberto Villa <avilla@FreeBSD.org>, FreeBSD Ports List <freebsd-ports@freebsd.org>
Subject:   Re: Dealing with options in dependent ports
Message-ID:  <601F44F1995485BC7DB3BCF1@utd71538.campus.ad.utdallas.edu>
In-Reply-To: <CAJp7RHZ8=P%2ByO8MO2%2BQfjueRnKXDyX=5u2-8=TWEQ0FyMqWOrQ@mail.gmail.com>
References:  <A9F2CA034E76DB10EB615B3B@utd71538.campus.ad.utdallas.edu> <20121130154740.GA16360@graf.pompo.net> <CAJp7RHZ8=P%2ByO8MO2%2BQfjueRnKXDyX=5u2-8=TWEQ0FyMqWOrQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
--On November 30, 2012 7:07:20 PM +0100 Alberto Villa <avilla@FreeBSD.org> 
wrote:

> On Fri, Nov 30, 2012 at 4:47 PM, Thierry Thomas <thierry@freebsd.org>
> 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?601F44F1995485BC7DB3BCF1>