Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 20 Jul 2002 17:29:28 +0100
From:      Nik Clayton <nik@freebsd.org>
To:        ports@freebsd.org
Subject:   Proposed new 'options' target
Message-ID:  <20020720162928.GD37802@clan.nothing-going-on.org>

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

--ZRyEpB+iJ+qUx0kp
Content-Type: multipart/mixed; boundary="qGV0fN9tzfkG3CxV"
Content-Disposition: inline


--qGV0fN9tzfkG3CxV
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi folks,

I'm not a regular on the ports list, so please cc: me on any replies.

Here's the background to the problem I'm trying to solve.

Many ports have a number of options that can be set on the command line.
For example, take a look at the ftp/pure-ftpd port, and it's Makefile.

It supports a number of different options, and is quite good about
reporting what they are, in the pre-fetch target.

However, that's not optimal.  If the user's not paying attention, that
might have scrolled off the screen (especially if it's being built as
part of some other port's dependency).  And not all ports honour this.
For example, www/apache13 has a number of options that can be set, but
you need to go grovelling through the Makefile to find them.

This is a pain in the backside to document to (potentially) naive end
users, and it helps contribute to the 'FreeBSD is not suitable for
mortals' meme.

What I'd like to be able to do is put some text like the following in to
the Handbook;

    Port options

        Some ports have additional options that can be set when they are=20
	built.  What these options do varies.  Some of them will enable=20
	additional functionality (perhaps bringing in other ports as=20
	dependencies).  Some of them will disable functionality
	(e.g., turning off support for X11, which can be important if
	you have a server which doesn't need X support).  Other options
	might compile in support for additional languages, and so on.

	In order to see the options that a port supports, run

	    # make options

        Options are enabled in one of two ways:

	...

Which is much nicer than telling the user to look through the Makefile,
understand variable definitions, and grok what they do.

Attached are two patches.  The first is to bsd.port.mk, and implements
a new options: target, and defines some (well, one, in this example)
options.

The second is to pure-ftpd/Makefile, and shows how an individual port
would use this new functionality.

Comments?

N
--=20
FreeBSD: The Power to Serve      http://www.freebsd.org/               (__)
FreeBSD Documentation Project    http://www.freebsd.org/docproj/    \\\'',)
                                                                      \/  \=
 ^
   --- 15B8 3FFC DDB4 34B0 AA5F  94B7 93A8 0764 2C37 E375 ---         .\._/=
_)

--qGV0fN9tzfkG3CxV
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="pure-ftpd.patch"
Content-Transfer-Encoding: quoted-printable

Index: Makefile
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/ncvs/ports/ftp/pure-ftpd/Makefile,v
retrieving revision 1.28
diff -u -r1.28 Makefile
--- Makefile	20 Jun 2002 07:25:17 -0000	1.28
+++ Makefile	20 Jul 2002 16:17:29 -0000
@@ -19,6 +19,28 @@
=20
 MAINTAINER=3D	j@pureftpd.org
=20
+OPTIONS=3D	WITH_LDAP WITH_MYSQL WITH_PGSQL WITH_LANG
+
+WITH_LDAP: .USE
+	@${ECHO} WITH_LDAP
+	@${ECHO} "	Include support for LDAP user authentication"
+
+WITH_MYSQL: .USE
+	@${ECHO} WITH_MYSQL
+	@${ECHO} "	Include support for MySQL user authentication"
+
+WITH_PGSQL: .USE
+	@${ECHO} WITH_PGSQL
+	@${ECHO} "	Include support for PostgreSQL user authentication"
+
+WITH_LANG: .USE
+	@${ECHO} WITH_LANG=3Dlang
+	@${ECHO} "	Include support for 'lang', which is one of:"
+	@${ECHO} "	english, german, romanian, french, french-funny, polish, spani=
sh,"
+	@${ECHO} "	dutch, italian, brazilian-portuguese, danish, slovak, korean,"
+	@${ECHO} "	norwegian, swedish, russian, traditional-chinese, simplified -=
chinese."
+
+
 .if defined(WITH_LDAP)
 LIB_DEPENDS+=3D	ldap:${PORTSDIR}/net/openldap2
 .endif
@@ -86,19 +108,6 @@
 		pureftpd.schema
=20
 CONTRIB=3D	xml_python_processors.txt sfv-crc-check.pl
-
-pre-fetch:
-	@${ECHO} "You can use the following additional options:"
-	@${ECHO} "WITH_LDAP=3D1           - Support for users in LDAP \
-		directories;"
-	@${ECHO} "WITH_MYSQL=3D1          - Support for users in MySQL databases;"
-	@${ECHO} "WITH_PGSQL=3D1          - Support for users in PostgreSQL datab=
ases;"=09
-	@${ECHO} "WITH_LANG=3Dlang        - enable compilation of language \
-		support, lang is one of"
-	@${ECHO} "  english, german, romanian, french, french-funny, polish, span=
ish,"
-	@${ECHO} "  dutch, italian, brazilian-portuguese, danish, slovak, korean,"
-	@${ECHO} "  norwegian, swedish, russian, traditional-chinese, simplified-=
chinese."
-	@${ECHO}
=20
 post-install:
 	${INSTALL_DATA} ${WRKSRC}/pureftpd-ldap.conf ${PREFIX}/etc/pureftpd-ldap.=
conf.sample

--qGV0fN9tzfkG3CxV
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="bsd.port.mk.patch"
Content-Transfer-Encoding: quoted-printable

Index: bsd.port.mk
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/ncvs/ports/Mk/bsd.port.mk,v
retrieving revision 1.419
diff -u -r1.419 bsd.port.mk
--- bsd.port.mk	9 Jul 2002 13:37:26 -0000	1.419
+++ bsd.port.mk	20 Jul 2002 16:28:33 -0000
@@ -3469,4 +3469,29 @@
 .endif
=20
 .endif
+
+.if !target(options)
+.if defined(OPTIONS)
+options: ${OPTIONS}
+	@${ECHO} This port supports the following options.
+	@${ECHO} ''
+.else
+options:
+	@${ECHO} There are no additional options for this port.
+.endif
+.endif
+
+# Define some of the common WITH_* targets to save porter's time.
+# These can be overridden if the port needs to include a special
+# message about them.
+.if !target(WITH_GNOME)
+WITH_GNOME: .USE
+	@${ECHO} WITH_GNOME
+	@${ECHO} "	Include additional GNOME functionality"
+.endif
+
+# Repeat for all the other 'standard' WITH_* options
+#
+# ...
+
 # End of post-makefile section.

--qGV0fN9tzfkG3CxV--

--ZRyEpB+iJ+qUx0kp
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (FreeBSD)
Comment: For info see http://www.gnupg.org

iEYEARECAAYFAj05j+cACgkQk6gHZCw343Vt/ACgieUn9Mq/pozDZwUbXyGsAsGG
0cYAnj3wvhYZIMZwyKEXeMYiakMuiHMf
=U+pK
-----END PGP SIGNATURE-----

--ZRyEpB+iJ+qUx0kp--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




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