lib_depends port patch and pkg-plist

Sam Lawrance boris at brooknet.com.au
Wed Jan 12 22:06:16 PST 2005


dave wrote:

>Hello,
>    I'm trying to alter a port, i want to change it so that instead of
>pulling in all the lib depends, they are not all necessary for the port they
>just give extra functionality, i use "if defined" blocks. My goal is if
>someone wants a feature "make WITH_FEATURE=yes" will do it, but if not they
>won't get all the extra dependencies needed. I've got the if defines going,
>and that seems to be working, but my problem is with the pkg-plist file, how
>do i handle this in view of the dependencies?
>Thanks.
>Dave.
>  
>

dave wrote:

>Hello,
>    I'm trying to alter a port, i want to change it so that instead of
>pulling in all the lib depends, they are not all necessary for the port they
>just give extra functionality, i use "if defined" blocks. My goal is if
>someone wants a feature "make WITH_FEATURE=yes" will do it, but if not they
>won't get all the extra dependencies needed. I've got the if defines going,
>and that seems to be working, but my problem is with the pkg-plist file, how
>do i handle this in view of the dependencies?
>  
>

The way this was explained to me was to put all the files in the 
pkg-plist, then use PLIST_SUB to comment them out if they aren't used.

Example: if WITH_FOOBAR is not defined, %%FOOBAR%% in the pkg-plist is 
replaced with "@comment ", making that line a no-op.

In the port Makefile:

.if defined(${WITH_FOOBAR})
PLIST_SUB+=   FOOBAR=""
.else
PLIST_SUB+=   FOOBAR="@comment "
.endif

In pkg-plist:

%%FOOBAR%%some/file/for/foobar/option


-- 
Sam Lawrance    ph +61 0425 228 579    freenode: deft



More information about the freebsd-ports mailing list