Depending on other ports with OPTIONS

Kris Kennaway kris at obsecurity.org
Fri Apr 22 23:31:44 PDT 2005


On Sat, Apr 23, 2005 at 03:56:48PM +0930, Paul A. Hoadley wrote:
> Hello,
> 
> I am currently making my first port: RefDB [1].  I have been quite
> carefully reading the Porter's Handbook, and examining other ports,
> and on the whole it is proceeding quite smoothly.
> 
> I am using OPTIONS in the Makefile for RefDB (a user can choose MySQL,
> PostgreSQL or SQLite as the back-end DB).  RefDB depends on libdbi,
> and, of course, the specific libdbi-driver corresponding to the chosen
> database.
> 
> Based on another port's Makefile, I have been setting RUN_DEPENDS to
> check for the specific libdbi-driver.  For example, if a user chooses
> MySQL as the backend for RefDB, I have this:
> 
> .if defined(WITH_MYSQL)
> USE_MYSQL=	yes
> RUN_DEPENDS+=	${LOCALBASE}/lib/dbd/libmysql.so:${PORTSDIR}/databases/libdbi-drivers
> CONFIGURE_ARGS+=	--with-db-server=mysql
> .endif
> 
> The problem is this.  Say I run 'make install' for my new port, and
> choose MySQL.  If libdbi-drivers has never been installed, that's fine
> and I can select the MySQL driver from it's options.  Say I don't
> install any other drivers, then run 'make deinstall clean rmconfig
> install' for RefDB, but this time choose PostgreSQL as the DB from my
> options.  It will certainly notice that libpgsql.so is missing, and
> run install in libdbi-drivers, but the options there are already saved
> and obviously not re-presented.  Hence libpgsql.so remains unbuilt and
> uninstalled.
> 
> This must be a common problem, and I hope it's not too much of a FAQ
> for the list.  How can I do the equivalent of 'rmconfig install' in
> libdbi-drivers when I change options when building the RefDB port?

It is a FAQ, and the answer is: you can't do it that way - think about
what happens if someone already had the port installed, or if they are
trying to install your software from the precompiled packages.

The solution is to make a slave port that enables the option you need,
depend on that, and make it conflict with the other non-enabled
versions of the port.

Kris
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-ports/attachments/20050422/c1f4a94a/attachment.bin


More information about the freebsd-ports mailing list