Dealing with options in dependent ports
Paul Schmehl
pschmehl_lists at tx.rr.com
Fri Nov 30 18:46:12 UTC 2012
--On November 30, 2012 7:07:20 PM +0100 Alberto Villa <avilla at FreeBSD.org>
wrote:
> On Fri, Nov 30, 2012 at 4:47 PM, Thierry Thomas <thierry at 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
More information about the freebsd-ports
mailing list