Complicated patching

Olli Hauer ohauer at
Tue May 17 22:07:10 UTC 2011

On 2011-05-17 06:32, Matthew Pounsett wrote:
> Hi.
> In a (possibly foolish) attempt to add a third-party patch to an application I use *without* abandoning the ports tree for this app, I'm trying to make a local modification to the port to download and include the patch in the build process.  The problem I'm running into is that it is distributed from a source distribution site that uses a downloads CGI rather than a direct URL to distribution files, and the URI has nothing whatsoever to do with the name of the resulting file.  This, obviously, breaks MASTER_SITES and DISTFILES because what I have to put in DISTFILES doesn't match what would go in the distinfo file.
> I'm poking around at possible alternatives, but nothing really stands out in the reading I've done.  Is this sort of thing supported by the ports system at all, or should I just abandon this completely and switch to fully manual builds?
> I briefly looked at downloading the patch file, splitting it up (it includes several patches) and including the resulting files in files/patch-*.  This would be worth the work, but I'm also toying with eventually submitting my changes as a patch to the port with a line in OPTIONS to include/ignore the 3rd party patches and I can't find a way to wrap an ifdef around patch-* files in the Makefile, since they seem to be auto-discovered and acted on.  
> If anyone has any advice on how to handle this in a way that solves both problems, I'd appreciate it.  Thanks in advance!
>    Matt Pounsett

Hi Matt,

there is a way, sample ports:
dns/djbdns, dns/bind94, mail/postfix (VDA patches) and many more

A short description can be found in Mk/
A longer description can be found in the porters handbook

Additional you can place a patch without the prefix "patch-"
into the portname/files directory, then use for example

.if defined(PATCH_THIS_FOO)

More information about the freebsd-ports mailing list