Creating port with options

Alejandro Pulver alejandro at varnet.biz
Mon Apr 11 16:38:06 PDT 2005


On Tue, 12 Apr 2005 01:02:17 +0200
Florent Thoumie <flz at xbsd.org> wrote:

> Le Tuesday 12 April 2005 à 00:55 +0300, Ion-Mihai Tetcu a écrit :
> > On Mon, 11 Apr 2005 18:48:18 -0300
> > Alejandro Pulver <alejandro at varnet.biz> wrote:
> > 
> > >  P.S.: the Porter's Handbook does not say anything about the
> > >  "OPTIONS" variable (at least I did not found it with grep
> > >  "OPTIONS" * in the document directory).
> > 
> > 
> > Update your docs.
> 
> 	That's not (yet) in the PH.
> 
> 	Here [1] is the submission Edwin sent some weeks ago, and here 
> 	[2] is a summarizeed-wiki'ed version of the draft.
> 
> 	[1] http://www.freebsd.org/cgi/query-pr.cgi?pr=docs/76472
> 	[2] http://www.xbsd.org/moin/FreeBSD/PortsGlossary/Options
> 
> -- 
> Florent Thoumie
> flz at xbsd.org
> 

Hello,

Thanks to all for the replies.

Wich is the best way to manage conflictive options inside the OPTIONS
variable?

For example, I have three options: SERVER, X11 and CURSES. SERVER means
the program will not be built with a user interface. X11 and CURSES
(the ncurses library) are the two possible user interfaces. So each
conflicts with the other two. Is the following adequate to handle it?
Will the port store the bad configuration in
/var/db/ports/<portname>/options?

===================================================================

OPTIONS=	SERVER "Server mode (no GUI)" off \
		X11 "X11 user interface" on \
		CURSES "console user interface" off \

# This port has a BSD Makefile (no configure) and the options are
# enabled/disabled with -D in CFLAGS (I tried to put it in CPPFLAGS but
# the Makefile defines its own rules; it does not use the predefined
# ones that include ${CPPFLAGS}).
# The variable "LIB" is used inside the final linking rule (inside the
# Makefile).

.include <bsd.port.pre.mk>

.if defined(WITH_SERVER) && (defined(WITH_X11) || defined(WITH_CURSES))
IGNORE=		Conflicting options: WITH_SERVER + WITH_X11/WITH_CURSES
.endif

.if defined(WITH_SERVER)
MAKE_ARGS+=	CFLAGS+="-DSERVER"
.endif

.if !defined(WITH_SERVER)

.if defined(WITH_X11) && defined(WITH_CURSES)
IGNORE=		Conflicting options WITH_X11 + WITH_CURSES
.endif

.if defined(WITH_X11)
USE_XLIB=	yes
MAKE_ARGS+=	CFLAGS+="-DXWINGRAPHX -I${X11BASE}/include"
MAKE_ARGS+=	LIB+="-L${X11BASE}/lib -lX11"
.endif

.if defined(WITH_CURSES)
MAKE_ARGS+=	CFLAGS+="-DGRAPHX"
MAKE_ARGS+=	LIB+="-lcurses"
.endif

.endif

.include <bsd.port.post.mk>

===================================================================

Thanks and Best Regards,
Ale


More information about the freebsd-ports mailing list