Slave ports

Matthew Seaman m.seaman at infracaninophile.co.uk
Sun Nov 20 09:24:01 UTC 2011


On 19/11/2011 22:47, Beñat Gonzalez Etxepare wrote:
> In my case, I need to compile a new port (Double Commander, a file
> manager) which depends in some other totally different port (Lazarus,
> an IDE).
> 
> With Lazarus you are able to compile applications for the toolkit you
> choose: QT or GTK2. Lazarus itself is compiled using one of them
> (which can be selected using Makefile's options). All programs compiled
> with Lazarus should use the same toolkit as the IDE. For this, I can
> get the selected option from a configuration file (written by Lazarus
> port) using the != assignment, but it is discouraged. So I need to do it
> some other way.
> 
> Are slave ports suited for this (getting a chosen option from some
> other port)? or is there some other way to solve this?

The way you'ld use slave ports for this is to create lazarus-qt and
lazarus-gtk2 slave ports which enabled the respective toolkit in each.
Then in your Double Commander port, you could have an OPTION setting to
choose between qt or gtk2 -- depending on the value selected, that would
flip the dependency between lazarus-qt or lazarus-gtk2.

This works, but has an important deficiency:

   * If the user already has lazarus (of any variety) installed, that
     would generally fulfil the dependency requirement irrespective
     of which toolkit option was chosen when building Double
     Commander.  Unless there is some sort of detectable filename
     change in lazarus depending on the toolkit, you can't tell the
     difference.

Also, you've got the hassle of coordinating with the lazarus maintainer
to get the required slave ports created.

The other style of dealing with this sort of problem is where there are
several different versions of a common port available -- eg. all of the
apache or mysql or php flavours in the tree.  In this case the response
boils down to having a common Makefile that all concerned ports can
include (eg bsd.apache.mk, bsd.database.mk, ${LOCALBASE}/php.conf)

Hmmm... I can't think of any examples of this being done elsewhere in
the ports tree, so it might not be an approved practice.  However, you
could pull in the OPTIONS settings from the lazarus port:

OPTIONS=        DCGTK2    "Use gtk20 interface instead of gtk12"  on \
                DCQT4     "Use qt4 interface" off

.if exists(${PORT_DBDIR}/lazarus/options)
.include "${PORT_DBDIR}/lazarus/options"
.endif

.if defined(WITH_DCGTK2) && defined(WITH_DCQT4)
IGNORE=         Please select only one of the DCQT4 or DCGTK2 options
.endif

.if ( defined(WITH_GTK2) && defined(WITH_DCQT4) ) || \
    ( defined(WITH_QT4) && defined(WITH_DCGTK2) )
IGNORE=	Your choice of GTK2 or QT4 options conflicts with the existing
editors/lazarus port"
.endif

Note the use of DCGTK2 as the local choice of option so it doesn't
collide with the option setting from editors/lazarus.  It might be
tempting to just use the OPTIONS result from editors/lazarus directly,
but you can't guarantee that editors/lazarus has been installed at the
point you run this options dialogue, and moreover, if lazarus is
installed from a package, there won't be an options file in any case.

This is all completely untested, and as I said, I can't find any
precedent for doing something like this in the ports: opinions as to
whether it is a good idea or not would be appreciated.

	Cheers,

	Matthew

-- 
Dr Matthew J Seaman MA, D.Phil.                   7 Priory Courtyard
                                                  Flat 3
PGP: http://www.infracaninophile.co.uk/pgpkey     Ramsgate
JID: matthew at infracaninophile.co.uk               Kent, CT11 9PW

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 267 bytes
Desc: OpenPGP digital signature
Url : http://lists.freebsd.org/pipermail/freebsd-ports/attachments/20111120/4b3300a9/signature.pgp


More information about the freebsd-ports mailing list