Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Feb 2020 06:37:53 +0000 (UTC)
From:      David Griffith <dave@661.org>
To:        FreeBSD Ports <freebsd-ports@freebsd.org>
Subject:   Seeking flavors examples and advice
Message-ID:  <alpine.DEB.2.21.2002040546470.19025@hermes.661.org>

next in thread | raw e-mail | index | archive | help

Would someone please point me to a simple example of FLAVORS being used to 
build something in ports to select different targets.

I recently took over games/frotz for which I am also upstream.  This 
package can be built with three different user interfaces with one of them 
having two sub-variations.  There are curses-nosound, curses (uses libao 
for audio output), dumb (no screen handling at all), and SDL (uses libsdl 
for graphics and audio).  When building straight from source, you simply 
do "gmake curses", "gmake nosound", "gmake dumb", or "gmake sdl" and you 
get the interface specified by the parameter supplied to gmake.  I can't 
seem to find any webpage that goes into any more detail than 
https://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/flavors-using.html 
and this leaves me wondering just how to even start.

Here's what I have so far: targeting noaudio and dumb for starters.  I'm 
leaving out documentation and examples for now until I figure this out. 
Both the noaudio and dumb targets will build, but when I do "make install" 
or "make FLAVOR=dumb install", nothing actually gets put into 
/usr/local/bin.

# Created by: Andrey Zakhvatov
# $FreeBSD: head/games/frotz/Makefile 522166 2020-01-05 19:39:46Z tcberner $

PORTNAME=	frotz
PORTVERSION=	2.50
CATEGORIES=	games

MAINTAINER=	dave@661.org
COMMENT=	Infocom Z-machine games interpreter

LICENSE=	GPLv2+
LICENSE_FILE=	${WRKSRC}/COPYING

USE_GITLAB=	yes
GL_ACCOUNT=	DavidGriffith
GL_COMMIT=	9867a1f14da1e9c0707492d2ac74d1e8ffdd3a64

USES=		gmake

FLAVORS=	curses dumb
FLAVOR?=	${FLAVORS:[1]}
curses_PKGNAMESUFFIX= 		-curses
dumb_PKGNAMESUFFIX= 		-dumb
curses_PLIST=	bin/frotz\
 		man/man6/frotz.6.gz
dumb_PLIST=	bin/dfrotz\
 		man/man6/dfrotz.6.gz

.if ${FLAVOR:U} == curses
COMMENT+=	(curses interface, no audio)
ALL_TARGET=	nosound
USES+=	ncurses
.elif ${FLAVOR:U} == dumb
COMMENT+=	(dumb interface)
ALL_TARGET= 	dumb
dumb_PKGNAMEPREFIX=	d
.endif

MAKE_ENV=	OPTS="${CFLAGS}" CONFIG_DIR="${PREFIX}/etc"

do-install:
 	${INSTALL_PROGRAM} ${WRKSRC}/${PKGNAMEPREFIX}${PORTNAME} ${STAGEDIR}${PREFIX}/bin/
 	${INSTALL_MAN} ${WRKSRC}/doc/${PKGNAMEPREFIX}${PORTNAME}.6 ${STAGEDIR}${MAN6PREFIX}/man/man6/

.include <bsd.port.mk>

-- 
David Griffith
dave@661.org

A: Because it fouls the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?alpine.DEB.2.21.2002040546470.19025>