autodetecting dependencies

A.J. Kehoe IV (Nanoman) nanoman at
Tue Apr 10 18:11:36 UTC 2012

Stephen Montgomery-Smith wrote:
>So suppose we are building port A.  It turns out that the configure in
>port A autodetects whether package B is present or not.  It will build
>either way.  But if built with package B, it will not operate without it.
>So suppose I build port A on machine X which has package B installed.
>Then I create a package from A, and copy the package to machine Y.
>Machine Y does not have package B installed, and so when package A is
>installed, it doesn't work on machine Y.
>What are the accepted ways of handling this?
>1.  Don't worry about it.  tinderbox builds will never build port A in
>the presence of package B.
>2.  Have the Makefile of port A detect whether package B is installed,
>and if it is then add B as a dependency of A.
>3.  Cripple the configure in port A so that it doesn't autodetect for
>package B.  (Sometimes this can be done using a suitable CONFIGURE_ARGS,
>but not in my particular situation.)
>I prefer the answer (1).  But I am interested in other people's
>opinions.  One problem with (2) or (3) is that the creator of the port
>might never find out which packages could be autodetected by port A's
>configure without performing an exhaustive search of the source code of A.
>Thanks, Stephen

In my opinion, it's best to use the OPTIONS framework and to avoid automatic detection entirely.  Consider this problem:

For your example, I would add this line to port A's Makefile:

OPTIONS=	PORT_B		"Enable Port B" off

I would then replace the automatic detection part of port A's Makefile with something like this:

.if defined(WITH_PORT_B) && !defined(WITHOUT_PORT_B)
RUN_DEPENDS+=	portb-1.0:${PORTSDIR}/category/portb

So, if you don't want port A built with package B as a dependency, you'd use the default on port A's OPTIONS "dialog" screen, otherwise, you'd put a check beside "PORT_B".

A.J. Kehoe IV (Nanoman)     |  /"\  ASCII Ribbon Campaign
Nanoman's Company           |  \ /   - No HTML/RTF in E-mail
E-mail: nanoman at  |   X    - No proprietary attachments
WWW: |  / \   - Respect for open standards
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3855 bytes
Desc: not available
Url :

More information about the freebsd-ports mailing list