Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 May 2011 23:10:37 +0100
From:      Matthew Seaman <m.seaman@infracaninophile.co.uk>
To:        freebsd-ports@freebsd.org
Subject:   Re: Optional Patches
Message-ID:  <4DD443DD.90909@infracaninophile.co.uk>
In-Reply-To: <C9301CD1-D2C0-449A-BD85-8488FDC028B5@conundrum.com>
References:  <C9301CD1-D2C0-449A-BD85-8488FDC028B5@conundrum.com>

next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enig375F4BD63C9DB9CB242FEE1F
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

On 18/05/2011 22:29, Matthew Pounsett wrote:
> I've added a new option (call it 'FOO') to the OPTIONS definition,
> and I'm attempting to add something like this directly below MASTER_SIT=
ES
> near the top of the Makefile:
>=20
> .if defined(FOO)
> PATCH_SITES=3D      http://location.site.com/path/
> PATCHFILES=3D       port-${PORTVERSION}.patch
> PATCH_DIST_STRIP=3D -p1
> .endif
>=20
> The option shows up when the config target is run, but ports doesn't
> do anything with the patch info.  If I remove or comment-out the .if
> and .endif surrounding the above block, then ports finds and applies
> the patch perfectly, so I know the patching info itself is correct.

For an option FOO you want to test 'WITH_FOO' and/or 'WITHOUT_FOO' in
your Makefile.

Basically the structure is like this:

OPTIONS=3D	FOO	"Frob the foo-ness"  no \
		BAR	"Enable order round" yes

=2Einclude <bsd.port.options.mk>

# Testing both WITH_ and WITHOUT_ is a good idea...
=2Eif defined(WITH_FOO) && !defined(WITHOUT_FOO)
{ do foo related stuff }
=2Eelse
{ do non-foo stuff }
=2Eendif

# ... but just testing WITH_ is very common too.
=2Eif defined(WITH_BAR)
ORDER+=3D	"Two pints of lager and a packet of crisps"
=2Eendif

The important thing is to only test OPTION settings *after* including
<bsd.port.options.mk> (or <bsd.port.pre.mk> which is an older style of
doing options stuff.)

	Cheers,

	Matthew

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


--------------enig375F4BD63C9DB9CB242FEE1F
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.16 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk3UQ+UACgkQ8Mjk52CukIzl9wCfU82g229BV9k+FRsL/1lkNjko
BcMAn0BcHg0meit4endDeWYACSO6/Jih
=d8z4
-----END PGP SIGNATURE-----

--------------enig375F4BD63C9DB9CB242FEE1F--



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