Patching? Probably a trivial question, but...

Kurt Buff kurt.buff at
Fri May 29 17:03:23 UTC 2009

On Fri, May 29, 2009 at 07:06, Steve Bertrand <steve at> wrote:
> Kurt Buff wrote:
>> On Wed, May 27, 2009 at 11:36, Mel Flynn
>> <mel.flynn+fbsd.questions at> wrote:
>>> On Wednesday 27 May 2009 17:21:42 Kurt Buff wrote:
>>>> All,
>>>> I've gotten a patch for a program in the ports tree from one of the
>>>> authors of the program - not the port maintainer - to fix a small
>>>> problem, but don't know how to install the updated port.
>>>> I cd'ed into the
>>>> /usr/ports/%CATEGORY%/%PROGRAM%/work/%PROGRAM-VERSION% directory, then
>>>> performed 'patch <patch-name' successfully, AFAICT.
>>>> Then I did a make, but got no output.
>>>> So - I'm obviously lacking clue here. Anyone have a spare set?
>>> Don't feel like reading the entire thread atm, but for reference:
>>> - Patches need to have relative paths, where the root of the path corresponds
>>> to the port's notion of $PATCH_WRKSRC
>>> - You can find out this directory by running:
>>> Â  Â  Â  Â % make -C /usr/ports/category/portname -V PATCH_WRKSRC
>>> Â The default is $WRKSRC which is $WRKDIR/$DISTNAME by default.
>>> Â Example:
>>> Â  Â  Â  Â % make -C /usr/ports/sysutils/nagios-statd -V PATCH_WRKSRC
>>> Â  Â  Â  Â /stable/usr/obj/usr/ports/sysutils/nagios-statd/work/nagios-statd-3.12
>>> - Patches are automatically applied if they reside in the port's notion of
>>> PATCHDIR and are named patch-*
>>> - You can find out this directory by running:
>>> Â  Â  Â  Â %make -C /usr/ports/category/portname -V PATCHDIR
>>> Â The default is $.CURDIR/files.
>>> Â Example:
>>> Â  Â  Â  Â % make -C /usr/ports/sysutils/nagios-statd -V PATCHDIR
>>> Â  Â  Â  Â /usr/ports/sysutils/nagios-statd/files
>>> - In order to apply a new patch after you have previously gone past the patch
>>> stage (configure, build, install), either run make clean or:
>>> Â  Â  Â  Â % rm $(make -C /usr/ports/category/portname -V PATCH_COOKIE)
>>> Â The above can cause problems, with the build. The normal course of action is
>>> to make clean.
>> Excellent. I will be trying this tomorrow - I'm leaving work early
>> today to get some things taken care of.
> Kurt,
> I had to leave rather hastily the other day, but I did test the patch,
> and it worked ok. If this is a one-off thing, here is how I did it:
> # cd /usr/ports/category/program
> # make clean
> # ee source.patch (pasted the patch in)
> # make configure (which preps the source)
> # cd work/progname
> # patch < ../../source.patch
> # cd ../..
> # make
> # make install
> All worked well.
> Steve

I did as others have suggested, placing the patch in
/usr/ports/www/squid30/files as patch-HttpHeader, then doing a 'make
&& make clean'. After fixing the typo, it went just fine.

I'll be installing at the end of the day today and testing with a few
folks to see how this works.


More information about the freebsd-questions mailing list